#N canvas 1 91 1246 672 10;
#X obj 14 14 receive fromSystem;
#X obj 14 60 route /location /compass;
#X obj 14 37 list trim;
#X obj 14 113 unpack f f f f f f f f f;
#X obj 63 192 pack f f f f, f 19;
#X obj 593 352 geocoord_dist;
#X obj 683 352 geocoord_bearing;
#X obj 593 292 pack f f f f;
#X obj 84 83 s \$0-compass;
#X obj 83 225 s latlon;
#X obj 28 446 wav2~;
#X msg 28 384 01.wav;
#X msg 41 417 1;
#X msg 114 376 \; pd dsp 1;
#X obj 75 320 loadbang;
#X obj 28 469 *~;
#X obj 75 343 t b b b;
#X obj 88 430 r \$0-dist;
#X obj 88 476 print vol;
#X obj 28 492 *~;
#X obj 28 515 dac~;
#N canvas 1 91 594 663 get_point 0;
#X obj 267 17 r fromGUI;
#X obj 267 86 sel 1;
#X obj 267 173 send toSystem;
#X obj 17 40 list trim;
#X obj 17 17 r fromSystem;
#X obj 17 63 route /textDialog;
#X obj 358 86 sel 1;
#X obj 267 40 list trim;
#X obj 17 158 tofloat;
#X obj 157 158 tofloat;
#X obj 267 63 route /btn.Set.Lat /btn.Set.Lon;
#X msg 267 110 list /textDialog /diagInputLat Set Latitude:;
#X msg 287 143 list /textDialog /diagInputLong Set Longitude:;
#X obj 17 316 send toGUI;
#X obj 17 86 route /diagInputLong /diagInputLat;
#X msg 17 264 list /disp.Loc.Pointing.Lon.Coarse \$1;
#X msg 44 287 list /disp.Loc.Pointing.Lon.Fine \$1;
#X obj 43 567 outlet;
#X obj 43 544 pack f f f f;
#X obj 157 427 send toGUI;
#X msg 184 398 list /disp.Loc.Pointing.Lat.Fine \$1;
#X msg 157 375 list /disp.Loc.Pointing.Lat.Coarse \$1;
#X text 40 589 (Lat.fine \, Lon.fine \, Lat.rough \, Lon.rough);
#X obj 43 521 f;
#X obj 43 492 t b a;
#X obj 157 323 expr $f1+int($f2*1000)/1000 \; rint(abs($f2*1000000))%1000
;
#X obj 17 212 expr $f1+int($f2*1000)/1000 \; rint(abs($f2*1000000))%1000
;
#X connect 0 0 7 0;
#X connect 1 0 11 0;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X connect 5 0 14 0;
#X connect 6 0 12 0;
#X connect 7 0 10 0;
#X connect 8 0 26 0;
#X connect 8 1 26 1;
#X connect 9 0 25 0;
#X connect 9 1 25 1;
#X connect 10 0 1 0;
#X connect 10 1 6 0;
#X connect 11 0 2 0;
#X connect 12 0 2 0;
#X connect 14 0 8 0;
#X connect 14 1 9 0;
#X connect 15 0 13 0;
#X connect 16 0 13 0;
#X connect 18 0 17 0;
#X connect 20 0 19 0;
#X connect 21 0 19 0;
#X connect 23 0 18 0;
#X connect 24 0 23 0;
#X connect 24 1 18 3;
#X connect 25 0 18 2;
#X connect 25 0 21 0;
#X connect 25 1 23 1;
#X connect 25 1 20 0;
#X connect 26 0 15 0;
#X connect 26 0 24 0;
#X connect 26 1 18 1;
#X connect 26 1 16 0;
#X restore 904 20 pd get_point;
#X obj 593 43 unpack f f f f;
#X obj 593 20 r latlon;
#X obj 831 352 geocoord_dist;
#X obj 921 352 geocoord_bearing;
#X obj 831 315 t a a;
#X obj 831 292 pack f f f f;
#X obj 593 112 pack f f f f;
#X obj 593 89 f;
#X obj 593 66 t b a;
#X obj 823 135 unpack f f f f;
#X obj 593 135 unpack f f f f;
#X obj 850 184 expr copysign($f1 \, $f2)/1e+06;
#X obj 823 207 expr copysign($f1 \, $f2)/1e+06;
#X obj 620 184 expr copysign($f1 \, $f2)/1e+06;
#X obj 593 207 expr copysign($f1 \, $f2)/1e+06;
#X text 984 274 coarse;
#X text 717 281 fine;
#X obj 633 414 print dist(km)-fine;
#X obj 633 437 print brng(deg)-fine;
#X obj 871 414 print dist(km)-coarse;
#X obj 871 437 print brng(deg)-coarse;
#X obj 593 375 v distF\$0;
#X obj 683 375 v brngF\$0;
#X obj 921 375 v brngC\$0;
#X obj 831 375 v distC\$0;
#X obj 593 315 t b a a;
#X obj 505 359 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 686 479 v x\$0;
#X obj 686 499 v y\$0;
#X obj 631 525 expr sqrt(x\$0*x\$0+y\$0*y\$0) \; atan2(x\$0 \, y\$0)*360/6.28319
\; x\$0=distC\$0*sin(brngC\$0*6.28319/360)+ distF\$0*sin(brngF\$0*6.28319/360)
\; y\$0=distC\$0*cos(brngC\$0*6.28319/360)+ distF\$0*cos(brngF\$0*6.28319/360)
;
#X obj 631 619 s \$0-dist;
#X obj 704 619 s \$0-brng;
#X obj 45 258 print locations:;
#N canvas 1 91 604 394 notes 0;
#X text 18 15 when location data is enabled \, it is sent via a message
"/location" with 9 numbers. Location coordinate data in iOS is a 64-bit
floating point number (double);
#X text 18 65 PureData is only 32-bit float \, so sending that number
into a patch loses resolution. However \, a tweaky workaround (via
64-bit math in the iOS layer) is provided by the last 4 numbers in
the message.;
#X text 18 125 arg #1: latitude coordinate (as 32-bit float);
#X text 18 145 arg #2: longitude coordinate (as 32-bit float);
#X text 18 165 arg #3: altitude (meters);
#X text 18 185 arg #4: horizontal accuracy (meters radius);
#X text 18 205 arg #5: vertical (altitude) accuracy (meters radius)
;
#X text 18 235 arg #6: latitude "rough";
#X text 18 275 arg #8: latitude "fine";
#X text 18 255 arg #7: longitude "rough";
#X text 18 295 arg #9: longitude "fine";
#X text 208 235 latitude/longitude "rough" = 64-bit value multiplied
by 1000 and truncated to an integer before being sent into Pd;
#X text 208 285 latitude/longitude "fine" = 64-bit value modded by
0.001 \, multiplied by 1e+06 \, and truncated to an integer \, before
being sent into Pd So the "rough" contains the significant digits up
to the thousandths place \, and the "fine" contains the next three
significant digits. An original coordinate value of 123.457 would be
turned into rough=123456 fine=789.;
#X restore 223 113 pd notes;
#X text 202 188 arg #6: latitude "rough";
#X text 202 228 arg #8: latitude "fine";
#X text 202 208 arg #7: longitude "rough";
#X text 202 248 arg #9: longitude "fine";
#X text 170 113 <======;
#N canvas 44 91 1064 607 gui 0;
#X obj 16 196 send toGUI;
#X obj 526 72 list trim;
#X obj 526 49 receive fromGUI;
#X msg 526 118 list /enableLocation \$1;
#X obj 526 141 send toSystem;
#X obj 356 49 loadbang;
#X obj 356 95 send toGUI;
#X obj 425 554 send toGUI;
#N canvas 1 91 504 397 draw_arrow 0;
#X obj 89 257 rot2d;
#X msg 89 149 0.5 0.6;
#X obj 70 327 list store;
#X msg 106 172 0.4 0.7;
#X msg 123 195 0.5 0;
#X msg 140 218 0.6 0.7;
#X obj 89 280 list prepend append;
#X obj 89 303 list trim;
#X obj 70 103 t b b b;
#X obj 89 126 t b b b b;
#X obj 70 81 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 70 19 inlet;
#X obj 70 42 t b a;
#X obj 209 219 t a;
#X obj 242 199 t a;
#X obj 70 350 outlet;
#X connect 0 0 6 0;
#X connect 1 0 0 0;
#X connect 2 0 15 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 0 0;
#X connect 6 0 7 0;
#X connect 7 0 2 0;
#X connect 8 0 2 0;
#X connect 8 1 9 0;
#X connect 8 2 13 0;
#X connect 9 0 1 0;
#X connect 9 1 3 0;
#X connect 9 2 4 0;
#X connect 9 3 5 0;
#X connect 10 0 8 0;
#X connect 11 0 12 0;
#X connect 12 0 10 0;
#X connect 12 1 14 0;
#X connect 13 0 2 1;
#X connect 14 0 0 2;
#X restore 406 425 pd draw_arrow;
#X floatatom 406 403 5 0 0 1 angle_(deg) - -;
#X obj 406 485 t b a b;
#X obj 795 474 send toGUI;
#X floatatom 406 335 5 0 0 1 angle_(deg) - -;
#X obj 406 380 +;
#X obj 406 357 * -1;
#X obj 406 312 r \$0-compass;
#X obj 485 364 r \$0-brng;
#X obj 795 428 r \$0-dist;
#X obj 35 554 send toGUI;
#X obj 154 372 loadbang;
#X obj 154 395 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#N canvas 1 91 504 397 draw_arrow 0;
#X obj 89 257 rot2d;
#X msg 89 149 0.5 0.6;
#X obj 70 327 list store;
#X msg 106 172 0.4 0.7;
#X msg 123 195 0.5 0;
#X msg 140 218 0.6 0.7;
#X obj 89 280 list prepend append;
#X obj 89 303 list trim;
#X obj 70 103 t b b b;
#X obj 89 126 t b b b b;
#X obj 70 81 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 70 19 inlet;
#X obj 70 42 t b a;
#X obj 209 219 t a;
#X obj 242 199 t a;
#X obj 70 350 outlet;
#X connect 0 0 6 0;
#X connect 1 0 0 0;
#X connect 2 0 15 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 0 0;
#X connect 6 0 7 0;
#X connect 7 0 2 0;
#X connect 8 0 2 0;
#X connect 8 1 9 0;
#X connect 8 2 13 0;
#X connect 9 0 1 0;
#X connect 9 1 3 0;
#X connect 9 2 4 0;
#X connect 9 3 5 0;
#X connect 10 0 8 0;
#X connect 11 0 12 0;
#X connect 12 0 10 0;
#X connect 12 1 14 0;
#X connect 13 0 2 1;
#X connect 14 0 0 2;
#X restore 16 425 pd draw_arrow;
#X obj 16 485 t b a b;
#X floatatom 16 335 5 0 0 1 angle_(deg) - -;
#X obj 16 312 r \$0-compass;
#X text 404 282 draw dest. pointing arrow;
#X text 11 16 disp. lat/long in text;
#X text 354 18 toggle gps reception + automatically enable at start-up
;
#X obj 16 46 r latlon;
#X floatatom 16 403 5 0 0 1 angle_(deg) - -;
#X obj 16 357 * -1;
#X obj 16 380 + 360;
#X text 792 393 disp. distance (km) in text;
#X obj 850 281 s toGUI;
#X obj 807 284 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 757 238 f;
#X obj 807 238 + 1;
#X obj 807 261 % 2;
#X obj 757 134 t a b;
#X msg 784 202 0;
#X obj 757 202 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 850 200 del 1000;
#X msg 850 223 0;
#X obj 757 62 r latlon;
#X obj 757 85 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X text 756 24 location info arrival indicator;
#X obj 757 163 scan 400;
#X msg 757 111 10;
#X obj 16 462 list prepend /lcd.Compass paintpoly;
#X msg 55 508 list /lcd.Compass paintoval 0 0 1 1 1 1 0 1;
#X msg 16 531 list /lcd.Compass paintoval 0.45 0.45 0.55 0.55 1 1 1
1;
#X obj 526 95 route /tgl.Location.En;
#X msg 356 72 list /tgl.Location.En 1;
#X msg 850 252 list /tgl.Location.Act set \$1;
#X msg 16 98 list /disp.Loc.Current.Lat.Coarse \$1;
#X msg 43 121 list /disp.Loc.Current.Lon.Coarse \$1;
#X msg 70 144 list /disp.Loc.Current.Lat.Fine \$1;
#X msg 97 167 list /disp.Loc.Current.Lon.Fine \$1;
#X obj 16 69 unpack f f f f;
#X obj 406 462 list prepend /lcd.Pointer paintpoly;
#X msg 445 508 list /lcd.Pointer paintoval 0 0 1 1 1 1 0 1;
#X msg 406 531 list /lcd.Pointer paintoval 0.45 0.45 0.55 0.55 1 1
1 1;
#X obj 795 451 list prepend /disp.Distance;
#X text 14 281 draw north pointing compass;
#X obj 564 396 loadbang;
#X obj 564 419 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X connect 1 0 51 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 5 0 52 0;
#X connect 8 0 59 0;
#X connect 9 0 8 0;
#X connect 10 0 61 0;
#X connect 10 1 7 0;
#X connect 10 2 60 0;
#X connect 12 0 14 0;
#X connect 13 0 9 0;
#X connect 14 0 13 0;
#X connect 15 0 12 0;
#X connect 16 0 13 1;
#X connect 17 0 62 0;
#X connect 19 0 20 0;
#X connect 20 0 23 0;
#X connect 21 0 48 0;
#X connect 22 0 50 0;
#X connect 22 1 18 0;
#X connect 22 2 49 0;
#X connect 23 0 30 0;
#X connect 24 0 23 0;
#X connect 28 0 58 0;
#X connect 29 0 21 0;
#X connect 30 0 31 0;
#X connect 31 0 29 0;
#X connect 34 0 53 0;
#X connect 35 0 36 0;
#X connect 36 0 37 0;
#X connect 37 0 35 1;
#X connect 37 0 34 0;
#X connect 38 0 46 0;
#X connect 38 1 39 0;
#X connect 39 0 35 1;
#X connect 40 0 35 0;
#X connect 41 0 42 0;
#X connect 42 0 53 0;
#X connect 43 0 44 0;
#X connect 44 0 47 0;
#X connect 46 0 40 0;
#X connect 46 1 41 0;
#X connect 47 0 38 0;
#X connect 48 0 22 0;
#X connect 49 0 18 0;
#X connect 50 0 18 0;
#X connect 51 0 3 0;
#X connect 52 0 6 0;
#X connect 53 0 33 0;
#X connect 54 0 0 0;
#X connect 55 0 0 0;
#X connect 56 0 0 0;
#X connect 57 0 0 0;
#X connect 58 0 54 0;
#X connect 58 1 55 0;
#X connect 58 2 56 0;
#X connect 58 3 57 0;
#X connect 59 0 10 0;
#X connect 60 0 7 0;
#X connect 61 0 7 0;
#X connect 62 0 11 0;
#X connect 64 0 65 0;
#X connect 65 0 9 0;
#X restore 247 45 pd gui guts;
#X text 735 73 (Lat.fine \, Lon.fine \, Lat.rough \, Lon.rough);
#X msg 428 65 36.123 127.789 456 12;
#X msg 428 114 456 12 36.123 127.789;
#X text 453 90 re-order to be;
#X obj 688 320 print fineinput;
#X obj 928 320 print coarseinput;
#X obj 63 142 / 1000;
#X obj 100 165 / 1000;
#X obj 505 446 sel 1;
#X obj 505 423 v haveSetPoint;
#X obj 964 135 v haveSetPoint;
#X msg 964 112 1;
#X obj 1063 225 send toGUI;
#X msg 1063 202 list /tgl.Location.En \$1;
#X obj 1100 150 del 500;
#X obj 1063 107 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 1063 127 t b b;
#X msg 1063 150 0;
#X msg 1100 173 1;
#X obj 904 43 t b b a;
#X obj 88 453 map 0.005 0.05 1 0.1;
#X connect 0 0 2 0;
#X connect 1 0 3 0;
#X connect 1 1 8 0;
#X connect 2 0 1 0;
#X connect 3 5 68 0;
#X connect 3 6 69 0;
#X connect 3 7 4 2;
#X connect 3 8 4 3;
#X connect 4 0 9 0;
#X connect 4 0 54 0;
#X connect 5 0 39 0;
#X connect 5 0 43 0;
#X connect 6 0 40 0;
#X connect 6 0 44 0;
#X connect 7 0 47 0;
#X connect 10 0 15 0;
#X connect 11 0 10 0;
#X connect 12 0 10 1;
#X connect 14 0 16 0;
#X connect 15 0 19 0;
#X connect 16 0 12 0;
#X connect 16 1 11 0;
#X connect 16 2 13 0;
#X connect 17 0 82 0;
#X connect 19 0 20 0;
#X connect 21 0 81 0;
#X connect 22 0 30 0;
#X connect 22 1 28 3;
#X connect 22 2 29 1;
#X connect 22 3 28 1;
#X connect 23 0 22 0;
#X connect 24 0 41 0;
#X connect 24 0 46 0;
#X connect 25 0 42 0;
#X connect 25 0 45 0;
#X connect 26 0 24 0;
#X connect 26 0 67 0;
#X connect 26 1 25 0;
#X connect 27 0 26 0;
#X connect 28 0 32 0;
#X connect 29 0 28 0;
#X connect 30 0 29 0;
#X connect 30 1 28 2;
#X connect 31 0 34 0;
#X connect 31 1 33 0;
#X connect 31 2 27 2;
#X connect 31 2 34 1;
#X connect 31 3 27 3;
#X connect 31 3 33 1;
#X connect 32 0 36 0;
#X connect 32 1 35 0;
#X connect 32 2 27 0;
#X connect 32 2 36 1;
#X connect 32 3 27 1;
#X connect 32 3 35 1;
#X connect 33 0 7 3;
#X connect 34 0 7 2;
#X connect 35 0 7 1;
#X connect 36 0 7 0;
#X connect 47 0 48 0;
#X connect 47 1 5 0;
#X connect 47 1 66 0;
#X connect 47 2 6 0;
#X connect 48 0 71 0;
#X connect 51 0 52 0;
#X connect 51 1 53 0;
#X connect 63 0 22 0;
#X connect 64 0 31 0;
#X connect 68 0 4 0;
#X connect 69 0 4 1;
#X connect 70 0 51 0;
#X connect 71 0 70 0;
#X connect 73 0 72 0;
#X connect 75 0 74 0;
#X connect 76 0 80 0;
#X connect 77 0 78 0;
#X connect 78 0 79 0;
#X connect 78 1 76 0;
#X connect 79 0 75 0;
#X connect 80 0 75 0;
#X connect 81 0 77 0;
#X connect 81 1 73 0;
#X connect 81 2 31 0;
#X connect 82 0 18 0;
#X connect 82 0 15 1;
#X connect 82 0 19 1;
