Changeset 2578 in josm for trunk/src/org
- Timestamp:
- 2009-12-05T18:23:03+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r2575 r2578 29 29 30 30 import org.openstreetmap.josm.Main; 31 import org.openstreetmap.josm.actions.CombineWayAction;32 import org.openstreetmap.josm.actions.JosmAction;33 import org.openstreetmap.josm.actions.ReverseWayAction;34 import org.openstreetmap.josm.actions.SplitWayAction;35 31 import org.openstreetmap.josm.command.AddCommand; 36 32 import org.openstreetmap.josm.command.ChangeCommand; … … 75 71 if(this.pos == o.pos) 76 72 return (this.dis - o.dis) > 0 ? 1 : -1; 77 return this.pos - o.pos;78 } 79 } ;73 return this.pos - o.pos; 74 } 75 } 80 76 81 77 // HelperClass 82 78 // Saves a relation and a role an OsmPrimitve was part of until it was stripped from all relations 83 79 private class RelationRole { 84 public Relation rel;85 public String role;80 public final Relation rel; 81 public final String role; 86 82 public RelationRole(Relation rel, String role) { 87 83 this.rel = rel; 88 84 this.role = role; 85 } 86 87 @Override 88 public int hashCode() { 89 return rel.hashCode(); 89 90 } 90 91 … … 100 101 public JoinAreasAction() { 101 102 super(tr("Join overlapping Areas"), "joinareas", tr("Joins areas that overlap each other"), Shortcut.registerShortcut("tools:joinareas", tr("Tool: {0}", tr("Join overlapping Areas")), 102 KeyEvent.VK_J, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);103 KeyEvent.VK_J, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true); 103 104 } 104 105 … … 116 117 OsmDataLayer dataLayer = Main.map.mapView.getEditLayer(); 117 118 for (DataSource ds : dataLayer.data.dataSources) { 118 if (ds.bounds != null) 119 if (ds.bounds != null) { 119 120 bounds.add(ds.bounds); 121 } 120 122 } 121 123 … … 137 139 // This is copied from SimplifyAction and should be probably ported to tools 138 140 for (Node node : way.getNodes()) { 139 if(askedAlready) break; 141 if(askedAlready) { 142 break; 143 } 140 144 boolean isInsideOneBoundingBox = false; 141 145 for (Bounds b : bounds) { … … 151 155 + "This can lead to nodes being deleted accidentally.\n" 152 156 + "Are you really sure to continue?"), 153 tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION,154 JOptionPane.WARNING_MESSAGE);157 tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION, 158 JOptionPane.WARNING_MESSAGE); 155 159 156 160 if (option != JOptionPane.YES_OPTION) return; … … 173 177 DataSet ds = Main.main.getCurrentDataSet(); 174 178 ds.fireSelectionChanged(); 175 } else 179 } else { 176 180 JOptionPane.showMessageDialog(Main.parent, tr("No intersection found. Nothing was changed.")); 181 } 177 182 } 178 183 … … 199 204 // Remove ways from all relations so ways can be combined/split quietly 200 205 ArrayList<RelationRole> relations = removeFromRelations(a); 201 if(!same) relations.addAll(removeFromRelations(b)); 206 if(!same) { 207 relations.addAll(removeFromRelations(b)); 208 } 202 209 203 210 // Don't warn now, because it will really look corrupted … … 217 224 218 225 // Delete the remaining inner ways 219 if(innerWays != null && innerWays.size() > 0) 226 if(innerWays != null && innerWays.size() > 0) { 220 227 cmds.add(DeleteCommand.delete(Main.map.mapView.getEditLayer(), innerWays, true)); 228 } 221 229 commitCommands(marktr("Delete Ways that are not part of an inner multipolygon")); 222 230 … … 228 236 stripTags(newInnerWays); 229 237 makeCommitsOneAction( 230 same238 same 231 239 ? marktr("Joined self-overlapping area") 232 : marktr("Joined overlapping areas")240 : marktr("Joined overlapping areas") 233 241 ); 234 242 235 if(warnAboutRelations) 243 if(warnAboutRelations) { 236 244 JOptionPane.showMessageDialog(Main.parent, tr("Some of the ways were part of relations that have been modified. Please verify no errors have been introduced.")); 245 } 237 246 238 247 return true; … … 254 263 for (Way w : ways) { 255 264 for (Entry<String,String> e : w.entrySet()) { 256 if (!props.containsKey(e.getKey())) 265 if (!props.containsKey(e.getKey())) { 257 266 props.put(e.getKey(), new TreeSet<String>()); 267 } 258 268 props.get(e.getKey()).add(e.getValue()); 259 269 } … … 338 348 continue; 339 349 } else 340 if(a.getNode(i).equals(b.getNode(j+1)) || a.getNode(i+1).equals(b.getNode(j+1))) {341 nodes.add(b.getNode(j+1));342 continue;343 }350 if(a.getNode(i).equals(b.getNode(j+1)) || a.getNode(i+1).equals(b.getNode(j+1))) { 351 nodes.add(b.getNode(j+1)); 352 continue; 353 } 344 354 LatLon intersection = getLineLineIntersection( 345 355 a.getNode(i) .getEastNorth().east(), a.getNode(i) .getEastNorth().north(), … … 347 357 b.getNode(j) .getEastNorth().east(), b.getNode(j) .getEastNorth().north(), 348 358 b.getNode(j+1).getEastNorth().east(), b.getNode(j+1).getEastNorth().north()); 349 if(intersection == null) continue; 359 if(intersection == null) { 360 continue; 361 } 350 362 351 363 // Create the node. Adding them to the ways must be delayed because we still loop over them … … 355 367 // The distance is needed to sort and add the nodes in direction of the way 356 368 nodesA.add(new NodeToSegs(i, n, a.getNode(i).getCoor())); 357 if(same) 369 if(same) { 358 370 nodesA.add(new NodeToSegs(j, n, a.getNode(j).getCoor())); 359 else371 } else { 360 372 nodesB.add(new NodeToSegs(j, n, b.getNode(j).getCoor())); 373 } 361 374 } 362 375 } 363 376 364 377 addNodesToWay(a, nodesA); 365 if(!same) addNodesToWay(b, nodesB); 378 if(!same) { 379 addNodesToWay(b, nodesB); 380 } 366 381 367 382 return nodes; … … 373 388 */ 374 389 static private LatLon getLineLineIntersection( 375 376 390 double x1, double y1, double x2, double y2, 391 double x3, double y3, double x4, double y4) { 377 392 378 393 if (!Line2D.linesIntersect(x1, y1, x2, y2, x3, y3, x4, y4)) return null; … … 392 407 393 408 return Main.proj.eastNorth2latlon(new EastNorth( 394 (b1*c2 - b2*c1)/det,395 (a2*c1 -a1*c2)/det409 (b1*c2 - b2*c1)/det, 410 (a2*c1 -a1*c2)/det 396 411 )); 397 412 } … … 421 436 private void commitCommands(String description) { 422 437 switch(cmds.size()) { 423 424 425 426 427 428 429 430 431 438 case 0: 439 return; 440 case 1: 441 Main.main.undoRedo.add(cmds.getFirst()); 442 break; 443 default: 444 Command c = new SequenceCommand(tr(description), cmds); 445 Main.main.undoRedo.add(c); 446 break; 432 447 } 433 448 … … 444 459 ArrayList<RelationRole> result = new ArrayList<RelationRole>(); 445 460 for (Relation r : Main.main.getCurrentDataSet().getRelations()) { 446 if (r.isDeleted() || r.incomplete) continue; 461 if (r.isDeleted() || r.isIncomplete()) { 462 continue; 463 } 447 464 for (RelationMember rm : r.getMembers()) { 448 if (rm.getMember() != osm) continue; 465 if (rm.getMember() != osm) { 466 continue; 467 } 449 468 450 469 Relation newRel = new Relation(r); … … 455 474 cmds.add(new ChangeCommand(r, newRel)); 456 475 RelationRole saverel = new RelationRole(r, rm.getRole()); 457 if(!result.contains(saverel)) result.add(saverel); 476 if(!result.contains(saverel)) { 477 result.add(saverel); 478 } 458 479 break; 459 480 } … … 471 492 ArrayList<Way> ways = new ArrayList<Way>(); 472 493 ways.add(a); 473 if(!a.equals(b)) ways.add(b); 494 if(!a.equals(b)) { 495 ways.add(b); 496 } 474 497 475 498 List<OsmPrimitive> affected = new ArrayList<OsmPrimitive>(); … … 493 516 Collection<Way> result = new ArrayList<Way>(); 494 517 for(OsmPrimitive w: ways) { 495 if(w instanceof Way) result.add((Way) w); 518 if(w instanceof Way) { 519 result.add((Way) w); 520 } 496 521 } 497 522 return result; … … 505 530 private Collection<Node> getNodesFromWays(Collection<Way> ways) { 506 531 Collection<Node> allNodes = new ArrayList<Node>(); 507 for(Way w: ways) allNodes.addAll(w.getNodes()); 532 for(Way w: ways) { 533 allNodes.addAll(w.getNodes()); 534 } 508 535 return allNodes; 509 536 } … … 521 548 for(Way w: multigonWays) { 522 549 Polygon poly = new Polygon(); 523 for(Node n: (w).getNodes()) poly.addPoint(latlonToXY(n.getCoor().lat()), latlonToXY(n.getCoor().lon())); 550 for(Node n: (w).getNodes()) { 551 poly.addPoint(latlonToXY(n.getCoor().lat()), latlonToXY(n.getCoor().lon())); 552 } 524 553 525 554 for(Node n: multigonNodes) { … … 546 575 private void getWaysByNode(Collection<Way> innerWays, Collection<Way> w, Node n) { 547 576 for(Way way : w) { 548 if(!(way).containsNode(n)) continue; 549 if(!innerWays.contains(way)) innerWays.add(way); // Will need this later for multigons 577 if(!(way).containsNode(n)) { 578 continue; 579 } 580 if(!innerWays.contains(way)) { 581 innerWays.add(way); // Will need this later for multigons 582 } 550 583 } 551 584 } … … 561 594 for(Way w: multigonWays) { 562 595 // Skip inner ways 563 if(innerWays.contains(w)) continue; 564 565 if(w.getNodesCount() <= 2) 596 if(innerWays.contains(w)) { 597 continue; 598 } 599 600 if(w.getNodesCount() <= 2) { 566 601 cmds.add(new DeleteCommand(w)); 567 else602 } else { 568 603 join.add(w); 604 } 569 605 } 570 606 … … 606 642 } 607 643 if(a.getNode(0).equals(b.getNode(0)) || 608 a.getNode(a.getNodesCount()-1).equals(b.getNode(b.getNodesCount()-1))) {644 a.getNode(a.getNodesCount()-1).equals(b.getNode(b.getNodesCount()-1))) { 609 645 Main.main.getCurrentDataSet().setSelected(b); 610 646 new ReverseWayAction().actionPerformed(null); … … 644 680 boolean hasInnerNodes = false; 645 681 for(Node n : w.getNodes()) { 646 if(outerNodes.contains(n)) continue wayIterator; 647 if(!hasInnerNodes && innerNodes.contains(n)) hasInnerNodes = true; 648 } 649 if(!hasInnerNodes || w.getNodesCount() < 2) continue; 682 if(outerNodes.contains(n)) { 683 continue wayIterator; 684 } 685 if(!hasInnerNodes && innerNodes.contains(n)) { 686 hasInnerNodes = true; 687 } 688 } 689 if(!hasInnerNodes || w.getNodesCount() < 2) { 690 continue; 691 } 650 692 possibleWays.add(w); 651 693 } … … 671 713 for(Way w2 : possibleWays) { 672 714 // w2 cannot be closed, otherwise it would have been removed above 673 if(!waysCanBeCombined(w1, w2)) continue; 715 if(!waysCanBeCombined(w1, w2)) { 716 continue; 717 } 674 718 675 719 ArrayList<Way> joinThem = new ArrayList<Way>(); … … 719 763 List<Way> removables = new ArrayList<Way>(); 720 764 for(Way a : ways) { 721 if(a.isClosed()) continue; 765 if(a.isClosed()) { 766 continue; 767 } 722 768 boolean connectedStart = false; 723 769 boolean connectedEnd = false; 724 770 for(Way b : ways) { 725 if(a.equals(b)) 771 if(a.equals(b)) { 726 772 continue; 727 if(b.isFirstLastNode(a.firstNode())) 773 } 774 if(b.isFirstLastNode(a.firstNode())) { 728 775 connectedStart = true; 729 if(b.isFirstLastNode(a.lastNode())) 776 } 777 if(b.isFirstLastNode(a.lastNode())) { 730 778 connectedEnd = true; 731 } 732 if(!connectedStart || !connectedEnd) 779 } 780 } 781 if(!connectedStart || !connectedEnd) { 733 782 removables.add(a); 783 } 734 784 } 735 785 ways.removeAll(removables); … … 749 799 for(Node n : w.getNodes()) { 750 800 x.removeNode(n); 751 if(x.containsNode(n)) count++; 801 if(x.containsNode(n)) { 802 count++; 803 } 752 804 if(count == 2) return true; 753 805 } … … 784 836 Relation newRel = new Relation(); 785 837 newRel.put("type", "multipolygon"); 786 for(Way w : inner) 838 for(Way w : inner) { 787 839 newRel.addMember(new RelationMember("inner", w)); 840 } 788 841 cmds.add(new AddCommand(newRel)); 789 842 … … 806 859 for(RelationRole r : rels) { 807 860 if( r.rel.get("type") != null && 808 r.rel.get("type").equalsIgnoreCase("multipolygon") &&809 r.role.equalsIgnoreCase("outer")810 861 r.rel.get("type").equalsIgnoreCase("multipolygon") && 862 r.role.equalsIgnoreCase("outer") 863 ) { 811 864 multiouters.add(r); 812 865 continue; … … 820 873 Relation newRel = null; 821 874 switch(multiouters.size()) { 822 case 0: 823 return; 824 case 1: 825 // Found only one to be part of a multipolygon relation, so just add it back as well 826 newRel = new Relation(multiouters.get(0).rel); 827 newRel.addMember(new RelationMember(multiouters.get(0).role, outer)); 828 cmds.add(new ChangeCommand(multiouters.get(0).rel, newRel)); 829 return; 830 default: 831 // Create a new relation with all previous members and (Way)outer as outer. 832 newRel = new Relation(); 833 for(RelationRole r : multiouters) { 834 // Add members 835 for(RelationMember rm : r.rel.getMembers()) 836 if(!newRel.getMembers().contains(rm)) newRel.addMember(rm); 837 // Add tags 838 for (String key : r.rel.keySet()) { 839 newRel.put(key, r.rel.get(key)); 875 case 0: 876 return; 877 case 1: 878 // Found only one to be part of a multipolygon relation, so just add it back as well 879 newRel = new Relation(multiouters.get(0).rel); 880 newRel.addMember(new RelationMember(multiouters.get(0).role, outer)); 881 cmds.add(new ChangeCommand(multiouters.get(0).rel, newRel)); 882 return; 883 default: 884 // Create a new relation with all previous members and (Way)outer as outer. 885 newRel = new Relation(); 886 for(RelationRole r : multiouters) { 887 // Add members 888 for(RelationMember rm : r.rel.getMembers()) 889 if(!newRel.getMembers().contains(rm)) { 890 newRel.addMember(rm); 840 891 } 841 // Delete old relation 842 cmds.add(new DeleteCommand(r.rel)); 843 } 844 newRel.addMember(new RelationMember("outer", outer)); 845 cmds.add(new AddCommand(newRel)); 892 // Add tags 893 for (String key : r.rel.keySet()) { 894 newRel.put(key, r.rel.get(key)); 895 } 896 // Delete old relation 897 cmds.add(new DeleteCommand(r.rel)); 898 } 899 newRel.addMember(new RelationMember("outer", outer)); 900 cmds.add(new AddCommand(newRel)); 846 901 } 847 902 } … … 851 906 */ 852 907 private void stripTags(Collection<Way> ways) { 853 for(Way w: ways) stripTags(w); 908 for(Way w: ways) { 909 stripTags(w); 910 } 854 911 commitCommands(marktr("Remove tags from inner ways")); 855 912 } … … 861 918 if(x.getKeys() == null) return; 862 919 Way y = new Way(x); 863 for (String key : x.keySet()) 920 for (String key : x.keySet()) { 864 921 y.remove(key); 922 } 865 923 cmds.add(new ChangeCommand(x, y)); 866 924 } … … 875 933 cmds.clear(); 876 934 int i = Math.max(ur.commands.size() - cmdsCount, 0); 877 for(; i < ur.commands.size(); i++) 935 for(; i < ur.commands.size(); i++) { 878 936 cmds.add(ur.commands.get(i)); 879 880 for(i = 0; i < cmds.size(); i++) 937 } 938 939 for(i = 0; i < cmds.size(); i++) { 881 940 ur.undo(); 941 } 882 942 883 943 commitCommands(message == null ? marktr("Join Areas Function") : message); -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r2512 r2578 90 90 int count = 0; 91 91 for (Way w : OsmPrimitive.getFilteredList(n.getReferrers(), Way.class)) { 92 if (w.isDeleted() || w.i ncomplete) {92 if (w.isDeleted() || w.isIncomplete()) { 93 93 continue; 94 94 } … … 308 308 HashSet<String> rolesToReAdd = null; 309 309 for (Relation r : OsmPrimitive.getFilteredList(originalNode.getReferrers(), Relation.class)) { 310 if (r.isDeleted() || r.i ncomplete) {310 if (r.isDeleted() || r.isIncomplete()) { 311 311 continue; 312 312 } … … 352 352 // modify all ways containing the nodes 353 353 for (Way w : OsmPrimitive.getFilteredList(selectedNode.getReferrers(), Way.class)) { 354 if (w.isDeleted() || w.i ncomplete) {354 if (w.isDeleted() || w.isIncomplete()) { 355 355 continue; 356 356 } -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r2512 r2578 10 10 import java.util.Collection; 11 11 import java.util.Collections; 12 import java.util.logging.Logger;13 12 14 13 import javax.swing.JOptionPane; … … 139 138 */ 140 139 static class UpdatePrimitivesTask extends PleaseWaitRunnable { 141 static private final Logger logger = Logger.getLogger(UpdatePrimitivesTask.class.getName());140 //static private final Logger logger = Logger.getLogger(UpdatePrimitivesTask.class.getName()); 142 141 143 142 private DataSet ds; … … 228 227 // 229 228 for (Way w : ds.getWays()) { 230 if (w.i ncomplete) {229 if (w.isIncomplete()) { 231 230 OsmServerObjectReader reader = new OsmServerObjectReader(w.getId(), OsmPrimitiveType.WAY, true /* full */); 232 231 theirDataSet = reader.parseOsm(progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)); -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r2512 r2578 11 11 import java.util.Set; 12 12 import java.util.Stack; 13 import java.util.logging.Logger;14 13 15 14 import javax.swing.JOptionPane; … … 39 38 */ 40 39 public class UploadSelectionAction extends JosmAction{ 41 static private Logger logger = Logger.getLogger(UploadSelectionAction.class.getName());40 //static private Logger logger = Logger.getLogger(UploadSelectionAction.class.getName()); 42 41 43 42 public UploadSelectionAction() { … … 90 89 if (p.isNew()) { 91 90 ret.add(p); 92 } else if (p.isVisible() && p.isModified() && !p.i ncomplete) {91 } else if (p.isVisible() && p.isModified() && !p.isIncomplete()) { 93 92 ret.add(p); 94 93 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java
r2512 r2578 107 107 HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>(); 108 108 for (OsmPrimitive primitive : ds.getNodes()) { 109 if (!primitive.i ncomplete&& !primitive.isNew()) {109 if (!primitive.isIncomplete() && !primitive.isNew()) { 110 110 ret.add(primitive); 111 111 } 112 112 } 113 113 for (OsmPrimitive primitive : ds.getWays()) { 114 if (!primitive.i ncomplete&& !primitive.isNew()) {114 if (!primitive.isIncomplete() && !primitive.isNew()) { 115 115 ret.add(primitive); 116 116 } 117 117 } 118 118 for (OsmPrimitive primitive : ds.getRelations()) { 119 if (!primitive.i ncomplete&& !primitive.isNew()) {119 if (!primitive.isIncomplete() && !primitive.isNew()) { 120 120 ret.add(primitive); 121 121 } -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r2567 r2578 487 487 private static class Incomplete extends Match { 488 488 @Override public boolean match(OsmPrimitive osm) { 489 return osm.i ncomplete;489 return osm.isIncomplete(); 490 490 } 491 491 @Override public String toString() {return "incomplete";} -
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 } -
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r2563 r2578 88 88 public String format(Node node) { 89 89 String name = ""; 90 if (node.i ncomplete) {90 if (node.isIncomplete()) { 91 91 name = tr("incomplete"); 92 92 } else { … … 113 113 public String format(Way way) { 114 114 String name = ""; 115 if (way.i ncomplete) {115 if (way.isIncomplete()) { 116 116 name = tr("incomplete"); 117 117 } else { … … 151 151 public String format(Relation relation) { 152 152 String name; 153 if (relation.i ncomplete) {153 if (relation.isIncomplete()) { 154 154 name = tr("incomplete"); 155 155 } else { -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r2505 r2578 371 371 for (Node n : w.getNodes()) { 372 372 i++; 373 if (n.isDeleted() || n.i ncomplete) {373 if (n.isDeleted() || n.isIncomplete()) { 374 374 continue; 375 375 } -
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r2512 r2578 296 296 if (alt) { 297 297 for (Node n : w.getNodes()) { 298 if (!n.i ncomplete&& r.contains(nc.getPoint(n))) {298 if (!n.isIncomplete() && r.contains(nc.getPoint(n))) { 299 299 selection.add(w); 300 300 break; … … 304 304 boolean allIn = true; 305 305 for (Node n : w.getNodes()) { 306 if (!n.i ncomplete&& !r.contains(nc.getPoint(n))) {306 if (!n.isIncomplete() && !r.contains(nc.getPoint(n))) { 307 307 allIn = false; 308 308 break; -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r2537 r2578 750 750 if (Main.main.getCurrentDataSet() != null) { 751 751 for (Relation r : Main.main.getCurrentDataSet().getRelations()) { 752 if (!r.isFiltered() && !r.i ncomplete&& !r.isDeleted()) {752 if (!r.isFiltered() && !r.isIncomplete() && !r.isDeleted()) { 753 753 for (RelationMember m : r.getMembers()) { 754 754 if (newSelection.contains(m.getMember())) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r2563 r2578 534 534 } 535 535 for (Relation r: relations) { 536 if (! r.isDeleted() && r.isVisible() && !r.i ncomplete) {536 if (! r.isDeleted() && r.isVisible() && !r.isIncomplete()) { 537 537 this.relations.add(r); 538 538 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r2512 r2578 16 16 import java.util.Set; 17 17 import java.util.Stack; 18 import java.util.logging.Logger;19 18 20 19 import javax.swing.AbstractAction; … … 54 53 */ 55 54 public class ChildRelationBrowser extends JPanel { 56 static private final Logger logger = Logger.getLogger(ChildRelationBrowser.class.getName());55 //static private final Logger logger = Logger.getLogger(ChildRelationBrowser.class.getName()); 57 56 58 57 /** the tree with relation children */ … … 194 193 for (int i=0; i < Math.min(selection.length,10);i++) { 195 194 Relation r = (Relation)selection[i].getLastPathComponent(); 196 if (r.i ncomplete) {195 if (r.isIncomplete()) { 197 196 continue; 198 197 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r2563 r2578 25 25 import java.util.Iterator; 26 26 import java.util.List; 27 import java.util.logging.Logger;28 27 29 28 import javax.swing.AbstractAction; … … 76 75 */ 77 76 public class GenericRelationEditor extends RelationEditor { 78 79 static private final Logger logger = Logger.getLogger(GenericRelationEditor.class.getName()); 77 //static private final Logger logger = Logger.getLogger(GenericRelationEditor.class.getName()); 80 78 81 79 /** the tag table and its model */ … … 1382 1380 return; 1383 1381 Relation r = (Relation) primitive; 1384 if (r.i ncomplete)1382 if (r.isIncomplete()) 1385 1383 return; 1386 1384 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r2563 r2578 319 319 Set<OsmPrimitive> ret = new HashSet<OsmPrimitive>(); 320 320 for (RelationMember member : members) { 321 if (member.getMember().i ncomplete) {321 if (member.getMember().isIncomplete()) { 322 322 ret.add(member.getMember()); 323 323 } … … 334 334 Set<OsmPrimitive> ret = new HashSet<OsmPrimitive>(); 335 335 for (RelationMember member : getSelectedMembers()) { 336 if (member.getMember().i ncomplete) {336 if (member.getMember().isIncomplete()) { 337 337 ret.add(member.getMember()); 338 338 } … … 348 348 public boolean hasIncompleteMembers() { 349 349 for (RelationMember member : members) { 350 if (member.getMember().i ncomplete)350 if (member.getMember().isIncomplete()) 351 351 return true; 352 352 } … … 361 361 public boolean hasIncompleteSelectedMembers() { 362 362 for (RelationMember member : getSelectedMembers()) { 363 if (member.getMember().i ncomplete)363 if (member.getMember().isIncomplete()) 364 364 return true; 365 365 } … … 577 577 return false; 578 578 Relation r = member.getRelation(); 579 return !r.i ncomplete;579 return !r.isIncomplete(); 580 580 } 581 581 … … 881 881 882 882 Way w = m.getWay(); 883 if (w == null || w.i ncomplete) {883 if (w == null || w.isIncomplete()) { 884 884 con.set(i, new WayConnectionType()); 885 885 resetFirstGoupIdx = true; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationNodeMap.java
r2512 r2578 57 57 for (int i = 0; i < members.size(); ++i) { 58 58 RelationMember m = members.get(i); 59 if (m.getMember().i ncomplete|| !m.isWay())59 if (m.getMember().isIncomplete() || !m.isWay()) 60 60 { 61 61 notSortable.add(i); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java
r2512 r2578 91 91 TreePath path = event.getPath(); 92 92 Relation parent = (Relation)event.getPath().getLastPathComponent(); 93 if (! parent.i ncomplete|| parent.isNew())93 if (! parent.isIncomplete() || parent.isNew()) 94 94 // we don't load complete or new relations 95 95 return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTreeModel.java
r2512 r2578 210 210 public boolean isLeaf(Object node) { 211 211 Relation r = (Relation)node; 212 if (r.i ncomplete) return false;212 if (r.isIncomplete()) return false; 213 213 return getNumRelationChildren(r) == 0; 214 214 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r2565 r2578 604 604 // records them? 605 605 for (Node n : data.getNodes()) { 606 if (n.i ncomplete|| n.isDeleted() || doneNodes.contains(n)) {606 if (n.isIncomplete() || n.isDeleted() || doneNodes.contains(n)) { 607 607 continue; 608 608 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionCache.java
r2512 r2578 149 149 } 150 150 for (Relation relation : layer.data.getRelations()) { 151 if (relation.i ncomplete|| relation.isDeleted()) {151 if (relation.isIncomplete() || relation.isDeleted()) { 152 152 continue; 153 153 } -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r2563 r2578 378 378 protected void rememberNodesOfIncompleteWaysToLoad(DataSet from) { 379 379 for (Way w: from.getWays()) { 380 if (w.i ncomplete) {380 if (w.isIncomplete()) { 381 381 for (Node n: w.getNodes()) { 382 if (n.i ncomplete) {382 if (n.isIncomplete()) { 383 383 nodes.add(n.getId()); 384 384 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r2563 r2578 448 448 "loaded data and is therefore incomplete too.", externalWayId, w.getNodesCount())); 449 449 } 450 w. incomplete = true;450 w.setIncomplete(true); 451 451 ds.addPrimitive(w); 452 452 } else { 453 w. incomplete = false;453 w.setIncomplete(false); 454 454 ds.addPrimitive(w); 455 455 } -
trunk/src/org/openstreetmap/josm/io/OsmServerBackreferenceReader.java
r2512 r2578 224 224 if (isReadFull() ||primitiveType.equals(OsmPrimitiveType.NODE)) { 225 225 for (Way way: waysToCheck) { 226 if (!way.isNew() && way.i ncomplete) {226 if (!way.isNew() && way.isIncomplete()) { 227 227 OsmServerObjectReader reader = new OsmServerObjectReader(way.getId(), OsmPrimitiveType.from(way), true /* read full */); 228 228 DataSet wayDs = reader.parseOsm(progressMonitor.createSubTaskMonitor(1, false)); … … 235 235 Collection<Relation> relationsToCheck = new ArrayList<Relation>(ds.getRelations()); 236 236 for (Relation relation: relationsToCheck) { 237 if (!relation.isNew() && relation.i ncomplete) {237 if (!relation.isNew() && relation.isIncomplete()) { 238 238 OsmServerObjectReader reader = new OsmServerObjectReader(relation.getId(), OsmPrimitiveType.from(relation), true /* read full */); 239 239 DataSet wayDs = reader.parseOsm(progressMonitor.createSubTaskMonitor(1, false)); -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r2381 r2578 105 105 106 106 public void visit(Node n) { 107 if (n.i ncomplete) return;107 if (n.isIncomplete()) return; 108 108 addCommon(n, "node"); 109 109 out.print(" lat='"+n.getCoor().lat()+"' lon='"+n.getCoor().lon()+"'"); … … 116 116 117 117 public void visit(Way w) { 118 if (w.i ncomplete) return;118 if (w.isIncomplete()) return; 119 119 addCommon(w, "way"); 120 120 if (!withBody) { … … 130 130 131 131 public void visit(Relation e) { 132 if (e.i ncomplete) return;132 if (e.isIncomplete()) return; 133 133 addCommon(e, "relation"); 134 134 if (!withBody) {
Note:
See TracChangeset
for help on using the changeset viewer.