Changeset 2396 in josm
- Timestamp:
- 2009-11-07T07:26:15+01:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r2390 r2396 229 229 String lbl = ""; 230 230 switch(primitiveType) { 231 232 233 231 case NODE: lbl = tr("Synchronize node {0} only", id); break; 232 case WAY: lbl = tr("Synchronize way {0} only", id); break; 233 case RELATION: lbl = tr("Synchronize relation {0} only", id); break; 234 234 } 235 235 ButtonSpec[] spec = new ButtonSpec[] { … … 275 275 ); 276 276 switch(ret) { 277 278 279 277 case 0: synchronizePrimitive(primitiveType, id); break; 278 case 1: synchronizeDataSet(); break; 279 default: return; 280 280 } 281 281 } … … 635 635 try { 636 636 getProgressMonitor().subTask(tr("Uploading {0} objects ...", toUpload.size())); 637 writer.uploadOsm(layer.data. version, toUpload, changeset, getProgressMonitor().createSubTaskMonitor(1, false));637 writer.uploadOsm(layer.data.getVersion(), toUpload, changeset, getProgressMonitor().createSubTaskMonitor(1, false)); 638 638 processedPrimitives.addAll(writer.getProcessedPrimitives()); 639 639 // if we get here we've successfully uploaded the data. Exit the loop. -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2388 r2396 52 52 * The API version that created this data set, if any. 53 53 */ 54 public String version; 54 private String version; 55 56 /** 57 * Replies the API version this dataset was created from. May be null. 58 * 59 * @return the API version this dataset was created from. May be null. 60 */ 61 public String getVersion() { 62 return version; 63 } 64 65 /** 66 * Sets the API version this dataset was created from. 67 * 68 * @param version the API version, i.e. "0.5" or "0.6" 69 */ 70 public void setVersion(String version) { 71 this.version = version; 72 } 55 73 56 74 /** 57 75 * All nodes goes here, even when included in other data (ways etc). This enables the instant 58 76 * conversion of the whole DataSet by iterating over this data structure. 59 * @deprecated Use getNodes() for read-only operations, addPrimitive() and removePrimitive() for modifications 60 */ 61 @Deprecated 62 public QuadBuckets<Node> nodes = new QuadBuckets<Node>(); 63 77 */ 78 private QuadBuckets<Node> nodes = new QuadBuckets<Node>(); 79 80 /** 81 * Replies an unmodifiable collection of nodes in this dataset 82 * 83 * @return an unmodifiable collection of nodes in this dataset 84 */ 64 85 public Collection<Node> getNodes() { 65 86 return Collections.unmodifiableCollection(nodes); … … 74 95 * 75 96 * The way nodes are stored only in the way list. 76 * @deprecated Use getWays() for read-only operations, addPrimitive() and removePrimitive() for modifications 77 */ 78 @Deprecated 79 public QuadBuckets<Way> ways = new QuadBuckets<Way>(); 80 97 */ 98 private QuadBuckets<Way> ways = new QuadBuckets<Way>(); 99 100 /** 101 * Replies an unmodifiable collection of ways in this dataset 102 * 103 * @return an unmodifiable collection of ways in this dataset 104 */ 81 105 public Collection<Way> getWays() { 82 106 return Collections.unmodifiableCollection(ways); … … 89 113 /** 90 114 * All relations/relationships 91 * @deprecated Use getRelations() for read-only operations, addPrimitive() and removePrimitive() for modifications 92 */ 93 @Deprecated 94 public Collection<Relation> relations = new LinkedList<Relation>(); 95 115 */ 116 private Collection<Relation> relations = new LinkedList<Relation>(); 117 118 /** 119 * Replies an unmodifiable collection of relations in this dataset 120 * 121 * @return an unmodifiable collection of relations in this dataset 122 */ 96 123 public Collection<Relation> getRelations() { 97 124 return Collections.unmodifiableCollection(relations); … … 703 730 } 704 731 } 732 733 /** 734 * Removes all primitives from the dataset and resets the currently selected primitives 735 * to the empty collection. Also notifies selection change listeners if necessary. 736 * 737 */ 738 public void clear() { 739 if (!selectedPrimitives.isEmpty()) { 740 selectedPrimitives.clear(); 741 fireSelectionChanged(); 742 } 743 nodes.clear(); 744 ways.clear(); 745 relations.clear(); 746 } 705 747 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java
r2348 r2396 10 10 import org.openstreetmap.josm.data.APIDataSet; 11 11 import org.openstreetmap.josm.data.osm.Changeset; 12 import org.openstreetmap.josm.data.osm.DataSet;13 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 121 120 ProgressMonitor m = monitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false); 122 121 if (isCancelled()) return; 123 writer.uploadOsm(layer.data. version, toUpload, changeset, m);122 writer.uploadOsm(layer.data.getVersion(), toUpload, changeset, m); 124 123 processedPrimitives.addAll(writer.getProcessedPrimitives()); 125 124 break; -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r2388 r2396 256 256 tool += trn("{0} way", "{0} ways", ways, ways); 257 257 258 if (data. version!= null) {259 tool += ", " + tr("version {0}", data. version);258 if (data.getVersion() != null) { 259 tool += ", " + tr("version {0}", data.getVersion()); 260 260 } 261 261 File f = getAssociatedFile(); … … 292 292 293 293 // copy the merged layer's API version, downgrade if required 294 if (data. version== null) {295 data. version = from.version;296 } else if ("0.5".equals(data. version) ^ "0.5".equals(from.version)) {294 if (data.getVersion() == null) { 295 data.setVersion(from.getVersion()); 296 } else if ("0.5".equals(data.getVersion()) ^ "0.5".equals(from.getVersion())) { 297 297 System.err.println(tr("Warning: mixing 0.6 and 0.5 data results in version 0.5")); 298 data. version = "0.5";298 data.setVersion("0.5"); 299 299 } 300 300 … … 522 522 p.add(new JLabel(wayText, ImageProvider.get("data", "way"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0)); 523 523 p.add(new JLabel(relationText, ImageProvider.get("data", "relation"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0)); 524 p.add(new JLabel(tr("API version: {0}", (data. version != null) ? data.version: tr("unset"))));524 p.add(new JLabel(tr("API version: {0}", (data.getVersion() != null) ? data.getVersion() : tr("unset")))); 525 525 526 526 return p; -
trunk/src/org/openstreetmap/josm/io/OsmExporter.java
r2181 r2396 66 66 Writer writer = new OutputStreamWriter(out, "UTF-8"); 67 67 68 OsmWriter w = new OsmWriter(new PrintWriter(writer), false, layer.data. version);68 OsmWriter w = new OsmWriter(new PrintWriter(writer), false, layer.data.getVersion()); 69 69 w.header(); 70 70 w.writeDataSources(layer.data); -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r2382 r2396 184 184 // save generator attribute for later use when creating DataSource objects 185 185 generator = atts.getValue("generator"); 186 ds. version = v;186 ds.setVersion(v); 187 187 188 188 } else if (qName.equals("bounds")) { … … 348 348 throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.", Long.toString(current.id), version)); 349 349 } 350 if (ds. version.equals("0.6")){350 if (ds.getVersion().equals("0.6")){ 351 351 if (current.version <= 0 && current.id > 0) { 352 352 throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.", Long.toString(current.id), version)); … … 355 355 current.version = 0; 356 356 } 357 } else if (ds. version.equals("0.5")) {357 } else if (ds.getVersion().equals("0.5")) { 358 358 if (current.version <= 0 && current.id > 0) { 359 359 System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.id, current.version, 1, "0.5")); … … 365 365 } else { 366 366 // should not happen. API version has been checked before 367 throwException(tr("Unknown or unsupported API version. Got {0}.", ds. version));367 throwException(tr("Unknown or unsupported API version. Got {0}.", ds.getVersion())); 368 368 } 369 369 } else { 370 370 // version expected for OSM primitives with an id assigned by the server (id > 0), since API 0.6 371 371 // 372 if (current.id > 0 && ds. version != null && ds.version.equals("0.6")) {372 if (current.id > 0 && ds.getVersion() != null && ds.getVersion().equals("0.6")) { 373 373 throwException(tr("Missing attribute ''version'' on OSM primitive with ID {0}.", Long.toString(current.id))); 374 } else if (current.id > 0 && ds. version != null && ds.version.equals("0.5")) {374 } else if (current.id > 0 && ds.getVersion() != null && ds.getVersion().equals("0.5")) { 375 375 // default version in 0.5 files for existing primitives 376 376 System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.id, current.version, 1, "0.5")); 377 377 current.version= 1; 378 } else if (current.id <= 0 && ds. version != null && ds.version.equals("0.5")) {378 } else if (current.id <= 0 && ds.getVersion() != null && ds.getVersion().equals("0.5")) { 379 379 // default version in 0.5 files for new primitives 380 380 System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.id, current.version, 0, "0.5")); -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r2388 r2396 45 45 protected static DataSet buildTestDataSet() { 46 46 DataSet ds = new DataSet(); 47 ds. version = "0.6";47 ds.setVersion("0.6"); 48 48 49 49 int numNodes = 1000; … … 215 215 } 216 216 logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString())); 217 OsmWriter w = new OsmWriter(pw, false, testDataSet. version);217 OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion()); 218 218 w.header(); 219 219 w.writeDataSources(testDataSet); -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r2381 r2396 109 109 protected static DataSet buildTestDataSet() { 110 110 DataSet ds = new DataSet(); 111 ds. version = "0.6";111 ds.setVersion("0.6"); 112 112 113 113 populateTestDataSetWithNodes(ds); … … 221 221 } 222 222 logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString())); 223 OsmWriter w = new OsmWriter(pw, false, testDataSet. version);223 OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion()); 224 224 w.header(); 225 225 w.writeDataSources(testDataSet); -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
r2381 r2396 79 79 public void nodeSimple_IdenticalNoConflict() { 80 80 DataSet my = new DataSet(); 81 my. version = "0.6";81 my.setVersion("0.6"); 82 82 Node n = new Node(new LatLon(0,0)); 83 83 n.setOsmId(1,1); … … 87 87 88 88 DataSet their = new DataSet(); 89 their. version = "0.6";89 their.setVersion("0.6"); 90 90 Node n1 = new Node(new LatLon(0,0)); 91 91 n1.setOsmId(1,1); … … 114 114 public void nodeSimple_locallyUnmodifiedNoConflict() { 115 115 DataSet my = new DataSet(); 116 my. version = "0.6";116 my.setVersion("0.6"); 117 117 Node n = new Node(new LatLon(0,0)); 118 118 n.setOsmId(1,1); … … 122 122 123 123 DataSet their = new DataSet(); 124 their. version = "0.6";124 their.setVersion("0.6"); 125 125 Node n1 = new Node(new LatLon(0,0)); 126 126 n1.setOsmId(1,2); … … 153 153 public void nodeSimple_TagConflict() { 154 154 DataSet my = new DataSet(); 155 my. version = "0.6";155 my.setVersion("0.6"); 156 156 Node n = new Node(new LatLon(0,0)); 157 157 n.setOsmId(1,1); … … 162 162 163 163 DataSet their = new DataSet(); 164 their. version = "0.6";164 their.setVersion("0.6"); 165 165 Node n1 = new Node(new LatLon(0,0)); 166 166 n1.setOsmId(1,2); … … 189 189 public void nodeSimple_DeleteConflict() { 190 190 DataSet my = new DataSet(); 191 my. version = "0.6";191 my.setVersion("0.6"); 192 192 Node n = new Node(1); 193 193 n.setCoor(new LatLon(0,0)); … … 198 198 199 199 DataSet their = new DataSet(); 200 their. version = "0.6";200 their.setVersion("0.6"); 201 201 Node n1 = new Node(new LatLon(0,0)); 202 202 n1.setOsmId(1,1); … … 223 223 public void nodeSimple_VisibleConflict() { 224 224 DataSet my = new DataSet(); 225 my. version = "0.6";225 my.setVersion("0.6"); 226 226 Node n = new Node(new LatLon(0,0)); 227 227 n.setOsmId(1,1); … … 231 231 232 232 DataSet their = new DataSet(); 233 their. version = "0.6";233 their.setVersion("0.6"); 234 234 Node n1 = new Node(new LatLon(0,0)); 235 235 n1.setOsmId(1,2); … … 256 256 public void nodeSimple_DeleteConflict_2() { 257 257 DataSet my = new DataSet(); 258 my. version = "0.6";258 my.setVersion("0.6"); 259 259 Node n = new Node(new LatLon(0,0)); 260 260 n.setOsmId(1,1); … … 263 263 264 264 DataSet their = new DataSet(); 265 their. version = "0.6";265 their.setVersion("0.6"); 266 266 Node n1 = new Node(new LatLon(0,0)); 267 267 n1.setOsmId(1,1); … … 286 286 public void nodeSimple_DeleteConflict_3() { 287 287 DataSet my = new DataSet(); 288 my. version = "0.6";288 my.setVersion("0.6"); 289 289 Node n = new Node(new LatLon(1,1)); 290 290 n.setDeleted(true); … … 292 292 293 293 DataSet their = new DataSet(); 294 their. version = "0.6";294 their.setVersion("0.6"); 295 295 Node n1 = new Node(new LatLon(1,1)); 296 296 their.addPrimitive(n1); … … 312 312 public void nodeSimple_DeleteConflict_4() { 313 313 DataSet my = new DataSet(); 314 my. version = "0.6";314 my.setVersion("0.6"); 315 315 Node n = new Node(new LatLon(1,1)); 316 316 n.setDeleted(true); … … 318 318 319 319 DataSet their = new DataSet(); 320 their. version = "0.6";320 their.setVersion("0.6"); 321 321 Node n1 = new Node(new LatLon(1,1)); 322 322 n1.setDeleted(true); … … 338 338 public void nodeSimple_InvisibleNodeInTheirDataset() { 339 339 DataSet my = new DataSet(); 340 my. version = "0.6";340 my.setVersion("0.6"); 341 341 Node n = new Node(new LatLon(0,0)); 342 342 n.setOsmId(1,1); … … 345 345 346 346 DataSet their = new DataSet(); 347 their. version = "0.6";347 their.setVersion("0.6"); 348 348 Node n1 = new Node(new LatLon(0,0)); 349 349 n1.setOsmId(2,1); … … 377 377 378 378 DataSet my = new DataSet(); 379 my. version = "0.6";379 my.setVersion("0.6"); 380 380 Node n = new Node(); 381 381 n.setCoor(new LatLon(0,0)); … … 387 387 388 388 DataSet their = new DataSet(); 389 their. version = "0.6";389 their.setVersion("0.6"); 390 390 Node n1 = new Node(); 391 391 n1.setCoor(new LatLon(0,0)); … … 418 418 419 419 DataSet my = new DataSet(); 420 my. version = "0.6";420 my.setVersion("0.6"); 421 421 Node n = new Node(); 422 422 n.setCoor(new LatLon(0,0)); … … 426 426 427 427 DataSet their = new DataSet(); 428 their. version = "0.6";428 their.setVersion("0.6"); 429 429 Node n1 = new Node(); 430 430 n1.setCoor(new LatLon(0,0)); … … 458 458 459 459 DataSet my = new DataSet(); 460 my. version = "0.6";460 my.setVersion("0.6"); 461 461 462 462 Node n1 = new Node(); … … 480 480 481 481 DataSet their = new DataSet(); 482 their. version = "0.6";482 their.setVersion("0.6"); 483 483 484 484 Node n3 = new Node(new LatLon(0,0)); … … 525 525 526 526 DataSet my = new DataSet(); 527 my. version = "0.6";527 my.setVersion("0.6"); 528 528 529 529 Node n1 = new Node(new LatLon(0,0)); … … 542 542 543 543 DataSet their = new DataSet(); 544 their. version = "0.6";544 their.setVersion("0.6"); 545 545 546 546 Node n3 = new Node(new LatLon(0,0)); … … 593 593 594 594 DataSet my = new DataSet(); 595 my. version = "0.6";595 my.setVersion("0.6"); 596 596 597 597 Node n1 = new Node(new LatLon(0,0)); … … 613 613 614 614 DataSet their = new DataSet(); 615 their. version = "0.6";615 their.setVersion("0.6"); 616 616 617 617 Node n3 = new Node(new LatLon(0,0)); … … 664 664 665 665 DataSet my = new DataSet(); 666 my. version = "0.6";666 my.setVersion("0.6"); 667 667 668 668 Node n1 = new Node(new LatLon(0,0)); … … 681 681 682 682 DataSet their = new DataSet(); 683 their. version = "0.6";683 their.setVersion("0.6"); 684 684 685 685 Way theirWay = new Way(); … … 710 710 711 711 DataSet my = new DataSet(); 712 my. version = "0.6";712 my.setVersion("0.6"); 713 713 714 714 Node n1 = new Node(new LatLon(0,0)); … … 726 726 727 727 DataSet their = new DataSet(); 728 their. version = "0.6";728 their.setVersion("0.6"); 729 729 730 730 Node n3 = new Node(new LatLon(0,0)); … … 763 763 764 764 DataSet my = new DataSet(); 765 my. version = "0.6";765 my.setVersion("0.6"); 766 766 767 767 Node n1 = new Node(new LatLon(0,0)); … … 777 777 778 778 DataSet their = new DataSet(); 779 their. version = "0.6";779 their.setVersion("0.6"); 780 780 781 781 Node n3 = new Node(new LatLon(0,0)); … … 815 815 816 816 DataSet my = new DataSet(); 817 my. version = "0.6";817 my.setVersion("0.6"); 818 818 819 819 Node n1 = new Node(new LatLon(0,0)); … … 823 823 824 824 DataSet their = new DataSet(); 825 their. version = "0.6";825 their.setVersion("0.6"); 826 826 827 827 Node n3 = new Node(new LatLon(0,0)); … … 871 871 872 872 DataSet my = new DataSet(); 873 my. version = "0.6";873 my.setVersion("0.6"); 874 874 875 875 Node n1 = new Node(new LatLon(0,0)); … … 879 879 880 880 DataSet their = new DataSet(); 881 their. version = "0.6";881 their.setVersion("0.6"); 882 882 883 883 Node n3 = new Node(new LatLon(0,0)); … … 922 922 public void newIncompleteWay() { 923 923 DataSet their = new DataSet(); 924 their. version = "0.6";924 their.setVersion("0.6"); 925 925 926 926 Node n1 = new Node(1); … … 936 936 937 937 DataSet my = new DataSet(); 938 their. version = "0.6";938 their.setVersion("0.6"); 939 939 940 940 MergeVisitor visitor = new MergeVisitor(my,their); … … 969 969 public void incompleteWayOntoCompleteWay() { 970 970 DataSet their = new DataSet(); 971 their. version = "0.6";971 their.setVersion("0.6"); 972 972 973 973 // an incomplete node … … 986 986 987 987 DataSet my = new DataSet(); 988 their. version = "0.6";988 their.setVersion("0.6"); 989 989 990 990 Node n4 = new Node(new LatLon(0,0));
Note:
See TracChangeset
for help on using the changeset viewer.