com.bbn.openmap.dataAccess.mapTile
Class ZoomLevelInfo

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.dataAccess.mapTile.ZoomLevelInfo
All Implemented Interfaces:
LightMapHandlerChild, PropertyConsumer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener
Direct Known Subclasses:
ZoomLevelMaker

public class ZoomLevelInfo
extends OMComponent

The ZoomLevelInfo class is used by the TileMaker and handles how tiles are defined and created for a particular zoom level. It handles any bounds restrictions, what layers should be rendered at this zoom level, and the path to the tiles from the root directory. The properties for this component are:

 #Needed for property file creation of TileMaker
 zoomMarker.class=com.bbn.openmap.image.ZoomLevelInfo
 #Optional, to limit tile areas created, in sets of 4
 zoomMarker.bounds=lat lon lat lon lat lon lat lon
 zoomMarker.description=Tiles for zoom level 4
 #Marker names for layers to be rendered, the property prefixes for the layers held by TileMaker
 zoomMarker.layers=lakes shape
 zoomMarker.name=ZoomLayerInfo 4
 zoomMarker.zoomLevel=4
 
 
Note that the zoomMarker keyword should be stored in the TileMaker zoomLevels property list.

Author:
dietrick

Field Summary
protected  float scale
           
protected  int zoomLevel
           
 
Fields inherited from class com.bbn.openmap.OMComponent
i18n, propertyPrefix
 
Fields inherited from class com.bbn.openmap.MapHandlerChild
beanContextChildSupport, isolated
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
ZoomLevelInfo()
          Default constructor.
 
Method Summary
 java.lang.String formatImageFilePath(java.lang.String rootDir, int uvx, int uvy)
          Creates file path given a root directory plus current zoom level, x, and y.
 java.lang.String formatParentDirectoryName(java.lang.String rootDir, int uvx, int uvy)
          Creates the parent directory of the file with the current zoom level set in the ZoomLevelInfo.
 int getEdgeTileCount()
           
 float getScale()
          Return the current scale set in this object.
 java.awt.geom.Rectangle2D getUVBounds(java.awt.geom.Rectangle2D bounds, MapTileCoordinateTransform mtct, int zoomLevel)
          Given a bounds containing a lat/lon box (x, y, w, h in decimal degrees) and a transform for the MapTileCoordinates being used for the tiles (OpenStreetMap or Google (MTS)), provide the UV tile coordinates for the the bounding box.
 int getZoomLevel()
           
 void setScale(float scale)
          Set the current scale to use for calculating the zoom level.
 void setZoomLevel(int zoomLevel)
           
 
Methods inherited from class com.bbn.openmap.OMComponent
getProperties, getPropertyInfo, getPropertyPrefix, setProperties, setProperties, setPropertyPrefix
 
Methods inherited from class com.bbn.openmap.MapHandlerChild
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

zoomLevel

protected int zoomLevel

scale

protected float scale
Constructor Detail

ZoomLevelInfo

public ZoomLevelInfo()
Default constructor.

Method Detail

getZoomLevel

public int getZoomLevel()
Returns:
the current zoom level.

setZoomLevel

public void setZoomLevel(int zoomLevel)
Parameters:
zoomLevel - the current zoom level.

getScale

public float getScale()
Return the current scale set in this object.

Returns:
scale setting for zoom level

setScale

public void setScale(float scale)
Set the current scale to use for calculating the zoom level.

Parameters:
scale - to set

getEdgeTileCount

public int getEdgeTileCount()
Returns:
the number of tiles across or down for the current zoom level.

getUVBounds

public java.awt.geom.Rectangle2D getUVBounds(java.awt.geom.Rectangle2D bounds,
                                             MapTileCoordinateTransform mtct,
                                             int zoomLevel)
Given a bounds containing a lat/lon box (x, y, w, h in decimal degrees) and a transform for the MapTileCoordinates being used for the tiles (OpenStreetMap or Google (MTS)), provide the UV tile coordinates for the the bounding box.

Parameters:
bounds - decimal degree bounds
mtct - MapTileCoordinateTransform (OSMMapTileCoordinateTransform or TMSMapTileCoordinateTransform).
Returns:
UV tile coordinates for bounds.

formatParentDirectoryName

public java.lang.String formatParentDirectoryName(java.lang.String rootDir,
                                                  int uvx,
                                                  int uvy)
Creates the parent directory of the file with the current zoom level set in the ZoomLevelInfo.

Parameters:
rootDir - path to root of dir structire, with no file separator at the end.
uvx - uv x coordinate of map tile.
uvy - uv y coordinate of map tile.
Returns:
path of parent directory of the file (no y coordinate).

formatImageFilePath

public java.lang.String formatImageFilePath(java.lang.String rootDir,
                                            int uvx,
                                            int uvy)
Creates file path given a root directory plus current zoom level, x, and y. Ready for file extension, which should have a period on it.

Parameters:
rootDir - path to root of dir structure, with no file separator at the end.
uvx - uv x coordinate of the map tile.
uvy - uv y coordinate of the map tile
Returns:
a file path, sans file extension.


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