public class NavigatableComponent extends javax.swing.JComponent implements Helpful
MapMover
. Used as map view and for the
zoomer in the download dialog.Modifier and Type | Class and Description |
---|---|
static interface |
NavigatableComponent.ZoomChangeListener
Interface to notify listeners of the change of the zoom area.
|
private static class |
NavigatableComponent.ZoomData |
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private java.awt.event.ComponentAdapter |
componentListener |
protected CursorManager |
cursorManager |
private java.awt.event.HierarchyListener |
hierarchyListener |
protected ViewportData |
initialViewport |
java.util.function.Predicate<OsmPrimitive> |
isSelectablePredicate
To determine if a primitive is currently selectable.
|
private NativeScaleLayer |
nativeScaleLayer
The layer which scale is set to.
|
static IntegerProperty |
PROP_SNAP_DISTANCE
Snap distance
|
static BooleanProperty |
PROP_ZOOM_INTERMEDIATE_STEPS
Divide intervals between native resolution levels to smaller steps if they are much larger than zoom ratio
|
static DoubleProperty |
PROP_ZOOM_RATIO
Zoom steps to get double scale
|
static java.lang.String |
PROPNAME_CENTER
Property name for center change events
|
static java.lang.String |
PROPNAME_SCALE
Property name for scale change events
|
private MapViewState |
state
The current state (scale, center, ...) of this map view.
|
private static java.util.concurrent.CopyOnWriteArrayList<NavigatableComponent.ZoomChangeListener> |
zoomChangeListeners
the zoom listeners
|
private java.util.Stack<NavigatableComponent.ZoomData> |
zoomRedoBuffer |
private java.util.Date |
zoomTimestamp |
private java.util.Stack<NavigatableComponent.ZoomData> |
zoomUndoBuffer |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
NavigatableComponent()
Constructs a new
NavigatableComponent . |
Modifier and Type | Method and Description |
---|---|
void |
addNotify() |
static void |
addZoomChangeListener(NavigatableComponent.ZoomChangeListener listener)
Adds a zoom change listener
|
protected static void |
fireZoomChanged() |
void |
fixProjection()
Changes the projection settings used for this map view.
|
java.awt.geom.AffineTransform |
getAffineTransform()
Creates an affine transform that is used to convert the east/north coordinates to view coordinates.
|
java.util.List<OsmPrimitive> |
getAllNearest(java.awt.Point p,
java.util.Collection<OsmPrimitive> ignore,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*.
|
java.util.List<OsmPrimitive> |
getAllNearest(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*.
|
private BBox |
getBBox(java.awt.Point p,
int snapDistance) |
EastNorth |
getCenter()
Returns the current center of the viewport.
|
CursorManager |
getCursorManager()
Gets the cursor manager that is used for this NavigatableComponent.
|
double |
getDist100Pixel()
Get the distance in meter that correspond to 100 px on screen.
|
double |
getDist100Pixel(boolean alwaysPositive)
Get the distance in meter that correspond to 100 px on screen.
|
java.lang.String |
getDist100PixelText()
Returns the text describing the distance in meter that correspond to 100 px on screen.
|
static java.lang.String |
getDistText(double dist)
Returns the text describing the given distance in the current system of measurement.
|
static java.lang.String |
getDistText(double dist,
java.text.NumberFormat format,
double threshold)
Returns the text describing the given distance in the current system of measurement.
|
EastNorth |
getEastNorth(int x,
int y) |
LatLon |
getLatLon(double x,
double y)
Returns unprojected geographic coordinates for a specific pixel position on the screen.
|
LatLon |
getLatLon(int x,
int y)
Returns unprojected geographic coordinates for a specific pixel position on the screen.
|
Bounds |
getLatLonBounds(java.awt.Rectangle r) |
ProjectionBounds |
getMaxProjectionBounds() |
double |
getMaxScale()
Get a max scale for projection that describes world in 1/512 of the projection unit
|
NativeScaleLayer |
getNativeScaleLayer()
Replies the layer which scale is set to.
|
Node |
getNearestNode(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
Convenience method to
getNearestNode(Point, Predicate, boolean) . |
Node |
getNearestNode(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate,
boolean useSelected)
The *result* depends on the current map selection state IF use_selected is true.
|
Node |
getNearestNode(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate,
boolean useSelected,
java.util.Collection<OsmPrimitive> preferredRefs)
The *result* depends on the current map selection state IF use_selected is true
If more than one node within node.snap-distance pixels is found,
the nearest node selected is returned IF use_selected is true.
|
OsmPrimitive |
getNearestNodeOrWay(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate,
boolean useSelected)
The *result* depends on the current map selection state IF use_selected is true.
|
java.util.List<Node> |
getNearestNodes(java.awt.Point p,
java.util.Collection<Node> ignore,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state,
neither does the result *order*.
|
java.util.List<Node> |
getNearestNodes(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state,
neither does the result *order*.
|
private java.util.Map<java.lang.Double,java.util.List<Node>> |
getNearestNodesImpl(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*.
|
java.util.List<OsmPrimitive> |
getNearestNodesOrWays(java.awt.Point p,
java.util.Collection<OsmPrimitive> ignore,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state,
neither does the result *order*.
|
java.util.List<OsmPrimitive> |
getNearestNodesOrWays(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state,
neither does the result *order*.
|
Way |
getNearestWay(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* depends on the current map selection state.
|
java.util.List<Way> |
getNearestWays(java.awt.Point p,
java.util.Collection<Way> ignore,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state,
neither does the result *order*.
|
java.util.List<Way> |
getNearestWays(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state,
neither does the result *order*.
|
WaySegment |
getNearestWaySegment(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
Convenience method to
getNearestWaySegment(Point, Predicate, boolean) . |
WaySegment |
getNearestWaySegment(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate,
boolean useSelected)
The *result* depends on the current map selection state IF use_selected is true.
|
WaySegment |
getNearestWaySegment(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate,
boolean useSelected,
java.util.Collection<OsmPrimitive> preferredRefs)
The *result* depends on the current map selection state IF use_selected is true.
|
java.util.List<WaySegment> |
getNearestWaySegments(java.awt.Point p,
java.util.Collection<WaySegment> ignore,
java.util.function.Predicate<OsmPrimitive> predicate)
The result *order* depends on the current map selection state.
|
java.util.List<WaySegment> |
getNearestWaySegments(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
The result *order* depends on the current map selection state.
|
private java.util.Map<java.lang.Double,java.util.List<WaySegment>> |
getNearestWaySegmentsImpl(java.awt.Point p,
java.util.function.Predicate<OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*.
|
java.awt.Point |
getPoint(EastNorth p)
looses precision, may overflow (depends on p and current scale)
|
java.awt.Point |
getPoint(LatLon latlon)
looses precision, may overflow (depends on p and current scale)
|
java.awt.Point |
getPoint(Node n)
looses precision, may overflow (depends on p and current scale)
|
java.awt.geom.Point2D |
getPoint2D(EastNorth p)
Return the point on the screen where this Coordinate would be.
|
java.awt.geom.Point2D |
getPoint2D(LatLon latlon)
Return the point on the screen where this Coordinate would be.
|
java.awt.geom.Point2D |
getPoint2D(Node n)
Return the point on the screen where this Node would be.
|
Projection |
getProjection() |
ProjectionBounds |
getProjectionBounds()
Determines the projection bounds of view area.
|
ProjectionBounds |
getProjectionBounds(java.awt.Rectangle r)
Determines the projection bounds of given rectangle.
|
Bounds |
getRealBounds() |
double |
getScale()
Returns the current scale.
|
MapViewState |
getState()
Gets the current view state.
|
int |
getViewID()
Return a ID which is unique as long as viewport dimensions are the same
|
boolean |
hasZoomRedoEntries()
Determines if zoom history contains "redo" entries.
|
boolean |
hasZoomUndoEntries()
Determines if zoom history contains "undo" entries.
|
java.lang.String |
helpTopic()
Returns the help topic on JOSM wiki for this feature.
|
private boolean |
isPrecedenceNode(Node osm,
java.awt.Point p,
boolean useSelected)
This is used as a helper routine to
getNearestNodeOrWay(Point, Predicate, boolean)
It decides, whether to yield the node to be tested or look for further (way) candidates. |
protected boolean |
isVisibleOnScreen() |
static java.awt.geom.Point2D |
project(double r,
java.awt.geom.Point2D a,
java.awt.geom.Point2D b)
if r = 0 returns a, if r=1 returns b,
if r = 0.5 returns center between a and b, etc..
|
private void |
pushZoomUndo(EastNorth center,
double scale) |
void |
removeNotify() |
static void |
removeZoomChangeListener(NavigatableComponent.ZoomChangeListener listener)
Removes a zoom change listener
|
void |
resetCursor(java.lang.Object reference)
Remove the new cursor and reset to previous
|
double |
scaleFloor(double scale)
Get a scale snapped to native resolutions.
|
double |
scaleRound(double scale)
Get a scale snapped to native resolutions, use round method.
|
double |
scaleSnap(double scale,
boolean floor)
Get a scale snapped to native resolutions.
|
double |
scaleZoomIn()
Get a new scale that is zoomed in from previous scale
and snapped to selected native scale layer.
|
double |
scaleZoomManyTimes(int times)
Get a new scale that is zoomed in/out a number of times
from previous scale and snapped to selected native scale layer.
|
double |
scaleZoomOut()
Get a new scale that is zoomed out from previous scale
and snapped to selected native scale layer.
|
void |
setNativeScaleLayer(NativeScaleLayer nativeScaleLayer)
Choose a layer that scale will be snap to its native scales.
|
void |
setNewCursor(java.awt.Cursor cursor,
java.lang.Object reference)
Set new cursor.
|
void |
setNewCursor(int cursor,
java.lang.Object reference)
Set new cursor.
|
void |
smoothScrollTo(EastNorth newCenter)
Create a thread that moves the viewport to the given center in an animated fashion.
|
protected void |
updateLocationState() |
void |
zoomIn()
Zoom in current view.
|
void |
zoomManyTimes(double x,
double y,
int times) |
void |
zoomNext()
Zoom to next location.
|
private void |
zoomNoUndoTo(EastNorth newCenter,
double newScale,
boolean initial)
Zoom to the given coordinate without adding to the zoom undo buffer.
|
void |
zoomOut()
Zoom out current view.
|
void |
zoomPrevious()
Zoom to previous location.
|
void |
zoomTo(BoundingXYVisitor box)
Set the new dimension to the view.
|
void |
zoomTo(Bounds box)
Zoom to given bounds.
|
void |
zoomTo(EastNorth newCenter)
Zoom to given east/north.
|
void |
zoomTo(EastNorth newCenter,
double newScale)
Zoom to the given coordinate and scale.
|
void |
zoomTo(EastNorth center,
double scale,
boolean initial)
Zoom to the given coordinate and scale.
|
void |
zoomTo(LatLon newCenter)
Zoom to given lat/lon.
|
void |
zoomTo(ProjectionBounds box)
Zoom to given projection bounds.
|
void |
zoomTo(ViewportData viewport)
Zoom to given viewport data.
|
void |
zoomToFactor(double factor) |
void |
zoomToFactor(double x,
double y,
double factor) |
void |
zoomToFactor(EastNorth newCenter,
double factor) |
addAncestorListener, 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, 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, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, 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, 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, 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, removeComponentListener, 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, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public transient java.util.function.Predicate<OsmPrimitive> isSelectablePredicate
public static final IntegerProperty PROP_SNAP_DISTANCE
public static final DoubleProperty PROP_ZOOM_RATIO
public static final BooleanProperty PROP_ZOOM_INTERMEDIATE_STEPS
public static final java.lang.String PROPNAME_CENTER
public static final java.lang.String PROPNAME_SCALE
private transient NativeScaleLayer nativeScaleLayer
private static final java.util.concurrent.CopyOnWriteArrayList<NavigatableComponent.ZoomChangeListener> zoomChangeListeners
private final transient java.awt.event.HierarchyListener hierarchyListener
private final transient java.awt.event.ComponentAdapter componentListener
protected transient ViewportData initialViewport
protected final transient CursorManager cursorManager
private transient MapViewState state
private final transient java.util.Stack<NavigatableComponent.ZoomData> zoomUndoBuffer
private final transient java.util.Stack<NavigatableComponent.ZoomData> zoomRedoBuffer
private java.util.Date zoomTimestamp
public NavigatableComponent()
NavigatableComponent
.public static void removeZoomChangeListener(NavigatableComponent.ZoomChangeListener listener)
listener
- the listener. Ignored if null or already absentpublic static void addZoomChangeListener(NavigatableComponent.ZoomChangeListener listener)
listener
- the listener. Ignored if null or already registered.protected static void fireZoomChanged()
public void addNotify()
addNotify
in class javax.swing.JComponent
public void removeNotify()
removeNotify
in class javax.swing.JComponent
public void setNativeScaleLayer(NativeScaleLayer nativeScaleLayer)
nativeScaleLayer
- layer to which scale will be snappedpublic NativeScaleLayer getNativeScaleLayer()
public double scaleZoomIn()
public double scaleZoomOut()
public double scaleZoomManyTimes(int times)
times
- count of zoom operations, negative means zoom inpublic double scaleRound(double scale)
scale
- to snappublic double scaleFloor(double scale)
scale
- to snappublic double scaleSnap(double scale, boolean floor)
scale
- to snapfloor
- use floor instead of round, set true when fitting view to objectspublic void zoomIn()
public void zoomOut()
protected void updateLocationState()
protected boolean isVisibleOnScreen()
public void fixProjection()
Made public temporarely, will be made private later.
public MapViewState getState()
public static java.lang.String getDistText(double dist)
dist
- The distance in metres.public static java.lang.String getDistText(double dist, java.text.NumberFormat format, double threshold)
dist
- The distance in metresformat
- A NumberFormat
to format the area valuethreshold
- Values lower than this threshold
are displayed as "< [threshold]"
public java.lang.String getDist100PixelText()
public double getDist100Pixel()
public double getDist100Pixel(boolean alwaysPositive)
alwaysPositive
- if true, makes sure the return value is always
> 0. (Two points 100 px apart can appear to be identical if the user
has zoomed out a lot and the projection code does something funny.)public EastNorth getCenter()
zoomTo(EastNorth)
to the change the center.)public double getScale()
public EastNorth getEastNorth(int x, int y)
x
- X-Pixelposition to get coordinate fromy
- Y-Pixelposition to get coordinate frompublic ProjectionBounds getProjectionBounds()
public ProjectionBounds getMaxProjectionBounds()
public Bounds getRealBounds()
public LatLon getLatLon(int x, int y)
x
- X-Pixelposition to get coordinate fromy
- Y-Pixelposition to get coordinate frompublic LatLon getLatLon(double x, double y)
x
- X-Pixelposition to get coordinate fromy
- Y-Pixelposition to get coordinate frompublic ProjectionBounds getProjectionBounds(java.awt.Rectangle r)
r
- rectangler
public Bounds getLatLonBounds(java.awt.Rectangle r)
r
- rectanglepublic java.awt.geom.AffineTransform getAffineTransform()
public java.awt.geom.Point2D getPoint2D(EastNorth p)
p
- The point, where this geopoint would be drawn.public java.awt.geom.Point2D getPoint2D(LatLon latlon)
latlon
- The point, where this geopoint would be drawn.public java.awt.geom.Point2D getPoint2D(Node n)
n
- The node, where this geopoint would be drawn.public java.awt.Point getPoint(EastNorth p)
p
- east/northgetPoint2D(EastNorth)
public java.awt.Point getPoint(LatLon latlon)
latlon
- lat/longetPoint2D(LatLon)
public java.awt.Point getPoint(Node n)
n
- nodegetPoint2D(Node)
public void zoomTo(EastNorth newCenter, double newScale)
newCenter
- The center x-value (easting) to zoom to.newScale
- The scale to use.public void zoomTo(EastNorth center, double scale, boolean initial)
center
- The center x-value (easting) to zoom to.scale
- The scale to use.initial
- true if this call initializes the viewport.private void zoomNoUndoTo(EastNorth newCenter, double newScale, boolean initial)
newCenter
- The center x-value (easting) to zoom to.newScale
- The scale to use.initial
- true if this call initializes the viewport.public void zoomTo(EastNorth newCenter)
newCenter
- new center coordinatespublic void zoomTo(LatLon newCenter)
newCenter
- new center coordinatespublic void smoothScrollTo(EastNorth newCenter)
newCenter
- new east/north centerpublic void zoomManyTimes(double x, double y, int times)
public void zoomToFactor(double x, double y, double factor)
public void zoomToFactor(EastNorth newCenter, double factor)
public void zoomToFactor(double factor)
public void zoomTo(ProjectionBounds box)
box
- new projection boundspublic void zoomTo(ViewportData viewport)
viewport
- new viewport datapublic void zoomTo(BoundingXYVisitor box)
box
- box to zoom toprivate void pushZoomUndo(EastNorth center, double scale)
public void zoomPrevious()
public void zoomNext()
public boolean hasZoomUndoEntries()
true
if zoom history contains "undo" entriespublic boolean hasZoomRedoEntries()
true
if zoom history contains "redo" entriesprivate java.util.Map<java.lang.Double,java.util.List<Node>> getNearestNodesImpl(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
p
- pointpredicate
- predicate to matchpublic final java.util.List<Node> getNearestNodes(java.awt.Point p, java.util.Collection<Node> ignore, java.util.function.Predicate<OsmPrimitive> predicate)
p
- the point for which to search the nearest segment.ignore
- a collection of nodes which are not to be returned.predicate
- the returned objects have to fulfill certain properties.public final java.util.List<Node> getNearestNodes(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
p
- the point for which to search the nearest segment.predicate
- the returned objects have to fulfill certain properties.getNearestNodes(Point, Collection, Predicate)
public final Node getNearestNode(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate, boolean useSelected)
p
- the screen pointpredicate
- this parameter imposes a condition on the returned object, e.g.
give the nearest node that is tagged.useSelected
- make search depend on selectionpublic final Node getNearestNode(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate, boolean useSelected, java.util.Collection<OsmPrimitive> preferredRefs)
p
- the screen pointpredicate
- this parameter imposes a condition on the returned object, e.g.
give the nearest node that is tagged.useSelected
- make search depend on selectionpreferredRefs
- primitives, whose nodes we preferpublic final Node getNearestNode(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
getNearestNode(Point, Predicate, boolean)
.p
- the screen pointpredicate
- this parameter imposes a condition on the returned object, e.g.
give the nearest node that is tagged.private java.util.Map<java.lang.Double,java.util.List<WaySegment>> getNearestWaySegmentsImpl(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
p
- the screen pointpredicate
- this parameter imposes a condition on the returned object, e.g.
give the nearest node that is tagged.public final java.util.List<WaySegment> getNearestWaySegments(java.awt.Point p, java.util.Collection<WaySegment> ignore, java.util.function.Predicate<OsmPrimitive> predicate)
p
- the point for which to search the nearest segments.ignore
- a collection of segments which are not to be returned.predicate
- the returned objects have to fulfill certain properties.public final java.util.List<WaySegment> getNearestWaySegments(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
p
- the point for which to search the nearest segments.predicate
- the returned objects have to fulfill certain properties.getNearestWaySegments(Point, Collection, Predicate)
public final WaySegment getNearestWaySegment(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate, boolean useSelected)
p
- the point for which to search the nearest segment.predicate
- the returned object has to fulfill certain properties.useSelected
- whether selected way segments should be preferred.getNearestWaySegments(Point, Collection, Predicate)
public final WaySegment getNearestWaySegment(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate, boolean useSelected, java.util.Collection<OsmPrimitive> preferredRefs)
p
- the point for which to search the nearest segment.predicate
- the returned object has to fulfill certain properties.useSelected
- whether selected way segments should be preferred.preferredRefs
- - prefer segments related to these primitives, may be nullgetNearestWaySegments(Point, Collection, Predicate)
public final WaySegment getNearestWaySegment(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
getNearestWaySegment(Point, Predicate, boolean)
.p
- the point for which to search the nearest segment.predicate
- the returned object has to fulfill certain properties.public final java.util.List<Way> getNearestWays(java.awt.Point p, java.util.Collection<Way> ignore, java.util.function.Predicate<OsmPrimitive> predicate)
p
- the point for which to search the nearest ways.ignore
- a collection of ways which are not to be returned.predicate
- the returned object has to fulfill certain properties.getNearestWaySegments(Point, Collection, Predicate)
public final java.util.List<Way> getNearestWays(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
p
- the point for which to search the nearest ways.predicate
- the returned object has to fulfill certain properties.getNearestWays(Point, Collection, Predicate)
public final Way getNearestWay(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
p
- the point for which to search the nearest segment.predicate
- the returned object has to fulfill certain properties.getNearestWaySegment(Point, Predicate)
public final java.util.List<OsmPrimitive> getNearestNodesOrWays(java.awt.Point p, java.util.Collection<OsmPrimitive> ignore, java.util.function.Predicate<OsmPrimitive> predicate)
p
- The point on screen.ignore
- a collection of ways which are not to be returned.predicate
- the returned object has to fulfill certain properties.getNearestNodes(Point, Collection, Predicate)
,
getNearestWays(Point, Collection, Predicate)
public final java.util.List<OsmPrimitive> getNearestNodesOrWays(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
p
- The point on screen.predicate
- the returned object has to fulfill certain properties.getNearestNodesOrWays(Point, Collection, Predicate)
private boolean isPrecedenceNode(Node osm, java.awt.Point p, boolean useSelected)
getNearestNodeOrWay(Point, Predicate, boolean)
It decides, whether to yield the node to be tested or look for further (way) candidates.osm
- node to checkp
- point clickeduseSelected
- whether to prefer selected nodespublic final OsmPrimitive getNearestNodeOrWay(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate, boolean useSelected)
getNearestNode(Point, Predicate)
to find
the nearest, selected node. If not found, try getNearestWaySegment(Point, Predicate)
to find the nearest selected way.
IF use_selected is false, or if no selected primitive was found, do the following.
If the nearest node found is within 4px of p, simply take it.
Else, find the nearest way segment. Then, if p is closer to its
middle than to the node, take the way segment, else take the node.
Finally, if no nearest primitive is found at all, return null.p
- The point on screen.predicate
- the returned object has to fulfill certain properties.useSelected
- whether to prefer primitives that are currently selected or referred by selected primitivesgetNearestNode(Point, Predicate)
,
getNearestWay(Point, Predicate)
public static java.awt.geom.Point2D project(double r, java.awt.geom.Point2D a, java.awt.geom.Point2D b)
r
- scale valuea
- root of vectorb
- vectorpublic final java.util.List<OsmPrimitive> getAllNearest(java.awt.Point p, java.util.Collection<OsmPrimitive> ignore, java.util.function.Predicate<OsmPrimitive> predicate)
p
- The point on screen.ignore
- a collection of ways which are not to be returned.predicate
- the returned object has to fulfill certain properties.public final java.util.List<OsmPrimitive> getAllNearest(java.awt.Point p, java.util.function.Predicate<OsmPrimitive> predicate)
p
- The point on screen.predicate
- the returned object has to fulfill certain properties.getAllNearest(Point, Collection, Predicate)
public Projection getProjection()
public java.lang.String helpTopic()
Helpful
public int getViewID()
public void setNewCursor(java.awt.Cursor cursor, java.lang.Object reference)
cursor
- The new cursor to use.reference
- A reference object that can be passed to the next set/reset calls to identify the caller.public void setNewCursor(int cursor, java.lang.Object reference)
cursor
- the type of predefined cursorreference
- A reference object that can be passed to the next set/reset calls to identify the caller.public void resetCursor(java.lang.Object reference)
reference
- Cursor referencepublic CursorManager getCursorManager()
public double getMaxScale()