|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.dataAccess.mapTile.SimpleEmptyTileHandler com.bbn.openmap.dataAccess.mapTile.ShpFileEmptyTileHandler com.bbn.openmap.dataAccess.mapTile.WholeWorldTileHandler
public class WholeWorldTileHandler
The WholeWorldTileHandler is a special EmptyTileHandler that manages a special set of jar files containing tiles that cover the entire earth. If you put all of the tiles from zoom levels 0-12 into a jar file, you end up with a 5Gb jar, and java doesn't handle it. Having zoom levels 0-14 on disk takes up 30Gb without being compressed.
This class, run as an application, organizes tiles into several jar files, depending on their zoom level and location. All tiles for the world in zoom levels 0-10 are placed in a single jar file. For all other zoom levels, they are placed together geographically, based on the tile boundaries of some higher level (zoom level 3 is the default, higher numbers might be chosen if tiles are created for higher zoom levels than 15).
This class is consulted when the MapTileFactory can't find a map tile. Since this class is an EmptyTileHandler, it is given free reign to return a tile for the missing one. Instead of assuming that the tiles don't exist and a quick replacement needs to be created, this EmtpyTileHandler assumes that the proper jar file hasn't been loaded yet, which is why the tile wasn't found as a resource. It uses the ux, uv, and zoom level for the tile to figure out what jar it would have been in, and checks to see if that jar has been added to the classpath. If the jar has been added, then the tile doesn't exist. If the jar needs to be added, it is and then the tile retrieval starts.
The properties for the tile set are a little different when using this EmptyTileHandler:
# specify this empty tile handler emptyTileHandler=com.bbn.openmap.dataAccess.mapTile.WholeWorldTileHandler # instead of the root directory to the jars, specify the root directory of the tiles # inside the jars. All of the jars within a set should share the root directory name # within them. Each set of jars should have a unique root directory name for that dataset. rootDir=main_tiles # The name of the jar containing world-level coverage. All of the sub-jars should be # named based on this jar name. If this class is run to build the tile jars, # it should have done this automatically. parentJarName=main_tiles.jar # This is the grid that defines how the subjars are divided. It matches the tile boundaries # of a certain zoom level. Level 3 is the default. subJarZoomLevel=9 # This is the highest level of tiles held in the part jar name. Tells the layer when it should # start looking in subjars for tiles at higher zoom levels. worldWideZoomLevel=10 # Tells the layer when to stop trying to fill tile orders. noCoverageZoom=15 # optional, png is default. fileExt=.png # You can also specify how empty tiles are handled, using the ShpFileEmptyTileHandler. shpFile=/Users/dietrick/dev/openmap/share/data/shape/cntry02/cntry02.shp land.fillColor=DECD8B background.fillColor=EAFFF4 mapTileTransform=com.bbn.openmap.dataAccess.mapTile.OSMMapTileCoordinateTransform land.lineColor=DECD8B background.lineColor=EAFFF4NOTE: If you create a set of tile jars to use with a Windows jre, and you're having problems when the jars are added to the classpath, it's because there are too many tiles in the jars. The number for files in this case can't exceed 262144. So you have to increase the zoom level used for the layout of the subjar files.
Nested Class Summary | |
---|---|
static class |
WholeWorldTileHandler.Builder
The builder class takes a map tile directory and creates a set of jars from it, divided so that the WholeWorldTileHandler can deal with it. |
Field Summary | |
---|---|
static int |
DEFAULT_SUBJAR_DEF_ZOOMLEVEL
|
static int |
DEFAULT_WORLDWIDE_ZOOMLEVEL
|
protected java.util.Set<java.lang.String> |
loadedJars
|
static java.lang.String |
PARENT_JAR_NAME_PROPERTY
|
protected java.lang.String |
parentJarName
|
protected java.lang.String |
rootDirForJars
|
protected int |
subFrameDefZoomLevel
|
static java.lang.String |
SUBJAR_ZOOMLEVEL_PROPERTY
|
static int |
WIN_MAX_FILES_IN_JAR
Turns out that the Windows JRE won't add jar files with more than 262144 tiles in them. |
static java.lang.String |
WORLDWIDE_ZOOMLEVEL_PROPERTY
|
protected int |
worldWideZoomLevel
|
Fields inherited from class com.bbn.openmap.dataAccess.mapTile.ShpFileEmptyTileHandler |
---|
LAND_ATTRIBUTES_PROPERTY, landAttributes, shapeStuff, SHP_FILE_PROPERTY |
Fields inherited from class com.bbn.openmap.dataAccess.mapTile.SimpleEmptyTileHandler |
---|
BACKGROUND_PROPERTY, backgroundAtts, backgroundTileImage, emptyTileImage, logger, NO_COVERAGE_PROPERTY, NO_COVERAGE_ZOOM_PROPERTY, noCoverageAtts, noCoverageZoom, prefix, TILE_SIZE |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Constructor Summary | |
---|---|
WholeWorldTileHandler()
|
Method Summary | |
---|---|
static java.lang.String |
buildSubJarName(java.lang.String parentJarNme,
double x,
double y)
|
byte[] |
getImageBytes(java.lang.String imagePath)
Tries to get the image bytes from imagePath URL. |
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. |
java.lang.String |
getParentJarName()
Get the name of the jar with worldwide coverage, for zoom levels 0-worldWideZoomLevel. |
java.util.Properties |
getProperties(java.util.Properties props)
Method to fill in a Properties object, reflecting the current values of the PropertyConsumer. |
int |
getSubFrameDefZoomLevel()
Get the tile zoom level that the subjar borders are based on. |
int |
getWorldWideZoomLevel()
Get the maximum tile zoom level that is contained in the worldwide jar. |
protected boolean |
loadJar(java.lang.String jarFileName)
Load the jar if necessary. |
static void |
main(java.lang.String[] args)
Takes arguments for source tile directory, target directory, and option sub-jar zoom level, and creates jars in the right place with expected tiles. |
void |
setParentJarName(java.lang.String parentJarName)
Set the name of the jar with worldwide coverage, for tiles with zoom levels 0-worldWideZoomLevel. |
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Method to set the properties in the PropertyConsumer. |
void |
setSubFrameDefZoomLevel(int subFrameZoomLevel)
Set the tile zoom level that the subjar borders will be based on. |
void |
setWorldWideZoomLevel(int worldWideZoomLevel)
Set the maximum tile zoom level that is contained in the worldwide jar. |
Methods inherited from class com.bbn.openmap.dataAccess.mapTile.ShpFileEmptyTileHandler |
---|
getLandAttributes, getShapeStuff, setLandAttributes, setShapeStuff |
Methods inherited from class com.bbn.openmap.dataAccess.mapTile.SimpleEmptyTileHandler |
---|
createTileImageFromDrawingAttributes, getBackgroundAtts, getNoCoverageAtts, getNoCoverageZoom, getPropertyInfo, getPropertyPrefix, setBackgroundAtts, setNoCoverageAtts, setNoCoverageZoom, setProperties, setPropertyPrefix |
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 SUBJAR_ZOOMLEVEL_PROPERTY
public static final java.lang.String WORLDWIDE_ZOOMLEVEL_PROPERTY
public static final java.lang.String PARENT_JAR_NAME_PROPERTY
public static final int DEFAULT_SUBJAR_DEF_ZOOMLEVEL
public static final int DEFAULT_WORLDWIDE_ZOOMLEVEL
protected int subFrameDefZoomLevel
protected int worldWideZoomLevel
protected java.lang.String parentJarName
protected java.util.Set<java.lang.String> loadedJars
protected java.lang.String rootDirForJars
public static final int WIN_MAX_FILES_IN_JAR
Constructor Detail |
---|
public WholeWorldTileHandler()
Method Detail |
---|
public java.awt.image.BufferedImage getImageForEmptyTile(java.lang.String imagePath, int x, int y, int zoomLevel, MapTileCoordinateTransform mtcTransform, Projection proj)
EmptyTileHandler
getImageForEmptyTile
in interface EmptyTileHandler
getImageForEmptyTile
in class ShpFileEmptyTileHandler
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 static java.lang.String buildSubJarName(java.lang.String parentJarNme, double x, double y)
public byte[] getImageBytes(java.lang.String imagePath)
imagePath
- the source URL image path.
protected boolean loadJar(java.lang.String jarFileName)
jarFileName
- the absolute path to the jar.
public void setProperties(java.lang.String prefix, java.util.Properties props)
PropertyConsumer
setProperties
in interface PropertyConsumer
setProperties
in class ShpFileEmptyTileHandler
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)
PropertyConsumer
getProperties
in interface PropertyConsumer
getProperties
in class ShpFileEmptyTileHandler
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
public int getSubFrameDefZoomLevel()
public void setSubFrameDefZoomLevel(int subFrameZoomLevel)
subFrameZoomLevel
- the subFrameDefZoomLevel to setpublic java.lang.String getParentJarName()
public void setParentJarName(java.lang.String parentJarName)
parentJarName
- the parentJarName to setpublic int getWorldWideZoomLevel()
public void setWorldWideZoomLevel(int worldWideZoomLevel)
worldWideZoomLevel
- the worldWideZoomLevel to setpublic static void main(java.lang.String[] args)
args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |