com.bbn.openmap.dataAccess.mapTile
Class ShpFileEmptyTileHandler

java.lang.Object
  extended by com.bbn.openmap.dataAccess.mapTile.SimpleEmptyTileHandler
      extended by com.bbn.openmap.dataAccess.mapTile.ShpFileEmptyTileHandler
All Implemented Interfaces:
EmptyTileHandler, PropertyConsumer
Direct Known Subclasses:
WholeWorldTileHandler

public class ShpFileEmptyTileHandler
extends SimpleEmptyTileHandler

Uses a Shape file to figure out if a tile is over water or over land, so the proper color is used for an empty tile. In addition to all of the properties listed in the SimpleEmptyTileHandler, there are other properties to set up the ShapeGeoIndex and the land drawing attribute properties.

 emptyTileHandler=com.bbn.openmap.dataAccess.mapTile.ShpFileEmptyTileHandler
 land.fillColor=hex RGB color
 land.lineColor=hex RGB color
 shpFile=File, resource or URL to shape file for land representation.  Tile locations will be tested against this file to determine if they are over land or sea.
 
 # From SimpleEmptyTileHandler superclass:
 # clear with black edges by default if not specified
 background.fillColor=hex RGB color
 background.lineColor=hex RGB color
 # if not specified for levels with no tiles at all, background will look blocky
 noCoverageZoom=zoom level when you don't want empty tiles, you want no coverage tiles
 # optional, will be clear otherwise
 noCoverage.fillColor=hex RGB color
 noCoverage.lineColor=hex RGB color
 noCoverage.fillPattern=path to resource, file or URL of pattern to use for tile fill.
 

Author:
ddietrick

Field Summary
protected  ShapeGeoIndex geoIndex
           
static java.lang.String LAND_ATTRIBUTES_PROPERTY
           
protected  DrawingAttributes landAttributes
           
static java.lang.String SHP_FILE_PROPERTY
           
 
Fields inherited from class com.bbn.openmap.dataAccess.mapTile.SimpleEmptyTileHandler
BACKGROUND_PROPERTY, backgroundAtts, logger, NO_COVERAGE_ZOOM_PROPERTY, noCoverageAtts, noCoverageZoom, prefix, TILE_SIZE
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
ShpFileEmptyTileHandler()
           
 
Method Summary
 ShapeGeoIndex getGeoIndex()
           
 java.awt.image.BufferedImage getImageForEmptyTile(java.lang.String imagePath, int x, int y, int zoomLevel, MapTileCoordinateTransform mtcTransform, Projection proj)
          The main call from the MapTileFactory to return something for the given missing tile.
 DrawingAttributes getLandAttributes()
           
 java.util.Properties getProperties(java.util.Properties props)
          Method to fill in a Properties object, reflecting the current values of the PropertyConsumer.
protected  boolean isOverLand(double lat, double lon)
          If there is no geoIndex set, this returns false.
 void setGeoIndex(ShapeGeoIndex geoIndex)
           
 void setGeoIndex(java.lang.String fileName)
          Creates the Geo Index from a shape file.
 void setLandAttributes(DrawingAttributes landAttributes)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Method to set the properties in the PropertyConsumer.
 
Methods inherited from class com.bbn.openmap.dataAccess.mapTile.SimpleEmptyTileHandler
getBackgroundAtts, getNoCoverageAtts, getNoCoverageZoom, getPropertyInfo, getPropertyPrefix, setBackgroundAtts, setNoCoverageAtts, setNoCoverageZoom, setProperties, setPropertyPrefix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAND_ATTRIBUTES_PROPERTY

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

SHP_FILE_PROPERTY

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

geoIndex

protected ShapeGeoIndex geoIndex

landAttributes

protected DrawingAttributes landAttributes
Constructor Detail

ShpFileEmptyTileHandler

public ShpFileEmptyTileHandler()
Method Detail

getImageForEmptyTile

public java.awt.image.BufferedImage getImageForEmptyTile(java.lang.String imagePath,
                                                         int x,
                                                         int y,
                                                         int zoomLevel,
                                                         MapTileCoordinateTransform mtcTransform,
                                                         Projection proj)
Description copied from interface: EmptyTileHandler
The main call from the MapTileFactory to return something for the given missing tile.

Specified by:
getImageForEmptyTile in interface EmptyTileHandler
Overrides:
getImageForEmptyTile in class SimpleEmptyTileHandler
Parameters:
imagePath - the path of the missing tile that is going to be used as cache lookup later.
x - the uv x coordinate of the tile.
y - the uv y coordinate of the tile.
zoomLevel - the zoom level of the tile.
mtcTransform - the transform that converts x,y coordinates to lat/lon and describes the layout of the uv tile coordinates.
proj - the map projection, in case that matters what should be returned for the empty tile.
Returns:
BufferedImage for image tile

isOverLand

protected boolean isOverLand(double lat,
                             double lon)
If there is no geoIndex set, this returns false.

Parameters:
lat - latitude, decimal degrees
lon - longitude, decimal degrees
Returns:
true if the point is a hit on any object in the shape file.

setGeoIndex

public void setGeoIndex(java.lang.String fileName)
Creates the Geo Index from a shape file. Geo index gets set to null if null is passed in, or if there's a problem reading the shape file.

Parameters:
fileName - file, resource or URL to shape file (.shp)

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from interface: PropertyConsumer
Method to set the properties in the PropertyConsumer. The prefix is a string that should be prepended to each property key (in addition to a separating '.') in order for the PropertyConsumer to uniquely identify properties meant for it, in the midst of of Properties meant for several objects.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class SimpleEmptyTileHandler
Parameters:
prefix - a String used by the PropertyConsumer to prepend to each property value it wants to look up - setList.getProperty(prefix.propertyKey). If the prefix had already been set, then the prefix passed in should replace that previous value.
props - a Properties object that the PropertyConsumer can use to retrieve expected properties it can use for configuration.

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from interface: PropertyConsumer
Method to fill in a Properties object, reflecting the current values of the PropertyConsumer. If the PropertyConsumer has a prefix 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 SimpleEmptyTileHandler
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.

getGeoIndex

public ShapeGeoIndex getGeoIndex()
Returns:
the geoIndex

setGeoIndex

public void setGeoIndex(ShapeGeoIndex geoIndex)
Parameters:
geoIndex - the geoIndex to set

getLandAttributes

public DrawingAttributes getLandAttributes()
Returns:
the landAttributes

setLandAttributes

public void setLandAttributes(DrawingAttributes landAttributes)
Parameters:
landAttributes - the landAttributes to set


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