Class ImproveWayAccuracyHelper
- java.lang.Object
-
- org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyHelper
-
final class ImproveWayAccuracyHelper extends java.lang.Object
This static class contains functions used to find target way, node to move or segment to divide.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateImproveWayAccuracyHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static booleanensureCandidateIsNotBehindSegments(java.lang.Iterable<Pair<Node,Node>> wpps, Node n, EastNorth pEN, EastNorth nEN)Check to see if a candidate node is underneath a way segmentstatic NodefindCandidateNode(MapView mv, Way w, java.awt.Point p)Returns the nearest node to cursor.static WaySegmentfindCandidateSegment(MapView mv, Way w, java.awt.Point p)Returns the nearest way segment to cursor.static WayfindWay(MapView mv, java.awt.Point p)Finds the way to work on.
-
-
-
Constructor Detail
-
ImproveWayAccuracyHelper
private ImproveWayAccuracyHelper()
-
-
Method Detail
-
findWay
public static Way findWay(MapView mv, java.awt.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:
Wayornullin case there is nothing under the cursor.
-
findCandidateNode
public static Node findCandidateNode(MapView mv, Way w, java.awt.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
-
ensureCandidateIsNotBehindSegments
private static boolean ensureCandidateIsNotBehindSegments(java.lang.Iterable<Pair<Node,Node>> wpps, Node n, EastNorth pEN, EastNorth nEN)
Check to see if a candidate node is underneath a way segment- Parameters:
wpps- The pairs of nodes to check for crossing way segmentsn- The current node to checkpEN- The cursor east-north positionnEN- The node east-north position- Returns:
trueif the candidate node is underneath a way segment
-
findCandidateSegment
public static WaySegment findCandidateSegment(MapView mv, Way w, java.awt.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
-
-