com.bbn.openmap.dataAccess.mapTile
Class ZoomLevelMaker

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

public class ZoomLevelMaker
extends ZoomLevelInfo

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, must be in lat,lon order.
 zoomMarker.bounds=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
 zoomMarker.range=0
 
 
Note that the zoomMarker keyword should be stored in the TileMaker zoomLevels property list.

Author:
dietrick

Field Summary
protected  java.util.List<java.awt.geom.Rectangle2D> bounds
           
static java.lang.String BOUNDS_PROPERTY
           
protected  java.lang.String description
           
static java.lang.String DESCRIPTION_PROPERTY
           
protected  java.util.List<Layer> layerList
           
protected  java.util.List<java.lang.String> layers
           
static java.lang.String LAYERS_PROPERTY
           
protected  java.lang.String name
           
static java.lang.String NAME_PROPERTY
           
protected  int range
          The range should be equal or smaller than the zoom level, describing how many other zoom levels should be created from the tiles created for this zoom level (scaling).
static int RANGE_NOT_SET
           
static java.lang.String RANGE_PROPERTY
           
static java.lang.String ZOOM_LEVEL_PROPERTY
           
 
Fields inherited from class com.bbn.openmap.dataAccess.mapTile.ZoomLevelInfo
scale, 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
ZoomLevelMaker()
          Need this to create it from properties
ZoomLevelMaker(java.lang.String name, java.lang.String desc, int zoomLevel)
          Create a ZoomLevelInfo object that contains information about what map tiles should be created for this zoom level.
 
Method Summary
 void addBounds(java.awt.geom.Rectangle2D bounds)
          Set world coordinate bounds for tiles to be created.
 java.awt.geom.Rectangle2D createProperBounds(double x1, double y1, double x2, double y2)
          Create a bounding rectangle given the four coordinates, where the upper left corner of the rectangle is the minimum x, y values and the width and height are the difference between xs and ys.
 java.util.List<java.awt.geom.Rectangle2D> getBounds()
          Get bounds, defined as world coordinates (i.e.
 java.lang.String getDescription()
          Get the description of this zoom level.
 java.util.List<Layer> getLayerList()
          Get the List of Layer Objects, if it's been set.
 java.util.List<java.lang.String> getLayers()
          Get the current marker name (property prefix) for layers considered for this zoom level.
 java.lang.String getName()
           
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
 java.util.Properties getPropertyInfo(java.util.Properties props)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
 int getRange()
          Get the range of this ZoomLevelMaker.
 java.util.List<java.awt.geom.Rectangle2D> getUVBounds(MapTileCoordinateTransform mtct, int zoomLevel)
          Get the bounds as defined as UV tile limits.
 byte[] makeTile(double uvx, double uvy, MapTileMaker mapTileMaker, Proj proj)
           
 void setDescription(java.lang.String description)
          Set the description for this zoom level.
 void setLayerList(java.util.List<Layer> layerList)
          Set a List of Layer objects.
 void setLayers(java.util.List<java.lang.String> layers)
          Set the marker names (property prefixes) for the layers that should be considered for this zoom level.
 void setName(java.lang.String name)
          Set the name of this zoom level info.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 void setRange(int range)
           
 void setZoomLevel(int zoomLevel)
           
 
Methods inherited from class com.bbn.openmap.dataAccess.mapTile.ZoomLevelInfo
formatImageFilePath, formatParentDirectoryName, getEdgeTileCount, getScale, getUVBounds, getZoomLevel, setScale
 
Methods inherited from class com.bbn.openmap.OMComponent
getPropertyPrefix, 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

BOUNDS_PROPERTY

public static final java.lang.String BOUNDS_PROPERTY
See Also:
Constant Field Values

NAME_PROPERTY

public static final java.lang.String NAME_PROPERTY
See Also:
Constant Field Values

DESCRIPTION_PROPERTY

public static final java.lang.String DESCRIPTION_PROPERTY
See Also:
Constant Field Values

ZOOM_LEVEL_PROPERTY

public static final java.lang.String ZOOM_LEVEL_PROPERTY
See Also:
Constant Field Values

LAYERS_PROPERTY

public static final java.lang.String LAYERS_PROPERTY
See Also:
Constant Field Values

RANGE_PROPERTY

public static final java.lang.String RANGE_PROPERTY
See Also:
Constant Field Values

RANGE_NOT_SET

public static final int RANGE_NOT_SET
See Also:
Constant Field Values

name

protected java.lang.String name

description

protected java.lang.String description

layers

protected java.util.List<java.lang.String> layers

layerList

protected java.util.List<Layer> layerList

range

protected int range
The range should be equal or smaller than the zoom level, describing how many other zoom levels should be created from the tiles created for this zoom level (scaling). If the range is -1, then it hasn't been set and the zoom level will be returned for this value.


bounds

protected java.util.List<java.awt.geom.Rectangle2D> bounds
Constructor Detail

ZoomLevelMaker

public ZoomLevelMaker()
Need this to create it from properties


ZoomLevelMaker

public ZoomLevelMaker(java.lang.String name,
                      java.lang.String desc,
                      int zoomLevel)
Create a ZoomLevelInfo object that contains information about what map tiles should be created for this zoom level.

Parameters:
name -
desc -
zoomLevel -
Method Detail

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponent
Sets the properties for the OMComponent.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMComponent
Parameters:
prefix - the token to prefix the property names
props - the Properties object

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from class: OMComponent
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class OMComponent
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

getPropertyInfo

public java.util.Properties getPropertyInfo(java.util.Properties props)
Description copied from class: OMComponent
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.). For Layer, this method should at least return the 'prettyName' property.

Specified by:
getPropertyInfo in interface PropertyConsumer
Overrides:
getPropertyInfo in class OMComponent
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

getName

public java.lang.String getName()
Returns:
the name of this zoom level info.

setName

public void setName(java.lang.String name)
Set the name of this zoom level info.

Parameters:
name -

getDescription

public java.lang.String getDescription()
Get the description of this zoom level.

Returns:
string description of zoom level

setDescription

public void setDescription(java.lang.String description)
Set the description for this zoom level.

Parameters:
description -

getLayers

public java.util.List<java.lang.String> getLayers()
Get the current marker name (property prefix) for layers considered for this zoom level.

Returns:
layers used for zoom level

setLayers

public void setLayers(java.util.List<java.lang.String> layers)
Set the marker names (property prefixes) for the layers that should be considered for this zoom level.

Parameters:
layers -

getLayerList

public java.util.List<Layer> getLayerList()
Get the List of Layer Objects, if it's been set.

Returns:
List of Layers

setLayerList

public void setLayerList(java.util.List<Layer> layerList)
Set a List of Layer objects. If this is set, the layer marker names won't be used. This is a more programmatic approach, rather than using properties and property prefixes of the layers to set them for this zoom level.

Parameters:
layerList -

setZoomLevel

public void setZoomLevel(int zoomLevel)
Overrides:
setZoomLevel in class ZoomLevelInfo
Parameters:
zoomLevel - the current zoom level.

getBounds

public java.util.List<java.awt.geom.Rectangle2D> getBounds()
Get bounds, defined as world coordinates (i.e. lat/lon). Does not cross over date line.

Returns:
the bounds for this zoom level

addBounds

public void addBounds(java.awt.geom.Rectangle2D bounds)
Set world coordinate bounds for tiles to be created. Should not cross over date line.

Parameters:
bounds - No checks performed - x, y have to be the min, height and width must not exceed boundary limits (lat +/- 85, lon +/- 180) when added to x, y.

getUVBounds

public java.util.List<java.awt.geom.Rectangle2D> getUVBounds(MapTileCoordinateTransform mtct,
                                                             int zoomLevel)
Get the bounds as defined as UV tile limits.

Returns:
a List of Rectangle2D of uv bounds for this zoom level

createProperBounds

public java.awt.geom.Rectangle2D createProperBounds(double x1,
                                                    double y1,
                                                    double x2,
                                                    double y2)
Create a bounding rectangle given the four coordinates, where the upper left corner of the rectangle is the minimum x, y values and the width and height are the difference between xs and ys.

Parameters:
x1 -
y1 -
x2 -
y2 -
Returns:
Rect2D, properly constructed from coordinates

getRange

public int getRange()
Get the range of this ZoomLevelMaker.

Returns:
the range set for this zlm, or the current zoom level if the range has not been set.

setRange

public void setRange(int range)

makeTile

public byte[] makeTile(double uvx,
                       double uvy,
                       MapTileMaker mapTileMaker,
                       Proj proj)
Parameters:
uvx -
uvy -
mapTileMaker -
proj -
Returns:
byte array of the tile image, raw image bytes.


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