public abstract class TileService extends Object implements ImageLoader
TileServices must at least have a name and a base URL.
Modifier and Type | Field and Description |
---|---|
protected static int |
cacheSize |
protected static Logger |
LOGGER |
Modifier | Constructor and Description |
---|---|
protected |
TileService(String name)
Creates a TileService
Client isn't set so you should override loadImageTileImage.
|
protected |
TileService(String name,
String baseURL)
Create a new TileService with a name and a base URL.
|
protected |
TileService(String name,
String baseURL,
HTTPClient client)
Create a new TileService with a name and a base URL
|
Modifier and Type | Method and Description |
---|---|
static ReferencedEnvelope |
createSafeEnvelopeInWGS84(ReferencedEnvelope _mapExtent) |
Set<Tile> |
findTilesInExtent(ReferencedEnvelope _mapExtent,
double scaleFactor,
boolean recommendedZoomLevel,
int maxNumberOfTiles) |
String |
getBaseUrl()
Returns the prefix of an tile-url, e.g.: http://tile.openstreetmap.org/
|
abstract ReferencedEnvelope |
getBounds()
Returns the bounds for the complete TileService
|
HTTPClient |
getHttpClient()
Returns the http client to use for fetching images.
|
int |
getMaxZoomLevel()
Returns the highest zoom-level number from the scaleList.
|
int |
getMinZoomLevel()
Returns the lowest zoom-level number from the scaleList.
|
String |
getName() |
abstract CoordinateReferenceSystem |
getProjectedTileCrs()
The projection the tiles are drawn in.
|
abstract double[] |
getScaleList()
Returns a list that represents a mapping between zoom-levels and map scale.
|
CoordinateReferenceSystem |
getTileCrs()
The CRS that is used when the extent is cut in tiles.
|
abstract TileFactory |
getTileFactory()
Returns the TileFactory which is used to call the method getTileFromCoordinate().
|
int |
getTileHeight() |
int |
getTileWidth() |
int |
getZoomLevelFromMapScale(ScaleZoomLevelMatcher zoomLevelMatcher,
double scaleFactor)
Translates the map scale into a zoom-level for the map services.
|
int |
getZoomLevelToUse(ScaleZoomLevelMatcher zoomLevelMatcher,
double scaleFactor,
boolean useRecommended)
Returns the zoom-level that should be used to fetch the tiles.
|
abstract TileIdentifier |
identifyTileAtCoordinate(double lon,
double lat,
ZoomLevel zoomLevel)
Returns tile identifier for the tile at the given coordinate
|
BufferedImage |
loadImageTileImage(Tile tile)
Fetches the image from url given by tile.
|
Tile |
obtainTile(TileIdentifier identifier)
Check cache for given identifier.
|
String |
toString() |
protected static final Logger LOGGER
protected static int cacheSize
protected TileService(String name)
Client isn't set so you should override loadImageTileImage.
name
- the name. Cannot be null.protected TileService(String name, String baseURL)
Client isn't set so you should override loadImageTileImage.
name
- the name. Cannot be null.baseURL
- the base URL. This is a string representing the common part of the URL for all
this service's tiles. Cannot be null. Note that this constructor doesn't ensure that the
URL is well-formed.protected TileService(String name, String baseURL, HTTPClient client)
name
- the name. Cannot be null.baseURL
- the base URL. This is a string representing the common part of the URL for all
this service's tiles. Cannot be null. Note that this constructor doesn't ensure that the
URL is well-formed.client
- HTTPClient instance to use for a tile request.public String getName()
public int getTileWidth()
public int getTileHeight()
public String getBaseUrl()
public CoordinateReferenceSystem getTileCrs()
public int getZoomLevelFromMapScale(ScaleZoomLevelMatcher zoomLevelMatcher, double scaleFactor)
The scale-factor (0-100) decides whether the tiles will be scaled down (100) or scaled up (0).
scaleFactor
- Scale-factor (0-100)public int getZoomLevelToUse(ScaleZoomLevelMatcher zoomLevelMatcher, double scaleFactor, boolean useRecommended)
useRecommended
- always use the calculated zoom-level, do not use the one the user
selectedpublic int getMinZoomLevel()
public int getMaxZoomLevel()
public Set<Tile> findTilesInExtent(ReferencedEnvelope _mapExtent, double scaleFactor, boolean recommendedZoomLevel, int maxNumberOfTiles)
public abstract TileIdentifier identifyTileAtCoordinate(double lon, double lat, ZoomLevel zoomLevel)
public BufferedImage loadImageTileImage(Tile tile) throws IOException
loadImageTileImage
in interface ImageLoader
IOException
public Tile obtainTile(TileIdentifier identifier)
public abstract double[] getScaleList()
Array index: zoom-level Value at index: map scale High zoom-level -> more detailed map Low zoom-level -> less detailed map
public abstract ReferencedEnvelope getBounds()
public abstract CoordinateReferenceSystem getProjectedTileCrs()
public abstract TileFactory getTileFactory()
public static final ReferencedEnvelope createSafeEnvelopeInWGS84(ReferencedEnvelope _mapExtent)
public final HTTPClient getHttpClient()
IllegalStateException
- If the service is constructed without a client.Copyright © 1996–2022 Geotools. All rights reserved.