Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
135 | ligi | 1 | /********************************************* |
2 | * |
||
3 | * class representing the DebugData Structure |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
6 | * |
||
7 | * see README for further Infos |
||
8 | * |
||
9 | ********************************************/ |
||
10 | |||
11 | public class MKGPSPosition |
||
12 | |||
13 | { |
||
14 | |||
15 | public final static int MAX_WAYPOINTS=100; |
||
16 | |||
17 | int[] LongWP; |
||
18 | int[] LatWP; |
||
19 | |||
20 | int last_wp=0; |
||
21 | |||
22 | |||
23 | int Longitude; |
||
24 | int Latitude; |
||
25 | |||
26 | int TargetLongitude; |
||
27 | int TargetLatitude; |
||
28 | |||
29 | int Distance2Target; |
||
30 | int Angle2Target; |
||
31 | |||
32 | byte Used_Sat; |
||
33 | |||
34 | |||
35 | public void push_wp() |
||
36 | { |
||
37 | LongWP[last_wp]=Longitude; |
||
38 | LatWP[last_wp]=Latitude; |
||
39 | last_wp++; |
||
40 | } |
||
41 | |||
42 | |||
43 | public String dec_to_min_sec(int val) |
||
44 | { |
||
45 | return "" + val/10000000 + "^" + ((val%10000000)*60)/10000000 + "'" + ((((val%10000000)*60)%10000000)*60)/10000000 + "." + ((((val%10000000)*60)%10000000)*60)%10000000; |
||
46 | } |
||
47 | |||
48 | |||
49 | public String WP_Latitude_min_sec(int id) |
||
50 | { |
||
51 | |||
52 | return "" + dec_to_min_sec(LatWP[id])+ "''N" ; |
||
53 | } |
||
54 | |||
55 | public String WP_Longitude_min_sec(int id) |
||
56 | { |
||
57 | return "" + dec_to_min_sec(LongWP[id])+ "''E" ; |
||
58 | |||
59 | } |
||
60 | |||
61 | |||
62 | |||
63 | public String Latitude_min_sec() |
||
64 | { |
||
65 | |||
66 | return "" + dec_to_min_sec(Latitude)+ "''N" ; |
||
67 | } |
||
68 | |||
69 | public String Longitude_min_sec() |
||
70 | { |
||
71 | return "" + dec_to_min_sec(Longitude)+ "''E" ; |
||
72 | |||
73 | } |
||
74 | |||
75 | public String Latitude_str() |
||
76 | { |
||
77 | return "" + Latitude/10000000 + "." +Latitude%10000000 ; |
||
78 | } |
||
79 | |||
80 | public String Longitude_str() |
||
81 | { |
||
82 | return "" + Longitude/10000000 + "." +Longitude%10000000 ; |
||
83 | } |
||
84 | |||
85 | public MKGPSPosition() |
||
86 | { |
||
87 | |||
88 | LongWP=new int[MAX_WAYPOINTS]; |
||
89 | LatWP=new int[MAX_WAYPOINTS]; |
||
90 | |||
91 | } |
||
92 | |||
93 | private int parse_arr(int offset,int[] in_arr) |
||
94 | { |
||
95 | return ((in_arr[offset+3]<<24) | |
||
96 | (in_arr[offset+2]<<16) | |
||
97 | (in_arr[offset+1]<<8) | |
||
98 | (in_arr[offset+0])); |
||
99 | } |
||
100 | |||
101 | public void set_by_mk_data(int[] in_arr,MKVersion version) |
||
102 | { |
||
103 | Longitude=parse_arr(0,in_arr); |
||
104 | Latitude=parse_arr(4,in_arr); |
||
105 | |||
106 | TargetLongitude=parse_arr(8,in_arr); |
||
107 | TargetLatitude=parse_arr(12,in_arr); |
||
108 | |||
109 | Distance2Target=parse_arr(16,in_arr); |
||
110 | Angle2Target=parse_arr(20,in_arr); |
||
111 | Used_Sat=(byte)in_arr[24]; |
||
112 | |||
113 | } |
||
114 | |||
115 | |||
116 | |||
117 | } |