Changeset 3698 in josm for trunk/src/org
- Timestamp:
- 2010-12-05T16:27:41+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java
r3671 r3698 6 6 import java.awt.geom.Area; 7 7 import java.util.ArrayList; 8 import java.util.Collection; 8 9 import java.util.Collections; 9 10 import java.util.LinkedList; … … 107 108 } 108 109 110 // To avoid false positives on upload (only modified primitives 111 // are visited), we have to check possible connection to ways 112 // that are not in the set of validated primitives. 113 if (headWays == 0) { 114 Collection<OsmPrimitive> refs = head.getReferrers(); 115 for (OsmPrimitive ref : refs) { 116 if (ref != c1 && isCoastline(ref)) { 117 // ref cannot be in <code>coastlines</code>, otherwise we would 118 // have picked it up already 119 headWays++; 120 next = (Way) ref; 121 122 if (head.equals(next.firstNode())) { 123 headReversed = true; 124 } else if (!head.equals(next.lastNode())) { 125 headUnordered = true; 126 } 127 } 128 } 129 } 130 if (tailWays == 0) { 131 Collection<OsmPrimitive> refs = tail.getReferrers(); 132 for (OsmPrimitive ref : refs) { 133 if (ref != c1 && isCoastline(ref)) { 134 tailWays++; 135 prev = (Way) ref; 136 137 if (tail.equals(prev.lastNode())) { 138 tailReversed = true; 139 } else if (!tail.equals(prev.firstNode())) { 140 tailUnordered = true; 141 } 142 } 143 } 144 } 145 109 146 List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>(); 110 147 primitives.add(c1); … … 130 167 131 168 boolean unordered = false; 132 boolean reversed = false; 133 134 if (headWays == 1 && headReversed && tailWays == 1 && tailReversed) { 135 reversed = true; 136 } 169 boolean reversed = headWays == 1 && headReversed && tailWays == 1 && tailReversed; 137 170 138 171 if (headWays > 1 || tailWays > 1) { … … 177 210 return; 178 211 179 String natural = way.get("natural"); 180 if (natural == null || !natural.equals("coastline")) 181 return; 182 183 coastlines.add(way); 212 if (isCoastline(way)) { 213 coastlines.add(way); 214 } 215 } 216 217 private static boolean isCoastline(OsmPrimitive osm) { 218 return osm instanceof Way && "coastline".equals(osm.get("natural")); 184 219 } 185 220
Note:
See TracChangeset
for help on using the changeset viewer.