com.bbn.openmap.dataAccess.mapTile
Class AbstractMapTileCoordinateTransform

java.lang.Object
  extended by com.bbn.openmap.dataAccess.mapTile.AbstractMapTileCoordinateTransform
All Implemented Interfaces:
MapTileCoordinateTransform
Direct Known Subclasses:
OSMMapTileCoordinateTransform, TMSMapTileCoordinateTransform

public abstract class AbstractMapTileCoordinateTransform
extends java.lang.Object
implements MapTileCoordinateTransform

An abstraction of MapTileCoordinateTransform that combines the identical methods of OSM and TMS MapTileCoordinateTransforms.

Author:
dietrick

Field Summary
 
Fields inherited from interface com.bbn.openmap.dataAccess.mapTile.MapTileCoordinateTransform
TILE_SIZE, UVLR, UVUL
 
Constructor Summary
AbstractMapTileCoordinateTransform()
           
 
Method Summary
protected  int getMaxZoomLevelForProj()
          Returns the maximum zoom level for calculating the appropriate zoom level.
protected  int getMinZoomLevelForProj()
          Returns the minimum zoom level for calculating the appropriate zoom level.
 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 getTileSize()
          Returns the tile size of the transform.
 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.
 java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon, int zoom)
           
 java.awt.geom.Point2D tileUVToLatLon(java.awt.geom.Point2D tileUV, int zoom)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bbn.openmap.dataAccess.mapTile.MapTileCoordinateTransform
getTileBoundsForProjection, getTransform, isYDirectionUp, latLonToTileUV, tileUVToLatLon
 

Constructor Detail

AbstractMapTileCoordinateTransform

public AbstractMapTileCoordinateTransform()
Method Detail

latLonToTileUV

public java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon,
                                            int zoom)
Specified by:
latLonToTileUV in interface MapTileCoordinateTransform

tileUVToLatLon

public java.awt.geom.Point2D tileUVToLatLon(java.awt.geom.Point2D tileUV,
                                            int zoom)
Specified by:
tileUVToLatLon in interface MapTileCoordinateTransform
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

getScaleForZoom

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

Specified by:
getScaleForZoom in interface MapTileCoordinateTransform
Parameters:
zoom - level
Returns:
scale value.

getScaleForZoomAndProjection

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

Specified by:
getScaleForZoomAndProjection in interface MapTileCoordinateTransform
Parameters:
proj - the projection to use for scale calculations.
zoom - the discrete zoom level.
Returns:
scale value for the given projection.

getZoomLevelForProj

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

Specified by:
getZoomLevelForProj in interface MapTileCoordinateTransform
Parameters:
proj -
Returns:
the zoom level.

getZoomLevelForProj

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

Specified by:
getZoomLevelForProj in interface MapTileCoordinateTransform
Parameters:
proj -
zoomLevelTileSize - used for determining zoom levels, a kind of buffer around true zoom levels since the OpenMap layers scale images.
Returns:
the zoom level.

getMinZoomLevelForProj

protected int getMinZoomLevelForProj()
Returns the minimum zoom level for calculating the appropriate zoom level.

Returns:
minimum zoom level

getMaxZoomLevelForProj

protected int getMaxZoomLevelForProj()
Returns the maximum zoom level for calculating the appropriate zoom level.

Returns:
maximum zoom level

getScalesForZoomLevels

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

Specified by:
getScalesForZoomLevels in interface MapTileCoordinateTransform
Parameters:
proj -
highZoomLevel -
Returns:
array, initialized for the low zoom level index to the high zoom level index.

getTileSize

public int getTileSize()
Returns the tile size of the transform.

Specified by:
getTileSize in interface MapTileCoordinateTransform
Returns:
the pixel size for tiles for this transform.


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