public class OSMLayer extends com.bbn.openmap.Layer implements java.lang.Runnable, java.awt.event.ComponentListener, com.bbn.openmap.event.MapMouseListener, FlushableLayer
OsmSegmenter
,
OsmDownloader
,
Serialized FormModifier and Type | Class and Description |
---|---|
static interface |
OSMLayer.AmenityStatisticsUpdateListener
Interface for listener who wants to know when amenity display statistics
are recomputed.
|
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.awt.Color |
DEFAULT_BUILDING_COLOR
The default color used for filling building outlines on the OpenStreetMap layer of the map.
|
static int |
FILETYPE_NODE
Symbolic constant for accessing cached java.ioFile object for a binary OSM file containing
Node s. |
static int |
FILETYPE_UNLABELED_WAY
Symbolic constant for accessing cached java.ioFile object for a binary OSM file containing
Way s
without renderable features. |
static int |
FILETYPE_WAY
Symbolic constant for accessing cached java.ioFile object for a binary OSM file containing
Way s. |
static float |
MAX_MARINE_NODE_ZOOM
Maximum value of map scale for rendering marine Nodes without either matching a searched-for AmenityType or having
an expanded zoom level (due to being a Place).
|
static float |
MAX_NODE_LABEL_ZOOM
Maximum value of map scale for rendering the labels of Nodes without either matching a searched-for AmenityType
or having an expanded zoom level (due to being a Place).
|
static float |
MAX_NODE_ZOOM
Maximum value of map scale for rendering Nodes without either matching a searched-for AmenityType or having
an expanded zoom level (due to being a Place).
|
static java.lang.String |
NODES_SUFFIX
Filetype suffix for binary-encoded Nodes files.
|
static java.lang.String |
SWAYS_SUFFIX
Filetype suffic for binary-encoded Ways files that don't contain renderable features
(only used for building
Relation s. |
static java.lang.String |
WAYS_SUFFIX
Filetype suffix for binary-encoded Ways files.
|
addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, coordTransform, DataPathPrefixProperty, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, localHackList, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, readyToPaint, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, windowSupport
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
OSMLayer(com.bbn.openmap.MapBean mapBean)
Create a layer for the map that renders OpenStreetMap data from the default filetypes.
|
OSMLayer(com.bbn.openmap.MapBean mapBean,
java.lang.String nodesSuffix,
java.lang.String waysSuffix,
java.lang.String swaysSuffix)
Create a layer for the map that renders OpenStreetMap data.
|
Modifier and Type | Method and Description |
---|---|
void |
addAmenityStatisticsUpdateListener(OSMLayer.AmenityStatisticsUpdateListener l)
Register to be informed when the amenity display statistics are updated.
|
void |
componentHidden(java.awt.event.ComponentEvent e)
Invoked when the OSMLayer has been made invisible.
|
void |
componentMoved(java.awt.event.ComponentEvent e)
Invoked when the OSMLayer's position changes.
|
void |
componentResized(java.awt.event.ComponentEvent e)
Invoked when the map window's size changes.
|
void |
componentShown(java.awt.event.ComponentEvent e)
Invoked when the OSMLayer has been made visible.
|
void |
flushFileCache()
Clear cached pointers to tile files.
|
int |
getAmenityStatistic(AmenityType amenityType)
Get the current statistic of the specified AmenityType.
|
AmenityType |
getAmenityToShow()
Report the specific AmenityType being highlighted on the map.
|
java.awt.Color |
getBuildingColor()
Get the current color used for filling in buildings on the map.
|
static java.io.File |
getLatitudeDirectory(int latitude)
Get a File object representing a latitude directory within the tile directory.
|
static java.io.File |
getLongitudeFile(int latitude,
int longitude,
int fileType,
java.lang.String suffix)
Get a File object representing a .nodes, .ways, or .sways file
|
com.bbn.openmap.event.MapMouseListener |
getMapMouseListener()
Specify the object to receive OpenMap mouse events on behalf of the OSM Layer.
|
java.lang.String[] |
getMouseModeServiceList()
Specify the behavior the MapBean should give to this OSMLayer for mouse input.
|
VisibleCtls |
getVisibleCtls()
Get the type-specific visibility controls for this OSMLayer instance.
|
void |
initializePlaceZoomLevels()
Load the persisted zoom levels for Place labels from the Preferences backing store.
|
static boolean |
isAutoLoadOsmTiles()
Report whether YAAC is configured to try to auto-download pre-imported OSM tiles that are not
currently on the system.
|
boolean |
isHideSeamarks()
Report whether seamark data should not be rendered.
|
boolean |
isShowHighwaySigns()
Report whether highway signs should be displayed on the map.
|
boolean |
isShowLabelsInEnglish()
Report whether map labels should be displayed in English if the default name is in some other locale
and OpenStreetMap provides an English translation.
|
boolean |
isShowLayer(int index)
Report whether the identified WayType layer should be rendered on the map.
|
boolean |
isShowMap()
Report whether the OpenStreetMap map overlay should be displayed.
|
boolean |
isShowPOI()
Report whether OSM Node points of interest should be displayed.
|
boolean |
isShowUnlabeledWays()
Report if unlabeled and untyped map features should be displayed.
|
boolean |
isSuppressMapPopups()
Test if popup windows from clicking on a map feature will be allowed.
|
boolean |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse button has been clicked (pressed
and released) on a component.
|
boolean |
mouseDragged(java.awt.event.MouseEvent mouseEvent) |
void |
mouseEntered(java.awt.event.MouseEvent mouseEvent)
Invoked when the mouse enters a component.
|
void |
mouseExited(java.awt.event.MouseEvent mouseEvent)
Invoked when the mouse exits a component.
|
void |
mouseMoved() |
boolean |
mouseMoved(java.awt.event.MouseEvent mouseEvent) |
boolean |
mousePressed(java.awt.event.MouseEvent mouseEvent)
Invoked when a mouse button has been pressed on a component.
|
boolean |
mouseReleased(java.awt.event.MouseEvent mouseEvent)
Invoked when a mouse button has been released on a component.
|
protected void |
paintComponent(java.awt.Graphics g)
Paint the rendered OpenStreetMap data into the map window.
|
void |
projectionChanged(com.bbn.openmap.event.ProjectionEvent e)
Callback from OpenMap when map projection is changed,
|
void |
regenerateAndRepaint()
Cause the OSMLayer to recompute its map based on current settings.
|
void |
reloadMapParamsFromPreferences()
Load all the WayParam and VisibleCtls objects from their cached Preference values (or defaults if not saved).
|
void |
removeAmenityStatisticsUpdateListener(OSMLayer.AmenityStatisticsUpdateListener l)
Unregister from being informed when the amenity display statistics are updated.
|
void |
run()
DO NOT CALL: background thread to render OpenStreetMap data into a BufferedImage for painting on the map window.
|
void |
setAmenityToShow(AmenityType amenityToShow)
Specify that Ways and Nodes of the specified AmenityType should be highlighted on the map, regardless
of zoom level, or that there is no special type to highlight.
|
void |
setAutoLoadOsmTiles(boolean autoLoadOsmTiles)
Specify whether auto-download of missing pre-imported OSM tiles should be performed.
|
void |
setBuildingColor(java.awt.Color buildingColor)
Set the color to be used for filling building outlines on the map.
|
void |
setFontsAndSigns(float fontScaleFactor) |
void |
setGTNToShow(GenericTaggedNode<?> gtnToShow)
Specify a Node or Way that should be highlighted on the map.
|
void |
setHideSeamarks(boolean hideSeamarks)
Report whether seamark data should not be rendered.
|
void |
setShowHighwaySigns(boolean showHighwaySigns)
Specify whether highway signs should be displayed on the map.
|
void |
setShowLabelsInEnglish(boolean showLabelsInEnglish)
Specify whether map labels should be displayed in English if the default name is in some other locale
and OpenStreetMap provides an English translation.
|
void |
setShowLayer(boolean showLayer,
int index)
Specify whether the identified WayType layer should be rendered on the map.
|
void |
setShowMap(boolean showMap)
Specify whether the OpenStreetMap map overlay should be rendered.
|
void |
setShowPOI(boolean showPOI)
Specify whether OSM Node points of interest should be displayed.
|
void |
setShowUnlabeledWays(boolean showUnlabeledWays)
Specify if unlabeled and untyped map features should be displayed.
|
void |
setSuppressMapPopups(boolean suppressMapPopups)
Specify if streemap popup windows should be triggered from mouse clicks.
|
void |
startRegenerate()
Release the lock against rendering OSM data and start a fresh rendering.
|
void |
stopRegenerate(int offsetX,
int offsetY)
Stop the current re-rendering of the map and set the pixel offsets for painting the last rendering of
the OSM data.
|
actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, disconnectFromBeanContext, dispose, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getCoordTransform, getGUI, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getProperties, getPropertyInfo, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, renderDataForProjection, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setProperties, setPropertyPrefix, setReadyToPaint, setRemovable, setVisible, setWindowSupport, showPalette
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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
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, transferFocusDownCycle, validate, validateTree
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, getAccessibleContext, 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, 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, transferFocusBackward, transferFocusUpCycle
public static final java.awt.Color DEFAULT_BUILDING_COLOR
public static final float MAX_NODE_ZOOM
public static final float MAX_NODE_LABEL_ZOOM
public static final float MAX_MARINE_NODE_ZOOM
public static final int FILETYPE_WAY
Way
s.public static final int FILETYPE_NODE
Node
s.public static final int FILETYPE_UNLABELED_WAY
Way
s
without renderable features.public static final java.lang.String NODES_SUFFIX
public static final java.lang.String WAYS_SUFFIX
public static final java.lang.String SWAYS_SUFFIX
Relation
s.public OSMLayer(com.bbn.openmap.MapBean mapBean)
mapBean
- MapBean that will contain this OSMLayerpublic OSMLayer(com.bbn.openmap.MapBean mapBean, java.lang.String nodesSuffix, java.lang.String waysSuffix, java.lang.String swaysSuffix)
mapBean
- MapBean that will contain this OSMLayernodesSuffix
- String suffix for files containing OpenStreetMap nodeswaysSuffix
- String suffix for files containing OpenStreetMap waysswaysSuffix
- String suffix for files containing OpenStreetMap ways with less informationpublic void setFontsAndSigns(float fontScaleFactor)
public void reloadMapParamsFromPreferences()
public void initializePlaceZoomLevels()
public final boolean isShowMap()
public void setShowMap(boolean showMap)
showMap
- boolean true if OpenStreetMap layer should be renderedpublic final boolean isShowLayer(int index)
index
- WayType enumeration ordinal of type being queriedpublic void setShowLayer(boolean showLayer, int index)
showLayer
- boolean true if ways of the specified WayType should be renderedindex
- WayType enumeration ordinal of type being specifiedpublic boolean isShowHighwaySigns()
public void setShowHighwaySigns(boolean showHighwaySigns)
showHighwaySigns
- boolean true if highways signs should be displayedpublic boolean isShowPOI()
public void setShowPOI(boolean showPOI)
showPOI
- boolean true if points of interest should be rendered on the mappublic boolean isShowUnlabeledWays()
public void setShowUnlabeledWays(boolean showUnlabeledWays)
showUnlabeledWays
- boolean true if unlabeled/untyped map elements should be plottedpublic static boolean isAutoLoadOsmTiles()
public void setAutoLoadOsmTiles(boolean autoLoadOsmTiles)
autoLoadOsmTiles
- boolean true if auto-download should be enabledpublic boolean isShowLabelsInEnglish()
public void setShowLabelsInEnglish(boolean showLabelsInEnglish)
showLabelsInEnglish
- boolean true if English labels should be usedpublic boolean isHideSeamarks()
public void setHideSeamarks(boolean hideSeamarks)
hideSeamarks
- boolean true if seamark map data should be renderedpublic boolean isSuppressMapPopups()
public void setSuppressMapPopups(boolean suppressMapPopups)
suppressMapPopups
- boolean true if popup windows should be preventedpublic AmenityType getAmenityToShow()
public void setAmenityToShow(AmenityType amenityToShow)
amenityToShow
- AmenityType to highlight, or null for no special highlightingpublic void setGTNToShow(GenericTaggedNode<?> gtnToShow)
gtnToShow
- GenericTaggedNode to emphasize, or null if none to enhancepublic void addAmenityStatisticsUpdateListener(OSMLayer.AmenityStatisticsUpdateListener l)
l
- AmenityStatisticsUpdateListener to registerpublic void removeAmenityStatisticsUpdateListener(OSMLayer.AmenityStatisticsUpdateListener l)
l
- AmenityStatisticsUpdateListener to unregisterpublic java.awt.Color getBuildingColor()
public void setBuildingColor(java.awt.Color buildingColor)
buildingColor
- Color for building fillpublic VisibleCtls getVisibleCtls()
public int getAmenityStatistic(AmenityType amenityType)
public void regenerateAndRepaint()
public void projectionChanged(com.bbn.openmap.event.ProjectionEvent e)
projectionChanged
in interface com.bbn.openmap.event.ProjectionListener
e
- ProjectionEvent identifying new projectionprotected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- Graphics object to use for paintingpublic void stopRegenerate(int offsetX, int offsetY)
offsetX
- int horizontal pixel offset for painting the last render of the OSM data onto the mapoffsetY
- int vertical pixel offset for painting the last render of the OSM data onto the mappublic void startRegenerate()
public final void run()
run
in interface java.lang.Runnable
public static java.io.File getLatitudeDirectory(int latitude)
latitude
- int latitude in millionths of degrees Northpublic static java.io.File getLongitudeFile(int latitude, int longitude, int fileType, java.lang.String suffix)
latitude
- int latitude in millionths of degrees Northlongitude
- int longitude in millionths of degrees EastfileType
- FILETYPE_WAY
, FILETYPE_NODE
, or FILETYPE_UNLABELED_WAY
suffix
- file suffix corresponding to fileType: NODES_SUFFIX
, WAYS_SUFFIX
, and SWAYS_SUFFIX
public void flushFileCache()
flushFileCache
in interface FlushableLayer
public void componentHidden(java.awt.event.ComponentEvent e)
componentHidden
in interface java.awt.event.ComponentListener
public void componentMoved(java.awt.event.ComponentEvent e)
componentMoved
in interface java.awt.event.ComponentListener
public void componentResized(java.awt.event.ComponentEvent e)
componentResized
in interface java.awt.event.ComponentListener
public void componentShown(java.awt.event.ComponentEvent e)
componentShown
in interface java.awt.event.ComponentListener
public com.bbn.openmap.event.MapMouseListener getMapMouseListener()
getMapMouseListener
in class com.bbn.openmap.Layer
public java.lang.String[] getMouseModeServiceList()
getMouseModeServiceList
in interface com.bbn.openmap.event.MapMouseListener
public boolean mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface com.bbn.openmap.event.MapMouseListener
public boolean mousePressed(java.awt.event.MouseEvent mouseEvent)
mousePressed
in interface com.bbn.openmap.event.MapMouseListener
public boolean mouseReleased(java.awt.event.MouseEvent mouseEvent)
mouseReleased
in interface com.bbn.openmap.event.MapMouseListener
public void mouseEntered(java.awt.event.MouseEvent mouseEvent)
mouseEntered
in interface com.bbn.openmap.event.MapMouseListener
public void mouseExited(java.awt.event.MouseEvent mouseEvent)
mouseExited
in interface com.bbn.openmap.event.MapMouseListener
public boolean mouseDragged(java.awt.event.MouseEvent mouseEvent)
mouseDragged
in interface com.bbn.openmap.event.MapMouseListener
public boolean mouseMoved(java.awt.event.MouseEvent mouseEvent)
mouseMoved
in interface com.bbn.openmap.event.MapMouseListener
public void mouseMoved()
mouseMoved
in interface com.bbn.openmap.event.MapMouseListener