Class TileMBTilesLayer

java.lang.Object
org.mapsforge.map.layer.Layer
org.mapsforge.map.layer.TileLayer<RendererJob>
slash.navigation.maps.mapsforge.mbtiles.TileMBTilesLayer
All Implemented Interfaces:
org.mapsforge.map.model.common.Observer

public class TileMBTilesLayer extends org.mapsforge.map.layer.TileLayer<RendererJob> implements org.mapsforge.map.model.common.Observer
  • Field Summary

    Fields inherited from class org.mapsforge.map.layer.TileLayer

    hasJobQueue, isTransparent, jobQueue, tileCache

    Fields inherited from class org.mapsforge.map.layer.Layer

    displayModel
  • Constructor Summary

    Constructors
    Constructor
    Description
    TileMBTilesLayer(org.mapsforge.map.layer.cache.TileCache tileCache, org.mapsforge.map.model.MapViewPosition mapViewPosition, boolean isTransparent, MBTilesFile file, org.mapsforge.core.graphics.GraphicFactory graphicFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected RendererJob
    createJob(org.mapsforge.core.model.Tile tile)
     
    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
     
    void
     
    protected void
     
    void
    setDisplayModel(org.mapsforge.map.model.DisplayModel displayModel)
     

    Methods inherited from class org.mapsforge.map.layer.TileLayer

    draw, getAlpha, getCacheTileMargin, getCacheZoomMinus, getCacheZoomPlus, getTileCache, retrieveLabelsOnly, setAlpha, setCacheTileMargin, setCacheZoomMinus, setCacheZoomPlus, setParentTilesRendering

    Methods inherited from class org.mapsforge.map.layer.Layer

    getDisplayModel, getPosition, isVisible, onDestroy, onLongPress, onScroll, onTap, requestRedraw, setVisible, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TileMBTilesLayer

      public TileMBTilesLayer(org.mapsforge.map.layer.cache.TileCache tileCache, org.mapsforge.map.model.MapViewPosition mapViewPosition, boolean isTransparent, MBTilesFile file, org.mapsforge.core.graphics.GraphicFactory graphicFactory)
  • Method Details

    • setDisplayModel

      public void setDisplayModel(org.mapsforge.map.model.DisplayModel displayModel)
      Overrides:
      setDisplayModel in class org.mapsforge.map.layer.TileLayer<RendererJob>
    • createJob

      protected RendererJob createJob(org.mapsforge.core.model.Tile tile)
      Specified by:
      createJob in class org.mapsforge.map.layer.TileLayer<RendererJob>
    • isTileStale

      protected boolean isTileStale(org.mapsforge.core.model.Tile tile, org.mapsforge.core.graphics.TileBitmap bitmap)
      Whether the tile is stale and should be refreshed. This method is called from TileLayer.draw(BoundingBox, byte, Canvas, Point, Rotation) to determine whether the tile needs to be refreshed. A tile is considered stale if the timestamp of the layer's databaseRenderer 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.
      Specified by:
      isTileStale in class org.mapsforge.map.layer.TileLayer<RendererJob>
      Parameters:
      tile - A tile.
      bitmap - The bitmap for tile currently held in the layer's cache.
    • onAdd

      protected void onAdd()
      Overrides:
      onAdd in class org.mapsforge.map.layer.Layer
    • onRemove

      protected void onRemove()
      Overrides:
      onRemove in class org.mapsforge.map.layer.Layer
    • onChange

      public void onChange()
      Specified by:
      onChange in interface org.mapsforge.map.model.common.Observer