Changeset 2396 in josm for trunk/src/org/openstreetmap/josm
- Timestamp:
- 2009-11-07T07:26:15+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 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"));
Note:
See TracChangeset
for help on using the changeset viewer.