Class TileSourceSupport

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 Details

    • TileSourceSupport

      public TileSourceSupport(@Nonnull Projection projection, int minZoomLevel, int maxZoomLevel, int defaultZoomLevel, int tileSize, String displayName, String cachePrefix)
      Creates a new TileSourceSupport instance.
      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

      @Nonnull public Projection 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:
      getMinZoomLevel in interface TileSource
      Returns:
      the minimum zoom level
    • getMaxZoomLevel

      public int getMaxZoomLevel()
      Returns the maximum zoom level..
      Specified by:
      getMaxZoomLevel in interface TileSource
      Returns:
      the maximum zoom level
    • getDefaultZoomLevel

      public int getDefaultZoomLevel()
      Returns the default zoom level..
      Specified by:
      getDefaultZoomLevel in interface TileSource
      Returns:
      the default zoom level
    • getTileSize

      public int getTileSize()
      Returns the size of the generated tiles..
      Specified by:
      getTileSize in interface TileSource
      Returns:
      the size of the generated tiles
    • getDisplayName

      public String getDisplayName()
      Returns the display name..
      Specified by:
      getDisplayName in interface TileSource
      Returns:
      the display name
    • getCachePrefix

      public String getCachePrefix()
      Returns the prefix for the local cache..
      Specified by:
      getCachePrefix in interface TileSource
      Returns:
      the prefix for the local cache
    • coordinatesToMapPoint

      public MapPoint coordinatesToMapPoint(MapCoordinates coordinates, double zoom)
      Description copied from interface: Projection
      Returns a MapPoint converted from the given coordinates and zoom level..
      Specified by:
      coordinatesToMapPoint in interface Projection
      Parameters:
      coordinates - the coordinates to convert
      zoom - the zoom level
      Returns:
      a MapPoint converted from the given coordinates and zoom level
    • mapPointToCoordinates

      public MapCoordinates mapPointToCoordinates(MapPoint mapPoint, double zoom)
      Description copied from interface: Projection
      Returns MapCoordinates converted from the point coordinates and zoom level..
      Specified by:
      mapPointToCoordinates in interface Projection
      Parameters:
      mapPoint - the point
      zoom - the zoom level
      Returns:
      MapCoordinates converted from the point coordinates and zoom level
    • metersPerPixel

      public double metersPerPixel(MapCoordinates coordinates, double zoom)
      Description copied from interface: Projection
      Returns the map scale (expressed in meters per pixel) at the given zoom level..
      Specified by:
      metersPerPixel in interface Projection
      Parameters:
      coordinates - coordinates
      zoom - the zoom level
      Returns:
      the map scale (expressed in meters per pixel) at the given zoom level