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