Class ImproveWayAccuracyHelper


  • final class ImproveWayAccuracyHelper
    extends Object
    This static class contains functions used to find target way, node to move or segment to divide.
    • 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 view
        p - the cursor position
        Returns:
        Way or null 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 view
        w - the way to check
        p - 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 view
        w - the way to check
        p - the cursor position
        Returns:
        nearest way segment to cursor