Rev 1563 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1563 | Rev 1565 | ||
---|---|---|---|
1 | package dongfang.mkt.datatype; |
1 | package dongfang.mkt.datatype; |
2 | 2 | ||
3 | public class GPSPosition { |
3 | public class GPSPosition { |
- | 4 | ||
4 | int longitude; // in 1E-7 degrees. 32 bit signed. |
5 | public static final int INVALID = 0x00; |
5 | int latitude; // in 1E-7 degrees. 32 bit signed. |
6 | public static final int NEWDATA = 0x01; |
6 | long altitude; // in mm. 32 bit signed. |
7 | public static final int PROCESSED = 0x02; |
- | 8 | ||
- | 9 | double longitude; |
|
- | 10 | double latitude; |
|
- | 11 | double altitude; |
|
- | 12 | ||
7 | int status; |
13 | int status; |
8 | 14 | ||
9 | public int getLongitude() { |
15 | public double getLongitude() { |
10 | return longitude; |
16 | return longitude; |
11 | } |
17 | } |
12 | 18 | ||
13 | public int getLatitude() { |
19 | public double getLatitude() { |
14 | return latitude; |
20 | return latitude; |
15 | } |
21 | } |
16 | 22 | ||
17 | public long getAltitude() { |
23 | public double getAltitude() { |
18 | return altitude; |
24 | return altitude; |
19 | } |
25 | } |
20 | 26 | ||
21 | public int getStatus() { |
27 | public int getStatus() { |
22 | return status; |
28 | return status; |
23 | } |
29 | } |
24 | 30 | ||
25 | public void setLongitude(int longitude) { |
31 | public void setLongitude(double longitude) { |
26 | this.longitude = longitude; |
32 | this.longitude = longitude; |
27 | } |
33 | } |
28 | 34 | ||
29 | public void setLatitude(int latitude) { |
35 | public void setLatitude(double latitude) { |
30 | this.latitude = latitude; |
36 | this.latitude = latitude; |
31 | } |
37 | } |
32 | 38 | ||
33 | public void setAltitude(long altitude) { |
39 | public void setAltitude(double altitude) { |
34 | this.altitude = altitude; |
40 | this.altitude = altitude; |
35 | } |
41 | } |
36 | 42 | ||
37 | public void setStatus(int status) { |
43 | public void setStatus(int status) { |
38 | this.status = status; |
44 | this.status = status; |
39 | } |
45 | } |
40 | 46 | ||
41 | public String toXML() { |
47 | public String toXML() { |
42 | double latitude = Math.abs(this.latitude); |
48 | double latitude = Math.abs(this.latitude); |
43 | String result = "latitude=\"" + latitude / 1E7; |
49 | String result = "latitude=\"" + latitude; |
44 | if (this.latitude < 0) |
50 | if (this.latitude < 0) |
45 | result += "S"; |
51 | result += "S"; |
46 | else |
52 | else |
47 | result += "N"; |
53 | result += "N"; |
48 | result += "\""; |
54 | result += "\""; |
49 | double longitude = Math.abs(this.longitude); |
55 | double longitude = Math.abs(this.longitude); |
50 | result += " longitude=\"" + longitude / 1E7; |
56 | result += " longitude=\"" + longitude; |
51 | if (this.longitude < 0) |
57 | if (this.longitude < 0) |
52 | result += "W"; |
58 | result += "W"; |
53 | else |
59 | else |
54 | result += "E"; |
60 | result += "E"; |
55 | result += "\""; |
61 | result += "\""; |
56 | return result; |
62 | return result; |
57 | } |
63 | } |
58 | 64 | ||
59 | public String toString() { |
65 | public String toString() { |
60 | double latitude = Math.abs(this.latitude); |
66 | double latitude = Math.abs(this.latitude); |
61 | String result = "" + latitude / 1E7; |
67 | String result = "" + latitude; |
62 | if (this.latitude < 0) |
68 | if (this.latitude < 0) |
63 | result += "S"; |
69 | result += "S"; |
64 | else |
70 | else |
65 | result += "N"; |
71 | result += "N"; |
66 | result += " "; |
72 | result += " "; |
67 | double longitude = Math.abs(this.longitude); |
73 | double longitude = Math.abs(this.longitude); |
68 | result += "" + longitude / 1E7; |
74 | result += "" + longitude; |
69 | if (this.longitude < 0) |
75 | if (this.longitude < 0) |
70 | result += "W"; |
76 | result += "W"; |
71 | else |
77 | else |
72 | result += "E"; |
78 | result += "E"; |
73 | return result; |
79 | return result; |
74 | } |
80 | } |
75 | } |
81 | } |
76 | 82 |