Class AbstractTileFactory<T,​U extends Tile<T>>

  • Direct Known Subclasses:
    DefaultTileFactory

    public abstract class AbstractTileFactory<T,​U extends Tile<T>>
    extends TileFactory<T,​U>
    The AbstractTileFactory provides a basic implementation for the TileFactory.
    Author:
    Frantisek Post
    • Constructor Detail

      • AbstractTileFactory

        public AbstractTileFactory​(TileFactoryInfo info)
        Creates a new instance of DefaultTileFactory using the spcified TileFactoryInfo
        Parameters:
        info - a TileFactoryInfo to configure this TileFactory
    • Method Detail

      • getTile

        public U getTile​(int x,
                         int y,
                         int zoom)
        Returns the tile that is located at the given tilePoint for this zoom. For example, if getMapSize() returns 10x20 for this zoom, and the tilePoint is (3,5), then the appropriate tile will be located and returned.
        Specified by:
        getTile in class TileFactory<T,​U extends Tile<T>>
        Parameters:
        tilePoint -
        zoom -
        Returns:
      • getTileCache

        public TileCache<T> getTileCache()
      • setTileCache

        public void setTileCache​(TileCache<T> cache)
      • getService

        protected ExecutorService getService()
        Subclasses may override this method to provide their own executor services. This method will be called each time a tile needs to be loaded. Implementations should cache the ExecutorService when possible.
        Returns:
        ExecutorService to load tiles with
      • startLoading

        protected void startLoading​(U tile)
        Description copied from class: TileFactory
        Override this method to load the tile using, for example, an ExecutorService.
        Specified by:
        startLoading in class TileFactory<T,​U extends Tile<T>>
        Parameters:
        tile - The tile to load.
      • createTileRunner

        protected abstract Runnable createTileRunner()
        Subclasses can override this if they need custom TileRunners for some reason
        Returns:
      • promote

        public void promote​(U tile)
        Increase the priority of this tile so it will be loaded sooner.
      • getTileQueue

        public abstract BlockingQueue<U> getTileQueue()
        gets tileQueue which should be static.
        target implementation should provide static tileQueue
      • createTileCache

        public abstract TileCache<T> createTileCache()
      • getTileMap

        protected abstract Map<String,​U> getTileMap()
        gets tileMap which should be static.
        target implementation should provide static tileMap