Class MapboxVectorStyle
- java.lang.Object
-
- org.openstreetmap.josm.data.imagery.vectortile.mapbox.style.MapboxVectorStyle
-
public class MapboxVectorStyle extends 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 String
glyphUrl
The optional URL for glyphs.private String
name
The optional name for the vector styleprivate Map<Source,ElemStyles>
sources
The required collection of sources with a list of layers that are applicable for that sourceprivate String
spriteUrl
The optional URL for sprites.private static ConcurrentHashMap<String,MapboxVectorStyle>
STYLE_MAPPING
private int
version
The version for the style specification
-
Constructor Summary
Constructors Constructor Description MapboxVectorStyle(javax.json.JsonObject jsonObject)
Create a new MapboxVector style.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
private void
fetchSprites()
Fetch sprites.static MapboxVectorStyle
getMapboxVectorStyle(String url)
Get a MapboxVector style for a URLMap<Source,ElemStyles>
getSources()
Get the generated layer->style mappingString
getSpriteUrl()
Get the sprite url for the styleint
hashCode()
private boolean
parseSprites(CachedFile spriteJson, CachedFile spritePng)
private void
save(String name, Object object)
String
toString()
-
-
-
Field Detail
-
STYLE_MAPPING
private static final ConcurrentHashMap<String,MapboxVectorStyle> STYLE_MAPPING
-
version
private final int version
The version for the style specification
-
spriteUrl
private final String spriteUrl
The optional URL for sprites. This mush be absolute (so it must contain the scheme, authority, and path).
-
glyphUrl
private final String glyphUrl
The optional URL for glyphs. This may have replaceable values in it.
-
sources
private final 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(javax.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(String url)
Get a MapboxVector style for a URL- Parameters:
url
- The url to get- Returns:
- The Mapbox Vector Style. May be
null
if 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)
-
getSources
public Map<Source,ElemStyles> getSources()
Get the generated layer->style mapping- Returns:
- The mapping (use to enable/disable a paint style)
-
getSpriteUrl
public String getSpriteUrl()
Get the sprite url for the style- Returns:
- The base sprite url
-
-