Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/data/gpx
- Timestamp:
- 2015-06-20T23:42:21+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/gpx
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxConstants.java
r7937 r8510 102 102 * Possible fix values. 103 103 */ 104 public static Collection<String> FIX_VALUES = Arrays.asList("none", "2d","3d","dgps","pps");104 public static Collection<String> FIX_VALUES = Arrays.asList("none", "2d", "3d", "dgps", "pps"); 105 105 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r8506 r8510 200 200 } 201 201 } 202 if (earliest ==null || latest==null) return null;202 if (earliest == null || latest == null) return null; 203 203 return new Date[]{earliest.getTime(), latest.getTime()}; 204 204 } … … 212 212 */ 213 213 public Date[] getMinMaxTimeForAllTracks() { 214 double min =1e100;215 double max =-1e100;214 double min = 1e100; 215 double max = -1e100; 216 216 double now = System.currentTimeMillis()/1000.0; 217 217 for (GpxTrack trk: tracks) { … … 219 219 for (WayPoint pnt : seg.getWayPoints()) { 220 220 double t = pnt.time; 221 if (t >0 && t<=now) {222 if (t >max) max=t;223 if (t <min) min=t;224 } 225 } 226 } 227 } 228 if (Utils.equalsEpsilon(min,1e100) || Utils.equalsEpsilon(max,-1e100)) return new Date[0]; 221 if (t > 0 && t <= now) { 222 if (t > max) max = t; 223 if (t < min) min = t; 224 } 225 } 226 } 227 } 228 if (Utils.equalsEpsilon(min, 1e100) || Utils.equalsEpsilon(max, -1e100)) return new Date[0]; 229 229 return new Date[]{new Date((long) (min * 1000)), new Date((long) (max * 1000))}; 230 230 } … … 363 363 public void resetEastNorthCache() { 364 364 if (waypoints != null) { 365 for (WayPoint wp : waypoints){ 365 for (WayPoint wp : waypoints) { 366 366 wp.invalidateEastNorthCache(); 367 367 } 368 368 } 369 if (tracks != null){ 369 if (tracks != null) { 370 370 for (GpxTrack track: tracks) { 371 371 for (GpxTrackSegment segment: track.getSegments()) { -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
r7509 r8510 14 14 15 15 Collection<GpxTrackSegment> getSegments(); 16 16 17 Map<String, Object> getAttributes(); 18 17 19 Bounds getBounds(); 20 18 21 double length(); 19 22 -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java
r5170 r8510 13 13 14 14 Bounds getBounds(); 15 15 16 Collection<WayPoint> getWayPoints(); 17 16 18 double length(); 19 17 20 /** 18 21 * -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrack.java
r7005 r8510 30 30 } 31 31 32 private double calculateLength(){ 32 private double calculateLength() { 33 33 double result = 0.0; // in meters 34 34 -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrackSegment.java
r7005 r8510 36 36 WayPoint last = null; 37 37 for (WayPoint tpt : wayPoints) { 38 if(last != null){ 38 if (last != null) { 39 39 Double d = last.getCoor().greatCircleDistance(tpt.getCoor()); 40 if(!d.isNaN() && !d.isInfinite()) { 40 if (!d.isNaN() && !d.isInfinite()) { 41 41 result += d; 42 42 } -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r8376 r8510 67 67 68 68 public final LatLon getCoor() { 69 return new LatLon(lat,lon); 69 return new LatLon(lat, lon); 70 70 } 71 71 … … 95 95 @Override 96 96 public String toString() { 97 return "WayPoint (" + (attr.containsKey(GPX_NAME) ? get(GPX_NAME) + ", " :"") + getCoor() + ", " + attr + ")"; 97 return "WayPoint (" + (attr.containsKey(GPX_NAME) ? get(GPX_NAME) + ", " : "") + getCoor() + ", " + attr + ")"; 98 98 } 99 99 … … 105 105 try { 106 106 time = dateParser.get().parse(get(PT_TIME).toString()).getTime() / 1000.; /* ms => seconds */ 107 } catch(Exception e) { 107 } catch (Exception e) { 108 108 time = 0; 109 109 } -
trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java
r7518 r8510 44 44 public String getString(String key) { 45 45 Object value = attr.get(key); 46 return (value instanceof String) ? (String)value : null; 46 return (value instanceof String) ? (String) value : null; 47 47 } 48 48 … … 60 60 public <T> Collection<T> getCollection(String key) { 61 61 Object value = attr.get(key); 62 return (value instanceof Collection) ? (Collection<T>)value : null; 62 return (value instanceof Collection) ? (Collection<T>) value : null; 63 63 } 64 64
Note:
See TracChangeset
for help on using the changeset viewer.