Package org.geotools.tile
Class TileFactory
Object
TileFactory
- Direct Known Subclasses:
WebMercatorTileFactory
,WMTSTileFactory
A TileFactory is responsible for finding and/or creating tiles for a given TileService and area. Here we make no
distinction whereas a requested tile is created or retrieved form an internal cache.
When creating/finding a tile, the factory must know the zoom level for which the tile is required. Also, a geographic position or, alternatively a reference tile, must be passed.
- Since:
- 12
- Author:
- Tobias Sauerwein, Ugo Taddei
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Tile
create
(TileIdentifier identifier, TileService service) Creates a new tile for the given position using a service.abstract Tile
findLowerNeighbour
(Tile tile, TileService service) Finds the tile for a service at the given position and zoom level, which is immediately below the the passed tile.abstract Tile
findRightNeighbour
(Tile tile, TileService service) Finds the tile for a service at the given position and zoom level, which is immediately to the right of the passed tile.abstract Tile
findTileAtCoordinate
(double lon, double lat, ZoomLevel zoomLevel, TileService service) Finds the tile for a service at the given position and zoom level.abstract ZoomLevel
getZoomLevel
(int zoomLevel, TileService service) Gets the ZoomLevel (object) for a given zoom level integer.static double
normalizeDegreeValue
(double value, int maxValue) Some clients, e.g. uDig, may produce numbers like -210° for the longitude, but we need a number in the range -180 to 180, so instead of -210 we want 150.
-
Constructor Details
-
TileFactory
public TileFactory()
-
-
Method Details
-
create
Creates a new tile for the given position using a service.- Parameters:
identifier
-service
-- Returns:
-
findTileAtCoordinate
public abstract Tile findTileAtCoordinate(double lon, double lat, ZoomLevel zoomLevel, TileService service) Finds the tile for a service at the given position and zoom level.- Parameters:
lon
- the longitudelat
- the latitudezoomLevel
- the zoom levelservice
- the service- Returns:
- a tile
-
getZoomLevel
Gets the ZoomLevel (object) for a given zoom level integer.- Parameters:
zoomLevel
- the zoom levelservice
- the service- Returns:
- a zoom level
-
findRightNeighbour
Finds the tile for a service at the given position and zoom level, which is immediately to the right of the passed tile.- Parameters:
tile
- the reference tile
-
findLowerNeighbour
Finds the tile for a service at the given position and zoom level, which is immediately below the the passed tile.- Parameters:
tile
- the reference tile
-
normalizeDegreeValue
public static double normalizeDegreeValue(double value, int maxValue) Some clients, e.g. uDig, may produce numbers like -210° for the longitude, but we need a number in the range -180 to 180, so instead of -210 we want 150.- Parameters:
value
- the number to normalize (e.g. -210)maxValue
- the maximum value (e.g. 180 -> the range is: -180..180)- Returns:
- a number between (-maxvalue) and maxvalue
-