Changeset 2578 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2009-12-05T18:23:03+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2517 r2578 159 159 Collection<OsmPrimitive> o = new LinkedList<OsmPrimitive>(); 160 160 for (OsmPrimitive osm : allPrimitives()) 161 if (osm.isVisible() && !osm.isDeleted() && !osm.i ncomplete) {161 if (osm.isVisible() && !osm.isDeleted() && !osm.isIncomplete()) { 162 162 o.add(osm); 163 163 } … … 168 168 Collection<OsmPrimitive> o = new LinkedList<OsmPrimitive>(); 169 169 for (OsmPrimitive osm : allPrimitives()) 170 if (osm.isVisible() && !osm.isDeleted() && !osm.i ncomplete&& !(osm instanceof Relation)) {170 if (osm.isVisible() && !osm.isDeleted() && !osm.isIncomplete() && !(osm instanceof Relation)) { 171 171 o.add(osm); 172 172 } -
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r2563 r2578 145 145 if (myWay == null) 146 146 throw new RuntimeException(tr("Missing merge target for way with id {0}", other.getUniqueId())); 147 if (!myWay.i ncomplete)return;148 if (myWay.i ncomplete&& other.getNodesCount() == 0) return;147 if (!myWay.isIncomplete())return; 148 if (myWay.isIncomplete() && other.getNodesCount() == 0) return; 149 149 for (Node n: myWay.getNodes()) { 150 if (n.i ncomplete) return;151 } 152 myWay. incomplete = false;150 if (n.isIncomplete()) return; 151 } 152 myWay.setIncomplete(false); 153 153 } 154 154 … … 167 167 if (myNode == null) 168 168 throw new RuntimeException(tr("Missing merge target for node with id {0}", other.getUniqueId())); 169 if (myNode.i ncomplete|| myNode.isDeleted() || !myNode.isVisible()) return;169 if (myNode.isIncomplete() || myNode.isDeleted() || !myNode.isVisible()) return; 170 170 wayloop: for (Way w: OsmPrimitive.getFilteredList(myNode.getReferrers(), Way.class)) { 171 if (w.isDeleted() || ! w.isVisible() || ! w.i ncomplete) {171 if (w.isDeleted() || ! w.isVisible() || ! w.isIncomplete()) { 172 172 continue; 173 173 } 174 174 for (Node n: w.getNodes()) { 175 if (n.i ncomplete) {175 if (n.isIncomplete()) { 176 176 continue wayloop; 177 177 } 178 178 } 179 179 // all nodes are complete - set the way complete too 180 w. incomplete = false;180 w.setIncomplete(false); 181 181 } 182 182 } … … 306 306 // 307 307 conflicts.add(target,source); 308 } else if (target.i ncomplete && !source.incomplete) {308 } else if (target.isIncomplete() && !source.isIncomplete()) { 309 309 // target is incomplete, source completes it 310 310 // => merge source into target … … 312 312 target.mergeFrom(source); 313 313 objectsWithChildrenToMerge.add(source.getPrimitiveId()); 314 } else if (!target.i ncomplete && source.incomplete) {314 } else if (!target.isIncomplete() && source.isIncomplete()) { 315 315 // target is complete and source is incomplete 316 316 // => keep target, it has more information already 317 317 // 318 } else if (target.i ncomplete && source.incomplete) {318 } else if (target.isIncomplete() && source.isIncomplete()) { 319 319 // target and source are incomplete. Doesn't matter which one to 320 320 // take. We take target. -
trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
r2527 r2578 48 48 private void checkCompleteWaysWithIncompleteNodes() { 49 49 for (Way way:dataSet.getWays()) { 50 if (!way.i ncomplete) {50 if (!way.isIncomplete()) { 51 51 for (Node node:way.getNodes()) { 52 if (node.i ncomplete) {52 if (node.isIncomplete()) { 53 53 writer.println(String.format("%s is complete but contains incomplete node '%s'", way, node)); 54 54 } … … 60 60 private void checkCompleteNodesWithoutCoordinates() { 61 61 for (Node node:dataSet.getNodes()) { 62 if (!node.i ncomplete&& (node.getCoor() == null || node.getEastNorth() == null)) {62 if (!node.isIncomplete() && (node.getCoor() == null || node.getEastNorth() == null)) { 63 63 writer.println(String.format("%s is not incomplete but has null coordinates", node)); 64 64 } … … 68 68 private void searchNodes() { 69 69 for (Node n:dataSet.getNodes()) { 70 if (!n.i ncomplete) {70 if (!n.isIncomplete()) { 71 71 LatLon c = n.getCoor(); 72 72 BBox box = new BBox(new LatLon(c.lat() - 0.0001, c.lon() - 0.0001), new LatLon(c.lat() + 0.0001, c.lon() + 0.0001)); … … 80 80 private void searchWays() { 81 81 for (Way w:dataSet.getWays()) { 82 if (!w.i ncomplete&& !dataSet.searchWays(w.getBBox()).contains(w)) {82 if (!w.isIncomplete() && !dataSet.searchWays(w.getBBox()).contains(w)) { 83 83 writer.println(String.format("%s not found using Dataset.searchWays()", w)); 84 84 } -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r2555 r2578 123 123 public void mergeFrom(OsmPrimitive other) { 124 124 super.mergeFrom(other); 125 if (!other.i ncomplete) {125 if (!other.isIncomplete()) { 126 126 setCoor(new LatLon(((Node)other).coor)); 127 127 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2574 r2578 229 229 * and type is known (type is the objects instance class) 230 230 */ 231 p ublicboolean incomplete = false;231 private boolean incomplete = false; 232 232 233 233 /** … … 259 259 } 260 260 this.version = 0; 261 this. incomplete = id > 0;261 this.setIncomplete(id > 0); 262 262 } 263 263 … … 357 357 */ 358 358 public boolean isUsable() { 359 return !isDeleted() && !i ncomplete&& !isDisabled();359 return !isDeleted() && !isIncomplete() && !isDisabled(); 360 360 } 361 361 … … 451 451 this.id = id; 452 452 this.version = version; 453 this. incomplete = false;453 this.setIncomplete(false); 454 454 } 455 455 … … 468 468 this.id = generateUniqueId(); 469 469 this.version = 0; 470 this. incomplete = false;470 this.setIncomplete(false); 471 471 } 472 472 … … 913 913 timestamp = osm.timestamp; 914 914 version = osm.version; 915 incomplete = osm.incomplete;915 setIncomplete(osm.isIncomplete()); 916 916 flags = osm.flags; 917 917 user= osm.user; … … 940 940 timestamp = other.timestamp; 941 941 version = other.version; 942 incomplete = other.incomplete;942 setIncomplete(other.isIncomplete()); 943 943 flags = other.flags; 944 944 user= other.user; … … 960 960 if (!isNew() && id != other.id) 961 961 return false; 962 if (i ncomplete && ! other.incomplete || !incomplete && other.incomplete)962 if (isIncomplete() && ! other.isIncomplete() || !isIncomplete() && other.isIncomplete()) 963 963 return false; 964 964 // can't do an equals check on the internal keys array because it is not ordered … … 1151 1151 return new SimplePrimitiveId(getUniqueId(), getType()); 1152 1152 } 1153 1154 public void setIncomplete(boolean incomplete) { 1155 this.incomplete = incomplete; 1156 } 1157 1158 public boolean isIncomplete() { 1159 return incomplete; 1160 } 1153 1161 } -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r2555 r2578 243 243 244 244 public RelationMember firstMember() { 245 if (i ncomplete) return null;245 if (isIncomplete()) return null; 246 246 return (members.size() == 0) ? null : members.get(0); 247 247 } 248 248 public RelationMember lastMember() { 249 if (i ncomplete) return null;249 if (isIncomplete()) return null; 250 250 return (members.size() == 0) ? null : members.get(members.size() -1); 251 251 } -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r2555 r2578 116 116 public ArrayList<Pair<Node,Node>> getNodePairs(boolean sort) { 117 117 ArrayList<Pair<Node,Node>> chunkSet = new ArrayList<Pair<Node,Node>>(); 118 if (i ncomplete) return chunkSet;118 if (isIncomplete()) return chunkSet; 119 119 Node lastN = null; 120 120 for (Node n : this.nodes) { … … 219 219 220 220 @Override public String toString() { 221 String nodesDesc = i ncomplete?"(incomplete)":"nodes=" + Arrays.toString(nodes);221 String nodesDesc = isIncomplete()?"(incomplete)":"nodes=" + Arrays.toString(nodes); 222 222 return "{Way id=" + getUniqueId() + " version=" + getVersion()+ " " + getFlagsAsString() + " " + nodesDesc + "}"; 223 223 } … … 245 245 246 246 public void removeNode(Node n) { 247 if (i ncomplete) return;247 if (isIncomplete()) return; 248 248 boolean closed = (lastNode() == n && firstNode() == n); 249 249 int i; … … 262 262 263 263 public void removeNodes(Collection<? extends OsmPrimitive> selection) { 264 if (i ncomplete) return;264 if (isIncomplete()) return; 265 265 for(OsmPrimitive p : selection) { 266 266 if (p instanceof Node) { … … 279 279 public void addNode(Node n) throws IllegalStateException { 280 280 if (n==null) return; 281 if (i ncomplete)281 if (isIncomplete()) 282 282 throw new IllegalStateException(tr("Cannot add node {0} to incomplete way {1}.", n.getId(), getId())); 283 283 clearCached(); … … 301 301 public void addNode(int offs, Node n) throws IllegalStateException, IndexOutOfBoundsException { 302 302 if (n==null) return; 303 if (i ncomplete)303 if (isIncomplete()) 304 304 throw new IllegalStateException(tr("Cannot add node {0} to incomplete way {1}.", n.getId(), getId())); 305 305 clearCached(); … … 327 327 328 328 public boolean isClosed() { 329 if (i ncomplete) return false;329 if (isIncomplete()) return false; 330 330 return nodes.length >= 3 && lastNode() == firstNode(); 331 331 } 332 332 333 333 public Node lastNode() { 334 if (i ncomplete|| nodes.length == 0) return null;334 if (isIncomplete() || nodes.length == 0) return null; 335 335 return nodes[nodes.length-1]; 336 336 } 337 337 338 338 public Node firstNode() { 339 if (i ncomplete|| nodes.length == 0) return null;339 if (isIncomplete() || nodes.length == 0) return null; 340 340 return nodes[0]; 341 341 } 342 342 343 343 public boolean isFirstLastNode(Node n) { 344 if (i ncomplete|| nodes.length == 0) return false;344 if (isIncomplete() || nodes.length == 0) return false; 345 345 return n == firstNode() || n == lastNode(); 346 346 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/AllNodesVisitor.java
r1946 r2578 34 34 */ 35 35 public void visit(Way w) { 36 if (w.i ncomplete) return;36 if (w.isIncomplete()) return; 37 37 for (Node n : w.getNodes()) 38 38 visit(n); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
r2572 r2578 28 28 29 29 public void visit(Way w) { 30 if (w.i ncomplete) return;30 if (w.isIncomplete()) return; 31 31 for (Node n : w.getNodes()) 32 32 visit(n); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r2526 r2578 563 563 putError(r, tr("Deleted member ''{0}'' in relation.", 564 564 m.getMember().getDisplayName(DefaultNameFormatter.getInstance())), true); 565 } else if(m.getMember().i ncomplete)565 } else if(m.getMember().isIncomplete()) 566 566 return; 567 567 else … … 922 922 putError(r, tr("Deleted member ''{0}'' in relation.", 923 923 m.getMember().getDisplayName(DefaultNameFormatter.getInstance())), true); 924 } else if(m.getMember().i ncomplete) {924 } else if(m.getMember().isIncomplete()) { 925 925 incomplete = true; 926 926 } else { … … 1383 1383 boolean drawable(OsmPrimitive osm) 1384 1384 { 1385 return !osm.isDeleted() && !osm.isFiltered() && !osm.i ncomplete;1385 return !osm.isDeleted() && !osm.isFiltered() && !osm.isIncomplete(); 1386 1386 } 1387 1387 … … 1545 1545 //profilerN = 0; 1546 1546 for (final OsmPrimitive osm : data.getSelected()) { 1547 if (!osm.i ncomplete&& !osm.isDeleted() && !(osm instanceof Node)1547 if (!osm.isIncomplete() && !osm.isDeleted() && !(osm instanceof Node) 1548 1548 && osm.mappaintDrawnCode != paintid 1549 1549 ) { … … 1584 1584 //profilerN = 0; 1585 1585 for (final Node osm: data.searchNodes(bbox)) { 1586 if (!osm.i ncomplete&& !osm.isDeleted() && (data.isSelected(osm) || !osm.isFiltered())1586 if (!osm.isIncomplete() && !osm.isDeleted() && (data.isSelected(osm) || !osm.isFiltered()) 1587 1587 && osm.mappaintDrawnCode != paintid) 1588 1588 { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java
r2512 r2578 130 130 return; 131 131 Node clone = new Node(n); 132 clone. incomplete = true;132 clone.setIncomplete(true); 133 133 mappedPrimitives.put(n, clone); 134 134 } … … 139 139 Way clone = new Way(w); 140 140 clone.setNodes(null); 141 clone. incomplete = true;141 clone.setIncomplete(true); 142 142 mappedPrimitives.put(w, clone); 143 143 } … … 152 152 } 153 153 clone.setMembers(null); 154 clone. incomplete = true;154 clone.setIncomplete(true); 155 155 if (! isAlreadyRemembered(r)) { 156 156 mappedPrimitives.put(r, clone); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r2468 r2578 249 249 */ 250 250 public void visit(Node n) { 251 if (n.i ncomplete) return;251 if (n.isIncomplete()) return; 252 252 253 253 if (inactive || n.isDisabled()) { … … 301 301 */ 302 302 public void visit(Way w) { 303 if (w.i ncomplete|| w.getNodesCount() < 2)303 if (w.isIncomplete() || w.getNodesCount() < 2) 304 304 return; 305 305 … … 344 344 4, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL); 345 345 public void visit(Relation r) { 346 if (r.i ncomplete) return;346 if (r.isIncomplete()) return; 347 347 348 348 Color col; … … 357 357 358 358 for (RelationMember m : r.getMembers()) { 359 if (m.getMember().i ncomplete|| m.getMember().isDeleted()) {359 if (m.getMember().isIncomplete() || m.getMember().isDeleted()) { 360 360 continue; 361 361 } … … 374 374 boolean first = true; 375 375 for (Node n : m.getWay().getNodes()) { 376 if (n.i ncomplete|| n.isDeleted()) {376 if (n.isIncomplete() || n.isDeleted()) { 377 377 continue; 378 378 }
Note:
See TracChangeset
for help on using the changeset viewer.