Changeset 5589 in josm for trunk/src/org/openstreetmap/josm/io/OsmWriter.java
- Timestamp:
- 2012-11-18T13:57:36+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r5497 r5589 40 40 private boolean osmConform; 41 41 private boolean withBody = true; 42 private boolean isOsmChange; 42 43 private String version; 43 44 private Changeset changeset; … … 55 56 this.withBody = wb; 56 57 } 58 59 public void setIsOsmChange(boolean isOsmChange) { 60 this.isOsmChange = isOsmChange; 61 } 62 57 63 public void setChangeset(Changeset cs) { 58 64 this.changeset = cs; … … 136 142 if (n.isIncomplete()) return; 137 143 addCommon(n, "node"); 138 if (n.getCoor() != null) {139 out.print(" lat='"+n.getCoor().lat()+"' lon='"+n.getCoor().lon()+"'");140 }141 144 if (!withBody) { 142 145 out.println("/>"); 143 146 } else { 147 if (n.getCoor() != null) { 148 out.print(" lat='"+n.getCoor().lat()+"' lon='"+n.getCoor().lon()+"'"); 149 } 144 150 addTags(n, "node", true); 145 151 } … … 240 246 } else 241 247 throw new IllegalStateException(tr("Unexpected id 0 for osm primitive found")); 242 if (!osmConform) { 243 String action = null; 244 if (osm.isDeleted()) { 245 action = "delete"; 246 } else if (osm.isModified()) { 247 action = "modify"; 248 } 249 if (action != null) { 250 out.print(" action='"+action+"'"); 251 } 252 } 253 if (!osm.isTimestampEmpty()) { 254 out.print(" timestamp='"+DateUtils.fromDate(osm.getTimestamp())+"'"); 255 } 256 // user and visible added with 0.4 API 257 if (osm.getUser() != null) { 258 if(osm.getUser().isLocalUser()) { 259 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'"); 260 } else if (osm.getUser().isOsmUser()) { 261 // uid added with 0.6 262 out.print(" uid='"+ osm.getUser().getId()+"'"); 263 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'"); 264 } 265 } 266 out.print(" visible='"+osm.isVisible()+"'"); 248 if (!isOsmChange) { 249 if (!osmConform) { 250 String action = null; 251 if (osm.isDeleted()) { 252 action = "delete"; 253 } else if (osm.isModified()) { 254 action = "modify"; 255 } 256 if (action != null) { 257 out.print(" action='"+action+"'"); 258 } 259 } 260 if (!osm.isTimestampEmpty()) { 261 out.print(" timestamp='"+DateUtils.fromDate(osm.getTimestamp())+"'"); 262 } 263 // user and visible added with 0.4 API 264 if (osm.getUser() != null) { 265 if(osm.getUser().isLocalUser()) { 266 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'"); 267 } else if (osm.getUser().isOsmUser()) { 268 // uid added with 0.6 269 out.print(" uid='"+ osm.getUser().getId()+"'"); 270 out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'"); 271 } 272 } 273 out.print(" visible='"+osm.isVisible()+"'"); 274 } 267 275 if (osm.getVersion() != 0) { 268 276 out.print(" version='"+osm.getVersion()+"'");
Note:
See TracChangeset
for help on using the changeset viewer.