Class TileLayer<T extends Job>

    • Field Detail

      • hasJobQueue

        protected final boolean hasJobQueue
      • isTransparent

        protected final boolean isTransparent
      • tileCache

        protected final TileCache tileCache
    • Constructor Detail

      • TileLayer

        public TileLayer​(TileCache tileCache,
                         IMapViewPosition mapViewPosition,
                         org.mapsforge.core.graphics.Matrix matrix,
                         boolean isTransparent)
      • TileLayer

        public TileLayer​(TileCache tileCache,
                         IMapViewPosition mapViewPosition,
                         org.mapsforge.core.graphics.Matrix matrix,
                         boolean isTransparent,
                         boolean hasJobQueue)
    • Method Detail

      • draw

        public void draw​(org.mapsforge.core.model.BoundingBox boundingBox,
                         byte zoomLevel,
                         org.mapsforge.core.graphics.Canvas canvas,
                         org.mapsforge.core.model.Point topLeftPoint)
        Description copied from class: Layer
        Draws this Layer on the given canvas.
        Specified by:
        draw in class Layer
        Parameters:
        boundingBox - the geographical area which should be drawn.
        zoomLevel - the zoom level at which this Layer should draw itself.
        canvas - the canvas on which this Layer should draw itself.
        topLeftPoint - the top-left pixel position of the canvas relative to the top-left map position.
      • setDisplayModel

        public void setDisplayModel​(DisplayModel displayModel)
        Description copied from class: Layer
        The DisplayModel comes from a MapView, so is generally not known when the layer itself is created. Maybe a better way would be to have a MapView as a parameter when creating a layer.
        Overrides:
        setDisplayModel in class Layer
        Parameters:
        displayModel - the displayModel to use.
      • createJob

        protected abstract T createJob​(org.mapsforge.core.model.Tile tile)
      • isTileStale

        protected abstract 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 draw(BoundingBox, byte, Canvas, Point) to determine whether the tile needs to be refreshed. Subclasses must override this method and implement appropriate checks to determine when a tile is stale.

        Return false to use the cached copy without attempting to refresh it.

        Return true to cause the layer to attempt to obtain a fresh copy of the tile. 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 (e.g. because the tile is obtained from an online source which cannot be reached), the stale tile will continue to be used until another #draw(BoundingBox, byte, Canvas, Point) operation requests it again.

        Parameters:
        tile - A tile.
        bitmap - The bitmap for tile currently held in the layer's cache.
      • retrieveLabelsOnly

        protected void retrieveLabelsOnly​(T job)
      • getAlpha

        public float getAlpha()
      • getTileCache

        public TileCache getTileCache()
      • setAlpha

        public void setAlpha​(float alpha)
      • setParentTilesRendering

        public void setParentTilesRendering​(org.mapsforge.core.util.Parameters.ParentTilesRendering parentTilesRendering)