Class ImproveWayAccuracyHelper
- java.lang.Object
-
- org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyHelper
-
final class ImproveWayAccuracyHelper extends Object
This static class contains functions used to find target way, node to move or segment to divide.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ImproveWayAccuracyHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Node
findCandidateNode(MapView mv, Way w, Point p)
Returns the nearest node to cursor.static WaySegment
findCandidateSegment(MapView mv, Way w, Point p)
Returns the nearest way segment to cursor.static Way
findWay(MapView mv, Point p)
Finds the way to work on.
-
-
-
Constructor Detail
-
ImproveWayAccuracyHelper
private ImproveWayAccuracyHelper()
-
-
Method Detail
-
findWay
public static Way findWay(MapView mv, Point p)
Finds the way to work on. If the mouse is on the node, extracts one of the ways containing it. If the mouse is on the way, simply returns it.- Parameters:
mv
- the current map viewp
- the cursor position- Returns:
Way
ornull
in case there is nothing under the cursor.
-
findCandidateNode
public static Node findCandidateNode(MapView mv, Way w, Point p)
Returns the nearest node to cursor. All nodes that are “behind” segments are neglected. This is to avoid way self-intersection after moving the candidateNode to a new place.- Parameters:
mv
- the current map vieww
- the way to checkp
- the cursor position- Returns:
- nearest node to cursor
-
findCandidateSegment
public static WaySegment findCandidateSegment(MapView mv, Way w, Point p)
Returns the nearest way segment to cursor. The distance to segment ab is the length of altitude from p to ab (say, c) or the minimum distance from p to a or b if c is out of ab. The priority is given to segments where c is in ab. Otherwise, a segment with the largest angle apb is chosen.- Parameters:
mv
- the current map vieww
- the way to checkp
- the cursor position- Returns:
- nearest way segment to cursor
-
-