Changeset 2587 in josm
- Timestamp:
- 2009-12-06T14:43:18+01:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r2578 r2587 150 150 if (n.isIncomplete()) return; 151 151 } 152 myWay.set Incomplete(false);152 myWay.setHasIncompleteNodes(false); 153 153 } 154 154 … … 168 168 throw new RuntimeException(tr("Missing merge target for node with id {0}", other.getUniqueId())); 169 169 if (myNode.isIncomplete() || myNode.isDeleted() || !myNode.isVisible()) return; 170 wayloop: for (Way w: OsmPrimitive.getFilteredList(myNode.getReferrers(), Way.class)) { 171 if (w.isDeleted() || ! w.isVisible() || ! w.isIncomplete()) { 172 continue; 173 } 174 for (Node n: w.getNodes()) { 175 if (n.isIncomplete()) { 176 continue wayloop; 170 171 wayloop: 172 for (Way w: OsmPrimitive.getFilteredList(myNode.getReferrers(), Way.class)) { 173 if (w.isDeleted() || ! w.isVisible() || ! w.isIncomplete()) { 174 continue; 177 175 } 178 } 179 // all nodes are complete - set the way complete too 180 w.setIncomplete(false); 181 } 176 for (Node n: w.getNodes()) { 177 if (n.isIncomplete()) { 178 continue wayloop; 179 } 180 } 181 // all nodes are complete - set the way complete too 182 w.setHasIncompleteNodes(false); 183 } 182 184 } 183 185 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2583 r2587 1155 1155 } 1156 1156 1157 //TODO This method should not be necessary, incomplete state should be handled internally by OsmPrimitive 1157 1158 public void setIncomplete(boolean incomplete) { 1158 1159 this.incomplete = incomplete; -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r2578 r2587 26 26 private Node[] nodes = new Node[0]; 27 27 private BBox bbox; 28 private boolean hasIncompleteNodes; 28 29 29 30 /** … … 375 376 bbox = new BBox(this); 376 377 } 378 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; 382 } 383 384 public boolean hasIncompleteNodes() { 385 return hasIncompleteNodes; 386 } 387 388 @Override 389 public boolean isUsable() { 390 return super.isUsable() && !hasIncompleteNodes(); 391 } 377 392 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r2578 r2587 418 418 for (Long externalWayId: ways.keySet()) { 419 419 Way w = (Way)externalIdMap.get("w" + externalWayId); 420 boolean incomplete= false;420 boolean hasIncompleteNodes = false; 421 421 List<Node> wayNodes = new ArrayList<Node>(); 422 422 for (long id : ways.get(externalWayId)) { … … 438 438 ds.addPrimitive(n); 439 439 } 440 incomplete= true;440 hasIncompleteNodes = true; 441 441 } 442 442 wayNodes.add(n); 443 443 } 444 444 w.setNodes(wayNodes); 445 if ( incomplete) {445 if (hasIncompleteNodes) { 446 446 if (logger.isLoggable(Level.FINE)) { 447 447 logger.fine(tr("Marked way {0} with {1} nodes incomplete because at least one node was missing in the " + 448 448 "loaded data and is therefore incomplete too.", externalWayId, w.getNodesCount())); 449 449 } 450 w.set Incomplete(true);450 w.setHasIncompleteNodes(true); 451 451 ds.addPrimitive(w); 452 452 } else { 453 w.set Incomplete(false);453 w.setHasIncompleteNodes(false); 454 454 ds.addPrimitive(w); 455 455 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r2585 r2587 1142 1142 Way w = (Way)target.getPrimitiveById(3, OsmPrimitiveType.WAY); 1143 1143 assertNotNull(w); 1144 assertFalse(w.isIncomplete()); 1144 assertFalse(w.hasIncompleteNodes()); 1145 assertFalse(w.isUsable()); 1145 1146 assertEquals(2, w.getNodesCount()); 1146 1147 assertEquals(1, w.getNode(0).getId());
Note:
See TracChangeset
for help on using the changeset viewer.