Changeset 14456 in josm
- Timestamp:
- 2018-11-27T21:40:10+01:00 (6 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r14451 r14456 9 9 import java.util.Collections; 10 10 import java.util.Date; 11 import java.util.DoubleSummaryStatistics;12 11 import java.util.HashMap; 13 12 import java.util.HashSet; 14 13 import java.util.Iterator; 15 14 import java.util.List; 15 import java.util.LongSummaryStatistics; 16 16 import java.util.Map; 17 17 import java.util.NoSuchElementException; … … 175 175 Date prevWpTime = null; 176 176 for (WayPoint wp : wpsOld) { 177 Date wpTime = wp. setTimeFromAttribute();177 Date wpTime = wp.getDate(); 178 178 boolean overlap = false; 179 179 if (wpTime != null) { … … 267 267 268 268 GpxTrackSegmentSpan(WayPoint a, WayPoint b) { 269 Date at = a.get Time();270 Date bt = b.get Time();269 Date at = a.getDate(); 270 Date bt = b.getDate(); 271 271 inv = bt.before(at); 272 272 if (inv) { … … 324 324 List<WayPoint> wps = new ArrayList<>(seg.getWayPoints()); 325 325 for (int i = forward ? 0 : wps.size() - 1; i >= 0 && i < wps.size(); i += forward ? 1 : -1) { 326 if (wps.get(i). setTimeFromAttribute() != null) {326 if (wps.get(i).hasDate()) { 327 327 return wps.get(i); 328 328 } … … 691 691 */ 692 692 public static Date[] getMinMaxTimeForTrack(GpxTrack trk) { 693 final DoubleSummaryStatistics statistics = trk.getSegments().stream()693 final LongSummaryStatistics statistics = trk.getSegments().stream() 694 694 .flatMap(seg -> seg.getWayPoints().stream()) 695 .mapTo Double(pnt -> pnt.time)695 .mapToLong(pnt -> pnt.getTimeInMillis()) 696 696 .summaryStatistics(); 697 697 return statistics.getCount() == 0 698 698 ? null 699 : new Date[]{new Date( (long) (statistics.getMin() * 1000)), new Date((long) (statistics.getMax() * 1000))};699 : new Date[]{new Date(statistics.getMin()), new Date(statistics.getMax())}; 700 700 } 701 701 … … 708 708 */ 709 709 public synchronized Date[] getMinMaxTimeForAllTracks() { 710 double now = System.currentTimeMillis() / 1000.0;711 final DoubleSummaryStatistics statistics = tracks.stream()710 long now = System.currentTimeMillis(); 711 final LongSummaryStatistics statistics = tracks.stream() 712 712 .flatMap(trk -> trk.getSegments().stream()) 713 713 .flatMap(seg -> seg.getWayPoints().stream()) 714 .mapTo Double(pnt -> pnt.time)714 .mapToLong(pnt -> pnt.getTimeInMillis()) 715 715 .filter(t -> t > 0 && t <= now) 716 716 .summaryStatistics(); 717 717 return statistics.getCount() == 0 718 718 ? new Date[0] 719 : new Date[]{new Date( (long) (statistics.getMin() * 1000)), new Date((long) (statistics.getMax() * 1000))};719 : new Date[]{new Date(statistics.getMin()), new Date(statistics.getMax())}; 720 720 } 721 721 … … 755 755 double pnminsq = tolerance * tolerance; 756 756 EastNorth bestEN = null; 757 double bestTime = 0.0;757 double bestTime = Double.NaN; 758 758 double px = p.east(); 759 759 double py = p.north(); … … 774 774 pnminsq = pRsq; 775 775 bestEN = en; 776 bestTime = r.time; 776 if (r.hasDate()) { 777 bestTime = r.getTime(); 778 } 777 779 } 778 780 } else { … … 800 802 double ny = ry + rnoverRS * a; 801 803 bestEN = new EastNorth(nx, ny); 802 bestTime = r.time + rnoverRS * (wpSeg.time - r.time); 804 if (r.hasDate() && wpSeg.hasDate()) { 805 bestTime = r.getTime() + rnoverRS * (wpSeg.getTime() - r.getTime()); 806 } 803 807 pnminsq = pnsq; 804 808 } … … 820 824 pnminsq = prsq; 821 825 bestEN = c; 822 bestTime = r.time; 826 if (r.hasDate()) { 827 bestTime = r.getTime(); 828 } 823 829 } 824 830 } … … 828 834 return null; 829 835 WayPoint best = new WayPoint(ProjectionRegistry.getProjection().eastNorth2latlon(bestEN)); 830 best.time = bestTime; 836 if (!Double.isNaN(bestTime)) { 837 best.setTimeInMillis((long) (bestTime * 1000)); 838 } 831 839 return best; 832 840 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java
r14211 r14456 46 46 int wp; 47 47 for (wp = 0; wp < wps.size(); wp++) { 48 if (wps.get(wp). setTimeFromAttribute() != null) {48 if (wps.get(wp).hasDate()) { 49 49 break; 50 50 } … … 62 62 if (o1.isEmpty() || o2.isEmpty()) 63 63 return 0; 64 return Double.compare(o1.get(0).time, o2.get(0).time);64 return o1.get(0).compareTo(o2.get(0)); 65 65 }); 66 66 trks.add(segs); … … 72 72 || o2.isEmpty() || o2.get(0).isEmpty()) 73 73 return 0; 74 return Double.compare(o1.get(0).get(0).time, o2.get(0).get(0).time);74 return o1.get(0).get(0).compareTo(o2.get(0).get(0)); 75 75 }); 76 76 … … 111 111 for (int i = 0; i < wps.size(); i++) { 112 112 WayPoint curWp = wps.get(i); 113 Date parsedTime = curWp.setTimeFromAttribute();114 113 // Interpolate timestamps in the segment, if one or more waypoints miss them 115 if ( parsedTime == null) {114 if (!curWp.hasDate()) { 116 115 //check if any of the following waypoints has a timestamp... 117 if (i > 0 && wps.get(i - 1). time != 0) {118 long prevWpTimeNoOffset = wps.get(i - 1).getTime ().getTime();116 if (i > 0 && wps.get(i - 1).hasDate()) { 117 long prevWpTimeNoOffset = wps.get(i - 1).getTimeInMillis(); 119 118 double totalDist = 0; 120 119 List<Pair<Double, WayPoint>> nextWps = new ArrayList<>(); … … 122 121 totalDist += wps.get(j - 1).getCoor().greatCircleDistance(wps.get(j).getCoor()); 123 122 nextWps.add(new Pair<>(totalDist, wps.get(j))); 124 final Date nextTime = wps.get(j).setTimeFromAttribute(); 125 if (nextTime != null) { 123 if (wps.get(j).hasDate()) { 126 124 // ...if yes, interpolate everything in between 127 long timeDiff = nextTime.getTime() - prevWpTimeNoOffset;125 long timeDiff = wps.get(j).getTimeInMillis() - prevWpTimeNoOffset; 128 126 for (Pair<Double, WayPoint> pair : nextWps) { 129 pair.b.setTime (new Date((long) (prevWpTimeNoOffset + (timeDiff * (pair.a / totalDist)))));127 pair.b.setTimeInMillis((long) (prevWpTimeNoOffset + (timeDiff * (pair.a / totalDist)))); 130 128 } 131 129 break; 132 130 } 133 131 } 134 parsedTime = curWp.setTimeFromAttribute(); 135 if (parsedTime == null) { 132 if (!curWp.hasDate()) { 136 133 break; //It's pointless to continue with this segment, because none of the following waypoints had a timestamp 137 134 } … … 142 139 } 143 140 144 final long curWpTime = parsedTime.getTime() + offset;141 final long curWpTime = curWp.getTimeInMillis() + offset; 145 142 boolean interpolate = true; 146 143 int tagTime = 0; -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r14446 r14456 5 5 import java.util.ArrayList; 6 6 import java.util.Date; 7 import java.util.HashMap; 7 8 import java.util.List; 8 9 import java.util.Objects; … … 14 15 import org.openstreetmap.josm.data.projection.Projecting; 15 16 import org.openstreetmap.josm.tools.Logging; 17 import org.openstreetmap.josm.tools.date.DateUtils; 16 18 import org.openstreetmap.josm.tools.template_engine.TemplateEngineDataProvider; 17 19 … … 23 25 24 26 /** 25 * The seconds (not milliseconds!) since 1970-01-01 00:00 UTC26 */27 public double time;28 /**29 27 * The color to draw the segment before this point in 30 28 * @see #drawLine 31 29 */ 32 30 public Color customColoring; 31 33 32 /** 34 33 * <code>true</code> indicates that the line before this point should be drawn 35 34 */ 36 35 public boolean drawLine; 36 37 37 /** 38 38 * The direction of the line before this point. Used as cache to speed up drawing. Should not be relied on. … … 40 40 public int dir; 41 41 42 /* 43 * We "inline" lat/lon, rather than using a LatLon internally => reduces memory overhead. Relevant 44 * because a lot of GPX waypoints are created when GPS tracks are downloaded from the OSM server. 45 */ 46 private final double lat; 47 private final double lon; 48 49 /* 50 * internal cache of projected coordinates 51 */ 52 private double east = Double.NaN; 53 private double north = Double.NaN; 54 private Object eastNorthCacheKey; 55 42 56 /** 43 57 * Constructs a new {@code WayPoint} from an existing one. 58 * 59 * Except for PT_TIME attribute, all attribute objects are shallow copied. 60 * This means modification of attr objects will affect original and new {@code WayPoint}. 61 * 44 62 * @param p existing waypoint 45 63 */ 46 64 public WayPoint(WayPoint p) { 65 init_attr(); 47 66 attr.putAll(p.attr); 67 attr.put(PT_TIME, p.getDate()); 48 68 lat = p.lat; 49 69 lon = p.lon; … … 51 71 north = p.north; 52 72 eastNorthCacheKey = p.eastNorthCacheKey; 53 time = p.time;54 73 customColoring = p.customColoring; 55 74 drawLine = p.drawLine; … … 62 81 */ 63 82 public WayPoint(LatLon ll) { 83 init_attr(); 64 84 lat = ll.lat(); 65 85 lon = ll.lon(); 66 86 } 67 87 68 /* 69 * We "inline" lat/lon, rather than usinga LatLon internally => reduces memory overhead. Relevant 70 * because a lot of GPX waypoints are created when GPS tracks are downloaded from the OSM server. 71 */ 72 private final double lat; 73 private final double lon; 74 75 /* 76 * internal cache of projected coordinates 77 */ 78 private double east = Double.NaN; 79 private double north = Double.NaN; 80 private Object eastNorthCacheKey; 88 /** 89 * Interim to detect legacy code that is not using {@code WayPoint.setTime(x)} 90 * functions, but {@code attr.put(PT_TIME, (String) x)} logic. 91 * To remove mid 2019 92 */ 93 private void init_attr() { 94 attr = new HashMap<String, Object>(0) { 95 @Override 96 public Object put(String key, Object value) { 97 Object ret = null; 98 if (key != PT_TIME || (key == PT_TIME && value instanceof Date)) { 99 ret = super.put(key, value); 100 } else { 101 if (value instanceof String) { 102 ret = super.put(PT_TIME, DateUtils.fromString((String) value)); 103 List<String> lastErrorAndWarnings = Logging.getLastErrorAndWarnings(); 104 if (!lastErrorAndWarnings.isEmpty() && !lastErrorAndWarnings.get(0).contains("calling WayPoint.put")) { 105 StackTraceElement[] e = Thread.currentThread().getStackTrace(); 106 int n = 1; 107 while (n < e.length && "put".equals(e[n].getMethodName())) { 108 n++; 109 } 110 if (n < e.length) { 111 Logging.warn("{0}:{1} calling WayPoint.put(PT_TIME, ..) is deprecated. " + 112 "Use WayPoint.setTime(..) instead.", e[n].getClassName(), e[n].getMethodName()); 113 } 114 } 115 } 116 } 117 return ret; 118 } 119 }; 120 } 81 121 82 122 /** … … 126 166 127 167 /** 128 * Sets the {@link # time} field as well as the {@link #PT_TIME} attribute to the specified time.168 * Sets the {@link #PT_TIME} attribute to the specified time. 129 169 * 130 170 * @param time the time to set … … 132 172 */ 133 173 public void setTime(Date time) { 134 this.time = time.getTime() / 1000.; 135 this.attr.put(PT_TIME, time); 174 setTimeInMillis(time.getTime()); 136 175 } 137 176 … … 139 178 * Convert the time stamp of the waypoint into seconds from the epoch. 140 179 * 141 * @deprecated call {@link #setTimeFromAttribute()} directly if you need this180 * @deprecated Use {@link #setTime(Date)}, {@link #setTime(long)}, {@link #setTimeInMillis(long)} 142 181 */ 143 182 @Deprecated … … 147 186 148 187 /** 149 * Sets the {@link # time} field as well as the {@link #PT_TIME} attribute to the specified time.188 * Sets the {@link #PT_TIME} attribute to the specified time. 150 189 * 151 190 * @param ts seconds from the epoch … … 153 192 */ 154 193 public void setTime(long ts) { 155 setTimeInMillis(ts *1000);156 } 157 158 /** 159 * Sets the {@link # time} field as well as the {@link #PT_TIME} attribute to the specified time.194 setTimeInMillis(ts * 1000); 195 } 196 197 /** 198 * Sets the {@link #PT_TIME} attribute to the specified time. 160 199 * 161 200 * @param ts milliseconds from the epoch … … 163 202 */ 164 203 public void setTimeInMillis(long ts) { 165 this.time = ts / 1000.; 166 this.attr.put(PT_TIME, new Date(ts)); 167 } 168 169 /** 170 * Convert the time stamp of the waypoint into seconds from the epoch 204 attr.put(PT_TIME, new Date(ts)); 205 } 206 207 /** 208 * Convert the time stamp of the waypoint into seconds from the epoch. 171 209 * @return The parsed time if successful, or {@code null} 172 210 * @since 9383 173 */ 211 * @deprecated Use {@link #setTime(Date)}, {@link #setTime(long)}, {@link #setTimeInMillis(long)} 212 */ 213 @Deprecated 174 214 public Date setTimeFromAttribute() { 175 if (attr.containsKey(PT_TIME)) { 176 final Object obj = get(PT_TIME); 215 Logging.warn("WayPoint.setTimeFromAttribute() is deprecated, please fix calling code"); 216 return getDate(); 217 } 218 219 @Override 220 public int compareTo(WayPoint w) { 221 return Long.compare(getTimeInMillis(), w.getTimeInMillis()); 222 } 223 224 /** 225 * Returns the waypoint time in seconds since the epoch. 226 * 227 * @return the waypoint time 228 */ 229 public double getTime() { 230 return getTimeInMillis() / 1000.; 231 } 232 233 /** 234 * Returns the waypoint time in milliseconds since the epoch. 235 * 236 * @return the waypoint time 237 * @since 14456 238 */ 239 public long getTimeInMillis() { 240 Date d = getDateImpl(); 241 return d == null ? 0 : d.getTime(); 242 } 243 244 /** 245 * Returns true if this waypoint has a time. 246 * 247 * @return true if a time is set, false otherwise 248 * @since 14456 249 */ 250 public boolean hasDate() { 251 return attr.get(PT_TIME) instanceof Date; 252 } 253 254 /** 255 * Returns the waypoint time Date object. 256 * 257 * @return a copy of the Date object associated with this waypoint 258 * @since 14456 259 */ 260 public Date getDate() { 261 return DateUtils.cloneDate(getDateImpl()); 262 } 263 264 /** 265 * Returns the waypoint time Date object. 266 * 267 * @return the Date object associated with this waypoint 268 */ 269 private Date getDateImpl() { 270 if (attr != null) { 271 final Object obj = attr.get(PT_TIME); 272 177 273 if (obj instanceof Date) { 178 final Date date = (Date) obj; 179 time = date.getTime() / 1000.; 180 return date; 274 return (Date) obj; 181 275 } else if (obj == null) { 182 276 Logging.info("Waypoint {0} value unset", PT_TIME); 183 277 } else { 184 278 Logging.warn("Unsupported waypoint {0} value: {1}", PT_TIME, obj); 185 time = 0;186 279 } 187 280 } 281 188 282 return null; 189 }190 191 @Override192 public int compareTo(WayPoint w) {193 return Double.compare(time, w.time);194 }195 196 /**197 * Returns the waypoint time.198 * @return the waypoint time199 */200 public Date getTime() {201 return new Date((long) (time * 1000));202 283 } 203 284 … … 228 309 temp = Double.doubleToLongBits(lon); 229 310 result = prime * result + (int) (temp ^ (temp >>> 32)); 230 temp = Double.doubleToLongBits(time);311 temp = getTimeInMillis(); 231 312 result = prime * result + (int) (temp ^ (temp >>> 32)); 232 313 return result; … … 242 323 return Double.doubleToLongBits(lat) == Double.doubleToLongBits(other.lat) 243 324 && Double.doubleToLongBits(lon) == Double.doubleToLongBits(other.lon) 244 && Double.doubleToLongBits(time) == Double.doubleToLongBits(other.time);325 && getTimeInMillis() == other.getTimeInMillis(); 245 326 } 246 327 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r14434 r14456 801 801 wpt.setTimeInMillis(time); 802 802 } else if (n.hasKey(GpxConstants.PT_TIME)) { 803 wpt.setTime (DateUtils.fromString(n.get(GpxConstants.PT_TIME)));803 wpt.setTimeInMillis(DateUtils.tsFromString(n.get(GpxConstants.PT_TIME))); 804 804 } else if (!n.isTimestampEmpty()) { 805 805 wpt.setTime(Integer.toUnsignedLong(n.getRawTimestamp())); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r14212 r14456 1230 1230 for (GpxTrackSegment segment : trk.getSegments()) { 1231 1231 for (WayPoint curWp : segment.getWayPoints()) { 1232 final Date parsedTime = curWp.setTimeFromAttribute(); 1233 if (parsedTime != null) { 1234 firstGPXDate = parsedTime.getTime(); 1232 if (curWp.hasDate()) { 1233 firstGPXDate = curWp.getTimeInMillis(); 1235 1234 break outer; 1236 1235 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r14451 r14456 509 509 continue; 510 510 } 511 if (oldWp != null && trkPnt. time > oldWp.time) {511 if (oldWp != null && trkPnt.getTimeInMillis() > oldWp.getTimeInMillis()) { 512 512 double vel = trkPnt.getCoor().greatCircleDistance(oldWp.getCoor()) 513 / (trkPnt. time - oldWp.time);513 / (trkPnt.getTime() - oldWp.getTime()); 514 514 velocities.add(vel); 515 515 } … … 587 587 switch (colored) { 588 588 case VELOCITY: 589 double dtime = trkPnt. time - oldWp.time;589 double dtime = trkPnt.getTime() - oldWp.getTime(); 590 590 if (dtime > 0) { 591 591 color = velocityScale.getColor(dist / dtime); … … 599 599 break; 600 600 case TIME: 601 double t = trkPnt. time;601 double t = trkPnt.getTime(); 602 602 // skip bad timestamps and very short tracks 603 603 if (t > 0 && t <= now && maxval - minval > minTrackDurationForTimeColoring) { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r14302 r14456 150 150 for (GpxTrackSegment seg : track.getSegments()) { 151 151 for (WayPoint w : seg.getWayPoints()) { 152 firstTime = w. time;152 firstTime = w.getTime(); 153 153 break; 154 154 } … … 175 175 if (hasWaypoints && Config.getPref().getBoolean("marker.audiofromexplicitwaypoints", true)) { 176 176 for (WayPoint w : layer.data.waypoints) { 177 if (w. time> firstTime) {177 if (w.getTime() > firstTime) { 178 178 waypoints.add(w); 179 } else if (w. time> 0.0) {179 } else if (w.getTime() > 0.0) { 180 180 timedMarkersOmitted = true; 181 181 } … … 192 192 if (wNear != null) { 193 193 WayPoint wc = new WayPoint(w.getCoor()); 194 wc. time = wNear.time;194 wc.setTimeInMillis(wNear.getTimeInMillis()); 195 195 if (w.attr.containsKey(GpxConstants.GPX_NAME)) { 196 196 wc.put(GpxConstants.GPX_NAME, w.getString(GpxConstants.GPX_NAME)); … … 230 230 for (GpxTrackSegment seg : track.getSegments()) { 231 231 for (WayPoint w : seg.getWayPoints()) { 232 if (startTime < w. time) {232 if (startTime < w.getTime()) { 233 233 w2 = w; 234 234 break; … … 246 246 } else { 247 247 wayPointFromTimeStamp = new WayPoint(w1.getCoor().interpolate(w2.getCoor(), 248 (startTime - w1. time) / (w2.time - w1.time)));249 wayPointFromTimeStamp. time = startTime;248 (startTime - w1.getTime()) / (w2.getTime() - w1.getTime()))); 249 wayPointFromTimeStamp.setTimeInMillis((long) (startTime * 1000)); 250 250 String name = audioFile.getName(); 251 251 int dot = name.lastIndexOf('.'); … … 268 268 WayPoint wStart = new WayPoint(w.getCoor()); 269 269 wStart.put(GpxConstants.GPX_NAME, "start"); 270 wStart. time = w.time;270 wStart.setTimeInMillis(w.getTimeInMillis()); 271 271 waypoints.add(wStart); 272 272 gotOne = true; … … 284 284 285 285 // we must have got at least one waypoint now 286 ((ArrayList<WayPoint>) waypoints).sort( Comparator.comparingDouble(o -> o.time));286 ((ArrayList<WayPoint>) waypoints).sort((wp, other) -> wp.compareTo(other)); 287 287 288 288 firstTime = -1.0; // this time of the first waypoint, not first trackpoint 289 289 for (WayPoint w : waypoints) { 290 290 if (firstTime < 0.0) { 291 firstTime = w. time;292 } 293 double offset = w. time- firstTime;294 AudioMarker am = new AudioMarker(w.getCoor(), w, url, ml, w. time, offset);291 firstTime = w.getTime(); 292 } 293 double offset = w.getTime() - firstTime; 294 AudioMarker am = new AudioMarker(w.getCoor(), w, url, ml, w.getTime(), offset); 295 295 // timeFromAudio intended for future use to shift markers of this type on synchronization 296 296 if (w == wayPointFromTimeStamp) { -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r14447 r14456 256 256 public WayPoint convertToWayPoint() { 257 257 WayPoint wpt = new WayPoint(getCoor()); 258 wpt.setTime ((long) (time*1000));258 wpt.setTimeInMillis((long) (time * 1000)); 259 259 if (text != null) { 260 260 wpt.addExtension("text", text); -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r14153 r14456 97 97 for (WayPoint wpt : indata.waypoints) { 98 98 /* calculate time differences in waypoints */ 99 double time = wpt. time;99 double time = wpt.getTime(); 100 100 boolean wptHasLink = wpt.attr.containsKey(GpxConstants.META_LINKS); 101 101 if (firstTime < 0 && wptHasLink) { -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r14153 r14456 167 167 if (m instanceof AudioMarker) { 168 168 AudioMarker a = (AudioMarker) m; 169 if (a.time > cw. time) {169 if (a.time > cw.getTime()) { 170 170 break; 171 171 } … … 188 188 if (cw != null) { 189 189 setCoor(cw.getCoor()); 190 ca.play(cw. time- ca.time);190 ca.play(cw.getTime() - ca.time); 191 191 } 192 192 endDrag(false); … … 245 245 return; 246 246 } 247 ca = recent.parentLayer.addAudioMarker(cw. time, cw.getCoor());247 ca = recent.parentLayer.addAudioMarker(cw.getTime(), cw.getCoor()); 248 248 } 249 249 … … 330 330 for (GpxTrackSegment trackseg : track.getSegments()) { 331 331 for (WayPoint w: trackseg.getWayPoints()) { 332 if (audioTime < w. time) {332 if (audioTime < w.getTime()) { 333 333 w2 = w; 334 334 break; … … 350 350 w1.getEastNorth(ProjectionRegistry.getProjection()) : 351 351 w1.getEastNorth(ProjectionRegistry.getProjection()).interpolate(w2.getEastNorth(ProjectionRegistry.getProjection()), 352 (audioTime - w1. time)/(w2.time - w1.time)));352 (audioTime - w1.getTime())/(w2.getTime() - w1.getTime()))); 353 353 time = audioTime; 354 354 MapView mapView = MainApplication.getMap().mapView; -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r14447 r14456 445 445 } 446 446 break; 447 case GpxConstants.PT_TIME:447 case PT_TIME: 448 448 try { 449 currentWayPoint.setTime (DateUtils.fromString(accumulator.toString()));449 currentWayPoint.setTimeInMillis(DateUtils.tsFromString(accumulator.toString())); 450 450 } catch (UncheckedParseException e) { 451 451 Logging.error(e); -
trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java
r14434 r14456 525 525 if (ps.pWp != currentwp) { 526 526 if (ps.pWp != null) { 527 ps.pWp. setTimeFromAttribute();527 ps.pWp.getDate(); 528 528 } 529 529 ps.pWp = currentwp; -
trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java
r14446 r14456 70 70 assertEquals(DateUtils.fromString("2016-01-25T05:05:09.400Z"), wayPoints.get(1).get(GpxConstants.PT_TIME)); 71 71 assertEquals(DateUtils.fromString("2016-01-25T05:05:09.600Z"), wayPoints.get(2).get(GpxConstants.PT_TIME)); 72 assertEquals(wayPoints.get(0).get Time(), wayPoints.get(0).get(GpxConstants.PT_TIME));73 74 assertEquals("2016-01-25T05:05:09.200Z", iso8601.format(wayPoints.get(0).get Time()));75 assertEquals("2016-01-25T05:05:09.400Z", iso8601.format(wayPoints.get(1).get Time()));76 assertEquals("2016-01-25T05:05:09.600Z", iso8601.format(wayPoints.get(2).get Time()));72 assertEquals(wayPoints.get(0).getDate(), wayPoints.get(0).get(GpxConstants.PT_TIME)); 73 74 assertEquals("2016-01-25T05:05:09.200Z", iso8601.format(wayPoints.get(0).getDate())); 75 assertEquals("2016-01-25T05:05:09.400Z", iso8601.format(wayPoints.get(1).getDate())); 76 assertEquals("2016-01-25T05:05:09.600Z", iso8601.format(wayPoints.get(2).getDate())); 77 77 78 78 assertEquals(new LatLon(46.98807, -1.400525), wayPoints.get(0).getCoor()); … … 171 171 172 172 private static Date readDate(String nmeaLine) throws IOException, SAXException { 173 return readWayPoint(nmeaLine).get Time();173 return readWayPoint(nmeaLine).getDate(); 174 174 } 175 175
Note:
See TracChangeset
for help on using the changeset viewer.