Package org.gvsig.mvtrenderer.lib.impl
Class MVTStyles
java.lang.Object
org.gvsig.mvtrenderer.lib.impl.MVTStyles
Manages Mapbox Vector Tile styles and their conversion to GeoTools styles.
- Author:
- fdiaz
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new instance of MVTStyles and creates the background polygon. -
Method Summary
Modifier and TypeMethodDescriptionvoidDownloads the style JSON and parses it with MBStyleParser to verify correctness.Extracts the field names used in the style layers for each source layer.getLayersToDraw(Map<String, MVTTile.MVTDataSource> dataSources, org.locationtech.jts.geom.Envelope tileEnvelope, org.geotools.api.referencing.crs.CoordinateReferenceSystem tileCRS) Builds and returns the list of layers (MVTLayer) ready to be painted, in the correct order (Z-order) defined by the Mapbox style.org.geotools.api.style.StyleCalculates and caches the GeoTools Style associated with the indicated styleLayerId and returns it.Returns the collection of font names used in the style.
-
Field Details
-
mbStyle
public org.geotools.mbstyle.MBStyle mbStyle
-
-
Constructor Details
-
MVTStyles
public MVTStyles()Initializes a new instance of MVTStyles and creates the background polygon.
-
-
Method Details
-
download
Downloads the style JSON and parses it with MBStyleParser to verify correctness. Stores the result in memory (MBStyle) for later use.- Parameters:
url- The style.json file URL.- Throws:
IOException- If there is a network or parsing error.
-
getLayersToDraw
public List<MVTLayer> getLayersToDraw(Map<String, MVTTile.MVTDataSource> dataSources, org.locationtech.jts.geom.Envelope tileEnvelope, org.geotools.api.referencing.crs.CoordinateReferenceSystem tileCRS) Builds and returns the list of layers (MVTLayer) ready to be painted, in the correct order (Z-order) defined by the Mapbox style.- Parameters:
dataSources- Map of available data layers.tileEnvelope- The envelope of the tile.tileCRS- The coordinate reference system of the tile.- Returns:
- Ordered list of MVTLayer objects.
-
getStyle
Calculates and caches the GeoTools Style associated with the indicated styleLayerId and returns it.- Parameters:
styleLayerId- The style layer ID (Mapbox layer id).- Returns:
- The GeoTools Style object ready for rendering, or null if the ID doesn't exist.
-
getUsedFontNames
Returns the collection of font names used in the style.- Returns:
- Collection of font names.
-
extractFieldsFromStyles
Extracts the field names used in the style layers for each source layer.- Returns:
- A map of source layer names to sets of field names.
-