com.bbn.openmap.dataAccess.mapTile
Class GoogleMapTileFactory
java.lang.Object
com.bbn.openmap.util.cacheHandler.CacheHandler
com.bbn.openmap.dataAccess.mapTile.StandardMapTileFactory
com.bbn.openmap.dataAccess.mapTile.ServerMapTileFactory
com.bbn.openmap.dataAccess.mapTile.GoogleMapTileFactory
- All Implemented Interfaces:
- MapTileFactory, PropertyConsumer
public class GoogleMapTileFactory
- extends ServerMapTileFactory
The GoogleMapTileFactory is a simple example of how to customize a
MapTileFactory to contact other services. This MTF is set up to contact the
Google static map server through the static maps API. If you don't provide
your API key you will be shut off. See the documentation at
https://developers.google.com/maps/documentation/staticmaps/, and read the
usage agreement.
Set the attribution property on the MapTileLayer, so the copyright shows up
when the data is displayed.
The additional properties of this class, which are added to the layer properties:
key=google_api_key
mapType=roadmap, terrain, satellite or hybrid
- Author:
- dietrick
Field Summary |
static java.lang.String |
API_KEY_PROPERTY
Set the api key to use for tracking/billing in the properties. |
static java.lang.String |
MAPTYPE_PROPERTY
Set the map type displayed in the properties. |
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, mapTileRequester, mtcTransform, MTCTRANSFORM_PROPERTY, prefix, ROOT_DIR_PATH_PROPERTY, ROOT_DIR_PROPERTY, rootDir, rootDirProperty, TILE_IMAGE_PREPARER_PROPERTY, TILE_PROPERTIES, tileImagePreparer, verbose, ZOOM_LEVEL_INFO_PROPERTY, ZOOM_LEVEL_TILE_SIZE_PROPERTY, zoomLevelInfo, zoomLevelTileSize |
Method Summary |
java.lang.String |
buildFilePath(int x,
int y,
int z,
java.lang.String fileExt)
Build an image path to load, based on specified tile coordinates, zoom
level and file extension settings. |
java.lang.String |
getApiKey()
|
java.lang.String |
getMapType()
|
java.util.Properties |
getProperties(java.util.Properties props)
Method to fill in a Properties object, reflecting the current
values of the PropertyConsumer. |
protected java.awt.image.BufferedImage |
preprocessImage(java.awt.Image origImage,
int imageWidth,
int imageHeight)
Method that allows subclasses to modify the image as necessary before it
is passed into an OMGraphic. |
void |
setApiKey(java.lang.String apiKey)
|
void |
setMapType(java.lang.String mapType)
|
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.StandardMapTileFactory |
configureFromProperties, createOMGraphicFromBufferedImage, get, getEmptyTile, getEmptyTileHandler, getFileExt, getInitPropertiesOrder, getMapTileRequester, getMtcTransform, getPropertyPrefix, getRootDir, getTileImagePreparer, getTileMatchingProjectionType, getTileNotMatchingProjectionType, getTilePathBuilder, getTiles, getTiles, getTiles, getTiles, getZoomLevelInfo, load, setEmptyTileHandler, setFileExt, setMapTileRequester, setMtcTransform, setProperties, setPropertyPrefix, setRootDir, setTileImagePreparer, setTilePathBuilder, setZoomLevelInfo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
API_KEY_PROPERTY
public static final java.lang.String API_KEY_PROPERTY
- Set the api key to use for tracking/billing in the properties.
- See Also:
- Constant Field Values
MAPTYPE_PROPERTY
public static final java.lang.String MAPTYPE_PROPERTY
- Set the map type displayed in the properties.
- See Also:
- Constant Field Values
GoogleMapTileFactory
public GoogleMapTileFactory()
buildFilePath
public java.lang.String buildFilePath(int x,
int y,
int z,
java.lang.String fileExt)
- Description copied from class:
StandardMapTileFactory
- Build an image path to load, based on specified tile coordinates, zoom
level and file extension settings.
Look at the root directory definition and determine if the x,y,z values
of the path are specified as the holder values {z}, {x} and {y}.
If they aren't specified, the provided values will be appended to the
rootDir as z/x/y.fileExt.
If {z}, {x} or {y} are found in the root dir path, then it's assumed that
the rootDir contains all the information needed to specify the path and
regular expressions will be used to replace those value holders with the
values specified. The file extension in this case will not be appended to
the rootDir.
- Overrides:
buildFilePath
in class StandardMapTileFactory
- Parameters:
x
- the x tile coordinatey
- the y tile coordinatez
- the zoom levelfileExt
- the file extension to use for the path.
preprocessImage
protected java.awt.image.BufferedImage preprocessImage(java.awt.Image origImage,
int imageWidth,
int imageHeight)
throws java.lang.InterruptedException
- Description copied from class:
StandardMapTileFactory
- Method that allows subclasses to modify the image as necessary before it
is passed into an OMGraphic.
- Overrides:
preprocessImage
in class StandardMapTileFactory
- Parameters:
origImage
- Any java ImageimageWidth
- pixel widthimageHeight
- pixel height
- Returns:
- BufferedImage with any changes necessary.
- Throws:
java.lang.InterruptedException
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 ServerMapTileFactory
- 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 ServerMapTileFactory
- 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.
getApiKey
public java.lang.String getApiKey()
- Returns:
- the apiKey
setApiKey
public void setApiKey(java.lang.String apiKey)
- Parameters:
apiKey
- the apiKey to set
getMapType
public java.lang.String getMapType()
- Returns:
- the mapType
setMapType
public void setMapType(java.lang.String mapType)
- Parameters:
mapType
- the mapType to set
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details