Class AbstractTileFactory
- java.lang.Object
-
- org.meteoinfo.data.mapdata.webmap.TileFactory
-
- org.meteoinfo.data.mapdata.webmap.AbstractTileFactory
-
- Direct Known Subclasses:
DefaultTileFactory
public abstract class AbstractTileFactory extends TileFactory
TheAbstractTileFactoryprovides 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.RunnablecreateTileRunner(Tile tile)Subclasses can override this if they need custom TileRunners for some reasonprotected java.util.concurrent.ExecutorServicegetService()Subclasses may override this method to provide their own executor services.TilegetTile(int x, int y, int zoom)Returns the tile that is located at the given tilePoint for this zoom.TileCachegetTileCache()protected java.net.URIgetURI(Tile tile)Gets the full URI of a tile.voidload(Tile tile)voidpromote(Tile tile)Increase the priority of this tile so it will be loaded sooner.voidsetThreadPoolSize(int size)Set the number of threads to use for loading the tiles.voidsetTileCache(TileCache cache)protected voidstartLoading(Tile tile)Override this method to load the tile using, for example, anExecutorService.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class org.meteoinfo.data.mapdata.webmap.TileFactory
geoToPixel, getInfo, getMapSize, getTileSize, pixelToGeo
-
-
-
-
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:
getTilein classTileFactory- Parameters:
x- X indexy- Y indexzoom- 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:TileFactoryOverride this method to load the tile using, for example, anExecutorService.- Specified by:
startLoadingin classTileFactory- Parameters:
tile- The tile to load.
-
load
public void load(Tile tile)
- Specified by:
loadin classTileFactory
-
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
-
-