Table of Contents

Class PlaceLabelStyle

Namespace
LansMap.Core.Labels

Maps a place class and rank to typographic variant, draw priority, and tile zoom.

public static class PlaceLabelStyle
Inheritance
object
PlaceLabelStyle

Methods

BaseFontPx(double)

Base label size in whole screen px for a fractional map zoom.

public static int BaseFontPx(double mapZoom)

Parameters

mapZoom double

Fractional map zoom, the same units as view state zoom.

Returns

int

Whole pixels, clamped to 15..25, so the bitmap font stays sharp.

DedupKey(string, MercatorPoint)

Stable key that collapses the same place emitted by neighboring tiles.

public static long DedupKey(string name, MercatorPoint p)

Parameters

name string

Display name.

p MercatorPoint

Position in normalized mercator.

Returns

long

A hash of the name and position quantized to about 1e-3 normalized mercator.

Remarks

Neighbor tiles emit the same place with sub-pixel coordinate noise. Two real places that share a name within about 40 km at the equator also collapse to one label.

LabelTileZoom(double)

Integer tile zoom that carries place labels for a fractional map zoom.

public static int LabelTileZoom(double mapZoom)

Parameters

mapZoom double

Fractional map zoom, the same units as view state zoom.

Returns

int

Floor of map zoom, clamped to 0..14.

Remarks

Place labels exist at tile zoom 0-14; above 14 the z14 tiles are reused.

Priority(string, int)

Draw order for declutter: lower values are placed first and win collisions.

public static int Priority(string cls, int rank)

Parameters

cls string

Place class such as city or town; unknown classes sort last.

rank int

Importance rank, lower more important, clamped to 0..999.

Returns

int

Class band times 1000 plus clamped rank; lower draws first.

Remarks

Class dominates; rank only breaks ties inside a class.

VariantFor(string, int)

Typographic variant for a place class and rank.

public static LabelVariant VariantFor(string cls, int rank)

Parameters

cls string

Place class such as city or town; unknown classes use Body.

rank int

Importance rank, lower more important.

Returns

LabelVariant

The size step to draw this place with.