|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.image.ImageServer com.bbn.openmap.dataAccess.mapTile.MapTileMaker
public class MapTileMaker
The MapTileMaker is an ImageServer extension that knows how to create image tile sets, like the kind of tiles used by Google Maps and OpenStreetMap, Tile Map Service (TMS). It uses ZoomLayerMarker objects to define how tiles are created for different zoom levels. You can run this class as an application. With the -create option, it will create a sample properties file to demonstrate what properties are needed to run it.
The properties look much like the ImageServer properties, with a couple of additional values:
### MapTileMaker/ImageServer properties ### antialiasing=false # Image formatter definition formatters=formatter1 # Layer definitions for layers that are available for zoom levels layers=layer1 layer2 ... rootDir=Path to top level directory for tiles zoomLevels=zoom1 zoom2 formatter1=.class=com.bbn.openmap.image.PNGImageIOFormatter layer1.class=com.bbn.openmap.layer.shape.ShapeLayer # ... layer1 properties follow, see layer docs for specific properties for that layer # Then, for each zoom level zoom1.class=com.bbn.openmap.image.ZoomLevelInfo #Optional, to limit tile areas created, in sets of 4, must be in lat,lon order zoom1.bounds=lat lon lat lon zoom1.description=Tiles for zoom level 4 #Marker names for layers to be rendered, the property prefixes for the layers held by TileMaker zoom1.layers=layer1 layer2 zoom1.name=ZoomLayerInfo 4 zoom1.zoomLevel=4 # If defined, copies of zoomLevel tiles will be scaled through range level. zoom1.range=0 # and repeat for every zoomLevel defined
Field Summary | |
---|---|
protected MapTileCoordinateTransform |
mtcTransform
|
static java.lang.String |
ROOT_DIRECTORY_PROPERTY
|
protected java.lang.String |
rootDir
|
protected int |
TILE_SIZE
|
static java.lang.String |
ZOOM_LEVELS_PROPERTY
|
protected java.util.List<ZoomLevelMaker> |
zoomLevels
|
Fields inherited from class com.bbn.openmap.image.ImageServer |
---|
AntiAliasingProperty, background, BackgroundProperty, doAntiAliasing, formatter, imageFormatters, ImageFormattersProperty, ImageServerLayersProperty, layers, logger, OpenMapPrefix, projectionFactory, propertiesPrefix |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Constructor Summary | |
---|---|
MapTileMaker()
Empty constructor that expects to be configured later. |
|
MapTileMaker(Layer[] layers,
ImageFormatter formatter)
Create an TileMaker from an array of Layers and an ImageFormatter. |
|
MapTileMaker(java.util.Properties props)
To create the TileMaker, you hand it a set of properties that let it create an array of layers, and also to set the properties for those layers. |
|
MapTileMaker(java.lang.String prefix,
java.util.Properties props)
Same as the other constructor, except that the properties can have a prefix in front of them. |
|
MapTileMaker(java.lang.String prefix,
java.util.Properties props,
java.util.Map<java.lang.String,Layer> instantiatedLayers)
Create an TileMaker that should be configured with a Properties file. |
Method Summary | |
---|---|
void |
createDefaultZoomLevels(int maxZoomLevel)
|
java.awt.image.BufferedImage |
getImageForEmptyTile(java.lang.String imagePath,
int x,
int y,
int zoomLevel,
MapTileCoordinateTransform mtcTransform,
Projection proj)
EmptyTileHandler method, called when a MapTileFactory needs to create and return a missing tile. |
java.util.Properties |
getProperties(java.util.Properties props)
Part of the PropertyConsumer interface. |
java.util.Properties |
getPropertyInfo(java.util.Properties props)
Part of the PropertyConsumer interface. |
java.lang.String |
getRootDir()
|
java.util.List<ZoomLevelMaker> |
getZoomLevels()
|
java.awt.geom.Point2D |
latLonToTileUV(java.awt.geom.Point2D latlon,
int zoom)
|
java.awt.geom.Point2D |
latLonToTileUV(java.awt.geom.Point2D latlon,
int zoom,
java.awt.geom.Point2D ret)
|
static void |
main(java.lang.String[] args)
|
byte[] |
makeTile(double uvx,
double uvy,
int zoomLevel,
java.util.List<Layer> layers,
Proj proj,
java.awt.Paint background)
Creating a tile more freely, when you have a set of layers you want to draw into the tile. |
byte[] |
makeTile(double uvx,
double uvy,
ZoomLevelMaker zoomInfo,
Proj proj)
Creating the tile using the ImageServer methodology, knowing that the MapTileMaker has been configured with an openmap.properties.file and knows about layers and their marker names. |
java.lang.String |
makeTileFile(double uvx,
double uvy,
ZoomLevelMaker zoomInfo,
Proj proj)
The main call to make for a tile to be created. |
void |
makeTiles()
Main call to make a set of tiles. |
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Set the layers and image type in the properties. |
void |
setRootDir(java.lang.String rootDir)
|
void |
setZoomLevels(java.util.List<ZoomLevelMaker> zoomLevels)
|
LatLonPoint |
tileUVToLatLon(java.awt.geom.Point2D tileUV,
int zoom)
|
LatLonPoint |
tileUVToLatLon(java.awt.geom.Point2D tileUV,
int zoom,
LatLonPoint ret)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ROOT_DIRECTORY_PROPERTY
public static final java.lang.String ZOOM_LEVELS_PROPERTY
protected java.lang.String rootDir
protected java.util.List<ZoomLevelMaker> zoomLevels
protected MapTileCoordinateTransform mtcTransform
protected int TILE_SIZE
Constructor Detail |
---|
public MapTileMaker()
public MapTileMaker(java.util.Properties props)
public MapTileMaker(java.lang.String prefix, java.util.Properties props)
public MapTileMaker(java.lang.String prefix, java.util.Properties props, java.util.Map<java.lang.String,Layer> instantiatedLayers)
public MapTileMaker(Layer[] layers, ImageFormatter formatter)
layers
- the array of layers.formatter
- the ImageFormatter to use for the output image format.Method Detail |
---|
public void setProperties(java.lang.String prefix, java.util.Properties props)
ImageServer
setProperties
in interface PropertyConsumer
setProperties
in class ImageServer
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.public java.util.Properties getProperties(java.util.Properties props)
ImageServer
getProperties
in interface PropertyConsumer
getProperties
in class ImageServer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
public java.util.Properties getPropertyInfo(java.util.Properties props)
ImageServer
getPropertyInfo
in interface PropertyConsumer
getPropertyInfo
in class ImageServer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
public byte[] makeTile(double uvx, double uvy, ZoomLevelMaker zoomInfo, Proj proj)
uvx
- uv x pixel coordinateuvy
- uv y pixel coordinatezoomInfo
- zoom level for image tileproj
- projection for tile
public byte[] makeTile(double uvx, double uvy, int zoomLevel, java.util.List<Layer> layers, Proj proj, java.awt.Paint background)
uvx
- uv x pixel coordinateuvy
- uv y pixel coordinatezoomLevel
- zoom level for tilelayers
- layers to include in imageproj
- projection for tilebackground
- the paint to use for the background of the image.
public java.lang.String makeTileFile(double uvx, double uvy, ZoomLevelMaker zoomInfo, Proj proj) throws java.io.IOException
uvx
- uvy
- zoomInfo
- proj
-
java.io.IOException
public java.awt.image.BufferedImage getImageForEmptyTile(java.lang.String imagePath, int x, int y, int zoomLevel, MapTileCoordinateTransform mtcTransform, Projection proj)
getImageForEmptyTile
in interface EmptyTileHandler
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.
public void makeTiles()
public java.lang.String getRootDir()
public void setRootDir(java.lang.String rootDir)
public java.util.List<ZoomLevelMaker> getZoomLevels()
public void setZoomLevels(java.util.List<ZoomLevelMaker> zoomLevels)
public void createDefaultZoomLevels(int maxZoomLevel)
public java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon, int zoom)
latlon
- a Point2D whose x component is the longitude and y
component is the latitudezoom
- Tile Map Service (TMS) style zoom level (0-19 usually)
public java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon, int zoom, java.awt.geom.Point2D ret)
public LatLonPoint tileUVToLatLon(java.awt.geom.Point2D tileUV, int zoom)
tileUV
- a Point2D whose x,y coordinates represent the distance in
number of tiles (each 256x256) from the origin (where the origin
is 90lat,-180lon)zoom
- Tile Map Service (TMS) style zoom level (0-19 usually)
public LatLonPoint tileUVToLatLon(java.awt.geom.Point2D tileUV, int zoom, LatLonPoint ret)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |