Ignore:
Timestamp:
2019-04-04T11:34:48+02:00 (5 years ago)
Author:
GerdP
Message:

see #13538:

  • Add new method isOutSideWorld() to class Node and use the method where LatLon.isOutSideWorld() was used before
  • Add a check in MoveNodeAction to make sure that rounding errors near 180 longitude don't move the node from east to west or vice versa

(I've removed the changes to reactions implemented in 13538-v2.patch, they would be too confusing.)

TODO: Plugins should use the new method in Node

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r14654 r14960  
    403403        return referrers(Way.class).collect(Collectors.toList());
    404404    }
     405
     406    /**
     407     * Determines if this node is outside of the world. See also #13538.
     408     * @return <code>true</code>, if the coordinate is outside the world, compared by using lat/lon and east/north
     409     * @since 14960
     410     */
     411    public boolean isOutSideWorld() {
     412        LatLon ll = getCoor();
     413        if (ll != null) {
     414            if (ll.isOutSideWorld())
     415                return true;
     416            if (!new Node(ll).getEastNorth().equalsEpsilon(getEastNorth(), 1.0)) {
     417                // we get here if a node was moved or created left from -180 or right from +180
     418                return true;
     419            }
     420        }
     421        return false;
     422    }
    405423}
Note: See TracChangeset for help on using the changeset viewer.