Changeset 13903 in josm


Ignore:
Timestamp:
2018-06-09T00:36:19+02:00 (2 months ago)
Author:
Don-vip
Message:

fix #16368 - export lat/lon and timestamps in .osn files as we do in .osm files: locale-independent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/NoteWriter.java

    r8380 r13903  
    77import java.io.PrintWriter;
    88import java.nio.charset.StandardCharsets;
    9 import java.text.DateFormat;
    109
     10import org.openstreetmap.josm.data.coor.LatLon;
    1111import org.openstreetmap.josm.data.notes.Note;
    1212import org.openstreetmap.josm.data.notes.NoteComment;
     
    2020 * attribute in the comment element to indicate if the comment is a new local
    2121 * comment that has not been uploaded to the OSM server yet.
     22 * @since 7732
    2223 */
    2324public class NoteWriter extends XmlWriter {
    24 
    25     private final DateFormat iso8601Format = DateUtils.newIsoDateTimeFormat();
    2625
    2726    /**
     
    4948        out.println("<osm-notes>");
    5049        for (Note note : data.getNotes()) {
     50            LatLon ll = note.getLatLon();
    5151            out.print("  <note ");
    5252            out.print("id=\"" + note.getId() + "\" ");
    53             out.print("lat=\"" + note.getLatLon().lat() + "\" ");
    54             out.print("lon=\"" + note.getLatLon().lon() + "\" ");
    55             out.print("created_at=\"" + iso8601Format.format(note.getCreatedAt()) + "\" ");
     53            out.print("lat=\"" + LatLon.cDdHighPecisionFormatter.format(ll.lat()) + "\" ");
     54            out.print("lon=\"" + LatLon.cDdHighPecisionFormatter.format(ll.lon()) + "\" ");
     55            out.print("created_at=\"" + DateUtils.fromDate(note.getCreatedAt()) + "\" ");
    5656            if (note.getClosedAt() != null) {
    57                 out.print("closed_at=\"" + iso8601Format.format(note.getClosedAt()) + "\" ");
     57                out.print("closed_at=\"" + DateUtils.fromDate(note.getClosedAt()) + "\" ");
    5858            }
    5959
     
    7272        out.print("    <comment");
    7373        out.print(" action=\"" + comment.getNoteAction() + "\" ");
    74         out.print("timestamp=\"" + iso8601Format.format(comment.getCommentTimestamp()) + "\" ");
     74        out.print("timestamp=\"" + DateUtils.fromDate(comment.getCommentTimestamp()) + "\" ");
    7575        if (comment.getUser() != null && !comment.getUser().equals(User.getAnonymous())) {
    7676            out.print("uid=\"" + comment.getUser().getId() + "\" ");
Note: See TracChangeset for help on using the changeset viewer.