- Timestamp:
- 2009-10-04T15:57:42+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/gpx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r2151 r2247 117 117 public double length(){ 118 118 double result = 0.0; // in meters 119 WayPoint last = null;120 119 121 for (GpxTrack trk : tracks) 122 result += trk.length(); 120 for (GpxTrack trk : tracks) { 121 result += trk.length(); 122 } 123 123 124 124 return result; -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
r2151 r2247 5 5 6 6 import java.util.Collection; 7 import java.util. LinkedList;7 import java.util.concurrent.ConcurrentLinkedQueue; 8 8 9 9 public class GpxTrack extends WithAttributes { 10 public Collection<Collection<WayPoint>> trackSegs11 = new LinkedList<Collection<WayPoint>>();10 public final Collection<Collection<WayPoint>> trackSegs 11 = new ConcurrentLinkedQueue<Collection<WayPoint>>(); 12 12 13 13 /** … … 18 18 WayPoint last = null; 19 19 20 for (Collection<WayPoint> trkseg : trackSegs) { 21 for (WayPoint tpt : trkseg) { 22 if(last != null){ 23 Double d = last.getCoor().greatCircleDistance(tpt.getCoor()); 24 if(!d.isNaN() && !d.isInfinite()) 25 result += d; 26 } 27 last = tpt; 28 } 29 last = null; // restart for each track segment 30 } 20 for (Collection<WayPoint> trkseg : trackSegs) { 21 for (WayPoint tpt : trkseg) { 22 if(last != null){ 23 Double d = last.getCoor().greatCircleDistance(tpt.getCoor()); 24 if(!d.isNaN() && !d.isInfinite()) { 25 result += d; 26 } 27 } 28 last = tpt; 29 } 30 last = null; // restart for each track segment 31 } 31 32 return result; 32 33 } -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r2017 r2247 41 41 */ 42 42 public void setTime() { 43 for(String key : new String[]{"time", "cmt", "desc"})43 if(attr.containsKey("time")) 44 44 { 45 if(attr.containsKey("time")) 46 { 47 double t = DateUtils.fromString(attr.get("time").toString()).getTime(); 48 if(t != 0.0) 49 { 50 time = t / 1000.0; /* ms => seconds */ 51 break; 52 } 45 double t = DateUtils.fromString(attr.get("time").toString()).getTime(); 46 if(t != 0.0) { 47 time = t / 1000.0; /* ms => seconds */ 53 48 } 54 49 }
Note:
See TracChangeset
for help on using the changeset viewer.