/[zanavi_public1]/navit/navit/android.c
ZANavi

Contents of /navit/navit/android.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (show annotations) (download)
Mon Nov 21 20:54:48 2011 UTC (9 years, 4 months ago) by zoff99
File MIME type: text/plain
File size: 35994 byte(s)
better search, make search interuptable, new translations
1 #include <stdlib.h>
2 #include <string.h>
3 #include <poll.h>
4 #include <glib.h>
5 #include "android.h"
6 #include <android/log.h>
7 #include "navit.h"
8 #include "config_.h"
9 #include "command.h"
10 #include "debug.h"
11 #include "event.h"
12 #include "callback.h"
13 #include "projection.h"
14 #include "map.h"
15 #include "transform.h"
16 #include "color.h"
17 #include "types.h"
18 #include "search.h"
19 #include "start_real.h"
20 #include "route.h"
21
22 // #include "layout.h"
23
24 JNIEnv *jnienv;
25 jobject *android_activity;
26 struct callback_list *android_activity_cbl;
27 int android_version;
28
29 jclass NavitGraphicsClass2=NULL;
30 jmethodID return_generic_int;
31 jclass NavitMapPreviewActivityClass=NULL;
32 jmethodID DrawMapPreview_target;
33 jmethodID DrawMapPreview_polyline=NULL;
34 jmethodID DrawMapPreview_text=NULL;
35
36 struct attr attr;
37
38 struct config {
39 struct attr **attrs;
40 struct callback_list *cbl;
41 } *config;
42
43
44 struct gui_config_settings {
45 int dummy;
46 };
47
48 struct gui_internal_data {
49 int dummy;
50 };
51
52 struct route_data {
53 int dummy;
54 };
55
56 struct widget {
57 int dummy;
58 };
59
60 struct gui_priv {
61 struct navit *nav;
62 struct attr self;
63 struct window *win;
64 struct graphics *gra;
65 struct graphics_gc *background;
66 struct graphics_gc *background2;
67 struct graphics_gc *highlight_background;
68 struct graphics_gc *foreground;
69 struct graphics_gc *text_foreground;
70 struct graphics_gc *text_background;
71 struct color background_color, background2_color, text_foreground_color, text_background_color;
72 int spacing;
73 int font_size;
74 int fullscreen;
75 struct graphics_font *fonts[3];
76 /**
77 * The size (in pixels) that xs style icons should be scaled to.
78 * This icon size can be too small to click it on some devices.
79 */
80 int icon_xs;
81 /**
82 * The size (in pixels) that s style icons (small) should be scaled to
83 */
84 int icon_s;
85 /**
86 * The size (in pixels) that l style icons should be scaled to
87 */
88 int icon_l;
89 int pressed;
90 struct widget *widgets;
91 int widgets_count;
92 int redraw;
93 struct widget root;
94 struct widget *highlighted,*editable;
95 struct widget *highlighted_menu;
96 int clickp_valid, vehicle_valid;
97 struct pcoord clickp, vehiclep;
98 struct attr *click_coord_geo, *position_coord_geo;
99 struct search_list *sl;
100 int ignore_button;
101 int menu_on_map_click;
102 int signal_on_map_click;
103 char *country_iso2;
104 int speech;
105 int keyboard;
106 int keyboard_required;
107 /**
108 * The setting information read from the configuration file.
109 * values of -1 indicate no value was specified in the config file.
110 */
111 struct gui_config_settings config;
112 struct event_idle *idle;
113 struct callback *motion_cb,*button_cb,*resize_cb,*keypress_cb,*window_closed_cb,*idle_cb, *motion_timeout_callback;
114 struct event_timeout *motion_timeout_event;
115 struct point current;
116
117 struct callback * vehicle_cb;
118 /**
119 * Stores information about the route.
120 */
121 struct route_data route_data;
122
123 struct gui_internal_data data;
124 struct callback_list *cbl;
125 int flags;
126 int cols;
127 struct attr osd_configuration;
128 int pitch;
129 int flags_town,flags_street,flags_house_number;
130 int radius;
131 /* html */
132 char *html_text;
133 int html_depth;
134 struct widget *html_container;
135 int html_skip;
136 char *html_anchor;
137 char *href;
138 int html_anchor_found;
139 struct form *form;
140 struct html {
141 int skip;
142 enum html_tag {
143 html_tag_none,
144 html_tag_a,
145 html_tag_h1,
146 html_tag_html,
147 html_tag_img,
148 html_tag_script,
149 html_tag_form,
150 html_tag_input,
151 html_tag_div,
152 } tag;
153 char *command;
154 char *name;
155 char *href;
156 char *refresh_cond;
157 struct widget *w;
158 struct widget *container;
159 } html[10];
160 };
161
162
163
164
165 static void
166 gui_internal_search_list_set_default_country2(struct gui_priv *this)
167 {
168 struct attr search_attr, country_name, country_iso2, *country_attr;
169 struct item *item;
170 struct country_search *cs;
171 struct tracking *tracking;
172 struct search_list_result *res;
173
174 //dbg(0,"### 1");
175
176 country_attr=country_default();
177 tracking=navit_get_tracking(this->nav);
178
179 if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL))
180 country_attr=&search_attr;
181 if (country_attr) {
182 //dbg(0,"### 2");
183 cs=country_search_new(country_attr, 0);
184 item=country_search_get_item(cs);
185 if (item && item_attr_get(item, attr_country_name, &country_name)) {
186 search_attr.type=attr_country_all;
187 //dbg(0,"country %s\n", country_name.u.str);
188 search_attr.u.str=country_name.u.str;
189 search_list_search(this->sl, &search_attr, 0);
190 while((res=search_list_get_result(this->sl)));
191 if(this->country_iso2)
192 {
193 // this seems to cause a crash, no idea why
194 //g_free(this->country_iso2);
195 this->country_iso2=NULL;
196 }
197 if (item_attr_get(item, attr_country_iso2, &country_iso2))
198 {
199 this->country_iso2=g_strdup(country_iso2.u.str);
200 }
201 }
202 country_search_destroy(cs);
203 } else {
204 dbg(0,"warning: no default country found\n");
205 if (this->country_iso2) {
206 dbg(0,"attempting to use country '%s'\n",this->country_iso2);
207 search_attr.type=attr_country_iso2;
208 search_attr.u.str=this->country_iso2;
209 search_list_search(this->sl, &search_attr, 0);
210 while((res=search_list_get_result(this->sl)));
211 }
212 }
213 //dbg(0,"### 99");
214 }
215
216
217
218 struct navit *global_navit;
219
220
221 int
222 android_find_class_global(char *name, jclass *ret)
223 {
224 *ret=(*jnienv)->FindClass(jnienv, name);
225 if (! *ret) {
226 dbg(0,"Failed to get Class %s\n",name);
227 return 0;
228 }
229 (*jnienv)->NewGlobalRef(jnienv, *ret);
230 return 1;
231 }
232
233 int
234 android_find_method(jclass class, char *name, char *args, jmethodID *ret)
235 {
236 *ret = (*jnienv)->GetMethodID(jnienv, class, name, args);
237 if (*ret == NULL) {
238 dbg(0,"Failed to get Method %s with signature %s\n",name,args);
239 return 0;
240 }
241 return 1;
242 }
243
244 int
245 android_find_static_method(jclass class, char *name, char *args, jmethodID *ret)
246 {
247 *ret = (*jnienv)->GetStaticMethodID(jnienv, class, name, args);
248 if (*ret == NULL) {
249 dbg(0,"Failed to get static Method %s with signature %s\n",name,args);
250 return 0;
251 }
252 return 1;
253 }
254
255 JNIEXPORT void JNICALL
256 Java_com_zoffcc_applications_zanavi_Navit_NavitMain( JNIEnv* env, jobject thiz, jobject activity, jobject lang, int version, jobject display_density_string)
257 {
258 char *strings[]={"/data/data/com.zoffcc.applications.zanavi/bin/navit",NULL};
259 const char *langstr;
260 const char *displaydensitystr;
261 android_version=version;
262 //__android_log_print(ANDROID_LOG_ERROR,"test","called");
263 android_activity_cbl=callback_list_new();
264 jnienv=env;
265 android_activity=activity;
266 (*jnienv)->NewGlobalRef(jnienv, activity);
267 langstr=(*env)->GetStringUTFChars(env, lang, NULL);
268 dbg(0,"enter env=%p thiz=%p activity=%p lang=%s version=%d\n",env,thiz,activity,langstr,version);
269 setenv("LANG",langstr,1);
270 (*env)->ReleaseStringUTFChars(env, lang, langstr);
271
272 displaydensitystr=(*env)->GetStringUTFChars(env, display_density_string, NULL);
273 dbg(0,"*****displaydensity=%s\n",displaydensitystr);
274 setenv("ANDROID_DENSITY",displaydensitystr,1);
275 (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr);
276 main_real(1, strings);
277 }
278
279 JNIEXPORT void JNICALL
280 Java_com_zoffcc_applications_zanavi_Navit_NavitActivity( JNIEnv* env, jobject thiz, int param)
281 {
282 dbg(0,"enter %d\n",param);
283
284 if (param == -2)
285 {
286 // onStop() -> called in Java app
287 // save center.txt
288 if (global_navit->bookmarks)
289 {
290 config_get_attr(config, attr_navit, &attr, NULL);
291 dbg(0,"save position to file");
292 char *center_file = bookmarks_get_center_file(TRUE);
293 bookmarks_write_center_to_file(attr.u.navit->bookmarks, center_file);
294 g_free(center_file);
295 // bookmarks_destroy(global_navit->bookmarks);
296 }
297 }
298
299 callback_list_call_1(android_activity_cbl, param);
300 if (param == -3)
301 {
302 exit(0);
303 }
304 //if (param == -3)
305 //{
306 // event_main_loop_quit();
307 //}
308 }
309
310 JNIEXPORT void JNICALL
311 Java_com_zoffcc_applications_zanavi_NavitGraphics_SizeChangedCallback( JNIEnv* env, jobject thiz, int id, int w, int h)
312 {
313 //dbg(0,"enter %p %d %d\n",(struct callback *)id,w,h);
314 if (id)
315 {
316 callback_call_2((struct callback *)id,w,h);
317 }
318 }
319
320 JNIEXPORT void JNICALL
321 Java_com_zoffcc_applications_zanavi_NavitGraphics_ButtonCallback( JNIEnv* env, jobject thiz, int id, int pressed, int button, int x, int y)
322 {
323 dbg(1,"enter %p %d %d\n",(struct callback *)id,pressed,button);
324 if (id)
325 callback_call_4((struct callback *)id,pressed,button,x,y);
326 }
327
328 JNIEXPORT void JNICALL
329 Java_com_zoffcc_applications_zanavi_NavitGraphics_MotionCallback( JNIEnv* env, jobject thiz, int id, int x, int y)
330 {
331 dbg(1,"enter %p %d %d\n",(struct callback *)id,x,y);
332 if (id)
333 callback_call_2((struct callback *)id,x,y);
334 }
335
336 JNIEXPORT void JNICALL
337 Java_com_zoffcc_applications_zanavi_NavitGraphics_KeypressCallback( JNIEnv* env, jobject thiz, int id, jobject str)
338 {
339 const char *s;
340 //dbg(0,"enter %p %p\n",(struct callback *)id,str);
341 s=(*env)->GetStringUTFChars(env, str, NULL);
342 //dbg(0,"key=%s\n",s);
343 if (id)
344 callback_call_1((struct callback *)id,s);
345 (*env)->ReleaseStringUTFChars(env, str, s);
346 }
347
348 JNIEXPORT void JNICALL
349 Java_com_zoffcc_applications_zanavi_NavitTimeout_TimeoutCallback( JNIEnv* env, jobject thiz, int delete, int id)
350 {
351 // dbg(1,"enter %p %d %p\n",thiz, delete, (void *)id);
352 callback_call_0((struct callback *)id);
353 if (delete)
354 {
355 (*jnienv)->DeleteGlobalRef(jnienv, thiz);
356 }
357 }
358
359 JNIEXPORT void JNICALL
360 Java_com_zoffcc_applications_zanavi_NavitVehicle_VehicleCallback( JNIEnv * env, jobject thiz, int id, jobject location)
361 {
362 // dbg(0,"enter %p %p\n",thiz, (void *)id);
363
364 // ***** calls: vehicle_android.c -> vehicle_android_callback()
365 callback_call_1((struct callback *)id, (void *)location);
366 }
367
368 JNIEXPORT void JNICALL
369 Java_com_zoffcc_applications_zanavi_NavitIdle_IdleCallback( JNIEnv* env, jobject thiz, int id)
370 {
371 // dbg(0,"enter %p %p\n",thiz, (void *)id);
372 callback_call_0((struct callback *)id);
373 }
374
375 JNIEXPORT void JNICALL
376 Java_com_zoffcc_applications_zanavi_NavitWatch_poll( JNIEnv* env, jobject thiz, int fd, int cond)
377 {
378 struct pollfd pfd;
379 pfd.fd=fd;
380 dbg(1,"%p poll called for %d %d\n",env, fd, cond);
381 switch ((enum event_watch_cond)cond) {
382 case event_watch_cond_read:
383 pfd.events=POLLIN;
384 break;
385 case event_watch_cond_write:
386 pfd.events=POLLOUT;
387 break;
388 case event_watch_cond_except:
389 pfd.events=POLLERR;
390 break;
391 default:
392 pfd.events=0;
393 }
394 pfd.revents=0;
395 poll(&pfd, 1, -1);
396 }
397
398 JNIEXPORT void JNICALL
399 Java_com_zoffcc_applications_zanavi_NavitWatch_WatchCallback( JNIEnv* env, jobject thiz, int id)
400 {
401 dbg(1,"enter %p %p\n",thiz, (void *)id);
402 callback_call_0((struct callback *)id);
403 }
404
405
406 JNIEXPORT void JNICALL
407 Java_com_zoffcc_applications_zanavi_NavitSensors_SensorCallback( JNIEnv* env, jobject thiz, int id, int sensor, float x, float y, float z)
408 {
409 dbg(1,"enter %p %p %f %f %f\n",thiz, (void *)id,x,y,z);
410 callback_call_4((struct callback *)id, sensor, &x, &y, &z);
411 }
412
413 void
414 android_return_search_result(struct jni_object *jni_o, char *str)
415 {
416 jstring js2 = NULL;
417 JNIEnv* env2;
418 env2=jni_o->env;
419 js2 = (*env2)->NewStringUTF(jni_o->env,str);
420 (*env2)->CallVoidMethod(jni_o->env, jni_o->jo, jni_o->jm, js2);
421 (*env2)->DeleteLocalRef(jni_o->env, js2);
422 }
423
424 void
425 android_return_generic_int(int id, int i)
426 {
427 if (NavitGraphicsClass2 == NULL)
428 {
429 if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitGraphics", &NavitGraphicsClass2))
430 {
431 NavitGraphicsClass2=NULL;
432 return;
433 }
434 }
435 if (return_generic_int == NULL)
436 {
437 android_find_static_method(NavitGraphicsClass2,"return_generic_int", "(II)V", &return_generic_int);
438 }
439 if (return_generic_int == NULL)
440 {
441 dbg(0,"no method found\n");
442 return; /* exception thrown */
443 }
444 // -crash- (*jnienv)->CallVoidMethod(jnienv, NavitGraphicsClass2, return_generic_int, id, i);
445 (*jnienv)->CallStaticVoidMethod(jnienv, NavitGraphicsClass2, return_generic_int, id, i);
446 // -works- (*jnienv)->CallStaticObjectMethod(jnienv, NavitGraphicsClass2, return_generic_int, id, i);
447 }
448
449
450 JNIEXPORT void JNICALL
451 Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackSearchResultList( JNIEnv* env, jobject thiz, int id, int partial, jobject str,int search_flags,jobject search_country, jobject latlon, int radius)
452 {
453 const char *s;
454 s=(*env)->GetStringUTFChars(env, str, NULL);
455 //dbg(0,"*****string=%s\n",s);
456
457
458 config_get_attr(config, attr_navit, &attr, NULL);
459 // attr.u.navit
460
461 jstring js2 = NULL;
462 jclass cls = (*env)->GetObjectClass(env,thiz);
463 jmethodID aMethodID = (*env)->GetMethodID(env, cls, "fillStringArray", "(Ljava/lang/String;)V");
464 if(aMethodID == 0)
465 {
466 //dbg(0,"**** Unable to get methodID: fillStringArray");
467 return;
468 }
469
470 if (id)
471 {
472 // search for town in variable "s" within current country -> return a list of towns as result
473 if (id==1)
474 {
475 // unused now!!
476 }
477 // search for street in variable "s" within "search_country" -> return a list of streets as result
478 else if (id == 2)
479 {
480 //struct attr s_attr4;
481 //struct gui_priv *gp4;
482 //struct gui_priv gp_24;
483
484 offline_search_break_searching = 0;
485
486 struct jni_object my_jni_object;
487 my_jni_object.env=env;
488 my_jni_object.jo=thiz;
489 my_jni_object.jm=aMethodID;
490
491 //gp4=&gp_24;
492 //gp4->nav=attr.u.navit;
493 struct mapset *ms4=navit_get_mapset(attr.u.navit);
494 GList *ret=NULL;
495 int flags=search_flags;
496 char *search_country_string=(*env)->GetStringUTFChars(env, search_country, NULL);
497 ret=search_by_address(ret,ms4,s,partial,&my_jni_object,flags,search_country_string);
498 (*env)->ReleaseStringUTFChars(env, search_country, search_country_string);
499
500 // free the memory
501 g_list_free(ret);
502 //dbg(0,"ret=%p\n",ret);
503
504
505 //if (gp4->sl)
506 //{
507 // //search_list_destroy(gp4->sl);
508 // gp4->sl=NULL;
509 //}
510 }
511 // do a full search in all mapfiles for string in variable "s" -> return a list of streets as result
512 else if (id == 3)
513 {
514 const char *s3;
515 s3=(*env)->GetStringUTFChars(env, latlon, NULL);
516 char parse_str[strlen(s3) + 1];
517 strcpy(parse_str, s3);
518 (*env)->ReleaseStringUTFChars(env, latlon, s3);
519
520 struct coord_geo g7;
521 char *p;
522 char *stopstring;
523
524 // lat
525 p = strtok (parse_str,"#");
526 g7.lat = strtof(p, &stopstring);
527 // lon
528 p = strtok (NULL, "#");
529 g7.lng = strtof(p, &stopstring);
530
531 struct jni_object my_jni_object;
532 my_jni_object.env=env;
533 my_jni_object.jo=thiz;
534 my_jni_object.jm=aMethodID;
535 // search_flags --> is search_order (search at what "order" level)
536 search_full_world(s, partial, search_flags, &my_jni_object, &g7, radius);
537 }
538 }
539
540 (*env)->ReleaseStringUTFChars(env, str, s);
541 }
542
543 JNIEXPORT jint JNICALL
544 Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackDestinationValid( JNIEnv* env, jobject thiz)
545 {
546 config_get_attr(config, attr_navit, &attr, NULL);
547 // dbg(0,"destination_valid=%d\n",attr.u.navit->destination_valid);
548 jint i=0;
549 if (attr.u.navit->route)
550 {
551 struct route *r;
552 r=attr.u.navit->route;
553 i=r->route_status;
554 // dbg(0,"route_status=%d\n",i);
555 }
556 return i;
557 }
558
559 static void map_preview_label_line(struct point *p, int count, char *label, int font_size)
560 {
561 int i,x,y,tl,tlm,th,thm,tlsq,l;
562 float lsq;
563 double dx,dy;
564 struct point p_t;
565 struct point pb[5];
566
567 int len = g_utf8_strlen(label, -1);
568 int xMin = 0;
569 int yMin = 0;
570 int yMax = 13*font_size/256;
571 int xMax = 9*font_size*len/256;
572
573 //dbg(0,"xMax=%d\n", xMax);
574 //dbg(0,"yMax=%d\n", yMax);
575
576 pb[0].x = xMin;
577 pb[0].y = -yMin;
578 pb[1].x = xMin;
579 pb[1].y = -yMax;
580 pb[2].x = xMax;
581 pb[2].y = -yMax;
582 pb[3].x = xMax;
583 pb[3].y = -yMin;
584
585 tl=(pb[2].x-pb[0].x);
586 th=(pb[0].y-pb[1].y);
587
588 // calc "tl" text length
589 // tl=strlen(label)*4;
590 // calc "th" text height
591 // th=8;
592
593 tlm=tl*32;
594 thm=th*36;
595 tlsq = (tlm*0.7)*(tlm*0.7);
596
597 for (i = 0 ; i < count-1 ; i++)
598 {
599 dx=p[i+1].x-p[i].x;
600 dx*=32;
601 dy=p[i+1].y-p[i].y;
602 dy*=32;
603 lsq = dx*dx+dy*dy;
604
605 if (lsq > tlsq)
606 {
607 //dbg(0,"-------- label=%s\n",label);
608 //dbg(0,"px i=%d py i=%d px i+1=%d py i+1=%d\n",p[i].x,p[i].y,p[i+1].x,p[i+1].y);
609 //dbg(0,"dx=%f dy=%f\n",dx,dy);
610 l=(int)sqrtf(lsq);
611 //dbg(0,"l=%d lsq=%f\n",l,lsq);
612 x=p[i].x;
613 y=p[i].y;
614 if (dx < 0)
615 {
616 dx=-dx;
617 dy=-dy;
618 x=p[i+1].x;
619 y=p[i+1].y;
620 }
621 x+=(l-tlm)*dx/l/64;
622 y+=(l-tlm)*dy/l/64;
623 x-=dy*thm/l/64;
624 y+=dx*thm/l/64;
625 p_t.x=x;
626 p_t.y=y;
627
628 //dbg(0,"dx=%f dy=%f\n",dx,dy);
629 //dbg(0,"dx=%d dy=%d\n",(int)dx,(int)dy);
630 //dbg(0,"draw px=%d py=%d\n",p_t.x,p_t.y);
631 //dbg(0,"l=%d\n",l);
632 //dbg(0,"+++++++++++++\n");
633 // **OLD and wrong** android_DrawMapPreview_text(p_t.x, p_t.y, label, font_size, dx*0x10000/l, dy*0x10000/l);
634 android_DrawMapPreview_text(p_t.x, p_t.y, label, font_size, (int)dx, (int)dy);
635 }
636 }
637 }
638
639
640 JNIEXPORT void JNICALL
641 Java_com_zoffcc_applications_zanavi_NavitMapPreviewActivity_DrawMapPreview( JNIEnv* env, jobject thiz, jobject latlonzoom, int width, int height, int font_size, int scale, int sel_range)
642 {
643 // config_get_attr(config, attr_navit, &attr, NULL);
644
645 const char *s;
646 int zoom;
647 s=(*env)->GetStringUTFChars(env, latlonzoom, NULL);
648 char parse_str[strlen(s) + 1];
649 strcpy(parse_str, s);
650 (*env)->ReleaseStringUTFChars(env, latlonzoom, s);
651 //dbg(0,"*****string=%s\n",s);
652
653 // show map preview for (lat#lon#zoom)
654 struct coord_geo g;
655 char *p;
656 char *stopstring;
657
658 // lat
659 p = strtok (parse_str,"#");
660 g.lat = strtof(p, &stopstring);
661 // lon
662 p = strtok (NULL, "#");
663 g.lng = strtof(p, &stopstring);
664 // zoom
665 p = strtok (NULL, "#");
666 zoom=atoi(p);
667
668 //dbg(0,"lat=%f\n",g.lat);
669 //dbg(0,"lng=%f\n",g.lng);
670 //dbg(0,"zoom=%d\n",zoom);
671 //dbg(0,"w=%d\n",width);
672 //dbg(0,"h=%d\n",height);
673
674 struct coord c;
675 transform_from_geo(projection_mg, &g, &c);
676
677 // struct pcoord pc;
678 // pc.x=c.x;
679 // pc.y=c.y;
680 // pc.pro=projection_mg;
681
682
683 // ----------------------- big draw loop -----------------------
684 // ----------------------- big draw loop -----------------------
685 // ----------------------- big draw loop -----------------------
686 // ----------------------- big draw loop -----------------------
687 struct item *item;
688 struct map_rect *mr=NULL;
689 struct mapset *ms;
690 struct mapset_handle *msh;
691 struct map* map = NULL;
692 struct attr map_name_attr;
693 struct attr attr;
694
695 struct map_selection sel;
696 const int selection_range = sel_range; // should be something with "width" and "height" i guess ??!!
697
698 const int max=100;
699 int count;
700 struct coord *ca=g_alloca(sizeof(struct coord)*max);
701 struct point *pa=g_alloca(sizeof(struct point)*max);
702
703 sel.next=NULL;
704 sel.order=zoom;
705 sel.range.min=type_none;
706 sel.range.max=type_last;
707 sel.u.c_rect.lu.x=c.x-selection_range;
708 sel.u.c_rect.lu.y=c.y+selection_range;
709 sel.u.c_rect.rl.x=c.x+selection_range;
710 sel.u.c_rect.rl.y=c.y-selection_range;
711
712 struct transformation *tr;
713 tr=transform_dup(global_navit->trans);
714 struct point p_center;
715 p_center.x=width/2;
716 p_center.y=height/2;
717 transform_set_screen_center(tr, &p_center);
718 transform_set_center(tr, &c);
719 transform_set_scale(tr, scale);
720 enum projection pro=transform_get_projection(global_navit->trans_cursor);
721
722 ms=global_navit->mapsets->data;
723 msh=mapset_open(ms);
724 while (msh && (map=mapset_next(msh, 0)))
725 {
726 if(map_get_attr(map,attr_name, &map_name_attr,NULL))
727 {
728 if (strncmp("_ms_sdcard_map:", map_name_attr.u.str, 15) == 0)
729 {
730 if (strncmp("_ms_sdcard_map:/sdcard/zanavi/maps/borders.bin", map_name_attr.u.str, 41) == 0)
731 {
732 // country borders
733 // dbg(0,"map name=%s",map_name_attr.u.str);
734 mr=map_rect_new(map, NULL);
735 if (mr)
736 {
737 while ((item=map_rect_get_item(mr)))
738 {
739
740 // count=item_coord_get_within_selection(item, ca, item->type < type_line ? 1: max, &sel);
741 count=item_coord_get_within_selection(item, ca, max, &sel);
742 if (! count)
743 {
744 continue;
745 }
746 count=transform(tr, pro, ca, pa, count, 0, 0, NULL);
747
748 // dbg(0,"uu %s\n",item_to_name(item->type));
749
750 if (item->type == type_border_country)
751 {
752 // dbg(0,"BB** %s\n",item_to_name(item->type));
753 android_DrawMapPreview_polyline(pa, count, 2);
754 }
755 }
756 map_rect_destroy(mr);
757 }
758 }
759 else if (strncmp("_ms_sdcard_map:/sdcard/zanavi/maps/navitmap", map_name_attr.u.str, 38) == 0)
760 {
761 // its an sdcard map
762 // dbg(0,"map name=%s",map_name_attr.u.str);
763 mr=map_rect_new(map, &sel);
764 if (mr)
765 {
766 //char *streetname_last=NULL;
767
768 while ((item=map_rect_get_item(mr)))
769 {
770 int label_count=0;
771 char *labels[2];
772
773 // count=item_coord_get_within_selection(item, ca, item->type < type_line ? 1: max, &sel);
774 count=item_coord_get_within_selection(item, ca, max, &sel);
775
776
777 // count=item_coord_get_within_selection(item, ca, max, &sel);
778 // count=item_coord_get(item, ca, item->type < type_line ? 1: max);
779 if (! count)
780 {
781 continue;
782 }
783 //dbg(0,"count 1=%d\n", count);
784
785 if (count == max)
786 {
787 //dbg(0,"count overflow!!\n");
788 }
789
790 struct attr attr_77;
791 if (item_attr_get(item, attr_flags, &attr_77))
792 {
793 //dbg(0,"uuuuuuuuuuuuu %s uuuuu %d\n",item_to_name(item->type), attr_77.u.num);
794 item->flags=attr_77.u.num;
795 }
796 else
797 {
798 item->flags=0;
799 }
800
801 //if (item_is_street(*item))
802 //{
803 // int i3;
804 // for (i3 = 0 ; i3 < count ; i3++)
805 // {
806 // if (i3)
807 // {
808 // dbg(0,"1 x1=%d\n",ca[i3-1].x);
809 // dbg(0,"1 y1=%d\n",ca[i3-1].y);
810 // dbg(0,"1 x2=%d\n",ca[i3].x);
811 // dbg(0,"1 y2=%d\n",ca[i3].y);
812 // }
813 // }
814 //}
815
816 count=transform(tr, pro, ca, pa, count, 0, 0, NULL);
817
818 //dbg(0,"count 2=%d\n", count);
819
820 // --- LABEL ---
821 labels[1]=NULL;
822 label_count=0;
823 if (item_attr_get(item, attr_label, &attr))
824 {
825 labels[0]=attr.u.str;
826 //dbg(0,"labels[0]=%s\n",attr.u.str);
827 if (!label_count)
828 {
829 label_count=2;
830 }
831 }
832 else
833 {
834 labels[0]=NULL;
835 }
836 // --- LABEL ---
837
838 if (item_is_street(*item))
839 {
840 //int i3;
841 //for (i3 = 0 ; i3 < count ; i3++)
842 //{
843 // if (i3)
844 // {
845 // dbg(0,"2 x1=%d\n",pa[i3-1].x);
846 // dbg(0,"2 y1=%d\n",pa[i3-1].y);
847 // dbg(0,"2 x2=%d\n",pa[i3].x);
848 // dbg(0,"2 y2=%d\n",pa[i3].y);
849 // }
850 //}
851 android_DrawMapPreview_polyline(pa, count, 0);
852 if (labels[0] != NULL)
853 {
854 map_preview_label_line(pa, count, labels[0], font_size);
855 }
856 }
857 else if (item_is_district(*item))
858 {
859 if (zoom > 6)
860 {
861 // dbg(0,"xx** %s - %s\n",item_to_name(item->type),labels[0]);
862 if (count >= 1)
863 {
864 android_DrawMapPreview_text(pa[0].x, pa[0].y, labels[0], font_size*2, 0x10000, 0);
865 }
866 }
867 }
868 else if (item_is_town(*item))
869 {
870 // dbg(0,"yy** %s - %s\n",item_to_name(item->type),labels[0]);
871 if (count >= 1)
872 {
873 android_DrawMapPreview_text(pa[0].x, pa[0].y, labels[0], font_size*3, 0x10000, 0);
874 }
875 }
876
877 //if (item_is_street(*item))
878 //{
879 // if (item_attr_get(item, attr_label, &attr))
880 // {
881 // //dbg(0,"street1=%s\n",map_convert_string(item->map, attr.u.str));
882 // if ( (streetname_last==NULL) || (strcmp(streetname_last,attr.u.str) != 0) )
883 // {
884 // //dbg(0,"street2=%s\n",map_convert_string(item->map, attr.u.str));
885 // }
886 // }
887 //}
888 }
889 //g_free(streetname_last);
890 map_rect_destroy(mr);
891 }
892 }
893 }
894 }
895 }
896 mapset_close(msh);
897
898 enum projection pro2=transform_get_projection(global_navit->trans_cursor);
899 struct point pnt;
900 transform(tr, pro2, &c, &pnt, 1, 0, 0, NULL);
901 transform_destroy(tr);
902 // ----------------------- big draw loop -----------------------
903 // ----------------------- big draw loop -----------------------
904 // ----------------------- big draw loop -----------------------
905 // ----------------------- big draw loop -----------------------
906
907 android_DrawMapPreview_target(pnt.x, pnt.y);
908 }
909
910 void
911 android_DrawMapPreview_target(int x, int y)
912 {
913 if (NavitMapPreviewActivityClass==NULL)
914 {
915 if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitMapPreviewActivity", &NavitMapPreviewActivityClass))
916 {
917 NavitMapPreviewActivityClass=NULL;
918 return;
919 }
920 }
921 if (DrawMapPreview_target == NULL)
922 {
923 android_find_static_method(NavitMapPreviewActivityClass,"DrawMapPreview_target", "(II)V", &DrawMapPreview_target);
924 }
925 if (DrawMapPreview_target == NULL)
926 {
927 dbg(0,"no method found\n");
928 return; /* exception thrown */
929 }
930 (*jnienv)->CallStaticVoidMethod(jnienv, NavitMapPreviewActivityClass, DrawMapPreview_target, x, y);
931 }
932
933 void
934 android_DrawMapPreview_text(int x, int y, char *text, int size, int dx, int dy)
935 {
936
937 if (NavitMapPreviewActivityClass==NULL)
938 {
939 if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitMapPreviewActivity", &NavitMapPreviewActivityClass))
940 {
941 NavitMapPreviewActivityClass=NULL;
942 return;
943 }
944 }
945 if (DrawMapPreview_text==NULL)
946 {
947 android_find_static_method(NavitMapPreviewActivityClass,"DrawMapPreview_text", "(IILjava/lang/String;III)V", &DrawMapPreview_text);
948 }
949 if (DrawMapPreview_text == NULL)
950 {
951 dbg(0,"no method found\n");
952 return; /* exception thrown */
953 }
954
955 //dbg(0,"** dx=%d,dy=%d\n",dx,dy);
956
957 jstring string1 = (*jnienv)->NewStringUTF(jnienv, text);
958 (*jnienv)->CallStaticVoidMethod(jnienv, NavitMapPreviewActivityClass, DrawMapPreview_text, x, y, string1, size, dx, dy);
959 (*jnienv)->DeleteLocalRef(jnienv, string1);
960 }
961
962
963 void
964 android_DrawMapPreview_polyline(struct point *p, int count, int type)
965 {
966 // type:
967 // 0 -> normal street
968 // 2 -> country border
969
970 if (NavitMapPreviewActivityClass==NULL)
971 {
972 if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitMapPreviewActivity", &NavitMapPreviewActivityClass))
973 {
974 NavitMapPreviewActivityClass=NULL;
975 return;
976 }
977 }
978 if (DrawMapPreview_polyline==NULL)
979 {
980 android_find_static_method(NavitMapPreviewActivityClass,"DrawMapPreview_polyline", "(I[I)V", &DrawMapPreview_polyline);
981 }
982 if (DrawMapPreview_polyline == NULL)
983 {
984 dbg(0,"no method found\n");
985 return; /* exception thrown */
986 }
987
988 jint pc[count*2];
989 int i;
990 jintArray points;
991 if (count <= 0)
992 {
993 return;
994 }
995 points = (*jnienv)->NewIntArray(jnienv,count*2);
996 for (i = 0 ; i < count ; i++)
997 {
998 pc[i*2]=p[i].x;
999 pc[i*2+1]=p[i].y;
1000 }
1001 (*jnienv)->SetIntArrayRegion(jnienv, points, 0, count*2, pc);
1002 (*jnienv)->CallStaticVoidMethod(jnienv, NavitMapPreviewActivityClass, DrawMapPreview_polyline, type, points);
1003 (*jnienv)->DeleteLocalRef(jnienv, points);
1004 }
1005
1006
1007
1008
1009
1010
1011
1012
1013 JNIEXPORT jstring JNICALL
1014 Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackGeoCalc( JNIEnv* env, jobject thiz, int i, float a, float b)
1015 {
1016 // const char *result;
1017 gchar *result;
1018
1019 if (i == 1)
1020 {
1021 // pixel-on-screen to geo
1022 struct coord_geo g22;
1023 struct coord c22;
1024 struct point p;
1025 p.x=a;
1026 p.y=b;
1027 transform_reverse(global_navit->trans, &p, &c22);
1028 //dbg(0,"%f, %f\n",a, b);
1029 //dbg(0,"%d, %d\n",p.x, p.y);
1030 transform_to_geo(projection_mg, &c22, &g22);
1031 //dbg(0,"%d, %d, %f, %f\n",c22.x, c22.y, g22.lat, g22.lng);
1032 result=g_strdup_printf("%f:%f",g22.lat,g22.lng);
1033 }
1034 else if (i == 2)
1035 {
1036 // geo to pixel-on-screen
1037 struct coord c99;
1038 struct coord_geo g99;
1039 g99.lat=a;
1040 g99.lng=b;
1041 //dbg(0,"zzzzz %f, %f\n",a, b);
1042 //dbg(0,"yyyyy %f, %f\n",g99.lat, g99.lng);
1043 transform_from_geo(projection_mg, &g99, &c99);
1044 //dbg(0,"%d %d %f %f\n",c99.x, c99.y, g99.lat, g99.lng);
1045
1046 enum projection pro=transform_get_projection(global_navit->trans_cursor);
1047 struct point pnt;
1048 transform(global_navit->trans, pro, &c99, &pnt, 1, 0, 0, NULL);
1049 //dbg(0,"x=%d\n",pnt.x);
1050 //dbg(0,"y=%d\n",pnt.y);
1051
1052 result=g_strdup_printf("%d:%d",pnt.x,pnt.y);
1053 }
1054 else if (i == 3)
1055 {
1056 // show lat,lng position on screen center
1057 struct coord c99;
1058 struct pcoord pc99;
1059 struct coord_geo g99;
1060 g99.lat=a;
1061 g99.lng=b;
1062 //dbg(0,"zzzzz %f, %f\n",a, b);
1063 //dbg(0,"yyyyy %f, %f\n",g99.lat, g99.lng);
1064 transform_from_geo(projection_mg, &g99, &c99);
1065 //dbg(0,"%d %d %f %f\n",c99.x, c99.y, g99.lat, g99.lng);
1066
1067 //enum projection pro=transform_get_projection(global_navit->trans_cursor);
1068 //struct point pnt;
1069 //transform(global_navit->trans, pro, &c99, &pnt, 1, 0, 0, NULL);
1070 //dbg(0,"x=%d\n",pnt.x);
1071 //dbg(0,"y=%d\n",pnt.y);
1072 pc99.x=c99.x;
1073 pc99.y=c99.y;
1074 pc99.pro=projection_mg;
1075
1076 navit_set_center(global_navit, &pc99, 0);
1077
1078 result=g_strdup_printf("1:1");
1079 }
1080
1081 //dbg(0,"result=%s\n", result);
1082 jstring js = (*env)->NewStringUTF(env,result);
1083 g_free(result);
1084
1085 return js;
1086 }
1087
1088 JNIEXPORT jstring JNICALL
1089 Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackLocalizedString( JNIEnv* env, jobject thiz, jobject str)
1090 {
1091 const char *s;
1092 const char *localized_str;
1093
1094 s=(*env)->GetStringUTFChars(env, str, NULL);
1095 //dbg(0,"*****string=%s\n",s);
1096
1097 localized_str=gettext(s);
1098 //dbg(0,"localized string=%s",localized_str);
1099
1100 // jstring dataStringValue = (jstring) localized_str;
1101 jstring js = (*env)->NewStringUTF(env,localized_str);
1102
1103 (*env)->ReleaseStringUTFChars(env, str, s);
1104
1105 return js;
1106 }
1107
1108 JNIEXPORT void JNICALL
1109 Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackMessageChannel( JNIEnv* env, jobject thiz, int i, jobject str)
1110 {
1111 const char *s;
1112 //dbg(0,"enter %p %p\n",(struct callback *)i,str);
1113
1114 config_get_attr(config, attr_navit, &attr, NULL);
1115 // attr.u.navit
1116
1117 if (i)
1118 {
1119 if (i == 1)
1120 {
1121 // zoom in
1122 navit_zoom_in_cursor(global_navit, 2);
1123 // navit_zoom_in_cursor(attr.u.navit, 2);
1124 }
1125 else if (i == 2)
1126 {
1127 // zoom out
1128 navit_zoom_out_cursor(global_navit, 2);
1129 // navit_zoom_out_cursor(attr.u.navit, 2);
1130 }
1131 else if (i == 46)
1132 {
1133 // stop searching and show results found until now
1134 offline_search_break_searching=1;
1135 }
1136 else if (i == 45)
1137 {
1138 // filter duplicates in search results
1139 offline_search_filter_duplicates=1;
1140 }
1141 else if (i == 44)
1142 {
1143 // show duplicates in search results
1144 offline_search_filter_duplicates=0;
1145 }
1146 else if (i == 43)
1147 {
1148 // routing mode "normal roads"
1149 routing_mode=1;
1150 }
1151 else if (i == 42)
1152 {
1153 // routing mode "highways"
1154 routing_mode=0;
1155 }
1156 else if (i == 41)
1157 {
1158 // switch "Map follows Vehicle" OFF
1159 struct attr attrx;
1160 attrx.type=attr_follow_cursor;
1161 attrx.u.num=0;
1162 navit_set_attr(global_navit,&attrx);
1163 }
1164 else if (i == 40)
1165 {
1166 // switch "Map follows Vehicle" ON
1167 struct attr attrx;
1168 attrx.type=attr_follow_cursor;
1169 attrx.u.num=1;
1170 navit_set_attr(global_navit,&attrx);
1171 }
1172 else if (i == 39)
1173 {
1174 // switch "Northing" OFF
1175 struct attr attrx;
1176 attrx.type=attr_orientation;
1177 attrx.u.num=0;
1178 navit_set_attr(global_navit,&attrx);
1179 }
1180 else if (i == 38)
1181 {
1182 // switch "Northing" ON
1183 struct attr attrx;
1184 attrx.type=attr_orientation;
1185 attrx.u.num=1;
1186 navit_set_attr(global_navit,&attrx);
1187 }
1188 else if (i == 37)
1189 {
1190 // switch "Lock on road" OFF
1191 struct attr attrx;
1192 attrx.type=attr_tracking;
1193 attrx.u.num=0;
1194 navit_set_attr(global_navit,&attrx);
1195 }
1196 else if (i == 36)
1197 {
1198 // switch "Lock on road" ON
1199 struct attr attrx;
1200 attrx.type=attr_tracking;
1201 attrx.u.num=1;
1202 navit_set_attr(global_navit,&attrx);
1203 }
1204 else if (i == 35)
1205 {
1206 // announcer voice ON
1207 navit_cmd_announcer_on(global_navit);
1208 }
1209 else if (i == 34)
1210 {
1211 // announcer voice OFF
1212 navit_cmd_announcer_off(global_navit);
1213 }
1214 else if (i == 33)
1215 {
1216 // zoom to specific zoomlevel
1217 s=(*env)->GetStringUTFChars(env, str, NULL);
1218 int zoom_level = atoi(s);
1219 navit_zoom_to_scale(global_navit, zoom_level);
1220 (*env)->ReleaseStringUTFChars(env, str, s);
1221 }
1222 else if (i == 32)
1223 {
1224 // switch to specific 3D pitch
1225 struct attr pitch_attr;
1226 s=(*env)->GetStringUTFChars(env, str, NULL);
1227 pitch_attr.type=attr_pitch;
1228 pitch_attr.u.num = atoi(s);
1229 navit_set_attr(global_navit,&pitch_attr);
1230 (*env)->ReleaseStringUTFChars(env, str, s);
1231 }
1232 else if (i == 31)
1233 {
1234 // switch to 3D
1235 struct attr pitch_attr;
1236 pitch_attr.type=attr_pitch;
1237 pitch_attr.u.num=30;
1238 navit_set_attr(global_navit,&pitch_attr);
1239 }
1240 else if (i == 30)
1241 {
1242 // switch to 2D
1243 struct attr pitch_attr;
1244 pitch_attr.type=attr_pitch;
1245 pitch_attr.u.num=0;
1246 navit_set_attr(global_navit,&pitch_attr);
1247 }
1248 // 21 - 25 are used in java, so leave a hole here to make it easier to understand
1249 else if (i == 20)
1250 {
1251 // add all scdard maps
1252 navit_add_all_maps(global_navit);
1253 }
1254 else if (i == 19)
1255 {
1256 // remove all scdard maps
1257 navit_remove_all_maps(global_navit);
1258 }
1259 else if (i == 18)
1260 {
1261 // reload scdard maps
1262 navit_reload_maps(global_navit);
1263 }
1264 else if (i == 17)
1265 {
1266 // zoom to route
1267 navit_zoom_to_route(global_navit, 0);
1268 }
1269 else if (i == 16)
1270 {
1271 // use imperial units
1272 global_navit->imperial=1;
1273 }
1274 else if (i == 15)
1275 {
1276 // use metric units
1277 global_navit->imperial=0;
1278 }
1279 else if (i == 14)
1280 {
1281 // draw location of self (car) in the screen center
1282 global_navit->radius=0;
1283 }
1284 else if (i == 13)
1285 {
1286 // draw location of self (car) 30% lower than screen center
1287 global_navit->radius=30;
1288 }
1289 else if (i == 12)
1290 {
1291 // draw map only at speeds higher than 5 km/h
1292 struct attr static_speed_attr;
1293 static_speed_attr.type=attr_static_speed;
1294 static_speed_attr.u.num=5;
1295 vehicleprofile_set_attr(global_navit->vehicleprofile, &static_speed_attr);
1296 }
1297 else if (i == 11)
1298 {
1299 // allow redraw map at ZERO speed
1300 struct attr static_speed_attr;
1301 static_speed_attr.type=attr_static_speed;
1302 static_speed_attr.u.num=0;
1303 vehicleprofile_set_attr(global_navit->vehicleprofile, &static_speed_attr);
1304 }
1305 else if (i == 10)
1306 {
1307 // allow internal GUI
1308 allow_gui_internal = 1;
1309 }
1310 else if (i == 9)
1311 {
1312 // disable internal GUI
1313 allow_gui_internal = 0;
1314 }
1315 else if (i == 8)
1316 {
1317 // zoom to zoomlevel
1318 // navit_zoom_to_scale(global_navit, 262144);
1319 navit_zoom_to_scale(global_navit, 524288);
1320 }
1321 else if (i == 7)
1322 {
1323 // stop navigation
1324 if (attr.u.navit->destination_valid != 0)
1325 {
1326 navit_set_destination(&attr.u.navit->self, NULL, NULL, 0);
1327 }
1328 }
1329 else if (i==6)
1330 {
1331 // not used now!
1332 }
1333 else if (i==5)
1334 {
1335 // call a command (like in gui) --> seems not many commands really work with this :-(
1336 s=(*env)->GetStringUTFChars(env, str, NULL);
1337 //dbg(0,"*****string=%s\n",s);
1338 command_evaluate(&attr.u.navit->self,s);
1339 (*env)->ReleaseStringUTFChars(env, str, s);
1340 }
1341 else if (i == 4)
1342 {
1343 // set destination to pixel x,y on screen
1344
1345 char *pstr;
1346 struct point p;
1347 struct coord c;
1348 struct pcoord pc;
1349
1350 s=(*env)->GetStringUTFChars(env, str, NULL);
1351 char parse_str[strlen(s) + 1];
1352 strcpy(parse_str, s);
1353 (*env)->ReleaseStringUTFChars(env, str, s);
1354 //dbg(0,"*****string=%s\n",parse_str);
1355
1356 // set destination to (pixel-x#pixel-y)
1357 // pixel-x
1358 pstr = strtok (parse_str,"#");
1359 p.x = atoi(pstr);
1360 // pixel-y
1361 pstr = strtok (NULL, "#");
1362 p.y = atoi(pstr);
1363
1364 //dbg(0,"11x=%d\n",p.x);
1365 //dbg(0,"11y=%d\n",p.y);
1366
1367 transform_reverse(global_navit->trans, &p, &c);
1368
1369
1370 pc.x = c.x;
1371 pc.y = c.y;
1372 pc.pro = transform_get_projection(global_navit->trans);
1373
1374 //dbg(0,"22x=%d\n",pc.x);
1375 //dbg(0,"22y=%d\n",pc.y);
1376
1377 // start navigation asynchronous
1378 navit_set_destination(global_navit, &pc, parse_str, 1);
1379 }
1380 else if (i == 3)
1381 {
1382 // set destination to lat, lng
1383
1384 char *name;
1385 s=(*env)->GetStringUTFChars(env, str, NULL);
1386 char parse_str[strlen(s) + 1];
1387 strcpy(parse_str, s);
1388 (*env)->ReleaseStringUTFChars(env, str, s);
1389 //dbg(0,"*****string=%s\n",s);
1390
1391 // set destination to (lat#lon#title)
1392 struct coord_geo g;
1393 char *p;
1394 char *stopstring;
1395
1396 // lat
1397 p = strtok (parse_str,"#");
1398 g.lat = strtof(p, &stopstring);
1399 // lon
1400 p = strtok (NULL, "#");
1401 g.lng = strtof(p, &stopstring);
1402 // description
1403 name = strtok (NULL, "#");
1404
1405 //dbg(0,"lat=%f\n",g.lat);
1406 //dbg(0,"lng=%f\n",g.lng);
1407 //dbg(0,"str1=%s\n",name);
1408
1409 struct coord c;
1410 transform_from_geo(projection_mg, &g, &c);
1411
1412 struct pcoord pc;
1413 pc.x=c.x;
1414 pc.y=c.y;
1415 pc.pro=projection_mg;
1416
1417 // start navigation asynchronous
1418 navit_set_destination(global_navit, &pc, name, 1);
1419
1420 }
1421 }
1422 }
1423

   
Visit the ZANavi Wiki