Changeset 5490 in josm for trunk/src/org
- Timestamp:
- 2012-09-01T19:01:03+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r5408 r5490 471 471 return nodes.length >= 3 && nodes[nodes.length-1] == nodes[0]; 472 472 } 473 474 /** 475 * Determines if this way denotes an area (closed way with at least three distinct nodes). 476 * @return {@code true} if this way is closed and contains at least three distinct nodes 477 * @see #isClosed 478 * @since 5490 479 */ 480 public boolean isArea() { 481 if (this.nodes.length >= 4 && isClosed()) { 482 Node distinctNode = null; 483 for (int i=1; i<nodes.length-1; i++) { 484 if (distinctNode == null && nodes[i] != nodes[0]) { 485 distinctNode = nodes[i]; 486 } else if (distinctNode != null && nodes[i] != nodes[0] && nodes[i] != distinctNode) { 487 return true; 488 } 489 } 490 } 491 return false; 492 } 473 493 474 494 /** … … 627 647 if (lastN != null) { 628 648 LatLon lastNcoor = lastN.getCoor(); 629 649 LatLon coor = n.getCoor(); 630 650 if (lastNcoor != null && coor != null) { 631 651 length += coor.greatCircleDistance(lastNcoor); -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
r5488 r5490 177 177 } 178 178 wNodesToUse.add(wNodes.get(lowestIndex)); 179 } else { 180 wNodesToUse.addAll(wNodes); 179 181 } 180 182 // Build the list of lat/lon -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r5012 r5490 116 116 @Override 117 117 public void visit(Way w) { 118 if (!w.is Closed() && ElemStyles.hasAreaElemStyle(w, false)) {118 if (!w.isArea() && ElemStyles.hasAreaElemStyle(w, false)) { 119 119 List<Node> nodes = w.getNodes(); 120 120 if (nodes.size()<1) return; // fix zero nodes bug -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingAreas.java
r5269 r5490 27 27 @Override 28 28 public void visit(Way w) { 29 if (w.isUsable() && w.is Closed() && ElemStyles.hasAreaElemStyle(w, false)) {29 if (w.isUsable() && w.isArea() && ElemStyles.hasAreaElemStyle(w, false)) { 30 30 index.add(w); 31 31 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java
r4806 r5490 107 107 } 108 108 109 if (type != null && !w.is Closed()) {109 if (type != null && !w.isArea()) { 110 110 for (OsmPrimitive parent: w.getReferrers()) { 111 111 if (parent instanceof Relation && ((Relation)parent).isMultipolygon())
Note:
See TracChangeset
for help on using the changeset viewer.