com.bbn.openmap.dataAccess.mapTile
Interface MapTileCoordinateTransform

All Known Implementing Classes:
AbstractMapTileCoordinateTransform, OSMMapTileCoordinateTransform, TMSMapTileCoordinateTransform

public interface MapTileCoordinateTransform

The TileCoordinateTransform is an object that knows how to translate lat/lon coordinates to UV tile coordinates for map tiles. Its an interface because there seem to be two accepted ways to divide up frames over the Earth. The Tile Map Service (TMS) tile system divide the Earth with the origin at the bottom left, OpenStreetMap has the origin at the top left.

Author:
dietrick

Field Summary
static int TILE_SIZE
           
static java.awt.geom.Point2D UVLR
           
static java.awt.geom.Point2D UVUL
           
 
Method Summary
 float getScaleForZoom(int zoom)
          Return a scale value for the transforming projection, given a discrete zoom level.
 float getScaleForZoomAndProjection(Projection proj, int zoom)
          Get the scale value for a Projection and discrete zoom level.
 float[] getScalesForZoomLevels(Projection proj, int highZoomLevel)
          Creates an array of scale values for different zoom levels.
 int[] getTileBoundsForProjection(java.awt.geom.Point2D upperLeft, java.awt.geom.Point2D lowerRight, int zoomLevel)
          Given a projection, provide the upper, lower, left and right tile coordinates that cover the projection area.
 int getTileSize()
           
 GeoCoordTransformation getTransform(int zoomLevel)
          The coordinate transformation object used for lat/lon uv conversions.
 int getZoomLevelForProj(Projection proj)
          Given a projection, figure out the appropriate zoom level for it.
 int getZoomLevelForProj(Projection proj, int zoomLevelTileSize)
          Given a projection, figure out the appropriate zoom level for it.
 boolean isYDirectionUp()
           
 java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon, int zoom)
           
 java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon, int zoom, java.awt.geom.Point2D ret)
           
 java.awt.geom.Point2D tileUVToLatLon(java.awt.geom.Point2D tileUV, int zoom)
           
 LatLonPoint tileUVToLatLon(java.awt.geom.Point2D tileUV, int zoom, LatLonPoint ret)
           
 

Field Detail

TILE_SIZE

static final int TILE_SIZE
See Also:
Constant Field Values

UVUL

static final java.awt.geom.Point2D UVUL

UVLR

static final java.awt.geom.Point2D UVLR
Method Detail

latLonToTileUV

java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon,
                                     int zoom)

latLonToTileUV

java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon,
                                     int zoom,
                                     java.awt.geom.Point2D ret)

tileUVToLatLon

java.awt.geom.Point2D tileUVToLatLon(java.awt.geom.Point2D tileUV,
                                     int zoom)
Parameters:
tileUV - a Point2D whose x,y coordinates represent the distance in number of tiles (each 256x256) from the origin (where the origin is 90lat,-180lon)
zoom - Tile Map Service (TMS) style zoom level (0-19 usually)
Returns:
a Point2D whose x coordinate is the longitude and y coordinate is the latitude

tileUVToLatLon

LatLonPoint tileUVToLatLon(java.awt.geom.Point2D tileUV,
                           int zoom,
                           LatLonPoint ret)

getTileBoundsForProjection

int[] getTileBoundsForProjection(java.awt.geom.Point2D upperLeft,
                                 java.awt.geom.Point2D lowerRight,
                                 int zoomLevel)
Given a projection, provide the upper, lower, left and right tile coordinates that cover the projection area.

Parameters:
upperLeft - lat/lon coordinate of upper left corner of bounding box.
lowerRight - lat/lon coordinate of lower right corner of bounding box.
zoomLevel - zoom level of desired tiles.
Returns:
int[], in top, left, bottom and right order.

isYDirectionUp

boolean isYDirectionUp()
Returns:
if y coordinates for tiles increase as pixel values increase.

getTransform

GeoCoordTransformation getTransform(int zoomLevel)
The coordinate transformation object used for lat/lon uv conversions.

Returns:
transform appropriate for a particular zoom level.

getScaleForZoom

float getScaleForZoom(int zoom)
Return a scale value for the transforming projection, given a discrete zoom level.

Parameters:
zoom - level
Returns:
scale value.

getScaleForZoomAndProjection

float getScaleForZoomAndProjection(Projection proj,
                                   int zoom)
Get the scale value for a Projection and discrete zoom level.

Parameters:
proj - the projection to use for scale calculations.
zoom - the discrete zoom level.
Returns:
scale value for the given projection.

getZoomLevelForProj

int getZoomLevelForProj(Projection proj)
Given a projection, figure out the appropriate zoom level for it. Right now, 0 is totally zoomed with one tile for the entire earth. But we don't return 0, we start at 1. OM can't handle one tile that covers the entire earth because of the restriction for handling OMGraphics to less than half of the earth. Uses the default zoomLevelTileSize of 350.

Parameters:
proj -
Returns:
the zoom level.

getZoomLevelForProj

int getZoomLevelForProj(Projection proj,
                        int zoomLevelTileSize)
Given a projection, figure out the appropriate zoom level for it. Right now, 0 is totally zoomed with one tile for the entire earth. But we don't return 0, we start at 1. OM can't handle one tile that covers the entire earth because of the restriction for handling OMGraphics to less than half of the earth.

Parameters:
proj -
zoomLevelTileSize - the pixel edge size of a tile before the zoom level changes.
Returns:
the zoom level.

getScalesForZoomLevels

float[] getScalesForZoomLevels(Projection proj,
                               int highZoomLevel)
Creates an array of scale values for different zoom levels. Make sure you don't reference the array outside of 0 and high zoom levels. There will be a high zoom level number of items in the array.

Parameters:
proj -
highZoomLevel -
Returns:
array, initialized for the 0 zoom level index to the high zoom level index.

getTileSize

int getTileSize()
Returns:
the pixel size for tiles for this transform.


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details