|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
org.openstreetmap.josm.gui.NavigatableComponent
public class NavigatableComponent
An component that can be navigated by a mapmover. Used as map view and for the zoomer in the download dialog.
Nested Class Summary | |
---|---|
private static class |
NavigatableComponent.CursorInfo
|
static class |
NavigatableComponent.SystemOfMeasurement
|
static interface |
NavigatableComponent.ZoomChangeListener
Interface to notify listeners of the change of the zoom area. |
private class |
NavigatableComponent.ZoomData
|
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 EastNorth |
center
Center n/e coordinate of the desired screen center. |
static NavigatableComponent.SystemOfMeasurement |
CHINESE_SOM
|
private java.util.LinkedList<NavigatableComponent.CursorInfo> |
Cursors
|
static NavigatableComponent.SystemOfMeasurement |
IMPERIAL_SOM
|
static NavigatableComponent.SystemOfMeasurement |
METRIC_SOM
|
static IntegerProperty |
PROP_SNAP_DISTANCE
|
static java.lang.String |
PROPNAME_CENTER
|
static java.lang.String |
PROPNAME_SCALE
|
private double |
scale
The scale factor in x or y-units per pixel. |
static java.util.Map<java.lang.String,NavigatableComponent.SystemOfMeasurement> |
SYSTEMS_OF_MEASUREMENT
|
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
|
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
|
asColl(T o)
|
|
private EastNorth |
calculateDefaultCenter()
|
|
protected static void |
fireZoomChanged()
|
|
java.awt.geom.AffineTransform |
getAffineTransform()
|
|
java.util.List<OsmPrimitive> |
getAllNearest(java.awt.Point p,
java.util.Collection<OsmPrimitive> ignore,
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,
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()
|
|
protected DataSet |
getCurrentDataSet()
|
|
double |
getDist100Pixel()
|
|
java.lang.String |
getDist100PixelText()
|
|
static java.lang.String |
getDistText(double dist)
|
|
EastNorth |
getEastNorth(int x,
int y)
|
|
LatLon |
getLatLon(double x,
double y)
|
|
LatLon |
getLatLon(int x,
int y)
|
|
Bounds |
getLatLonBounds(java.awt.Rectangle r)
|
|
ProjectionBounds |
getMaxProjectionBounds()
|
|
Node |
getNearestNode(java.awt.Point p,
Predicate<OsmPrimitive> predicate)
Convenience method to getNearestNode(Point, Predicate, boolean) . |
|
Node |
getNearestNode(java.awt.Point p,
Predicate<OsmPrimitive> predicate,
boolean use_selected)
The *result* depends on the current map selection state IF use_selected is true. |
|
OsmPrimitive |
getNearestNodeOrWay(java.awt.Point p,
Predicate<OsmPrimitive> predicate,
boolean use_selected)
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,
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,
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,
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,
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,
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,
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,
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,
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,
Predicate<OsmPrimitive> predicate)
Convenience method to getNearestWaySegment(Point, Predicate, boolean) . |
|
WaySegment |
getNearestWaySegment(java.awt.Point p,
Predicate<OsmPrimitive> predicate,
boolean use_selected)
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,
Predicate<OsmPrimitive> predicate)
The result *order* depends on the current map selection state. |
|
java.util.List<WaySegment> |
getNearestWaySegments(java.awt.Point p,
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,
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)
|
|
java.awt.Point |
getPoint(LatLon latlon)
|
|
java.awt.Point |
getPoint(Node n)
|
|
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)
|
|
java.awt.geom.Point2D |
getPoint2D(Node n)
|
|
Projection |
getProjection()
|
|
ProjectionBounds |
getProjectionBounds()
|
|
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()
|
|
private boolean |
isPrecedenceNode(Node osm,
java.awt.Point p,
boolean use_selected)
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. |
|
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)
|
|
private void |
pushZoomUndo(EastNorth center,
double scale)
|
|
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(EastNorth newCenter)
Create a thread that moves the viewport to the given center in an animated fashion. |
|
void |
smoothScrollTo(LatLon newCenter)
|
|
private void |
stripCursors(java.lang.Object reference)
|
|
void |
zoomNext()
|
|
private void |
zoomNoUndoTo(EastNorth newCenter,
double newScale)
Zoom to the given coordinate without adding to the zoom undo buffer. |
|
void |
zoomPrevious()
|
|
void |
zoomTo(Bounds box)
|
|
void |
zoomTo(EastNorth newCenter)
|
|
void |
zoomTo(EastNorth newCenter,
double newScale)
Zoom to the given coordinate. |
|
void |
zoomTo(LatLon newCenter)
|
|
void |
zoomTo(ProjectionBounds box)
|
|
void |
zoomToFactor(double factor)
|
|
void |
zoomToFactor(double x,
double y,
double factor)
|
|
void |
zoomToFactor(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 |
---|
public static final IntegerProperty PROP_SNAP_DISTANCE
public static final java.lang.String PROPNAME_CENTER
public static final java.lang.String PROPNAME_SCALE
private static final java.util.concurrent.CopyOnWriteArrayList<NavigatableComponent.ZoomChangeListener> zoomChangeListeners
private double scale
protected EastNorth center
private java.util.Stack<NavigatableComponent.ZoomData> zoomUndoBuffer
private java.util.Stack<NavigatableComponent.ZoomData> zoomRedoBuffer
private java.util.Date zoomTimestamp
public static final NavigatableComponent.SystemOfMeasurement METRIC_SOM
public static final NavigatableComponent.SystemOfMeasurement CHINESE_SOM
public static final NavigatableComponent.SystemOfMeasurement IMPERIAL_SOM
public static final java.util.Map<java.lang.String,NavigatableComponent.SystemOfMeasurement> SYSTEMS_OF_MEASUREMENT
private java.util.LinkedList<NavigatableComponent.CursorInfo> Cursors
Constructor Detail |
---|
public NavigatableComponent()
Method Detail |
---|
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()
protected DataSet getCurrentDataSet()
private EastNorth calculateDefaultCenter()
public static java.lang.String getDistText(double dist)
public java.lang.String getDist100PixelText()
public double getDist100Pixel()
public EastNorth getCenter()
public EastNorth getEastNorth(int x, int y)
x
- X-Pixelposition to get coordinate fromy
- Y-Pixelposition to get coordinate from
public 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 from
public LatLon getLatLon(double x, double y)
public Bounds getLatLonBounds(java.awt.Rectangle r)
r
-
public 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)
public java.awt.geom.Point2D getPoint2D(Node n)
public java.awt.Point getPoint(EastNorth p)
public java.awt.Point getPoint(LatLon latlon)
public java.awt.Point getPoint(Node n)
public void zoomTo(EastNorth newCenter, double newScale)
newCenter
- The center x-value (easting) to zoom to.scale
- The scale to use.private void zoomNoUndoTo(EastNorth newCenter, double newScale)
newCenter
- The center x-value (easting) to zoom to.scale
- The scale to use.public void zoomTo(EastNorth newCenter)
public void zoomTo(LatLon newCenter)
public void smoothScrollTo(LatLon newCenter)
public void smoothScrollTo(EastNorth newCenter)
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)
public void zoomTo(Bounds box)
private void pushZoomUndo(EastNorth center, double scale)
public void zoomPrevious()
public void zoomNext()
public boolean hasZoomUndoEntries()
public boolean hasZoomRedoEntries()
private BBox getBBox(java.awt.Point p, int snapDistance)
private java.util.Map<java.lang.Double,java.util.List<Node>> getNearestNodesImpl(java.awt.Point p, Predicate<OsmPrimitive> predicate)
public final java.util.List<Node> getNearestNodes(java.awt.Point p, java.util.Collection<Node> ignore, 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, 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, Predicate<OsmPrimitive> predicate, boolean use_selected)
p
- the screen pointpredicate
- this parameter imposes a condition on the returned object, e.g.
give the nearest node that is tagged.
public final Node getNearestNode(java.awt.Point p, Predicate<OsmPrimitive> predicate)
getNearestNode(Point, Predicate, boolean)
.
private java.util.Map<java.lang.Double,java.util.List<WaySegment>> getNearestWaySegmentsImpl(java.awt.Point p, Predicate<OsmPrimitive> predicate)
public final java.util.List<WaySegment> getNearestWaySegments(java.awt.Point p, java.util.Collection<WaySegment> ignore, 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, 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, Predicate<OsmPrimitive> predicate, boolean use_selected)
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.
getNearestWaySegments(Point, Collection, Predicate)
public final WaySegment getNearestWaySegment(java.awt.Point p, Predicate<OsmPrimitive> predicate)
getNearestWaySegment(Point, Predicate, boolean)
.
public final java.util.List<Way> getNearestWays(java.awt.Point p, java.util.Collection<Way> ignore, 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, 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, Predicate<OsmPrimitive> predicate)
p
- the point for which to search the nearest segment.predicate
- the returned object has to fulfill certain properties.
#getNearestWaySegment(Point, Collection, Predicate)
public final java.util.List<OsmPrimitive> getNearestNodesOrWays(java.awt.Point p, java.util.Collection<OsmPrimitive> ignore, 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, Predicate<OsmPrimitive> predicate)
p
- The point on screen.predicate
- the returned object has to fulfill certain properties.
#getNearests(Point, Collection, Predicate)
private boolean isPrecedenceNode(Node osm, java.awt.Point p, boolean use_selected)
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 clickeduse_selected
- whether to prefer selected nodes
public final OsmPrimitive getNearestNodeOrWay(java.awt.Point p, Predicate<OsmPrimitive> predicate, boolean use_selected)
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.use_selected
- whether to prefer primitives that are currently selected.
getNearestNode(Point, Predicate)
,
getNearestNodesImpl(Point, Predicate)
,
getNearestWay(Point, Predicate)
public static <T> java.util.Collection<T> asColl(T o)
public static double perDist(java.awt.geom.Point2D pt, java.awt.geom.Point2D a, java.awt.geom.Point2D b)
public static java.awt.geom.Point2D project(java.awt.geom.Point2D pt, java.awt.geom.Point2D a, java.awt.geom.Point2D b)
pt
- point to project onto (ab)a
- root of vectorb
- vector
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
- vector
public final java.util.List<OsmPrimitive> getAllNearest(java.awt.Point p, java.util.Collection<OsmPrimitive> ignore, 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, 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()
helpTopic
in interface Helpful
public int getViewID()
public static NavigatableComponent.SystemOfMeasurement getSystemOfMeasurement()
public void setNewCursor(java.awt.Cursor cursor, java.lang.Object reference)
public void setNewCursor(int cursor, java.lang.Object reference)
public void resetCursor(java.lang.Object reference)
private void stripCursors(java.lang.Object reference)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |