Subversion Repositories Projects

Rev

Rev 1563 | 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 GPSBearingAndRange {
3
public class GPSBearingAndRange {
4
        int distance;   // in m/10. 16 bit unsigned.
4
        double distance;        // in m.
-
 
5
        double bearing;         // in degrees.
5
        int bearing;    // in degrees. 16 bit signed.
6
       
6
        public int getDistance() {
7
        public double getDistance() {
7
                return distance;
8
                return distance;
-
 
9
        }
8
        }
10
       
9
        public int getBearing() {
11
        public double getBearing() {
10
                return bearing;
12
                return bearing;
-
 
13
        }
11
        }
14
       
12
        public void setDistance(int distance) {
15
        public void setDistance(double distance) {
13
                this.distance = distance;
16
                this.distance = distance;
-
 
17
        }
14
        }
18
       
15
        public void setBearing(int bearing) {
19
        public void setBearing(double bearing) {
16
                this.bearing = bearing;
20
                this.bearing = bearing;
-
 
21
        }
17
        }
22
       
18
        public String toXML() {
23
        public String toXML() {
19
                String result = "distance=\"" + ((double)this.distance)/10;
24
                String result = "distance=\"" + this.distance;
20
                result += "\" bearing=\"";
25
                result += "\" bearing=\"";
21
                result += this.bearing;
26
                result += this.bearing;
22
                result += "\"";
27
                result += "\"";
23
                return result; 
28
                return result; 
-
 
29
        }
24
        }
30
       
25
        public String toString() {
31
        public String toString() {
26
                String result = "" + ((double)this.distance)/10;
-
 
27
                result += "m @";
32
                String result = this.distance + "m @";
28
                result += this.bearing;
33
                result += this.bearing;
29
                result += "deg";
34
                result += "deg";
30
                return result; 
35
                return result; 
31
        }
36
        }