Package com.massifmaps.layers
Class CompositeVectorTileLayer
java.lang.Object
com.massifmaps.layers.Layer
com.massifmaps.layers.TileLayer
com.massifmaps.layers.VectorTileLayer
com.massifmaps.layers.CompositeVectorTileLayer
A VectorTileLayer that can weave named external data sources (raster, hillshade,
merged vector / contour) into the master CartoCSS style's layer order.
Each external source is placed at the position of a matching layer name in the style
project's "layers" array, and configured by a matching '#name { ... }' block in the
CartoCSS (e.g. raster-opacity, hillshade-exaggeration), including zoom- and style-parameter-
parameter-dependent expressions. Raster and hillshade sources are rendered as their
own draped child layers interleaved between the master style layers; merged vector
sources are folded into the master source and styled normally.
Sources can be added and removed at runtime.
merged vector / contour) into the master CartoCSS style's layer order.
Each external source is placed at the position of a matching layer name in the style
project's "layers" array, and configured by a matching '#name { ... }' block in the
CartoCSS (e.g. raster-opacity, hillshade-exaggeration), including zoom- and style-parameter-
parameter-dependent expressions. Raster and hillshade sources are rendered as their
own draped child layers interleaved between the master style layers; merged vector
sources are folded into the master source and styled normally.
Sources can be added and removed at runtime.
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeVectorTileLayer(TileDataSource dataSource, VectorTileDecoder decoder) Constructs a CompositeVectorTileLayer from a master vector data source and decoder. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExternalDataSource(String name, TileDataSource dataSource, int type) Adds a named external data source.voidaddExternalDataSource(String name, TileDataSource dataSource, int type, ElevationDecoder elevationDecoder) Adds a named external data source.voidaddVectorDataSource(String name, TileDataSource dataSource) Adds a named MBVT/protobuf source (including ContourTileDataSource) merged into the
master source and styled by the master CartoCSS.voidClears the per-source zoom level bias, so the source follows the layer-wide value again.getExternalChildLayer(String name) Returns the child layer a slot is drawn by - a RasterTileLayer, a HillshadeRasterTileLayer
or a VectorTileLayer, depending on the source type.intReturns the maximum overzoom level of the given external data source.Returns the names of all registered external data sources.floatReturns the effective zoom level bias of the given external data source.booleanReturns whether single-pass segmented rendering is enabled (Milestone 6, optional).booleanRemoves the named external data source (of any type).voidsetExternalDataSourceMaxOverzoomLevel(String name, int level) Sets the maximum overzoom level of a single external data source.voidsetExternalDataSourceZoomLevelBias(String name, float bias) Sets the zoom level bias of a single external data source, overriding the layer-wide value.
Use this to fetch a source at a different resolution from the base map - e.g.voidsetPreloading(boolean preloading) Sets the preloading state for this layer and for every child layer it owns.voidsetSinglePassRenderingEnabled(boolean enabled) Sets whether to use the optional single-pass segmented renderer instead of the
default one-vt-pass-per-segment path.voidsetZoomLevelBias(float bias) Sets the zoom level bias for this layer and for every child layer it owns (external
raster/hillshade/vector sources and the internal style-group layers).Methods inherited from class com.massifmaps.layers.VectorTileLayer
getBuildingRenderOrder, getClickHandlerLayerFilter, getClickRadius, getLabelBlendingSpeed, getLabelPerspectiveScaling, getLabelRenderOrder, getLayerBlendingSpeed, getRendererLayerFilter, getTileCacheCapacity, getTileDecoder, getVectorTileEventListener, setBuildingRenderOrder, setClickHandlerLayerFilter, setClickRadius, setLabelBlendingSpeed, setLabelPerspectiveScaling, setLabelRenderOrder, setLayerBlendingSpeed, setRendererLayerFilter, setTileCacheCapacity, setVectorTileEventListenerMethods inherited from class com.massifmaps.layers.TileLayer
bakeDrapeCoverage, bakeGroundAOMask, bakeSpanDrapeTile, calculateMapTile, calculateMapTileBounds, calculateMapTileOrigin, clearTileCaches, collectDrapeStackOrder, collectSpanDrapeTiles, consumeShadowCastersMissingElevation, getDataSource, getFrameNr, getMaxOverzoomLevel, getMaxStandInLevel, getMaxUnderzoomLevel, getPreloadingTileCount, getProjection, getTileLoadListener, getTileSubstitutionPolicy, getUTFGridDataSource, getUTFGridEventListener, getVisibleTileCount, getZoomLevelBias, isGroundAOActive, isGroundAOBakeable, isLabelOcclusionWanted, isPreloading, isSynchronizedRefresh, isTerrainDecodeSettled, isUpdateInProgress, renderGroundAOMask, renderLabelOcclusionDepth, renderTerrainShadowMask, setDrapeCoverageMasks, setFrameNr, setGroundDrapeTextures, setLabelOcclusionDepth, setMaxOverzoomLevel, setMaxStandInLevel, setMaxUnderzoomLevel, setSpanDrapeTextures, setSynchronizedRefresh, setTerrainShadowMask, setTileLoadListener, setTileSubstitutionPolicy, setUTFGridDataSource, setUTFGridEventListenerMethods inherited from class com.massifmaps.layers.Layer
containsMetaDataKey, equals, getMetaData, getMetaDataElement, getOpacity, getUpdatePriority, getVisibleZoomRange, hashCode, isPostProcessed, isVisible, refresh, setCullDelay, setMetaData, setMetaDataElement, setOpacity, setPostProcessed, setUpdatePriority, setVisible, setVisibleZoomRange, simulateClick, update
-
Constructor Details
-
CompositeVectorTileLayer
Constructs a CompositeVectorTileLayer from a master vector data source and decoder.- Parameters:
dataSource- The master vector tile data source.decoder- The tile decoder (must be an MBVectorTileDecoder for external source
configuration and placement to work).
-
-
Method Details
-
addExternalDataSource
public void addExternalDataSource(String name, TileDataSource dataSource, int type, ElevationDecoder elevationDecoder) Adds a named external data source. For raster and hillshade types the source is
drawn as its own child layer at the style slot named 'name'. For the vector type
the source is merged into the master source (see addVectorDataSource).- Parameters:
name- The source name; must match a layer name in the style "layers" array.dataSource- The external data source.type- The source type.elevationDecoder- Optional elevation decoder for hillshade sources. If null,
it is resolved from the data source 'encoding' metadata ("terrarium"/"mapbox").
-
addExternalDataSource
Adds a named external data source. For raster and hillshade types the source is
drawn as its own child layer at the style slot named 'name'. For the vector type
the source is merged into the master source (see addVectorDataSource).- Parameters:
name- The source name; must match a layer name in the style "layers" array.dataSource- The external data source.type- The source type.
-
addVectorDataSource
Adds a named MBVT/protobuf source (including ContourTileDataSource) merged into the
master source and styled by the master CartoCSS. Equivalent to addExternalDataSource
with COMPOSITE_SOURCE_TYPE_VECTOR.- Parameters:
name- The source name; its layers must be declared in the master style.dataSource- The vector data source to merge.
-
removeExternalDataSource
Removes the named external data source (of any type). Returns true if removed.- Parameters:
name- The source name.- Returns:
- True if a source was removed.
-
getExternalDataSourceNames
Returns the names of all registered external data sources.- Returns:
- The registered external source names.
-
getExternalChildLayer
Returns the child layer a slot is drawn by - a RasterTileLayer, a HillshadeRasterTileLayer
or a VectorTileLayer, depending on the source type. This is the way to reach a setting the
config symbolizer does not carry: a HillshadeRasterTileLayer's NormalMapLightingShader is
generated GLSL rather than a style property, and applyConfig never writes it, so a shader
set through this survives the per-frame config pass.
The child is owned by this layer - do not add it to a map.- Parameters:
name- The source name.- Returns:
- The child layer, or null if no source is registered under that name.
-
isSinglePassRenderingEnabled
public boolean isSinglePassRenderingEnabled()Returns whether single-pass segmented rendering is enabled (Milestone 6, optional).- Returns:
- True if single-pass rendering is enabled. The default is false.
-
setSinglePassRenderingEnabled
public void setSinglePassRenderingEnabled(boolean enabled) Sets whether to use the optional single-pass segmented renderer instead of the
default one-vt-pass-per-segment path. Intended for A/B comparison; currently a
no-op placeholder until the single-pass renderer lands.- Parameters:
enabled- True to enable single-pass rendering.
-
setZoomLevelBias
public void setZoomLevelBias(float bias) Sets the zoom level bias for this layer and for every child layer it owns (external
raster/hillshade/vector sources and the internal style-group layers). Sources with a
per-source bias set via setExternalDataSourceZoomLevelBias keep their own value.- Overrides:
setZoomLevelBiasin classTileLayer- Parameters:
bias- The new bias value, both positive and negative fractional values are supported.
-
setPreloading
public void setPreloading(boolean preloading) Sets the preloading state for this layer and for every child layer it owns.- Overrides:
setPreloadingin classTileLayer- Parameters:
preloading- The new preloading state of the layer.
-
setExternalDataSourceZoomLevelBias
Sets the zoom level bias of a single external data source, overriding the layer-wide value.
Use this to fetch a source at a different resolution from the base map - e.g. a bias of 1.0
on a high-resolution DEM source makes the hillshade use one zoom level more detail.
Note that if the style defines a 'zoom-level-bias' value for this source, the style value
wins - the same precedence the other per-source config values have.- Parameters:
name- The source name.bias- The new bias value, both positive and negative fractional values are supported.- Throws:
IllegalArgumentException- If the source does not exist.
-
getExternalDataSourceZoomLevelBias
Returns the effective zoom level bias of the given external data source.- Parameters:
name- The source name.- Returns:
- The zoom level bias of the source.
- Throws:
IllegalArgumentException- If the source does not exist.
-
clearExternalDataSourceZoomLevelBias
Clears the per-source zoom level bias, so the source follows the layer-wide value again.- Parameters:
name- The source name.- Throws:
IllegalArgumentException- If the source does not exist.
-
setExternalDataSourceMaxOverzoomLevel
Sets the maximum overzoom level of a single external data source. Overzooming reuses a
coarser parent tile when the source has no tile at the target zoom level, which is how a
low-resolution DEM keeps covering the map above its own max zoom.- Parameters:
name- The source name.level- The new maximum overzoom level.- Throws:
IllegalArgumentException- If the source does not exist.
-
getExternalDataSourceMaxOverzoomLevel
Returns the maximum overzoom level of the given external data source.- Parameters:
name- The source name.- Returns:
- The maximum overzoom level of the source.
- Throws:
IllegalArgumentException- If the source does not exist.
-