com.bbn.openmap.dataAccess.mapTile
Class GreyStandardMapTileFactory

java.lang.Object
  extended by com.bbn.openmap.util.cacheHandler.CacheHandler
      extended by com.bbn.openmap.dataAccess.mapTile.StandardMapTileFactory
          extended by com.bbn.openmap.dataAccess.mapTile.GreyStandardMapTileFactory
All Implemented Interfaces:
MapTileFactory, PropertyConsumer

public class GreyStandardMapTileFactory
extends StandardMapTileFactory

A StandardMapTileFactory that converts the tiles to greyscale for display.

Author:
ddietrick

Field Summary
 
Fields inherited from class com.bbn.openmap.dataAccess.mapTile.StandardMapTileFactory
CACHE_SIZE_PROPERTY, EMPTY_TILE_HANDLER_PROPERTY, emptyTileHandler, FILE_EXT_PROPERTY, fileExt, lastProj, logger, mapTileLogger, mtcTransform, MTCTRANSFORM_PROPERTY, prefix, repaintCallback, ROOT_DIR_PATH_PROPERTY, ROOT_DIR_PROPERTY, rootDir, rootDirProperty, scales, TILE_PROPERTIES, verbose, ZOOM_LEVEL_INFO_PROPERTY, ZOOM_LEVEL_TILE_SIZE_PROPERTY, zoomLevelInfo, zoomLevelTileSize
 
Fields inherited from class com.bbn.openmap.util.cacheHandler.CacheHandler
DEFAULT_MAX_CACHE_SIZE, logicalClock, objs
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
GreyStandardMapTileFactory()
           
GreyStandardMapTileFactory(java.awt.Component layer, java.lang.String rootDir, java.lang.String tileFileExt)
           
 
Method Summary
 CacheObject getEmptyTile(java.lang.Object key, int x, int y, int zoomLevel, Projection proj)
          Overriding the method that creates empty tiles for places with no coverage.
protected  java.awt.image.BufferedImage preprocessImage(java.awt.Image origImage, int imageWidth, int imageHeight)
          Callback method that converts tiles to greyscale.
 
Methods inherited from class com.bbn.openmap.dataAccess.mapTile.StandardMapTileFactory
configureFromProperties, createOMGraphicFromBufferedImage, get, getEmptyTileHandler, getFileExt, getFromCache, getMtcTransform, getProperties, getPropertyInfo, getPropertyPrefix, getRepaintCallback, getRootDir, getTileMatchingProjectionType, getTileNotMatchingProjectionType, getTiles, getTiles, getTiles, getTiles, getZoomLevelForProj, getZoomLevelInfo, load, load, reset, setEmptyTileHandler, setFileExt, setMtcTransform, setProperties, setProperties, setPropertyPrefix, setRepaintCallback, setRootDir, setZoomLevelInfo
 
Methods inherited from class com.bbn.openmap.util.cacheHandler.CacheHandler
clear, get, getCacheSize, listIterator, replaceLeastUsed, resetCache, resetCache, searchCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GreyStandardMapTileFactory

public GreyStandardMapTileFactory()

GreyStandardMapTileFactory

public GreyStandardMapTileFactory(java.awt.Component layer,
                                  java.lang.String rootDir,
                                  java.lang.String tileFileExt)
Method Detail

getEmptyTile

public CacheObject getEmptyTile(java.lang.Object key,
                                int x,
                                int y,
                                int zoomLevel,
                                Projection proj)
Overriding the method that creates empty tiles for places with no coverage. We need to set the no-coverage attributes for the EmptyTileHandler (if it's a SimpleEmptyTileHandler) to null, so it doesn't create empty tiles when it's beyond the coverage zoom level limit. Those tiles are normally returned as clear, but in the conversion to greyscale they turn black.

Overrides:
getEmptyTile in class StandardMapTileFactory
Parameters:
key - the cache key for this object
x - the uv x coordinate of the tile
y - the uv y coordinate of the tile
zoomLevel - the zoom level for the tile
proj - the projection being used for the map.
Returns:
CacheObject, or null if the empty tile should be blank.

preprocessImage

protected java.awt.image.BufferedImage preprocessImage(java.awt.Image origImage,
                                                       int imageWidth,
                                                       int imageHeight)
                                                throws java.lang.InterruptedException
Callback method that converts tiles to greyscale.

Overrides:
preprocessImage in class StandardMapTileFactory
Parameters:
origImage - Any java Image
imageWidth - pixel width
imageHeight - pixel height
Returns:
BufferedImage with any changes necessary.
Throws:
java.lang.InterruptedException


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