public class TileRendererLayer extends TileLayer<RendererJob> implements Observer
hasJobQueue, isTransparent, jobQueue, tileCache
displayModel
Constructor and Description |
---|
TileRendererLayer(TileCache tileCache,
MapDataStore mapDataStore,
MapViewPosition mapViewPosition,
boolean isTransparent,
boolean renderLabels,
boolean cacheLabels,
org.mapsforge.core.graphics.GraphicFactory graphicFactory)
Creates a TileRendererLayer (without hillshading).
|
TileRendererLayer(TileCache tileCache,
MapDataStore mapDataStore,
MapViewPosition mapViewPosition,
boolean isTransparent,
boolean renderLabels,
boolean cacheLabels,
org.mapsforge.core.graphics.GraphicFactory graphicFactory,
HillsRenderConfig hillsRenderConfig)
Creates a TileRendererLayer.
|
TileRendererLayer(TileCache tileCache,
MapDataStore mapDataStore,
MapViewPosition mapViewPosition,
org.mapsforge.core.graphics.GraphicFactory graphicFactory)
Creates a TileRendererLayer (without hillshading).
- Tiles will not have alpha/transparency - Labels will be rendered onto tiles - Labels will not be cached in a LabelStore |
Modifier and Type | Method and Description |
---|---|
protected void |
compileRenderTheme() |
protected RendererJob |
createJob(org.mapsforge.core.model.Tile tile) |
LabelStore |
getLabelStore()
Labels can be stored in a LabelStore for rendering on a separate Layer.
|
MapDataStore |
getMapDataStore() |
RenderThemeFuture |
getRenderThemeFuture() |
float |
getTextScale() |
protected boolean |
isTileStale(org.mapsforge.core.model.Tile tile,
org.mapsforge.core.graphics.TileBitmap bitmap)
Whether the tile is stale and should be refreshed.
|
protected void |
onAdd()
Called each time this
Layer is added to a Layers list. |
void |
onChange()
Called whenever the observed object has been changed.
|
void |
onDestroy() |
protected void |
onRemove()
Called each time this
Layer is removed from a Layers list. |
protected void |
retrieveLabelsOnly(RendererJob job) |
void |
setDisplayModel(DisplayModel displayModel)
The DisplayModel comes from a MapView, so is generally not known when the layer itself is created.
|
void |
setTextScale(float textScale) |
void |
setXmlRenderTheme(XmlRenderTheme xmlRenderTheme) |
draw, getTileCache
getDisplayModel, getPosition, isVisible, onLongPress, onTap, requestRedraw, setVisible, setVisible
public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapViewPosition mapViewPosition, org.mapsforge.core.graphics.GraphicFactory graphicFactory)
tileCache
- cache where tiles are storedmapDataStore
- the mapsforge map filemapViewPosition
- the mapViewPosition to know which tiles to rendergraphicFactory
- the graphicFactory to carry out platform specific operationspublic TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapViewPosition mapViewPosition, boolean isTransparent, boolean renderLabels, boolean cacheLabels, org.mapsforge.core.graphics.GraphicFactory graphicFactory)
tileCache
- cache where tiles are storedmapDataStore
- the mapsforge map filemapViewPosition
- the mapViewPosition to know which tiles to renderisTransparent
- true if the tile should have an alpha/transparencyrenderLabels
- true if labels should be rendered onto tilescacheLabels
- true if labels should be cached in a LabelStoregraphicFactory
- the graphicFactory to carry out platform specific operationspublic TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapViewPosition mapViewPosition, boolean isTransparent, boolean renderLabels, boolean cacheLabels, org.mapsforge.core.graphics.GraphicFactory graphicFactory, HillsRenderConfig hillsRenderConfig)
tileCache
- cache where tiles are storedmapDataStore
- the mapsforge map filemapViewPosition
- the mapViewPosition to know which tiles to renderisTransparent
- true if the tile should have an alpha/transparencyrenderLabels
- true if labels should be rendered onto tilescacheLabels
- true if labels should be cached in a LabelStoregraphicFactory
- the graphicFactory to carry out platform specific operationshillsRenderConfig
- the hillshading setup to be used (can be null)public LabelStore getLabelStore()
public MapDataStore getMapDataStore()
public float getTextScale()
public void setDisplayModel(DisplayModel displayModel)
Layer
setDisplayModel
in class TileLayer<RendererJob>
displayModel
- the displayModel to use.public void setTextScale(float textScale)
public void setXmlRenderTheme(XmlRenderTheme xmlRenderTheme)
protected void compileRenderTheme()
public RenderThemeFuture getRenderThemeFuture()
protected RendererJob createJob(org.mapsforge.core.model.Tile tile)
createJob
in class TileLayer<RendererJob>
protected boolean isTileStale(org.mapsforge.core.model.Tile tile, org.mapsforge.core.graphics.TileBitmap bitmap)
TileLayer.draw(org.mapsforge.core.model.BoundingBox, byte, org.mapsforge.core.graphics.Canvas, org.mapsforge.core.model.Point)
to determine whether the tile needs to
be refreshed.
A tile is considered stale if the timestamp of the layer's mapDataStore
is more recent than the
bitmap
's TileBitmap.getTimestamp()
.
When a tile has become stale, the layer will first display the tile referenced by bitmap
and attempt to
obtain a fresh copy in the background. When a fresh copy becomes available, the layer will replace is and update
the cache. If a fresh copy cannot be obtained for whatever reason, the stale tile will continue to be used until
another #draw(BoundingBox, byte, Canvas, Point)
operation requests it again.isTileStale
in class TileLayer<RendererJob>
tile
- A tile.bitmap
- The bitmap for tile
currently held in the layer's cache.protected void onAdd()
Layer
Layer
is added to a Layers
list.protected void onRemove()
Layer
Layer
is removed from a Layers
list.protected void retrieveLabelsOnly(RendererJob job)
retrieveLabelsOnly
in class TileLayer<RendererJob>