Changeset 6580 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2013-12-31T14:35:34+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java
r6380 r6580 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import java.awt.geom.Line2D; 3 5 4 6 /** … … 63 65 return equals(o) ? 0 : toWay().compareTo(o.toWay()); 64 66 } 67 68 /** 69 * Checks whether this segment crosses other segment 70 * 71 * @param s2 The other segment 72 * @return true if both segments crosses 73 */ 74 public boolean intersects(WaySegment s2) { 75 if (getFirstNode().equals(s2.getFirstNode()) || getSecondNode().equals(s2.getSecondNode()) || 76 getFirstNode().equals(s2.getSecondNode()) || getSecondNode().equals(s2.getFirstNode())) 77 return false; 78 79 return Line2D.linesIntersect( 80 getFirstNode().getEastNorth().east(), getFirstNode().getEastNorth().north(), 81 getSecondNode().getEastNorth().east(), getSecondNode().getEastNorth().north(), 82 s2.getFirstNode().getEastNorth().east(), s2.getFirstNode().getEastNorth().north(), 83 s2.getSecondNode().getEastNorth().east(), s2.getSecondNode().getEastNorth().north()); 84 } 65 85 }
Note:
See TracChangeset
for help on using the changeset viewer.