Package com.massifmaps.layers
Class VectorTileLayer
java.lang.Object
com.massifmaps.layers.Layer
com.massifmaps.layers.TileLayer
com.massifmaps.layers.VectorTileLayer
- Direct Known Subclasses:
CompositeVectorTileLayer,TorqueTileLayer
A tile layer where each tile is a bitmap. Should be used together with corresponding data source.
-
Constructor Summary
ConstructorsConstructorDescriptionVectorTileLayer(TileDataSource dataSource, VectorTileDecoder decoder) Constructs a VectorTileLayer object from a data source and tile decoder. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the current display order of the buildings.Returns the click handler layer filter.floatReturns the click radius of vector tile features.
Units are screen density independent pixels (DP or DIP).floatReturns the current relative label blending speed.floatReturns how much of the perspective divide a label keeps as it recedes from the camera.intReturns the current display order of the labels.floatReturns the current relative layer blending speed.Returns the renderer layer filter.longReturns the tile cache capacity.Returns the tile decoder assigned to this layer.Returns the vector tile event listener.voidsetBuildingRenderOrder(int renderOrder) Sets the current display order of the buildings.voidsetClickHandlerLayerFilter(String filter) Sets the click handler layer filter.voidsetClickRadius(float radius) Sets the click radius of vector tile features.
The click radius is applied as an extra buffer to the vector tile features to make clicking on small features less sensitive.
Units are screen density independent pixels (DP or DIP).voidsetLabelBlendingSpeed(float speed) Sets the relative label blending speed.voidsetLabelPerspectiveScaling(float scaling) Sets how much of the perspective divide a label keeps as it recedes from the camera.
At 0 a label holds a constant on-screen size at any distance.voidsetLabelRenderOrder(int renderOrder) Sets the current display order of the labels.voidsetLayerBlendingSpeed(float speed) Sets the relative layer blending speed.
The default is 0 - a tile's geometry appears, as maplibre and mapbox-gl do it; they fade
rasters only.voidsetRendererLayerFilter(String filter) Sets the renderer layer filter.voidsetTileCacheCapacity(long capacityInBytes) Sets the vector tile cache capacity.voidsetVectorTileEventListener(VectorTileEventListener eventListener) Sets the vector tile event listener.Methods 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, setPreloading, setSpanDrapeTextures, setSynchronizedRefresh, setTerrainShadowMask, setTileLoadListener, setTileSubstitutionPolicy, setUTFGridDataSource, setUTFGridEventListener, setZoomLevelBiasMethods 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
-
VectorTileLayer
Constructs a VectorTileLayer object from a data source and tile decoder.- Parameters:
dataSource- The data source from which this layer loads data.decoder- The tile decoder that decoder loaded tiles and applies styles.
-
-
Method Details
-
getTileDecoder
Returns the tile decoder assigned to this layer.- Returns:
- The tile decoder assigned to this layer.
-
getTileCacheCapacity
public long getTileCacheCapacity()Returns the tile cache capacity.- Returns:
- The tile cache capacity in bytes.
-
setTileCacheCapacity
public void setTileCacheCapacity(long capacityInBytes) Sets the vector tile cache capacity. Tile cache is the primary storage for vector data,
all tiles contained within the cache are stored as uncompressed vertex buffers and can immediately be
drawn to the screen. Setting the cache size too small may cause artifacts, such as disappearing tiles.
The more tiles are visible on the screen, the larger this cache should be.
The default is 10MB, which should be enough for most use cases with preloading enabled. If preloading is
disabled, the cache size should be reduced by the user to conserve memory.- Parameters:
capacityInBytes- The new tile bitmap cache capacity in bytes.
-
getLabelRenderOrder
public int getLabelRenderOrder()Returns the current display order of the labels.- Returns:
- The display order of the labels. Default is VECTOR_TILE_RENDER_ORDER_LAYER.
-
setLabelRenderOrder
public void setLabelRenderOrder(int renderOrder) Sets the current display order of the labels.- Parameters:
renderOrder- The new display order of the labels.
-
getBuildingRenderOrder
public int getBuildingRenderOrder()Returns the current display order of the buildings.- Returns:
- The display order of the buildings. Default is VECTOR_TILE_RENDER_ORDER_LAST.
LAST draws over the flat labels too, so a label that must clear a building is a BILLBOARD
one - that pass runs after the buildings, and moving this order is not the mechanism.
-
setBuildingRenderOrder
public void setBuildingRenderOrder(int renderOrder) Sets the current display order of the buildings.- Parameters:
renderOrder- The new display order of the labels.
-
getClickRadius
public float getClickRadius()Returns the click radius of vector tile features.
Units are screen density independent pixels (DP or DIP).- Returns:
- The click radius of vector tile features.
-
setClickRadius
public void setClickRadius(float radius) Sets the click radius of vector tile features.
The click radius is applied as an extra buffer to the vector tile features to make clicking on small features less sensitive.
Units are screen density independent pixels (DP or DIP).- Parameters:
radius- The new click radius of vector tile features. The default value is 4.
-
getLayerBlendingSpeed
public float getLayerBlendingSpeed()Returns the current relative layer blending speed.- Returns:
- The current relative layer blending speed. Default is 0.0 (no blending).
-
setLayerBlendingSpeed
public void setLayerBlendingSpeed(float speed) Sets the relative layer blending speed.
The default is 0 - a tile's geometry appears, as maplibre and mapbox-gl do it; they fade
rasters only. A cased road cross-fades badly, because its fill is usually near the
background colour: for the length of the fade only the casing reads and the road looks
like an outline waiting to be filled. Set 1 for the fade this SDK used to do.- Parameters:
speed- The new relative speed value. Use zero or negative values to disable blending.
-
getLabelBlendingSpeed
public float getLabelBlendingSpeed()Returns the current relative label blending speed.- Returns:
- The current relative label blending speed. Default is 1.0.
-
setLabelBlendingSpeed
public void setLabelBlendingSpeed(float speed) Sets the relative label blending speed.- Parameters:
speed- The new relative speed value. Default is 1.0. Use zero or negative values to disable blending.
-
getLabelPerspectiveScaling
public float getLabelPerspectiveScaling()Returns how much of the perspective divide a label keeps as it recedes from the camera.- Returns:
- The label perspective scaling, 0 to 1. Default is 0.5.
-
setLabelPerspectiveScaling
public void setLabelPerspectiveScaling(float scaling) Sets how much of the perspective divide a label keeps as it recedes from the camera.
At 0 a label holds a constant on-screen size at any distance. At 0.5, mapbox's and
maplibre's own value, a distant label shrinks at half the rate the projection would
shrink it. At 1 it shrinks with the map. Callout labels always hold their size.- Parameters:
scaling- The new scaling, clamped to 0 to 1. Default is 0.5.
-
getRendererLayerFilter
Returns the renderer layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names.- Returns:
- The renderer layer filter. Default is empty string, which means no filter is used.
-
setRendererLayerFilter
Sets the renderer layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names.
If non-empty, then only layers that pass the filter are rendered.- Parameters:
filter- The new renderer layer filter.- Throws:
Exception- If the filter expression is not valid.
-
getClickHandlerLayerFilter
Returns the click handler layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names.- Returns:
- The click handler layer filter. Default is empty string, which means no filter is used.
-
setClickHandlerLayerFilter
Sets the click handler layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names.
If non-empty, then only layers that pass the filter are tested when handling clicks.- Parameters:
filter- The new click handler layer filter.- Throws:
Exception- If the filter expression is not valid.
-
getVectorTileEventListener
Returns the vector tile event listener.- Returns:
- The vector tile event listener.
-
setVectorTileEventListener
Sets the vector tile event listener.- Parameters:
eventListener- The vector tile event listener.
-