source: josm/trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java@ 1911

Last change on this file since 1911 was 1724, checked in by stoecker, 15 years ago

some more changes and bug fixes related to new projection stuff - GPX should now work also

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1//License: GPLv2 or later
2//Copyright 2007 by Raphael Mack and others
3
4package org.openstreetmap.josm.data.gpx;
5
6import java.util.Date;
7import java.awt.Color;
8
9import org.openstreetmap.josm.Main;
10import org.openstreetmap.josm.data.coor.CachedLatLon;
11import org.openstreetmap.josm.data.coor.EastNorth;
12import org.openstreetmap.josm.data.coor.LatLon;
13import org.openstreetmap.josm.data.projection.Projection;
14import org.openstreetmap.josm.tools.DateUtils;
15
16public class WayPoint extends WithAttributes implements Comparable<WayPoint>
17{
18 public double time;
19 public Color customColoring;
20 public boolean drawLine;
21 public int dir;
22
23 private CachedLatLon coor;
24
25 public final LatLon getCoor() {
26 return coor;
27 }
28
29 public final EastNorth getEastNorth() {
30 return coor.getEastNorth();
31 }
32
33 public WayPoint(LatLon ll) {
34 coor = new CachedLatLon(ll);
35 }
36
37 @Override
38 public String toString() {
39 return "WayPoint (" + (attr.containsKey("name") ? attr.get("name") + ", " :"") + coor.toString() + ", " + attr + ")";
40 }
41
42 /**
43 * Convert the time stamp of the waypoint into seconds from the epoch
44 */
45 public void setTime() {
46 for(String key : new String[]{"time", "cmt", "desc"})
47 {
48 if(attr.containsKey("time"))
49 {
50 double t = DateUtils.fromString(attr.get("time").toString()).getTime();
51 if(t != 0.0)
52 {
53 time = t / 1000.0; /* ms => seconds */
54 break;
55 }
56 }
57 }
58 }
59
60 public int compareTo(WayPoint w)
61 {
62 return Double.compare(time, w.time);
63 }
64}
Note: See TracBrowser for help on using the repository browser.