Changeset 6841 in josm
 Timestamp:
 20140212T00:55:05+01:00 (9 years ago)
 Location:
 trunk/src/org/openstreetmap/josm
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/data/osm/MultipolygonCreate.java
r6093 r6841 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.geom.Area; 6 7 import java.util.ArrayList; 7 8 import java.util.Collection; … … 26 27 public final List<Boolean> reversed; 27 28 public final List<Node> nodes; 29 public final Area area; 28 30 29 31 public JoinedPolygon(List<Way> ways, List<Boolean> reversed) { … … 31 33 this.reversed = reversed; 32 34 this.nodes = this.getNodes(); 35 this.area = Geometry.getArea(nodes); 33 36 } 34 37 … … 38 41 */ 39 42 public JoinedPolygon(Way way) { 40 this.ways = Collections.singletonList(way); 41 this.reversed = Collections.singletonList(Boolean.FALSE); 42 this.nodes = this.getNodes(); 43 } 44 43 this(Collections.singletonList(way), Collections.singletonList(Boolean.FALSE)); 44 } 45 45 46 46 /** … … 233 233 } 234 234 235 PolygonIntersection intersection = Geometry.polygonIntersection(outerWay. nodes, innerWay.nodes);235 PolygonIntersection intersection = Geometry.polygonIntersection(outerWay.area, innerWay.area); 236 236 237 237 if (intersection == PolygonIntersection.FIRST_INSIDE_SECOND) { 
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r6830 r6841 441 441 } 442 442 443 private static Area getArea(List<Node> polygon) { 443 /** 444 * Returns the Area of a polygon, from its list of nodes. 445 * @param polygon List of nodes forming polygon 446 * @return Area for the given list of nodes 447 * @since 6841 448 */ 449 public static Area getArea(List<Node> polygon) { 444 450 Path2D path = new Path2D.Double(); 445 451 … … 462 468 /** 463 469 * Tests if two polygons intersect. 464 * @param first 465 * @param second 470 * @param first List of nodes forming first polygon 471 * @param second List of nodes forming second polygon 466 472 * @return intersection kind 467 473 */ 468 474 public static PolygonIntersection polygonIntersection(List<Node> first, List<Node> second) { 469 470 475 Area a1 = getArea(first); 471 476 Area a2 = getArea(second); 477 return polygonIntersection(a1, a2); 478 } 479 480 /** 481 * Tests if two polygons intersect. 482 * @param a1 Area of first polygon 483 * @param a2 Area of second polygon 484 * @return intersection kind 485 * @since 6841 486 */ 487 public static PolygonIntersection polygonIntersection(Area a1, Area a2) { 472 488 473 489 Area inter = new Area(a1);
Note: See TracChangeset
for help on using the changeset viewer.