Rev 1563 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1563 | Rev 1565 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package dongfang.mkt.datatype; |
1 | package dongfang.mkt.datatype; |
Line 2... | Line 2... | ||
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; |
- | 7 | public static final int PROCESSED = 0x02; |
|
- | 8 | ||
- | 9 | double longitude; |
|
- | 10 | double latitude; |
|
- | 11 | double altitude; |
|
6 | long altitude; // in mm. 32 bit signed. |
12 | |
Line 7... | Line 13... | ||
7 | int status; |
13 | int status; |
8 | 14 | ||
9 | public int getLongitude() { |
15 | public double getLongitude() { |
Line 10... | Line 16... | ||
10 | return longitude; |
16 | return longitude; |
11 | } |
17 | } |
12 | 18 | ||
Line 13... | Line 19... | ||
13 | public int getLatitude() { |
19 | public double getLatitude() { |
14 | return latitude; |
20 | return latitude; |
15 | } |
21 | } |
Line 16... | Line 22... | ||
16 | 22 | ||
17 | public long getAltitude() { |
23 | public double getAltitude() { |
18 | return altitude; |
24 | return altitude; |
Line 19... | Line 25... | ||
19 | } |
25 | } |
20 | 26 | ||
21 | public int getStatus() { |
27 | public int getStatus() { |
Line 22... | Line 28... | ||
22 | return status; |
28 | return status; |
23 | } |
29 | } |
24 | 30 | ||
Line 25... | Line 31... | ||
25 | public void setLongitude(int longitude) { |
31 | public void setLongitude(double longitude) { |
26 | this.longitude = longitude; |
32 | this.longitude = longitude; |
27 | } |
33 | } |
Line 28... | Line 34... | ||
28 | 34 | ||
29 | public void setLatitude(int latitude) { |
35 | public void setLatitude(double latitude) { |
30 | this.latitude = latitude; |
36 | this.latitude = latitude; |
Line 31... | Line 37... | ||
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"; |
Line 48... | Line 54... | ||
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) |