Changes between Initial Version and Version 1 of Ticket #22492, comment 2


Ignore:
Timestamp:
2022-11-14T21:42:48+01:00 (3 years ago)
Author:
taylor.smock

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22492, comment 2

    initial v1  
    1 The `time` element is ''technically'' optional. So this shouldn't be too difficult to fix.
     1The `time` element is ''technically'' optional. ~~So this shouldn't be too difficult to fix.~~
     2
     3EDIT: Nevermind. It looks like it is going to be breaking several public methods to fix this.
     4
     5This would be the "easiest" fix that closes this ticket. Unfortunately, it also means that older behavior would not work, and converting an arbitrary way to a GPX file would probably fail.
     6
     7{{{#!diff
     8Index: src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
     9===================================================================
     10diff --git a/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java b/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
     11--- a/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java    (revision 18597)
     12+++ b/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java    (date 1668458279450)
     13@@ -886,8 +886,6 @@
     14                 wpt.setTimeInMillis(time);
     15             } else if ((v = gpxVal(n, gpxPrefix, GpxConstants.PT_TIME)) != null) {
     16                 wpt.setInstant(DateUtils.parseInstant(v));
     17-            } else if (!n.isTimestampEmpty()) {
     18-                wpt.setInstant(n.getInstant());
     19             }
     20         } catch (UncheckedParseException | DateTimeException e) {
     21             Logging.error(e);
     22}}}
     23
     24In order to really fix this, I'm going to need to extract the OSM to GPX translation code to its own class and add a UI asking the user if they want to keep the node timestamp.