org.openstreetmap.josm.gui
Class NavigatableComponent

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.openstreetmap.josm.gui.NavigatableComponent
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, org.openstreetmap.josm.gui.help.Helpful
Direct Known Subclasses:
MapView

public class NavigatableComponent
extends javax.swing.JComponent
implements org.openstreetmap.josm.gui.help.Helpful

An component that can be navigated by a mapmover. Used as map view and for the zoomer in the download dialog.

Author:
imi
See Also:
Serialized Form

Nested Class Summary
static class NavigatableComponent.SystemOfMeasurement
           
static interface NavigatableComponent.ZoomChangeListener
          Interface to notify listeners of the change of the zoom area.
 
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  org.openstreetmap.josm.data.coor.EastNorth center
          Center n/e coordinate of the desired screen center.
static NavigatableComponent.SystemOfMeasurement CHINESE_SOM
           
static NavigatableComponent.SystemOfMeasurement IMPERIAL_SOM
           
static NavigatableComponent.SystemOfMeasurement METRIC_SOM
           
static org.openstreetmap.josm.data.preferences.IntegerProperty PROP_SNAP_DISTANCE
           
static java.util.Map<java.lang.String,NavigatableComponent.SystemOfMeasurement> SYSTEMS_OF_MEASUREMENT
           
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
NavigatableComponent()
           
 
Method Summary
static void addZoomChangeListener(NavigatableComponent.ZoomChangeListener listener)
          Adds a zoom change listener
static
<T> java.util.Collection<T>
asColl(T o)
           
protected static void fireZoomChanged()
           
 java.util.List<org.openstreetmap.josm.data.osm.OsmPrimitive> getAllNearest(java.awt.Point p, java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive> ignore, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* does not depend on the current map selection state, neither does the result *order*.
 java.util.List<org.openstreetmap.josm.data.osm.OsmPrimitive> getAllNearest(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* does not depend on the current map selection state, neither does the result *order*.
 org.openstreetmap.josm.data.coor.EastNorth getCenter()
           
protected  org.openstreetmap.josm.data.osm.DataSet getCurrentDataSet()
           
 double getDist100Pixel()
           
 java.lang.String getDist100PixelText()
           
static java.lang.String getDistText(double dist)
           
 org.openstreetmap.josm.data.coor.EastNorth getEastNorth(int x, int y)
           
 org.openstreetmap.josm.data.coor.LatLon getLatLon(double x, double y)
           
 org.openstreetmap.josm.data.coor.LatLon getLatLon(int x, int y)
           
 org.openstreetmap.josm.data.Bounds getLatLonBounds(java.awt.Rectangle r)
           
 org.openstreetmap.josm.data.ProjectionBounds getMaxProjectionBounds()
           
 org.openstreetmap.josm.data.osm.OsmPrimitive getNearest(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          Deprecated. 
 java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive> getNearestCollection(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          Deprecated. 
 org.openstreetmap.josm.data.osm.Node getNearestNode(java.awt.Point p)
          Deprecated. 
 org.openstreetmap.josm.data.osm.Node getNearestNode(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          Convenience method to getNearestNode(Point, Predicate, boolean).
 org.openstreetmap.josm.data.osm.Node getNearestNode(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate, boolean use_selected)
          The *result* depends on the current map selection state IF use_selected is true.
 org.openstreetmap.josm.data.osm.OsmPrimitive getNearestNodeOrWay(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate, boolean use_selected)
          The *result* depends on the current map selection state IF use_selected is true.
 java.util.List<org.openstreetmap.josm.data.osm.Node> getNearestNodes(java.awt.Point p, java.util.Collection<org.openstreetmap.josm.data.osm.Node> ignore, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* does not depend on the current map selection state, neither does the result *order*.
 java.util.List<org.openstreetmap.josm.data.osm.Node> getNearestNodes(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* does not depend on the current map selection state, neither does the result *order*.
 java.util.List<org.openstreetmap.josm.data.osm.OsmPrimitive> getNearestNodesOrWays(java.awt.Point p, java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive> ignore, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* does not depend on the current map selection state, neither does the result *order*.
 java.util.List<org.openstreetmap.josm.data.osm.OsmPrimitive> getNearestNodesOrWays(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* does not depend on the current map selection state, neither does the result *order*.
 org.openstreetmap.josm.data.osm.Way getNearestWay(java.awt.Point p)
          Deprecated. 
 org.openstreetmap.josm.data.osm.Way getNearestWay(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* depends on the current map selection state.
 java.util.List<org.openstreetmap.josm.data.osm.Way> getNearestWays(java.awt.Point p, java.util.Collection<org.openstreetmap.josm.data.osm.Way> ignore, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* does not depend on the current map selection state, neither does the result *order*.
 java.util.List<org.openstreetmap.josm.data.osm.Way> getNearestWays(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The *result* does not depend on the current map selection state, neither does the result *order*.
 org.openstreetmap.josm.data.osm.WaySegment getNearestWaySegment(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          Convenience method to getNearestWaySegment(Point, Predicate, boolean).
 org.openstreetmap.josm.data.osm.WaySegment getNearestWaySegment(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate, boolean use_selected)
          The *result* depends on the current map selection state IF use_selected is true.
 java.util.List<org.openstreetmap.josm.data.osm.WaySegment> getNearestWaySegments(java.awt.Point p, java.util.Collection<org.openstreetmap.josm.data.osm.WaySegment> ignore, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The result *order* depends on the current map selection state.
 java.util.List<org.openstreetmap.josm.data.osm.WaySegment> getNearestWaySegments(java.awt.Point p, org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
          The result *order* depends on the current map selection state.
 java.awt.Point getPoint(org.openstreetmap.josm.data.coor.EastNorth p)
           
 java.awt.Point getPoint(org.openstreetmap.josm.data.coor.LatLon latlon)
           
 java.awt.Point getPoint(org.openstreetmap.josm.data.osm.Node n)
           
 java.awt.geom.Point2D getPoint2D(org.openstreetmap.josm.data.coor.EastNorth p)
          Return the point on the screen where this Coordinate would be.
 java.awt.geom.Point2D getPoint2D(org.openstreetmap.josm.data.coor.LatLon latlon)
           
 java.awt.geom.Point2D getPoint2D(org.openstreetmap.josm.data.osm.Node n)
           
 org.openstreetmap.josm.data.projection.Projection getProjection()
           
 org.openstreetmap.josm.data.ProjectionBounds getProjectionBounds()
           
 org.openstreetmap.josm.data.Bounds getRealBounds()
           
static NavigatableComponent.SystemOfMeasurement getSystemOfMeasurement()
           
 int getViewID()
          Return a ID which is unique as long as viewport dimensions are the same
 boolean hasZoomRedoEntries()
           
 boolean hasZoomUndoEntries()
           
 java.lang.String helpTopic()
           
static double perDist(java.awt.geom.Point2D pt, java.awt.geom.Point2D a, java.awt.geom.Point2D b)
           
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..
static java.awt.geom.Point2D project(java.awt.geom.Point2D pt, java.awt.geom.Point2D a, java.awt.geom.Point2D b)
           
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
 void setNewCursor(java.awt.Cursor cursor, java.lang.Object reference)
          Set new cursor.
 void setNewCursor(int cursor, java.lang.Object reference)
           
 void smoothScrollTo(org.openstreetmap.josm.data.coor.EastNorth newCenter)
          Create a thread that moves the viewport to the given center in an animated fashion.
 void smoothScrollTo(org.openstreetmap.josm.data.coor.LatLon newCenter)
           
 void zoomNext()
           
 void zoomPrevious()
           
 void zoomTo(org.openstreetmap.josm.data.Bounds box)
           
 void zoomTo(org.openstreetmap.josm.data.coor.EastNorth newCenter)
           
 void zoomTo(org.openstreetmap.josm.data.coor.LatLon newCenter)
           
 void zoomTo(org.openstreetmap.josm.data.ProjectionBounds box)
           
 void zoomToFactor(double factor)
           
 void zoomToFactor(double x, double y, double factor)
           
 void zoomToFactor(org.openstreetmap.josm.data.coor.EastNorth newCenter, double factor)
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, 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, transferFocusDownCycle, validate, validateTree
 
Methods 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, 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, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_SNAP_DISTANCE

public static final org.openstreetmap.josm.data.preferences.IntegerProperty PROP_SNAP_DISTANCE

center

protected org.openstreetmap.josm.data.coor.EastNorth center
Center n/e coordinate of the desired screen center.


METRIC_SOM

public static final NavigatableComponent.SystemOfMeasurement METRIC_SOM

CHINESE_SOM

public static final NavigatableComponent.SystemOfMeasurement CHINESE_SOM

IMPERIAL_SOM

public static final NavigatableComponent.SystemOfMeasurement IMPERIAL_SOM

SYSTEMS_OF_MEASUREMENT

public static java.util.Map<java.lang.String,NavigatableComponent.SystemOfMeasurement> SYSTEMS_OF_MEASUREMENT
Constructor Detail

NavigatableComponent

public NavigatableComponent()
Method Detail

removeZoomChangeListener

public static void removeZoomChangeListener(NavigatableComponent.ZoomChangeListener listener)
Removes a zoom change listener

Parameters:
listener - the listener. Ignored if null or already absent

addZoomChangeListener

public static void addZoomChangeListener(NavigatableComponent.ZoomChangeListener listener)
Adds a zoom change listener

Parameters:
listener - the listener. Ignored if null or already registered.

fireZoomChanged

protected static void fireZoomChanged()

getCurrentDataSet

protected org.openstreetmap.josm.data.osm.DataSet getCurrentDataSet()

getDistText

public static java.lang.String getDistText(double dist)

getDist100PixelText

public java.lang.String getDist100PixelText()

getDist100Pixel

public double getDist100Pixel()

getCenter

public org.openstreetmap.josm.data.coor.EastNorth getCenter()
Returns:
Returns the center point. A copy is returned, so users cannot change the center by accessing the return value. Use zoomTo instead.

getEastNorth

public org.openstreetmap.josm.data.coor.EastNorth getEastNorth(int x,
                                                               int y)
Parameters:
x - X-Pixelposition to get coordinate from
y - Y-Pixelposition to get coordinate from
Returns:
Geographic coordinates from a specific pixel coordination on the screen.

getProjectionBounds

public org.openstreetmap.josm.data.ProjectionBounds getProjectionBounds()

getMaxProjectionBounds

public org.openstreetmap.josm.data.ProjectionBounds getMaxProjectionBounds()

getRealBounds

public org.openstreetmap.josm.data.Bounds getRealBounds()

getLatLon

public org.openstreetmap.josm.data.coor.LatLon getLatLon(int x,
                                                         int y)
Parameters:
x - X-Pixelposition to get coordinate from
y - Y-Pixelposition to get coordinate from
Returns:
Geographic unprojected coordinates from a specific pixel coordination on the screen.

getLatLon

public org.openstreetmap.josm.data.coor.LatLon getLatLon(double x,
                                                         double y)

getLatLonBounds

public org.openstreetmap.josm.data.Bounds getLatLonBounds(java.awt.Rectangle r)
Parameters:
r -
Returns:
Minimum bounds that will cover rectangle

getPoint2D

public java.awt.geom.Point2D getPoint2D(org.openstreetmap.josm.data.coor.EastNorth p)
Return the point on the screen where this Coordinate would be.

Parameters:
p - The point, where this geopoint would be drawn.
Returns:
The point on screen where "point" would be drawn, relative to the own top/left.

getPoint2D

public java.awt.geom.Point2D getPoint2D(org.openstreetmap.josm.data.coor.LatLon latlon)

getPoint2D

public java.awt.geom.Point2D getPoint2D(org.openstreetmap.josm.data.osm.Node n)

getPoint

public java.awt.Point getPoint(org.openstreetmap.josm.data.coor.EastNorth p)

getPoint

public java.awt.Point getPoint(org.openstreetmap.josm.data.coor.LatLon latlon)

getPoint

public java.awt.Point getPoint(org.openstreetmap.josm.data.osm.Node n)

zoomTo

public void zoomTo(org.openstreetmap.josm.data.coor.EastNorth newCenter)

zoomTo

public void zoomTo(org.openstreetmap.josm.data.coor.LatLon newCenter)

smoothScrollTo

public void smoothScrollTo(org.openstreetmap.josm.data.coor.LatLon newCenter)

smoothScrollTo

public void smoothScrollTo(org.openstreetmap.josm.data.coor.EastNorth newCenter)
Create a thread that moves the viewport to the given center in an animated fashion.


zoomToFactor

public void zoomToFactor(double x,
                         double y,
                         double factor)

zoomToFactor

public void zoomToFactor(org.openstreetmap.josm.data.coor.EastNorth newCenter,
                         double factor)

zoomToFactor

public void zoomToFactor(double factor)

zoomTo

public void zoomTo(org.openstreetmap.josm.data.ProjectionBounds box)

zoomTo

public void zoomTo(org.openstreetmap.josm.data.Bounds box)

zoomPrevious

public void zoomPrevious()

zoomNext

public void zoomNext()

hasZoomUndoEntries

public boolean hasZoomUndoEntries()

hasZoomRedoEntries

public boolean hasZoomRedoEntries()

getNearestNodes

public final java.util.List<org.openstreetmap.josm.data.osm.Node> getNearestNodes(java.awt.Point p,
                                                                                  java.util.Collection<org.openstreetmap.josm.data.osm.Node> ignore,
                                                                                  org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*. It solely depends on the distance to point p.

Parameters:
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.
Returns:
All nodes nearest to point p that are in a belt from dist(nearest) to dist(nearest)+4px around p and that are not in ignore.

getNearestNodes

public final java.util.List<org.openstreetmap.josm.data.osm.Node> getNearestNodes(java.awt.Point p,
                                                                                  org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*. It solely depends on the distance to point p.

Parameters:
p - the point for which to search the nearest segment.
predicate - the returned objects have to fulfill certain properties.
Returns:
All nodes nearest to point p that are in a belt from dist(nearest) to dist(nearest)+4px around p.
See Also:
getNearestNodes(Point, Collection, Predicate)

getNearestNode

public final org.openstreetmap.josm.data.osm.Node getNearestNode(java.awt.Point p,
                                                                 org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate,
                                                                 boolean use_selected)
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. Else the nearest new/id=0 node within about the same distance as the true nearest node is returned. If no such node is found either, the true nearest node to p is returned. Finally, if a node is not found at all, null is returned.

Parameters:
p - the screen point
predicate - this parameter imposes a condition on the returned object, e.g. give the nearest node that is tagged.
Returns:
A node within snap-distance to point p, that is chosen by the algorithm described.

getNearestNode

public final org.openstreetmap.josm.data.osm.Node getNearestNode(java.awt.Point p,
                                                                 org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
Convenience method to getNearestNode(Point, Predicate, boolean).

Returns:
The nearest node to point p.

getNearestNode

@Deprecated
public final org.openstreetmap.josm.data.osm.Node getNearestNode(java.awt.Point p)
Deprecated. 


getNearestWaySegments

public final java.util.List<org.openstreetmap.josm.data.osm.WaySegment> getNearestWaySegments(java.awt.Point p,
                                                                                              java.util.Collection<org.openstreetmap.josm.data.osm.WaySegment> ignore,
                                                                                              org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The result *order* depends on the current map selection state. Segments within 10px of p are searched and sorted by their distance to @param p, then, within groups of equally distant segments, prefer those that are selected.

Parameters:
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.
Returns:
all segments within 10px of p that are not in ignore, sorted by their perpendicular distance.

getNearestWaySegments

public final java.util.List<org.openstreetmap.josm.data.osm.WaySegment> getNearestWaySegments(java.awt.Point p,
                                                                                              org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The result *order* depends on the current map selection state.

Parameters:
p - the point for which to search the nearest segments.
predicate - the returned objects have to fulfill certain properties.
Returns:
all segments within 10px of p, sorted by their perpendicular distance.
See Also:
getNearestWaySegments(Point, Collection, Predicate)

getNearestWaySegment

public final org.openstreetmap.josm.data.osm.WaySegment getNearestWaySegment(java.awt.Point p,
                                                                             org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate,
                                                                             boolean use_selected)
The *result* depends on the current map selection state IF use_selected is true.

Parameters:
p - the point for which to search the nearest segment.
predicate - the returned object has to fulfill certain properties.
use_selected - whether selected way segments should be preferred.
Returns:
The nearest way segment to point p, and, depending on use_selected, prefers a selected way segment, if found.
See Also:
getNearestWaySegments(Point, Collection, Predicate)

getNearestWaySegment

public final org.openstreetmap.josm.data.osm.WaySegment getNearestWaySegment(java.awt.Point p,
                                                                             org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
Convenience method to getNearestWaySegment(Point, Predicate, boolean).

Returns:
The nearest way segment to point p.

getNearestWays

public final java.util.List<org.openstreetmap.josm.data.osm.Way> getNearestWays(java.awt.Point p,
                                                                                java.util.Collection<org.openstreetmap.josm.data.osm.Way> ignore,
                                                                                org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*. It solely depends on the perpendicular distance to point p.

Parameters:
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.
Returns:
all nearest ways to the screen point given that are not in ignore.
See Also:
getNearestWaySegments(Point, Collection, Predicate)

getNearestWays

public final java.util.List<org.openstreetmap.josm.data.osm.Way> getNearestWays(java.awt.Point p,
                                                                                org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*. It solely depends on the perpendicular distance to point p.

Parameters:
p - the point for which to search the nearest ways.
predicate - the returned object has to fulfill certain properties.
Returns:
all nearest ways to the screen point given.
See Also:
getNearestWays(Point, Collection, Predicate)

getNearestWay

public final org.openstreetmap.josm.data.osm.Way getNearestWay(java.awt.Point p,
                                                               org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* depends on the current map selection state.

Parameters:
p - the point for which to search the nearest segment.
predicate - the returned object has to fulfill certain properties.
Returns:
The nearest way to point p, prefer a selected way if there are multiple nearest.
See Also:
#getNearestWaySegment(Point, Collection, Predicate)

getNearestWay

@Deprecated
public final org.openstreetmap.josm.data.osm.Way getNearestWay(java.awt.Point p)
Deprecated. 


getNearestNodesOrWays

public final java.util.List<org.openstreetmap.josm.data.osm.OsmPrimitive> getNearestNodesOrWays(java.awt.Point p,
                                                                                                java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive> ignore,
                                                                                                org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*. It solely depends on the distance to point p. First, nodes will be searched. If there are nodes within BBox found, return a collection of those nodes only. If no nodes are found, search for nearest ways. If there are ways within BBox found, return a collection of those ways only. If nothing is found, return an empty collection.

Parameters:
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.
Returns:
Primitives nearest to the given screen point that are not in ignore.
See Also:
getNearestNodes(Point, Collection, Predicate), getNearestWays(Point, Collection, Predicate)

getNearestNodesOrWays

public final java.util.List<org.openstreetmap.josm.data.osm.OsmPrimitive> getNearestNodesOrWays(java.awt.Point p,
                                                                                                org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*. It solely depends on the distance to point p.

Parameters:
p - The point on screen.
predicate - the returned object has to fulfill certain properties.
Returns:
Primitives nearest to the given screen point.
See Also:
#getNearests(Point, Collection, Predicate)

getNearestNodeOrWay

public final org.openstreetmap.josm.data.osm.OsmPrimitive getNearestNodeOrWay(java.awt.Point p,
                                                                              org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate,
                                                                              boolean use_selected)
The *result* depends on the current map selection state IF use_selected is true. IF use_selected is true, use 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.

Parameters:
p - The point on screen.
predicate - the returned object has to fulfill certain properties.
use_selected - whether to prefer primitives that are currently selected.
Returns:
A primitive within snap-distance to point p, that is chosen by the algorithm described.
See Also:
getNearestNode(Point, Predicate), getNearestNodesImpl(Point, Predicate), getNearestWay(Point, Predicate)

getNearest

@Deprecated
public final org.openstreetmap.josm.data.osm.OsmPrimitive getNearest(java.awt.Point p,
                                                                                org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
Deprecated. 


getNearestCollection

@Deprecated
public final java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive> getNearestCollection(java.awt.Point p,
                                                                                                                org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
Deprecated. 


asColl

public static <T> java.util.Collection<T> asColl(T o)
Returns:
o as collection of o's type.

perDist

public static double perDist(java.awt.geom.Point2D pt,
                             java.awt.geom.Point2D a,
                             java.awt.geom.Point2D b)

project

public static java.awt.geom.Point2D project(java.awt.geom.Point2D pt,
                                            java.awt.geom.Point2D a,
                                            java.awt.geom.Point2D b)
Parameters:
pt - point to project onto (ab)
a - root of vector
b - vector
Returns:
point of intersection of line given by (ab) with its orthogonal line running through pt

project

public 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..

Parameters:
r - scale value
a - root of vector
b - vector
Returns:
new point at a + r*(ab)

getAllNearest

public final java.util.List<org.openstreetmap.josm.data.osm.OsmPrimitive> getAllNearest(java.awt.Point p,
                                                                                        java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive> ignore,
                                                                                        org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*. It solely depends on the distance to point p.

Parameters:
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.
Returns:
a list of all objects that are nearest to point p and not in ignore or an empty list if nothing was found.

getAllNearest

public final java.util.List<org.openstreetmap.josm.data.osm.OsmPrimitive> getAllNearest(java.awt.Point p,
                                                                                        org.openstreetmap.josm.tools.Predicate<org.openstreetmap.josm.data.osm.OsmPrimitive> predicate)
The *result* does not depend on the current map selection state, neither does the result *order*. It solely depends on the distance to point p.

Parameters:
p - The point on screen.
predicate - the returned object has to fulfill certain properties.
Returns:
a list of all objects that are nearest to point p or an empty list if nothing was found.
See Also:
getAllNearest(Point, Collection, Predicate)

getProjection

public org.openstreetmap.josm.data.projection.Projection getProjection()
Returns:
The projection to be used in calculating stuff.

helpTopic

public java.lang.String helpTopic()
Specified by:
helpTopic in interface org.openstreetmap.josm.gui.help.Helpful

getViewID

public int getViewID()
Return a ID which is unique as long as viewport dimensions are the same


getSystemOfMeasurement

public static NavigatableComponent.SystemOfMeasurement getSystemOfMeasurement()

setNewCursor

public void setNewCursor(java.awt.Cursor cursor,
                         java.lang.Object reference)
Set new cursor.


setNewCursor

public void setNewCursor(int cursor,
                         java.lang.Object reference)

resetCursor

public void resetCursor(java.lang.Object reference)
Remove the new cursor and reset to previous