|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.bbn.openmap.Layer
com.bbn.openmap.layer.OMGraphicHandlerLayer
com.bbn.openmap.layer.imageTile.MapTileLayer
public class MapTileLayer
A Layer that uses a MapTileFactory to display information (tiles) on the map. Properties for this layer look like this:
tiles.class=com.bbn.openmap.layer.imageTile.MapTileLayer tiles.prettyName=TILES tiles.tileFactory=com.bbn.openmap.dataAccess.mapTile.StandardMapTileFactory tiles.rootDir=root_directory_of_tiles #optional, .png is default tiles.fileExt=.png tiles.cacheSize=the number of mapTiles the factory should hold on to. The default is 100. # transform for naming convention of tiles default is OSMMapTileCoordinateTransform, but it depends on the source of tiles. GDAL is TSMMapTileCoordinateTransform tiles.mapTileTransform=com.bbn.openmap.dataAccess.mapTile.OSMMapTileCoordinateTransform, or com.bbn.openmap.dataAccess.mapTile.TMSMapTileCoordinateTransformYou can use a server that provides image tiles:
tiles.class=com.bbn.openmap.layer.imageTile.MapTileLayer tiles.prettyName=TILES tiles.tileFactory=com.bbn.openmap.dataAccess.mapTile.ServerMapTileFactory tiles.rootDir=URL root directory of tiles # a local location to cache tiles, to reduce load on server. tiles.localCacheRootDir=/data/tiles/osmtiles # save cache when layer is done (true by default) tiles.saveCache=true # other properties are the same. tiles.fileExt=.png tiles.cacheSize=the number of mapTiles the factory should hold on to. The default is 100. # transform for naming convention of tiles default is OSMMapTileCoordinateTransform, but it depends on the source of tiles. GDAL is TSMMapTileCoordinateTransform mapTileTransform=com.bbn.openmap.dataAccess.mapTile.OSMMapTileCoordinateTransform, or com.bbn.openmap.dataAccess.mapTile.TMSMapTileCoordinateTransformThe rootDir property can be defined as a pattern, with the zoom level z, x tile coordinate and y tile coordinate set using {z}{x}{y} for however the tiles are stored or retrieved:
rootDir=/data/tiles/{z}/{x}/{y}.png
#or, for the ServerMapTileFactory:
rootDir=http://someserver.com/tileset/{z}/{x}/{y}.png
In this case, the fileExt won't be used as the code will assume you are
setting that.
To make things simpler, you can define a tiles.omp file that sits under the
tile root directory or at the top level of the jar file, and let it specify
the properties for the tile set. The properties in that file should be
unscoped:
fileExt=.png #for instance, for GDAL processed images you need this transform since tiles have difference reference coordinates mapTileTransform=com.bbn.openmap.dataAccess.mapTile.TMSMapTileCoordinateTransform #in jar file, should specify rootDir inside jar to tiles (don't need this for layers accessing local file system rootDirs, unless you want to specify z,x,y order differently): rootDir=mytiles #optional attribution=map data 2013 OpenStreetMapIf you do this last configuration, all you need to define is rootDir (and prettyName, class) property for layer, and then define all other props with data.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected java.lang.String |
attribution
Attribution for the map data. |
protected DrawingAttributes |
attributionAttributes
Rendering parameters for attribution string. |
static java.lang.String |
DATA_ATTRIBUTION_PROPERTY
A property to set for displaying attribution for the data used by the layer. |
static java.lang.String |
INCREMENTAL_UPDATES_PROPERTY
Property to allow the MapTileFactory to call repaint on this layer as map tiles become available. |
protected boolean |
incrementalUpdates
Flag to allow this layer to set itself as a repaint callback object on the tile factory. |
static java.util.logging.Logger |
logger
|
static java.lang.String |
SAVE_CACHE_PROPERTY
A property to save or destroy the tile factory cache when the layer is removed. |
protected boolean |
saveCache
Flag to save tile factory cache when the layer is no longer used. |
static java.lang.String |
TILE_FACTORY_CLASS_PROPERTY
Property that sets the class name of the MapTileFactory to use for this layer. |
protected MapTileFactory |
tileFactory
The MapTileFactory that knows how to fetch image files and create OMRasters for them. |
static java.lang.String |
ZOOM_LEVEL_PROPERTY
A property to set if you want to force the layer to use tiles of a certain zoom level. |
protected int |
zoomLevel
The zoomLevel to use when requesting tiles from the MapTileFactory. |
| Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer |
|---|
consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface com.bbn.openmap.PropertyConsumer |
|---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
MapTileLayer()
|
|
MapTileLayer(MapTileFactory tileFactory)
|
|
| Method Summary | |
|---|---|
void |
clearCache()
Clear the MapTileFactory cache. |
java.lang.String |
getAttribution()
|
DrawingAttributes |
getAttributionAttributes()
|
protected OMText |
getAttributionGraphic()
|
java.awt.Component |
getGUI()
Gets the gui controls associated with the layer. |
java.util.Properties |
getProperties(java.util.Properties props)
Overrides Layer getProperties method., also calls that method on Layer. |
java.util.Properties |
getPropertyInfo(java.util.Properties props)
Overrides Layer getProperties method., also calls that method on Layer. |
MapTileFactory |
getTileFactory()
|
java.lang.String |
getToolTipTextFor(OMGraphic omg)
If applicable, should return a tool tip for the OMGraphic. |
int |
getZoomLevel()
|
boolean |
isIncrementalUpdates()
|
void |
listUpdated()
Called when the provided OMGraphicList has another tile added to it, so the list can be repainted if the caller is interested in incremental updates. |
void |
paint(java.awt.Graphics g)
The default action is to get the OMGraphicList and render it. |
OMGraphicList |
prepare()
OMGraphicHandlerLayer method, called with projection changes or whenever else doPrepare() is called. |
void |
removed(java.awt.Container cont)
Called when the layer has been turned off and the projection changes, signifying that the layer can clean up. |
void |
setAttribution(java.lang.String attribution)
|
void |
setAttributionAttributes(DrawingAttributes attributionAttributes)
|
void |
setIncrementalUpdates(boolean incrementalUpdates)
|
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Overrides the Layer setProperties method. |
void |
setTileFactory(MapTileFactory tileFactory)
|
void |
setZoomLevel(int zoomLevel)
|
boolean |
shouldContinue()
Asked by the MapTileFactory if the tile fetching should continue. |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.beans.beancontext.BeanContextChild |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| Field Detail |
|---|
public static java.util.logging.Logger logger
public static final java.lang.String TILE_FACTORY_CLASS_PROPERTY
public static final java.lang.String INCREMENTAL_UPDATES_PROPERTY
public static final java.lang.String ZOOM_LEVEL_PROPERTY
public static final java.lang.String DATA_ATTRIBUTION_PROPERTY
public static final java.lang.String SAVE_CACHE_PROPERTY
protected MapTileFactory tileFactory
protected boolean incrementalUpdates
protected int zoomLevel
protected java.lang.String attribution
protected boolean saveCache
protected DrawingAttributes attributionAttributes
| Constructor Detail |
|---|
public MapTileLayer()
public MapTileLayer(MapTileFactory tileFactory)
| Method Detail |
|---|
public OMGraphicList prepare()
prepare in class OMGraphicHandlerLayerpublic void paint(java.awt.Graphics g)
OMGraphicHandlerLayer
paint in class OMGraphicHandlerLayerg - java.awt.Graphics object to render OMGraphics into.protected OMText getAttributionGraphic()
public java.lang.String getToolTipTextFor(OMGraphic omg)
OMGraphicHandlerLayer
getToolTipTextFor in interface GestureResponsePolicygetToolTipTextFor in class OMGraphicHandlerLayer
public void setProperties(java.lang.String prefix,
java.util.Properties props)
OMGraphicHandlerLayer
setProperties in interface PropertyConsumersetProperties in class OMGraphicHandlerLayerprefix - the token to prefix the property namesprops - the Properties objectpublic java.util.Properties getProperties(java.util.Properties props)
OMGraphicHandlerLayer
getProperties in interface PropertyConsumergetProperties in class OMGraphicHandlerLayerprops - a Properties object to load the PropertyConsumer properties
into. If props equals null, then a new Properties object should be
created.
public java.util.Properties getPropertyInfo(java.util.Properties props)
OMGraphicHandlerLayer
getPropertyInfo in interface PropertyConsumergetPropertyInfo in class OMGraphicHandlerLayerprops - a Properties object to load the PropertyConsumer properties
into. If getList equals null, then a new Properties object should
be created.
public void removed(java.awt.Container cont)
removed in class Layercont - Containerpublic MapTileFactory getTileFactory()
public void setTileFactory(MapTileFactory tileFactory)
public boolean isIncrementalUpdates()
public void setIncrementalUpdates(boolean incrementalUpdates)
public int getZoomLevel()
public void setZoomLevel(int zoomLevel)
public java.awt.Component getGUI()
Layer
getGUI in class Layerpublic java.lang.String getAttribution()
public void setAttribution(java.lang.String attribution)
attribution - the attribution to setpublic DrawingAttributes getAttributionAttributes()
public void setAttributionAttributes(DrawingAttributes attributionAttributes)
attributionAttributes - the attributionAttributes to setpublic boolean shouldContinue()
MapTileRequester
shouldContinue in interface MapTileRequesterpublic void listUpdated()
MapTileRequester
listUpdated in interface MapTileRequesterpublic void clearCache()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||