com.bbn.openmap.dataAccess.mapTile
Class SimpleEmptyTileHandler

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

public class SimpleEmptyTileHandler
extends java.lang.Object
implements EmptyTileHandler, PropertyConsumer

An EmptyTileHandler that uses DrawingAttributes to create a rectangle to fill in for empty tiles. You can set one of these up using the properties for a MapTileLayer, and those properties will trickle down through the MapTileServer, which will in turn create one of these.

 emptyTileHandler=com.bbn.openmap.dataAccess.mapTile.SimpleEmptyTileHandler

 # The zoom level to start using the no coverage parameters. O by default, so that the
 # noCoverage parameters are used to create what is sent back by default.
 noCoverageZoom=zoom level when you don't want empty tiles, you want no coverage tiles

 # If an image is not defined, these colors will be used to create no coverage
 # tiles.  If not specified, nothing will be sent back.
 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.

 # If not specified, no image will be returned if zoom level less than noCoverageZoom.  If you
 # want to use these parameters to set up on-the-fly filled tile images, make sure you also adjust
 # the noCoverageZoom level.
 background.fillColor=hex RGB color
 background.lineColor=hex RGB color
 background.fillPattern=path to resource, file or URL of pattern to use for tile fill.

 

Author:
ddietrick

Field Summary
static java.lang.String BACKGROUND_PROPERTY
           
protected  DrawingAttributes backgroundAtts
           
protected  java.awt.image.BufferedImage backgroundTileImage
           
protected  java.awt.image.BufferedImage emptyTileImage
           
protected static java.util.logging.Logger logger
           
static java.lang.String NO_COVERAGE_PROPERTY
           
static java.lang.String NO_COVERAGE_ZOOM_PROPERTY
           
protected  DrawingAttributes noCoverageAtts
           
protected  int noCoverageZoom
          The zoom level at which point the EmptyTileHandler will create no-coverage tiles, if defined.
protected  java.lang.String prefix
           
static int TILE_SIZE
           
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
SimpleEmptyTileHandler()
           
 
Method Summary
protected  java.awt.image.BufferedImage createTileImageFromDrawingAttributes(DrawingAttributes da)
          Create a BufferedImage from the provided DrawingAttributes.
 DrawingAttributes getBackgroundAtts()
           
 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 getNoCoverageAtts()
           
 int getNoCoverageZoom()
           
 java.util.Properties getProperties(java.util.Properties props)
          Method to fill in a Properties object, reflecting the current values of the PropertyConsumer.
 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.
 java.lang.String getPropertyPrefix()
          Get the property key prefix that is being used to prepend to the property keys for Properties lookups.
 void setBackgroundAtts(DrawingAttributes backgroundAtts)
          Set the background drawing attributes and create the cached backgroundTileImage if the drawing attributes provided doesn't match what's there.
 void setNoCoverageAtts(DrawingAttributes noCoverageAtts)
          Set the no-coverage drawing attributes and create the cached emptyTileImage if the drawing attributes provided doesn't match what's there.
 void setNoCoverageZoom(int noCoverageZoom)
           
 void setProperties(java.util.Properties props)
          Method to set the properties in the PropertyConsumer.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Method to set the properties in the PropertyConsumer.
 void setPropertyPrefix(java.lang.String pref)
          Set the property key prefix that should be used by the PropertyConsumer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static java.util.logging.Logger logger

BACKGROUND_PROPERTY

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

NO_COVERAGE_PROPERTY

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

NO_COVERAGE_ZOOM_PROPERTY

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

TILE_SIZE

public static final int TILE_SIZE
See Also:
Constant Field Values

backgroundAtts

protected DrawingAttributes backgroundAtts

noCoverageAtts

protected DrawingAttributes noCoverageAtts

prefix

protected java.lang.String prefix

emptyTileImage

protected java.awt.image.BufferedImage emptyTileImage

backgroundTileImage

protected java.awt.image.BufferedImage backgroundTileImage

noCoverageZoom

protected int noCoverageZoom
The zoom level at which point the EmptyTileHandler will create no-coverage tiles, if defined.

Constructor Detail

SimpleEmptyTileHandler

public SimpleEmptyTileHandler()
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
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

setPropertyPrefix

public void setPropertyPrefix(java.lang.String pref)
Description copied from interface: PropertyConsumer
Set the property key prefix that should be used by the PropertyConsumer. The prefix, along with a '.', should be prepended to the property keys known by the PropertyConsumer.

Specified by:
setPropertyPrefix in interface PropertyConsumer
Parameters:
pref - the prefix String.

getPropertyPrefix

public java.lang.String getPropertyPrefix()
Description copied from interface: PropertyConsumer
Get the property key prefix that is being used to prepend to the property keys for Properties lookups.

Specified by:
getPropertyPrefix in interface PropertyConsumer
Returns:
the prefix string

setProperties

public void setProperties(java.util.Properties props)
Description copied from interface: PropertyConsumer
Method to set the properties in the PropertyConsumer. It is assumed that the properties do not have a prefix associated with them, or that the prefix has already been set.

Specified by:
setProperties in interface PropertyConsumer
Parameters:
props - a properties object that the PropertyConsumer can use to retrieve expected properties it can use for configuration.

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

getPropertyInfo

public java.util.Properties getPropertyInfo(java.util.Properties props)
Description copied from interface: PropertyConsumer
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.).

Specified by:
getPropertyInfo in interface PropertyConsumer
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.

createTileImageFromDrawingAttributes

protected java.awt.image.BufferedImage createTileImageFromDrawingAttributes(DrawingAttributes da)
Create a BufferedImage from the provided DrawingAttributes.

Parameters:
da - DrawingAttributes
Returns:
BudderedImage with TYPE_INT_ARGB

getBackgroundAtts

public DrawingAttributes getBackgroundAtts()
Returns:
the backgroundAtts

setBackgroundAtts

public void setBackgroundAtts(DrawingAttributes backgroundAtts)
Set the background drawing attributes and create the cached backgroundTileImage if the drawing attributes provided doesn't match what's there. If backgroundAtts never gets set or is set to the default DrawingAttributes object, the backgroundTileImage won't get created and no background images will be returned.

Parameters:
backgroundAtts - the backgroundAtts to set

getNoCoverageAtts

public DrawingAttributes getNoCoverageAtts()
Returns:
the noCoverageAtts

setNoCoverageAtts

public void setNoCoverageAtts(DrawingAttributes noCoverageAtts)
Set the no-coverage drawing attributes and create the cached emptyTileImage if the drawing attributes provided doesn't match what's there. If noCoverageAtts never gets set or is set to the default DrawingAttributes object, the emptyTileImage won't get created and no no-coverage images will be returned.

Parameters:
noCoverageAtts - the noCoverageAtts to set

getNoCoverageZoom

public int getNoCoverageZoom()
Returns:
the noCoverageZoom

setNoCoverageZoom

public void setNoCoverageZoom(int noCoverageZoom)
Parameters:
noCoverageZoom - the noCoverageZoom to set


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