Changeset 2591 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-12-06T20:26:21+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r2589 r2591 145 145 if (myWay == null) 146 146 throw new RuntimeException(tr("Missing merge target for way with id {0}", other.getUniqueId())); 147 if (!myWay.isIncomplete() || other.getNodesCount() == 0) return; 148 for (Node n: myWay.getNodes()) { 149 if (n.isIncomplete()) return; 150 } 151 myWay.setHasIncompleteNodes(false); 147 myWay.setHasIncompleteNodes(); 152 148 } 153 149 … … 168 164 if (myNode.isIncomplete() || myNode.isDeleted() || !myNode.isVisible()) return; 169 165 170 wayloop: 171 for (Way w: OsmPrimitive.getFilteredList(myNode.getReferrers(), Way.class)) { 172 if (w.isDeleted() || ! w.isVisible() || ! w.isIncomplete()) { 173 continue; 174 } 175 for (Node n: w.getNodes()) { 176 if (n.isIncomplete()) { 177 continue wayloop; 178 } 179 } 180 // all nodes are complete - set the way complete too 181 w.setHasIncompleteNodes(false); 182 } 166 for (Way w: OsmPrimitive.getFilteredList(myNode.getReferrers(), Way.class)) { 167 w.setHasIncompleteNodes(); 168 } 183 169 } 184 170 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2587 r2591 1119 1119 StringBuilder builder = new StringBuilder(); 1120 1120 1121 if (isIncomplete()) { 1122 builder.append("I"); 1123 } 1121 1124 if (isModified()) { 1122 1125 builder.append("M"); -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r2587 r2591 378 378 379 379 //TODO This method should not be necessary. hasIncomplete state should be updated automatically when incomplete state of nodes change 380 public void setHasIncompleteNodes(boolean hasIncompleteNodes) { 381 this.hasIncompleteNodes = hasIncompleteNodes; 380 public void setHasIncompleteNodes() { 381 hasIncompleteNodes = false; 382 for (Node node:getNodes()) { 383 if (node.isIncomplete()) { 384 hasIncompleteNodes = true; 385 break; 386 } 387 } 382 388 } 383 389 -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r2587 r2591 418 418 for (Long externalWayId: ways.keySet()) { 419 419 Way w = (Way)externalIdMap.get("w" + externalWayId); 420 boolean hasIncompleteNodes = false;421 420 List<Node> wayNodes = new ArrayList<Node>(); 422 421 for (long id : ways.get(externalWayId)) { … … 438 437 ds.addPrimitive(n); 439 438 } 440 hasIncompleteNodes = true;441 439 } 442 440 wayNodes.add(n); 443 441 } 444 442 w.setNodes(wayNodes); 445 if (hasIncompleteNodes) { 443 w.setHasIncompleteNodes(); 444 if (w.hasIncompleteNodes()) { 446 445 if (logger.isLoggable(Level.FINE)) { 447 446 logger.fine(tr("Marked way {0} with {1} nodes incomplete because at least one node was missing in the " + 448 447 "loaded data and is therefore incomplete too.", externalWayId, w.getNodesCount())); 449 448 } 450 w.setHasIncompleteNodes(true);451 449 ds.addPrimitive(w); 452 450 } else { 453 w.setHasIncompleteNodes(false);454 451 ds.addPrimitive(w); 455 452 }
Note:
See TracChangeset
for help on using the changeset viewer.