java.lang.Object
it.tidalwave.mapview.spi.TileSourceSupport
- All Implemented Interfaces:
Projection,TileSource
- Direct Known Subclasses:
OpenStreetMapTileSource
@API(status=EXPERIMENTAL)
public abstract class TileSourceSupport
extends Object
implements TileSource
A generic, basic implementation for
TileSource. This class basically acts as a holder for immutable properties (such as zoom ranges etc...)
and also contains an instance of Projection to which it delegates the coordinate conversion tasks.- Author:
- Fabrizio Giudici
-
Constructor Summary
ConstructorsConstructorDescriptionTileSourceSupport(Projection projection, int minZoomLevel, int maxZoomLevel, int defaultZoomLevel, int tileSize, String displayName, String cachePrefix) Creates a newTileSourceSupportinstance. -
Method Summary
Modifier and TypeMethodDescriptioncoordinatesToMapPoint(MapCoordinates coordinates, double zoom) Returns aMapPointconverted from the given coordinates and zoom level.Returns the prefix for the local cache.intReturns the default zoom level.Returns the display name.intReturns the maximum zoom level.intReturns the minimum zoom level.Returns the projection that converts (latitude,longitude) into rectified map coordinates.intReturns the size of the generated tiles.mapPointToCoordinates(MapPoint mapPoint, double zoom) ReturnsMapCoordinatesconverted from the point coordinates and zoom level.doublemetersPerPixel(MapCoordinates coordinates, double zoom) Returns the map scale (expressed in meters per pixel) at the given zoom level.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface it.tidalwave.mapview.TileSource
getTileUri
-
Constructor Details
-
TileSourceSupport
public TileSourceSupport(@Nonnull Projection projection, int minZoomLevel, int maxZoomLevel, int defaultZoomLevel, int tileSize, String displayName, String cachePrefix) Creates a newTileSourceSupportinstance.- Parameters:
projection- The projection that converts (latitude,longitude) into rectified map coordinates.minZoomLevel- The minimum zoom level.maxZoomLevel- The maximum zoom level.defaultZoomLevel- The default zoom level.tileSize- The size of the generated tiles.displayName- The display name.cachePrefix- The prefix for the local cache.
-
-
Method Details
-
getProjection
Returns the projection that converts (latitude,longitude) into rectified map coordinates..- Returns:
- the projection that converts (latitude,longitude) into rectified map coordinates
-
getMinZoomLevel
public int getMinZoomLevel()Returns the minimum zoom level..- Specified by:
getMinZoomLevelin interfaceTileSource- Returns:
- the minimum zoom level
-
getMaxZoomLevel
public int getMaxZoomLevel()Returns the maximum zoom level..- Specified by:
getMaxZoomLevelin interfaceTileSource- Returns:
- the maximum zoom level
-
getDefaultZoomLevel
public int getDefaultZoomLevel()Returns the default zoom level..- Specified by:
getDefaultZoomLevelin interfaceTileSource- Returns:
- the default zoom level
-
getTileSize
public int getTileSize()Returns the size of the generated tiles..- Specified by:
getTileSizein interfaceTileSource- Returns:
- the size of the generated tiles
-
getDisplayName
Returns the display name..- Specified by:
getDisplayNamein interfaceTileSource- Returns:
- the display name
-
getCachePrefix
Returns the prefix for the local cache..- Specified by:
getCachePrefixin interfaceTileSource- Returns:
- the prefix for the local cache
-
coordinatesToMapPoint
Description copied from interface:ProjectionReturns aMapPointconverted from the given coordinates and zoom level..- Specified by:
coordinatesToMapPointin interfaceProjection- Parameters:
coordinates- the coordinates to convertzoom- the zoom level- Returns:
- a
MapPointconverted from the given coordinates and zoom level
-
mapPointToCoordinates
Description copied from interface:ProjectionReturnsMapCoordinatesconverted from the point coordinates and zoom level..- Specified by:
mapPointToCoordinatesin interfaceProjection- Parameters:
mapPoint- the pointzoom- the zoom level- Returns:
MapCoordinatesconverted from the point coordinates and zoom level
-
metersPerPixel
Description copied from interface:ProjectionReturns the map scale (expressed in meters per pixel) at the given zoom level..- Specified by:
metersPerPixelin interfaceProjection- Parameters:
coordinates- coordinateszoom- the zoom level- Returns:
- the map scale (expressed in meters per pixel) at the given zoom level
-