Class PlaceLabelStyle
Maps a place class and rank to typographic variant, draw priority, and tile zoom.
public static class PlaceLabelStyle
- Inheritance
-
objectPlaceLabelStyle
Methods
BaseFontPx(double)
Base label size in whole screen px for a fractional map zoom.
public static int BaseFontPx(double mapZoom)
Parameters
mapZoomdoubleFractional 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
namestringDisplay name.
pMercatorPointPosition 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
mapZoomdoubleFractional 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
clsstringPlace class such as city or town; unknown classes sort last.
rankintImportance 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
clsstringPlace class such as city or town; unknown classes use Body.
rankintImportance rank, lower more important.
Returns
- LabelVariant
The size step to draw this place with.