com.bbn.openmap.dataAccess.mapTile
Class GreyServerMapTileFactory

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.ServerMapTileFactory
              extended by com.bbn.openmap.dataAccess.mapTile.GreyServerMapTileFactory
All Implemented Interfaces:
MapTileFactory, PropertyConsumer

public class GreyServerMapTileFactory
extends ServerMapTileFactory

Extension of ServerMapTileFactory that converts tiles to greyscale.

Author:
ddietrick

Field Summary
 
Fields inherited from class com.bbn.openmap.dataAccess.mapTile.ServerMapTileFactory
LOCAL_CACHE_ROOT_DIR_PROPERTY, localCacheDir
 
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
GreyServerMapTileFactory()
           
GreyServerMapTileFactory(java.lang.String rootDir)
           
 
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.ServerMapTileFactory
getFromCache, getProperties, getPropertyInfo, load, setProperties
 
Methods inherited from class com.bbn.openmap.dataAccess.mapTile.StandardMapTileFactory
configureFromProperties, createOMGraphicFromBufferedImage, get, getEmptyTileHandler, getFileExt, getMtcTransform, getPropertyPrefix, getRepaintCallback, getRootDir, getTileMatchingProjectionType, getTileNotMatchingProjectionType, getTiles, getTiles, getTiles, getTiles, getZoomLevelForProj, getZoomLevelInfo, load, reset, setEmptyTileHandler, setFileExt, setMtcTransform, 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
 
Methods inherited from interface com.bbn.openmap.dataAccess.mapTile.MapTileFactory
getTiles, getTiles, getTiles, reset, setRepaintCallback
 
Methods inherited from interface com.bbn.openmap.PropertyConsumer
getPropertyPrefix, setProperties, setPropertyPrefix
 

Constructor Detail

GreyServerMapTileFactory

public GreyServerMapTileFactory()

GreyServerMapTileFactory

public GreyServerMapTileFactory(java.lang.String rootDir)
Parameters:
rootDir -
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