Class MapboxVectorStyle
- java.lang.Object
-
- org.openstreetmap.josm.data.imagery.vectortile.mapbox.style.MapboxVectorStyle
-
public class MapboxVectorStyle extends java.lang.Object
Create a mapping for a Mapbox Vector Style- Since:
- 17862
- See Also:
- https://docs.mapbox.com/mapbox-gl-js/style-spec/
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringglyphUrlThe optional URL for glyphs.private java.lang.StringnameThe optional name for the vector styleprivate java.util.Map<Source,ElemStyles>sourcesThe required collection of sources with a list of layers that are applicable for that sourceprivate java.lang.StringspriteUrlThe optional URL for sprites.private static java.util.concurrent.ConcurrentHashMap<java.lang.String,MapboxVectorStyle>STYLE_MAPPINGprivate intversionThe version for the style specification
-
Constructor Summary
Constructors Constructor Description MapboxVectorStyle(jakarta.json.JsonObject jsonObject)Create a new MapboxVector style.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)private voidfetchSprites()Fetch sprites.static MapboxVectorStylegetMapboxVectorStyle(java.lang.String url)Get a MapboxVector style for a URLjava.util.Map<Source,ElemStyles>getSources()Get the generated layer → style mappingjava.lang.StringgetSpriteUrl()Get the sprite url for the styleinthashCode()private booleanparseSprites(CachedFile spriteJson, CachedFile spritePng)private voidsave(java.lang.String name, java.lang.Object object)java.lang.StringtoString()
-
-
-
Field Detail
-
STYLE_MAPPING
private static final java.util.concurrent.ConcurrentHashMap<java.lang.String,MapboxVectorStyle> STYLE_MAPPING
-
version
private final int version
The version for the style specification
-
name
private final java.lang.String name
The optional name for the vector style
-
spriteUrl
private final java.lang.String spriteUrl
The optional URL for sprites. This mush be absolute (so it must contain the scheme, authority, and path).
-
glyphUrl
private final java.lang.String glyphUrl
The optional URL for glyphs. This may have replaceable values in it.
-
sources
private final java.util.Map<Source,ElemStyles> sources
The required collection of sources with a list of layers that are applicable for that source
-
-
Constructor Detail
-
MapboxVectorStyle
public MapboxVectorStyle(jakarta.json.JsonObject jsonObject)
Create a new MapboxVector style. You should prefergetMapboxVectorStyle(String)for deduplication purposes.- Parameters:
jsonObject- The object to create the style from- See Also:
getMapboxVectorStyle(String)
-
-
Method Detail
-
getMapboxVectorStyle
public static MapboxVectorStyle getMapboxVectorStyle(java.lang.String url)
Get a MapboxVector style for a URL- Parameters:
url- The url to get- Returns:
- The Mapbox Vector Style. May be
nullif there was an error.
-
fetchSprites
private void fetchSprites()
Fetch sprites. Please note that this is (literally) only png. Unfortunately.
-
parseSprites
private boolean parseSprites(CachedFile spriteJson, CachedFile spritePng)
-
save
private void save(java.lang.String name, java.lang.Object object)
-
getSources
public java.util.Map<Source,ElemStyles> getSources()
Get the generated layer → style mapping- Returns:
- The mapping (use to enable/disable a paint style)
-
getSpriteUrl
public java.lang.String getSpriteUrl()
Get the sprite url for the style- Returns:
- The base sprite url
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-