Class TileFactory

Object
TileFactory
Direct Known Subclasses:
WebMercatorTileFactory, WMTSTileFactory

public abstract class TileFactory extends Object
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 Details

    • TileFactory

      public TileFactory()
  • Method Details

    • create

      public abstract Tile create(TileIdentifier identifier, TileService service)
      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 longitude
      lat - the latitude
      zoomLevel - the zoom level
      service - the service
      Returns:
      a tile
    • getZoomLevel

      public abstract ZoomLevel getZoomLevel(int zoomLevel, TileService service)
      Gets the ZoomLevel (object) for a given zoom level integer.
      Parameters:
      zoomLevel - the zoom level
      service - the service
      Returns:
      a zoom level
    • findRightNeighbour

      public 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.
      Parameters:
      tile - the reference tile
    • findLowerNeighbour

      public 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.
      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