Class AbstractTileFactory

  • Direct Known Subclasses:
    DefaultTileFactory


    public abstract class AbstractTileFactory
    extends TileFactory
    The AbstractTileFactory provides a basic implementation for the TileFactory.
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractTileFactory​(TileFactoryInfo info)
      Creates a new instance of DefaultTileFactory using the spcified TileFactoryInfo
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Runnable createTileRunner​(Tile tile)
      Subclasses can override this if they need custom TileRunners for some reason
      protected java.util.concurrent.ExecutorService getService​()
      Subclasses may override this method to provide their own executor services.
      Tile getTile​(int x, int y, int zoom)
      Returns the tile that is located at the given tilePoint for this zoom.
      TileCache getTileCache​()  
      protected java.net.URI getURI​(Tile tile)
      Gets the full URI of a tile.
      void load​(Tile tile)  
      void promote​(Tile tile)
      Increase the priority of this tile so it will be loaded sooner.
      void setThreadPoolSize​(int size)
      Set the number of threads to use for loading the tiles.
      void setTileCache​(TileCache cache)  
      protected void startLoading​(Tile tile)
      Override this method to load the tile using, for example, an ExecutorService.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 Tile 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
        Parameters:
        x - X index
        y - Y index
        zoom - Zoom value
        Returns:
        Tile
      • getTileCache

        public TileCache getTileCache​()
      • setTileCache

        public void setTileCache​(TileCache cache)
      • getService

        protected java.util.concurrent.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
      • setThreadPoolSize

        public void setThreadPoolSize​(int size)
        Set the number of threads to use for loading the tiles. This controls the number of threads used by the ExecutorService returned from getService(). Note, this method should be called before loading the first tile. Calls after the first tile are loaded will have no effect by default.
        Parameters:
        size -
      • startLoading

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

        protected java.net.URI getURI​(Tile tile)
                               throws java.net.URISyntaxException
        Gets the full URI of a tile.
        Parameters:
        tile -
        Returns:
        URI
        Throws:
        java.net.URISyntaxException
      • createTileRunner

        protected java.lang.Runnable createTileRunner​(Tile tile)
        Subclasses can override this if they need custom TileRunners for some reason
        Parameters:
        tile - Tile
        Returns:
        Runnable
      • promote

        public void promote​(Tile tile)
        Increase the priority of this tile so it will be loaded sooner.
        Parameters:
        tile - Tile