Changeset 4053 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-04-21T00:05:17+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r3943 r4053 58 58 this.nodes = nodes.toArray(new Node[nodes.size()]); 59 59 } 60 for (Node node: this.nodes) {60 for (Node node: this.nodes) { 61 61 node.addReferrer(this); 62 62 } … … 67 67 writeUnlock(locked); 68 68 } 69 } 70 71 /** 72 * Prevent directly following identical nodes in ways. 73 */ 74 private List<Node> removeDouble(List<Node> nodes) { 75 Node last = null; 76 int count = nodes.size(); 77 for(int i = 0; i < count && count > 2; ++i) { 78 Node n = nodes.get(i); 79 if(last == n) { 80 nodes.remove(i); 81 --count; 82 } 83 last = n; 84 } 85 return nodes; 69 86 } 70 87 … … 278 295 copy.remove(i-1); 279 296 } 280 setNodes( copy);297 setNodes(removeDouble(copy)); 281 298 } finally { 282 299 writeUnlock(locked); … … 303 320 copy.remove(i-1); 304 321 } 305 setNodes( copy);322 setNodes(removeDouble(copy)); 306 323 } finally { 307 324 writeUnlock(locked);
Note:
See TracChangeset
for help on using the changeset viewer.