Changeset 17848 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r17787 r17848 224 224 public void writeDataSources(DataSet ds) { 225 225 for (DataSource s : ds.getDataSources()) { 226 out.println(" <bounds minlat='" 227 + DecimalDegreesCoordinateFormat.INSTANCE.latToString(s.bounds.getMin()) 228 +"' minlon='" 229 + DecimalDegreesCoordinateFormat.INSTANCE.lonToString(s.bounds.getMin()) 230 +"' maxlat='" 231 + DecimalDegreesCoordinateFormat.INSTANCE.latToString(s.bounds.getMax()) 232 +"' maxlon='" 233 + DecimalDegreesCoordinateFormat.INSTANCE.lonToString(s.bounds.getMax()) 234 +"' origin='"+XmlWriter.encode(s.origin)+"' />"); 226 out.append(" <bounds minlat='").append(DecimalDegreesCoordinateFormat.INSTANCE.latToString(s.bounds.getMin())); 227 out.append("' minlon='").append(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(s.bounds.getMin())); 228 out.append("' maxlat='").append(DecimalDegreesCoordinateFormat.INSTANCE.latToString(s.bounds.getMax())); 229 out.append("' maxlon='").append(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(s.bounds.getMax())); 230 out.append("' origin='").append(XmlWriter.encode(s.origin)).append("' />"); 231 out.println(); 235 232 } 236 233 } … … 238 235 void writeLatLon(LatLon ll) { 239 236 if (ll != null) { 240 out. print(" lat='"+LatLon.cDdHighPrecisionFormatter.format(ll.lat())+241 "'lon='"+LatLon.cDdHighPrecisionFormatter.format(ll.lon())+'\'');237 out.append(" lat='").append(LatLon.cDdHighPrecisionFormatter.format(ll.lat())).append("'"); 238 out.append(" lon='").append(LatLon.cDdHighPrecisionFormatter.format(ll.lon())).append("'"); 242 239 } 243 240 } … … 264 261 out.println(">"); 265 262 for (int i = 0; i < w.getNodesCount(); ++i) { 266 out.println(" <nd ref='"+w.getNodeId(i) +"' />"); 263 out.append(" <nd ref='").append(String.valueOf(w.getNodeId(i))).append("' />"); 264 out.println(); 267 265 } 268 266 addTags(w, "way", false); … … 281 279 out.print(" <member type='"); 282 280 out.print(e.getMemberType(i).getAPIName()); 283 out.println("' ref='"+e.getMemberId(i)+"' role='" + 284 XmlWriter.encode(e.getRole(i)) + "' />"); 281 out.append("' ref='").append(String.valueOf(e.getMemberId(i))); 282 out.append("' role='").append(XmlWriter.encode(e.getRole(i))).append("' />"); 283 out.println(); 285 284 } 286 285 addTags(e, "relation", false); … … 293 292 */ 294 293 public void visit(Changeset cs) { 295 out. print(" <changeset id='"+cs.getId()+'\'');294 out.append(" <changeset id='").append(String.valueOf(cs.getId())).append("'"); 296 295 if (cs.getUser() != null) { 297 out. print(" user='"+XmlWriter.encode(cs.getUser().getName())+'\'');298 out. print(" uid='"+cs.getUser().getId()+'\'');296 out.append(" user='").append(XmlWriter.encode(cs.getUser().getName())).append("'"); 297 out.append(" uid='").append(String.valueOf(cs.getUser().getId())).append("'"); 299 298 } 300 299 Instant createdDate = cs.getCreatedAt(); 301 300 if (createdDate != null) { 302 out. print(" created_at='"+createdDate+'\'');301 out.append(" created_at='").append(String.valueOf(createdDate)).append("'"); 303 302 } 304 303 Instant closedDate = cs.getClosedAt(); 305 304 if (closedDate != null) { 306 out. print(" closed_at='"+closedDate+'\'');307 } 308 out. print(" open='"+(cs.isOpen() ? "true" : "false")+'\'');305 out.append(" closed_at='").append(String.valueOf(closedDate)).append("'"); 306 } 307 out.append(" open='").append(cs.isOpen() ? "true" : "false").append("'"); 309 308 if (cs.getMin() != null) { 310 out. print(" min_lon='"+DecimalDegreesCoordinateFormat.INSTANCE.lonToString(cs.getMin())+'\'');311 out. print(" min_lat='"+DecimalDegreesCoordinateFormat.INSTANCE.latToString(cs.getMin())+'\'');309 out.append(" min_lon='").append(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(cs.getMin())).append("'"); 310 out.append(" min_lat='").append(DecimalDegreesCoordinateFormat.INSTANCE.latToString(cs.getMin())).append("'"); 312 311 } 313 312 if (cs.getMax() != null) { 314 out. print(" max_lon='"+DecimalDegreesCoordinateFormat.INSTANCE.lonToString(cs.getMax())+'\'');315 out. print(" max_lat='"+DecimalDegreesCoordinateFormat.INSTANCE.latToString(cs.getMax())+'\'');313 out.append(" max_lon='").append(DecimalDegreesCoordinateFormat.INSTANCE.lonToString(cs.getMax())).append("'"); 314 out.append(" max_lat='").append(DecimalDegreesCoordinateFormat.INSTANCE.latToString(cs.getMax())).append("'"); 316 315 } 317 316 out.println(">"); … … 329 328 entries.sort(byKeyComparator); 330 329 for (Entry<String, String> e : entries) { 331 out.println(" <tag k='"+ XmlWriter.encode(e.getKey()) + 332 "' v='"+XmlWriter.encode(e.getValue())+ "' />"); 330 out.append(" <tag k='").append(XmlWriter.encode(e.getKey())); 331 out.append("' v='").append(XmlWriter.encode(e.getValue())).append("' />"); 332 out.println(); 333 333 } 334 334 out.println(" </" + tagname + '>'); … … 347 347 */ 348 348 protected void addCommon(IPrimitive osm, String tagname) { 349 out. print(" <"+tagname);349 out.append(" <").append(tagname); 350 350 if (osm.getUniqueId() != 0) { 351 out. print(" id='"+osm.getUniqueId()+'\'');351 out.append(" id='").append(String.valueOf(osm.getUniqueId())).append("'"); 352 352 } else 353 353 throw new IllegalStateException(tr("Unexpected id 0 for osm primitive found")); … … 361 361 } 362 362 if (action != null) { 363 out. print(" action='"+action+'\'');363 out.append(" action='").append(action).append("'"); 364 364 } 365 365 } 366 366 if (!osm.isTimestampEmpty()) { 367 out. print(" timestamp='"+osm.getInstant()+'\'');367 out.append(" timestamp='").append(String.valueOf(osm.getInstant())).append("'"); 368 368 } 369 369 // user and visible added with 0.4 API 370 370 if (osm.getUser() != null) { 371 371 if (osm.getUser().isLocalUser()) { 372 out. print(" user='"+XmlWriter.encode(osm.getUser().getName())+'\'');372 out.append(" user='").append(XmlWriter.encode(osm.getUser().getName())).append("'"); 373 373 } else if (osm.getUser().isOsmUser()) { 374 374 // uid added with 0.6 375 out. print(" uid='"+osm.getUser().getId()+'\'');376 out. print(" user='"+XmlWriter.encode(osm.getUser().getName())+'\'');375 out.append(" uid='").append(String.valueOf(osm.getUser().getId())).append("'"); 376 out.append(" user='").append(XmlWriter.encode(osm.getUser().getName())).append("'"); 377 377 } 378 378 } 379 379 if (withVisible) { 380 out. print(" visible='"+osm.isVisible()+'\'');380 out.append(" visible='").append(String.valueOf(osm.isVisible())).append("'"); 381 381 } 382 382 } 383 383 if (osm.getVersion() != 0) { 384 out. print(" version='"+osm.getVersion()+'\'');384 out.append(" version='").append(String.valueOf(osm.getVersion())).append("'"); 385 385 } 386 386 if (this.changeset != null && this.changeset.getId() != 0) { 387 out. print(" changeset='"+this.changeset.getId()+'\'');387 out.append(" changeset='").append(String.valueOf(this.changeset.getId())).append("'"); 388 388 } else if (osm.getChangesetId() > 0 && !osm.isNew()) { 389 out. print(" changeset='"+osm.getChangesetId()+'\'');389 out.append(" changeset='").append(String.valueOf(osm.getChangesetId())).append("'"); 390 390 } 391 391 }
Note:
See TracChangeset
for help on using the changeset viewer.