Package com.massifmaps.layers
Class TileLayer
java.lang.Object
com.massifmaps.layers.Layer
com.massifmaps.layers.TileLayer
- Direct Known Subclasses:
RasterTileLayer,VectorTileLayer
An abstract base class for all tile layers.
-
Method Summary
Modifier and TypeMethodDescriptionintbakeDrapeCoverage(SWIGTYPE_p_massif__vt__TileId tileId, int fromStyleLayerIdx) intintcalculateMapTile(MapPos mapPos, int zoom) Calculates the tile corresponding to given geographical coordinates and zoom level.
Note: zoom level bias is NOT applied, only discrete zoom level is used.calculateMapTileBounds(MapTile mapTile) Calculates the bounds of given map tile.calculateMapTileOrigin(MapTile mapTile) Calculates the origin of given map tile.voidclearTileCaches(boolean all) Clears layer tile caches.voidvoidintReturns the data source assigned to this layer.intintGets the current maximum overzoom level for this layer.intGets how many zoom levels up a cached tile may stand in for a missing one.intGets the current maximum underzoom level for this layer.intReturns the projection this layer's data is in, which is its data source's.Returns the tile load listener.intReturns the current tile substitution policy.Returns the tile data source of the associated UTF grid.Returns the UTF grid event listener.intReturns the current frame number.floatGets the current zoom level bias for this layer.booleanbooleanbooleanbooleanReturns the state of the preloading flag of this layer.booleanReturns the state of the synchronized refresh flag.booleanWhether the visible tiles are all decoded for the terrain state the layer is now in.booleanTests whether this layer is being currently updated.intintintvoidsetDrapeCoverageMasks(SWIGTYPE_p_std__vectorT_std__mapT_massif__vt__TileId_unsigned_int_t_t maskTextures, SWIGTYPE_p_std__mapT_int_int_t styleLayerMasks) voidsetFrameNr(int frameNr) Sets the frame number, only used for animated tiles.voidsetGroundDrapeTextures(SWIGTYPE_p_std__mapT_massif__vt__TileId_massif__TileLayer__GroundDrapeRef_t drapes) voidsetLabelOcclusionDepth(long depthTexture, float occluderSize) voidsetMaxOverzoomLevel(int overzoomLevel) Sets the maximum overzoom level for this layer.
If a tile for the given zoom level Z is not available, SDK will try to use tiles with zoom levels Z-1, ..., Z-MaxOverzoomLevel.
The default is 6.voidsetMaxStandInLevel(int standInLevel) Sets how many zoom levels up a cached tile may stand in for a missing one while it loads.
This used to be MaxOverzoomLevel, which is a different thing: that one says how far the
SDK may go for the DATA of a tile the source does not have, and it has to stay deep.voidsetMaxUnderzoomLevel(int underzoomLevel) Sets the maximum underzoom level for this layer.
If a tile for the given zoom level Z is not available, SDK will try to use tiles with zoom levels Z-1, ..., Z-MaxOverzoomLevel and then Z+1, ..., Z+MaxUnderzoomLevel.
The default is 3.voidsetPreloading(boolean preloading) Sets the state of preloading for this layer.voidvoidsetSynchronizedRefresh(boolean synchronizedRefresh) Sets the state of the synchronized refresh flag.voidsetTerrainShadowMask(long texture, float invScreenWidth, float invScreenHeight) voidsetTileLoadListener(TileLoadListener tileLoadListener) Sets the tile load listener.voidsetTileSubstitutionPolicy(int policy) Sets the current tile substitution policy.voidsetUTFGridDataSource(TileDataSource dataSource) Sets the tile data source of the associated UTF grid.voidsetUTFGridEventListener(UTFGridEventListener utfGridEventListener) Sets the UTF grid event listener.voidsetZoomLevelBias(float bias) Sets the zoom level bias for this layer.
Higher zoom level bias forces SDK to use more detailed tiles for given view compared to lower zoom bias.
The default bias is 0.Methods 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
-
Method Details
-
getDataSource
Returns the data source assigned to this layer.- Returns:
- The tile data source assigned to this layer.
-
getProjection
Returns the projection this layer's data is in, which is its data source's.- Returns:
- The projection, or null when the layer has no data source.
-
getUTFGridDataSource
Returns the tile data source of the associated UTF grid. By default this is null.- Returns:
- The tile data source of the associated UTF grid.
-
setUTFGridDataSource
Sets the tile data source of the associated UTF grid.- Parameters:
dataSource- The data source to use. Can be null if UTF grid is not used.
-
getVisibleTileCount
public int getVisibleTileCount()Returns the current frame number.- Returns:
- The current frame number.
How many tiles the last cull put on screen, and how many are preloaded around them.
A diagnostic: it is what the tile LOD numbers actually cost.
-
getPreloadingTileCount
public int getPreloadingTileCount()- Returns:
- The count of tiles fetched around the visible ones, but not drawn.
-
getFrameNr
public int getFrameNr() -
setFrameNr
public void setFrameNr(int frameNr) Sets the frame number, only used for animated tiles.
Loading a new frame may take some time, previous frame is shown during loading.- Parameters:
frameNr- The frame number to display.
-
isPreloading
public boolean isPreloading()Returns the state of the preloading flag of this layer.- Returns:
- True if preloading is enabled.
-
setPreloading
public void setPreloading(boolean preloading) Sets the state of preloading for this layer. Preloading allows the downloading of tiles that are not
currently visible on screen, but are adjacent to ones that are. This means that the user can pan the map without
immediately noticing any missing tiles.
Enabling this option might introduce a small performance hit on slower devices. It should also be noted that this
will considerably increase network traffic if used with online maps. The default is false.- Parameters:
preloading- The new preloading state of the layer.
-
isSynchronizedRefresh
public boolean isSynchronizedRefresh()Returns the state of the synchronized refresh flag.- Returns:
- The state of the synchronized refresh flag.
-
setSynchronizedRefresh
public void setSynchronizedRefresh(boolean synchronizedRefresh) Sets the state of the synchronized refresh flag. If disabled all tiles will appear on screen
one by one as they finish loading. If enabled the map will wait for all the visible tiles to finish loading
and then show them all on screen together. This is useful for animated tiles.- Parameters:
synchronizedRefresh- The new state of the synchronized refresh flag.
-
getTileSubstitutionPolicy
public int getTileSubstitutionPolicy()Returns the current tile substitution policy.- Returns:
- The current substitution policy. Default is TILE_SUBSTITUTION_POLICY_ALL.
-
setTileSubstitutionPolicy
public void setTileSubstitutionPolicy(int policy) Sets the current tile substitution policy.- Parameters:
policy- The new substitution policy. Default is TILE_SUBSTITUTION_POLICY_ALL.
-
getZoomLevelBias
public float getZoomLevelBias()Gets the current zoom level bias for this layer.- Returns:
- The current zoom level bias for this layer.
-
setZoomLevelBias
public void setZoomLevelBias(float bias) Sets the zoom level bias for this layer.
Higher zoom level bias forces SDK to use more detailed tiles for given view compared to lower zoom bias.
The default bias is 0.- Parameters:
bias- The new bias value, both positive and negative fractional values are supported.
-
getMaxOverzoomLevel
public int getMaxOverzoomLevel()Gets the current maximum overzoom level for this layer.- Returns:
- The current maximum overzoom level for this layer.
-
setMaxOverzoomLevel
public void setMaxOverzoomLevel(int overzoomLevel) Sets the maximum overzoom level for this layer.
If a tile for the given zoom level Z is not available, SDK will try to use tiles with zoom levels Z-1, ..., Z-MaxOverzoomLevel.
The default is 6.- Parameters:
overzoomLevel- The new maximum overzoom value.
-
getMaxStandInLevel
public int getMaxStandInLevel()Gets how many zoom levels up a cached tile may stand in for a missing one.- Returns:
- The current maximum stand-in level for this layer.
-
setMaxStandInLevel
public void setMaxStandInLevel(int standInLevel) Sets how many zoom levels up a cached tile may stand in for a missing one while it loads.
This used to be MaxOverzoomLevel, which is a different thing: that one says how far the
SDK may go for the DATA of a tile the source does not have, and it has to stay deep. The
stand-in is only what is shown meanwhile, and a deep one is visible as a ladder - the same
area redrawn from a z7 tile, then z8, then z9, each magnified 2^N and so 2^N coarser than
it was meant to look. That is glaring for a source whose detail changes with zoom, like
generated contours, and merely wasteful for a raster.
The default is 6, the same as MaxOverzoomLevel: a zoom-in of several levels must still
find something to show, or the map goes empty exactly when the user asked for more detail.
Lower it (1 = immediate parent only) for a source whose look changes so much with zoom that
a coarse stand-in is worse than nothing.- Parameters:
standInLevel- The new maximum stand-in level.
-
getMaxUnderzoomLevel
public int getMaxUnderzoomLevel()Gets the current maximum underzoom level for this layer.- Returns:
- The current maximum underzoom level for this layer.
-
setMaxUnderzoomLevel
public void setMaxUnderzoomLevel(int underzoomLevel) Sets the maximum underzoom level for this layer.
If a tile for the given zoom level Z is not available, SDK will try to use tiles with zoom levels Z-1, ..., Z-MaxOverzoomLevel and then Z+1, ..., Z+MaxUnderzoomLevel.
The default is 3.- Parameters:
underzoomLevel- The new maximum underzoom value.
-
calculateMapTile
Calculates the tile corresponding to given geographical coordinates and zoom level.
Note: zoom level bias is NOT applied, only discrete zoom level is used.- Parameters:
mapPos- Coordinates of the point in data source projection coordinate system.zoom- Zoom level to use for the tile.- Returns:
- The corresponding map tile.
-
calculateMapTileOrigin
Calculates the origin of given map tile.- Parameters:
mapTile- The map tile to use.- Returns:
- The corresponding coordinates of the tile origin in data source projection coordinate system.
-
calculateMapTileBounds
Calculates the bounds of given map tile.- Parameters:
mapTile- The map tile to use.- Returns:
- The corresponding bounds of the tile origin in data source projection coordinate system.
-
clearTileCaches
public void clearTileCaches(boolean all) Clears layer tile caches. This will release memory allocated to tiles.- Parameters:
all- True if all tiles should be released, otherwise only preloading (invisible) tiles are released.
-
getTileLoadListener
Returns the tile load listener.- Returns:
- The tile load listener.
-
setTileLoadListener
Sets the tile load listener.- Parameters:
tileLoadListener- The tile load listener.
-
getUTFGridEventListener
Returns the UTF grid event listener.- Returns:
- The UTF grid event listener.
-
setUTFGridEventListener
Sets the UTF grid event listener.- Parameters:
utfGridEventListener- The UTF grid event listener.
-
isUpdateInProgress
public boolean isUpdateInProgress()Description copied from class:LayerTests whether this layer is being currently updated.- Overrides:
isUpdateInProgressin classLayer- Returns:
- True when the layer is being updated or false when the layer is in steady state.
-
isTerrainDecodeSettled
public boolean isTerrainDecodeSettled()Whether the visible tiles are all decoded for the terrain state the layer is now in. False
from the moment a 2D/3D switch invalidates them until their replacements have arrived; the
switch waits on it before it lets the terrain rise. Internal method.- Returns:
- True if no tile is still waiting for the current terrain decode state.
-
collectSpanDrapeTiles
-
bakeSpanDrapeTile
-
setSpanDrapeTextures
-
setGroundDrapeTextures
public void setGroundDrapeTextures(SWIGTYPE_p_std__mapT_massif__vt__TileId_massif__TileLayer__GroundDrapeRef_t drapes) -
collectDrapeStackOrder
-
bakeDrapeCoverage
-
setDrapeCoverageMasks
public void setDrapeCoverageMasks(SWIGTYPE_p_std__vectorT_std__mapT_massif__vt__TileId_unsigned_int_t_t maskTextures, SWIGTYPE_p_std__mapT_int_int_t styleLayerMasks) -
consumeShadowCastersMissingElevation
public int consumeShadowCastersMissingElevation() -
setTerrainShadowMask
public void setTerrainShadowMask(long texture, float invScreenWidth, float invScreenHeight) -
renderTerrainShadowMask
-
isGroundAOActive
public boolean isGroundAOActive() -
isGroundAOBakeable
public boolean isGroundAOBakeable() -
setLabelOcclusionDepth
public void setLabelOcclusionDepth(long depthTexture, float occluderSize) -
isLabelOcclusionWanted
public boolean isLabelOcclusionWanted() -
renderLabelOcclusionDepth
public int renderLabelOcclusionDepth() -
renderGroundAOMask
public int renderGroundAOMask() -
bakeGroundAOMask
-