Package org.openstreetmap.josm.gui.bbox
Class SlippyMapBBoxChooser
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.openstreetmap.gui.jmapviewer.JMapViewer
org.openstreetmap.josm.gui.bbox.JosmMapViewer
org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener,BBoxChooser,LayerManager.LayerChangeListener,MainLayerManager.ActiveLayerChangeListener
public class SlippyMapBBoxChooser
extends JosmMapViewer
implements BBoxChooser, ChangeListener, MainLayerManager.ActiveLayerChangeListener, LayerManager.LayerChangeListener
This panel displays a map and lets the user chose a
BBox.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.bbox.JosmMapViewer
JosmMapViewer.AbstractImageryInfoBasedTileSourceProvider, JosmMapViewer.CurrentLayersTileSourceProvider, JosmMapViewer.DefaultOsmTileSourceProvider, JosmMapViewer.TileSourceProvider, JosmMapViewer.TMSTileSourceProviderNested classes/interfaces inherited from class org.openstreetmap.gui.jmapviewer.JMapViewer
org.openstreetmap.gui.jmapviewer.JMapViewer.ZOOM_BUTTON_STYLENested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Boundsstatic final StringThe property name used for theILatLonof the mouse cursor on the map.private org.openstreetmap.gui.jmapviewer.interfaces.ICoordinateprivate org.openstreetmap.gui.jmapviewer.interfaces.ICoordinateprivate final SizeButtonprivate final SourceButtonprivate static final StringPropertyprivate static final BooleanPropertyprivate static final CopyOnWriteArrayList<JosmMapViewer.TileSourceProvider>static final StringThe property name used for the resize button.private final ButtonModelFields inherited from class org.openstreetmap.josm.gui.bbox.JosmMapViewer
cachedLoader, uncachedLoaderFields inherited from class org.openstreetmap.gui.jmapviewer.JMapViewer
attribution, center, debug, evtListenerList, mapMarkerList, mapMarkersVisible, mapPolygonList, mapPolygonsVisible, mapRectangleList, mapRectanglesVisible, MAX_ZOOM, MIN_ZOOM, scrollWrapEnabled, tileController, tileGridVisible, tileSource, zoom, zoomButtonStyle, zoomInButton, zoomOutButton, zoomReverseWheel, zoomSliderFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface org.openstreetmap.josm.gui.bbox.BBoxChooser
BBOX_PROPFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled whenever the active or edit layer changed.static voidaddTileSourceProvider(JosmMapViewer.TileSourceProvider tileSourceProvider) Plugins that wish to add custom tile sources to slippy map choose should call this methodReplies the currently selected bounding box in this BBoxChooser.private doubleGet the distance in meter that correspond to 100 px on screen.private static StringgetTileSourceId(org.openstreetmap.gui.jmapviewer.interfaces.TileSource ts) In case the tile source has no ID, use the nameReturns the currently visible map areabooleanhandleAttribution(Point p, boolean click) Handles a click/move on the attributionvoidhandleMouseMoved(Point point) Handles aSlippyMapController.mouseMoved(java.awt.event.MouseEvent)eventvoidNotifies this listener that a layer has been added.voidNotifies this listener that the order of layers was changed.voidNotifies this listener that a layer was just removed.voidDraw the map.final voidRefreshes the tile sourcesvoidPerforms resizing of the DownloadDialog in order to enlarge or shrink the map.voidsetBoundingBox(Bounds bbox) Sets the current bounding box in this bbox chooser without emitting a property change event.voidsetSelection(Point aStart, Point aEnd) Callback for the OsmMapControl.voidsetSizeButtonVisible(boolean visible) Enables or disables painting of the shrink/enlarge buttonvoidvoidtoggleMapSource(org.openstreetmap.gui.jmapviewer.interfaces.TileSource tileSource) Sets the active tile sourceMethods inherited from class org.openstreetmap.josm.gui.bbox.JosmMapViewer
imageryInfosToTileSources, setFileCacheEnabled, setMaxTilesInMemoryMethods inherited from class org.openstreetmap.gui.jmapviewer.JMapViewer
addJMVListener, addMapMarker, addMapPolygon, addMapRectangle, getAttribution, getCenter, getLatOffset, getMapMarkerList, getMapMarkersVisible, getMapPolygonList, getMapPosition, getMapPosition, getMapPosition, getMapPosition, getMapRectangleList, getMeterPerPixel, getPosition, getPosition, getPosition, getRadius, getTileCache, getTileController, getToolTipText, getZoom, getZoomButtonStyle, getZoomControlsVisible, initializeZoomSlider, isMapPolygonsVisible, isMapRectanglesVisible, isScrollWrapEnabled, isTileGridVisible, moveMap, paintMarker, paintPolygon, paintRectangle, removeAllMapMarkers, removeAllMapPolygons, removeAllMapRectangles, removeJMVListener, removeMapMarker, removeMapPolygon, removeMapRectangle, setCenter, setDisplayPosition, setDisplayPosition, setDisplayPosition, setDisplayPosition, setDisplayToFitMapElements, setDisplayToFitMapMarkers, setDisplayToFitMapPolygons, setDisplayToFitMapRectangles, setMapMarkerList, setMapMarkerVisible, setMapPolygonList, setMapPolygonsVisible, setMapRectangleList, setMapRectanglesVisible, setScrollWrapEnabled, setTileGridVisible, setTileLoader, setTileSource, setZoom, setZoom, setZoomButtonStyle, setZoomContolsVisible, setZoomControlsVisible, tileLoadingFinished, zoomChanged, zoomIn, zoomIn, zoomOut, zoomOutMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, 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, setVisible, unregisterKeyboardAction, updateMethods 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, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, 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, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
providers
-
PROP_MAPSTYLE
-
PROP_SHOWDLAREA
-
RESIZE_PROP
The property name used for the resize button. -
CURSOR_COORDINATE_PROP
The property name used for theILatLonof the mouse cursor on the map. -
iSizeButton
-
showDownloadAreaButtonModel
-
iSourceButton
-
bbox
-
iSelectionRectStart
-
iSelectionRectEnd
-
-
Constructor Details
-
SlippyMapBBoxChooser
public SlippyMapBBoxChooser()Constructs a newSlippyMapBBoxChooser.
-
-
Method Details
-
addTileSourceProvider
Plugins that wish to add custom tile sources to slippy map choose should call this method- Parameters:
tileSourceProvider- new tile source provider
-
getAllTileSources
private static Map<String,org.openstreetmap.gui.jmapviewer.interfaces.TileSource> getAllTileSources() -
getTileSourceId
In case the tile source has no ID, use the name -
getDist100Pixel
Get the distance in meter that correspond to 100 px on screen.- Returns:
- the distance in meter that correspond to 100 px on screen
- See Also:
-
handleAttribution
Handles a click/move on the attribution- Parameters:
p- The point in the viewclick- true if it was a click, false for hover- Returns:
- if the attribution handled the event
-
paintComponent
Draw the map.- Overrides:
paintComponentin classorg.openstreetmap.gui.jmapviewer.JMapViewer
-
activeOrEditLayerChanged
Description copied from interface:MainLayerManager.ActiveLayerChangeListenerCalled whenever the active or edit layer changed.You can be sure that this layer is still contained in this set.
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
- Specified by:
activeOrEditLayerChangedin interfaceMainLayerManager.ActiveLayerChangeListener- Parameters:
e- The change event.
-
stateChanged
- Specified by:
stateChangedin interfaceChangeListener
-
handleMouseMoved
Handles aSlippyMapController.mouseMoved(java.awt.event.MouseEvent)event- Parameters:
point- The point in the view
-
setSelection
Callback for the OsmMapControl. (Re-)Sets the start and end point of the selection rectangle.- Parameters:
aStart- selection startaEnd- selection end
-
resizeSlippyMap
Performs resizing of the DownloadDialog in order to enlarge or shrink the map. -
toggleMapSource
Sets the active tile source- Parameters:
tileSource- The active tile source
-
getBoundingBox
Description copied from interface:BBoxChooserReplies the currently selected bounding box in this BBoxChooser. Replies null, if currently there isn't a bbox chosen in this BBoxChooser.- Specified by:
getBoundingBoxin interfaceBBoxChooser- Returns:
- the currently selected bounding box
-
setBoundingBox
Sets the current bounding box in this bbox chooser without emitting a property change event.- Specified by:
setBoundingBoxin interfaceBBoxChooser- Parameters:
bbox- the bounding box. null to reset the bounding box
-
setSizeButtonVisible
Enables or disables painting of the shrink/enlarge button- Parameters:
visible-trueto enable painting of the shrink/enlarge button
-
refreshTileSources
Refreshes the tile sources- Since:
- 6364
-
layerAdded
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer has been added.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerAddedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The new added layer event
-
layerRemoving
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer was just removed.Listeners are called in the EDT thread after the layer was removed. Use
LayerManager.LayerRemoveEvent.scheduleRemoval(Collection)to remove more layers. You should not do blocking or long-running tasks in this method.- Specified by:
layerRemovingin interfaceLayerManager.LayerChangeListener- Parameters:
e- The layer to be removed (as event)
-
layerOrderChanged
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that the order of layers was changed.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerOrderChangedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The order change event.
-
getVisibleMapArea
Returns the currently visible map area- Returns:
- the currently visible map area
-