Class TiledProvider

java.lang.Object
com.codename1.maps.providers.MapProvider
com.codename1.maps.providers.TiledProvider
Direct Known Subclasses:
GoogleMapsProvider, OpenStreetMapProvider

public abstract class TiledProvider extends MapProvider
This is a tiled map provider
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final String
     
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TiledProvider(String url, Projection projection, Dimension tileSize)
    Creates a new Tiled provider
  • Method Summary

    Modifier and Type
    Method
    Description
    bboxFor(Coord position, int zoomLevel)
    Returns the bounding box of a position ina given zoom level
    scale(int zoomLevel)
    Scale to the zoom level
    Gets a tile for the given bounding box
    protected String
    url(int zoomLevel, int xTile, int yTile)
    build a url request for a tile

    Methods inherited from class MapProvider

    attribution, maxZoomFor, maxZoomLevel, minZoomLevel, projection, tileSize, tileSize, translate
    Modifier and Type
    Method
    Description
    abstract String
    The provider attribution.
    int
    Returns the maximum zoom of a specific Tile.
    abstract int
    Maximal zoom level.
    int
    Minimal zoom level user is able to see.
    Gets the Provider projection
    Gets the tile size
    void
    Request map to provide tiles of specific sizes.
    translate(Coord position, int zoomLevel, int pixelsX, int pixelsY)
    Translates position by [pixelsX, pixelsY] at zoomLevel acordingly to maps scale.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • Field Details

    • _url

      protected final String _url
    • _zoomLevel

      protected int _zoomLevel
  • Constructor Details

    • TiledProvider

      public TiledProvider(String url, Projection projection, Dimension tileSize)

      Creates a new Tiled provider

      Parameters
      • url: the url of the provider

      • projection: the Projection system of the Provider

      • tileSize: the tiles size(usually 256x256)

  • Method Details

    • url

      protected String url(int zoomLevel, int xTile, int yTile)

      build a url request for a tile

      Parameters
      • zoomLevel: the zoom level

      • xTile: x position of the tile

      • yTile: y position of the tile

      Returns

      the image url of the tile

    • scale

      public Coord scale(int zoomLevel)

      Scale to the zoom level

      Parameters
      • zoomLevel: to scale to
      Returns

      a scaled coordinate.

      Specified by:
      scale in class MapProvider
    • bboxFor

      public BoundingBox bboxFor(Coord position, int zoomLevel)

      Returns the bounding box of a position ina given zoom level

      Parameters
      • position: on the map

      • zoomLevel: the zoom level

      Returns

      a bounding box

      Specified by:
      bboxFor in class MapProvider
    • tileFor

      public Tile tileFor(BoundingBox bbox)

      Gets a tile for the given bounding box

      Parameters
      • bbox: a bounding box
      Returns

      a Tile for the given bounding box

      Specified by:
      tileFor in class MapProvider