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

Last change on this file since 2151 was 2017, checked in by Gubaer, 15 years ago

removed OptionPaneUtil
cleanup of deprecated Layer API
cleanup of deprecated APIs in OsmPrimitive and Way
cleanup of imports

  • Property svn:eol-style set to native
File size: 1.5 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.awt.Color;
7
8import org.openstreetmap.josm.data.coor.CachedLatLon;
9import org.openstreetmap.josm.data.coor.EastNorth;
10import org.openstreetmap.josm.data.coor.LatLon;
11import org.openstreetmap.josm.tools.DateUtils;
12
13public class WayPoint extends WithAttributes implements Comparable<WayPoint>
14{
15 public double time;
16 public Color customColoring;
17 public boolean drawLine;
18 public int dir;
19
20 private CachedLatLon coor;
21
22 public final LatLon getCoor() {
23 return coor;
24 }
25
26 public final EastNorth getEastNorth() {
27 return coor.getEastNorth();
28 }
29
30 public WayPoint(LatLon ll) {
31 coor = new CachedLatLon(ll);
32 }
33
34 @Override
35 public String toString() {
36 return "WayPoint (" + (attr.containsKey("name") ? attr.get("name") + ", " :"") + coor.toString() + ", " + attr + ")";
37 }
38
39 /**
40 * Convert the time stamp of the waypoint into seconds from the epoch
41 */
42 public void setTime() {
43 for(String key : new String[]{"time", "cmt", "desc"})
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 }
53 }
54 }
55 }
56
57 public int compareTo(WayPoint w)
58 {
59 return Double.compare(time, w.time);
60 }
61}
Note: See TracBrowser for help on using the repository browser.