Changeset 647 in josm for trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
- Timestamp:
- 2008-06-10T00:16:09+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r646 r647 26 26 import java.util.Comparator; 27 27 import java.util.LinkedList; 28 import java.util.Date; 29 import java.text.DateFormat; 30 import java.text.DecimalFormat; 28 31 29 32 import javax.swing.AbstractAction; … … 279 282 .append("<br>"); 280 283 284 if(data.tracks.size() > 0){ 285 boolean first = true; 286 WayPoint earliest = null, latest = null; 287 288 for(GpxTrack trk: data.tracks){ 289 for(Collection<WayPoint> seg:trk.trackSegs){ 290 for(WayPoint pnt:seg){ 291 if(first){ 292 latest = earliest = pnt; 293 first = false; 294 }else{ 295 if(pnt.compareTo(earliest) < 0){ 296 earliest = pnt; 297 }else{ 298 latest = pnt; 299 } 300 } 301 } 302 } 303 } 304 DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); 305 info.append(tr("Timespan: ") + df.format(new Date((long)(earliest.time * 1000))) + " - " + df.format(new Date((long)(latest.time * 1000)))); 306 int diff = (int)(latest.time - earliest.time); 307 info.append(" (" + (diff / 3600) + ":" + ((diff % 3600)/60) + ")"); 308 info.append("<br>"); 309 } 310 info.append(tr("Length: ") + new DecimalFormat("#0.00").format(data.length() / 1000) + "km"); 311 info.append("<br>"); 312 281 313 return info.append("</html>").toString(); 282 314 }
Note:
See TracChangeset
for help on using the changeset viewer.