Class MapStyle
java.lang.Object
com.codename1.maps.vector.MapStyle
An ordered list of
StyleLayer rules plus a background color, describing
how a vector tile is painted. The built-in light() and dark() styles
target the common OpenMapTiles/Protomaps source-layer names and also the
simplified names used by the bundled screenshot fixtures, so they render
real basemaps and the offline fixtures alike.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(StyleLayer layer) Appends a layer rule (rendered in insertion order, bottom to top).static MapStyledark()A dark basemap suited to night mode.static MapStyleParses a (subset of a) MapLibre GL style JSON document.intThe viewport background color as 0xAARRGGBB.getName()The style name.static MapStylelight()A clean light basemap (sensible default for most apps).
-
Constructor Details
-
MapStyle
Creates an empty style with the given background color (0xAARRGGBB).
-
-
Method Details
-
getName
The style name. -
getBackgroundColor
public int getBackgroundColor()The viewport background color as 0xAARRGGBB. -
add
Appends a layer rule (rendered in insertion order, bottom to top). -
light
A clean light basemap (sensible default for most apps). Settlement labels are joined by street and park names from zoom 12 and points of interest from zoom 14, when the tile source supplies those names.
Every colour falls back to the value baked in here but is overridable through a theme constant (a CSS color string) so an app can recolour the map without supplying a whole style:
mapLightWaterColor,mapLightLandcoverColor,mapLightLanduseColor,mapLightParkColor,mapLightRoadColor,mapLightBuildingColor,mapLightBackgroundColor,mapLightLabelColor,mapLightLabelHaloColor. e.g. a theme constantmapLightWaterColor=#1e88e5. -
dark
A dark basemap suited to night mode. Mirrorslight(): each colour is overridable via a theme constant (mapDarkWaterColor,mapDarkLandcoverColor,mapDarkLanduseColor,mapDarkParkColor,mapDarkRoadColor,mapDarkBuildingColor,mapDarkBackgroundColor,mapDarkLabelColor,mapDarkLabelHaloColor). -
fromJson
Parses a (subset of a) MapLibre GL style JSON document. Recognized: the top-levellayersarray withtypeofbackground/fill/line/symbol, each layer'ssource-layer,minzoom/maxzoom, a simple["==", key, value]filter, and the common paint/layout properties (background-color,fill-color,line-color,line-width,text-field,text-color,text-size). Unsupported constructs are ignored rather than failing.
-