… | |
… | |
54 | jmethodID DrawMapPreview_polyline = NULL; |
54 | jmethodID DrawMapPreview_polyline = NULL; |
55 | jmethodID DrawMapPreview_text = NULL; |
55 | jmethodID DrawMapPreview_text = NULL; |
56 | jmethodID NavitGraphics_send_osd_values2 = NULL; |
56 | jmethodID NavitGraphics_send_osd_values2 = NULL; |
57 | jmethodID NavitGraphics_set_vehicle_values2 = NULL; |
57 | jmethodID NavitGraphics_set_vehicle_values2 = NULL; |
58 | jmethodID NavitGraphics_set_vehicle_values3 = NULL; |
58 | jmethodID NavitGraphics_set_vehicle_values3 = NULL; |
|
|
59 | jmethodID NavitGraphics_send_route_rect_to_java = NULL; |
59 | |
60 | |
60 | struct attr attr; |
61 | struct attr attr; |
61 | |
62 | |
62 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
63 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
63 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
64 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
… | |
… | |
407 | { |
408 | { |
408 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
409 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
409 | // dbg(0,"+#+:enter\n"); |
410 | // dbg(0,"+#+:enter\n"); |
410 | #endif |
411 | #endif |
411 | |
412 | |
|
|
413 | #ifdef DEBUG_GLIB_MEM_FUNCTIONS |
|
|
414 | // GLIB debugging |
|
|
415 | // GLIB debugging |
|
|
416 | // GLIB debugging |
|
|
417 | dbg(0,"GLIB debugging ----------------------"); |
|
|
418 | dbg(0,"GLIB debugging ----------------------"); |
|
|
419 | dbg(0,"GLIB debugging ----------------------"); |
|
|
420 | dbg(0,"GLIB debugging ----------------------"); |
|
|
421 | dbg(0,"GLIB debugging ----------------------"); |
|
|
422 | dbg(0,"GLIB debugging ----------------------"); |
|
|
423 | dbg(0,"GLIB debugging ----------------------"); |
|
|
424 | dbg(0,"GLIB debugging ----------------------"); |
|
|
425 | dbg(0,"GLIB debugging 1 --------------------"); |
|
|
426 | g_mem_set_vtable(glib_mem_profiler_table); |
|
|
427 | //char *dummy_997; |
|
|
428 | //dummy_997 = g_malloc(1024*1024*10); // 10 MByte |
|
|
429 | //g_free(dummy_997); |
|
|
430 | //dummy_997 = NULL; |
|
|
431 | //g_mem_profile(); |
|
|
432 | dbg(0,"GLIB debugging 2 --------------------"); |
|
|
433 | dbg(0,"GLIB debugging ----------------------"); |
|
|
434 | dbg(0,"GLIB debugging ----------------------"); |
|
|
435 | dbg(0,"GLIB debugging ----------------------"); |
|
|
436 | dbg(0,"GLIB debugging ----------------------"); |
|
|
437 | dbg(0,"GLIB debugging ----------------------"); |
|
|
438 | dbg(0,"GLIB debugging ----------------------"); |
|
|
439 | dbg(0,"GLIB debugging ----------------------"); |
|
|
440 | dbg(0,"GLIB debugging ----------------------"); |
|
|
441 | // GLIB debugging |
|
|
442 | // GLIB debugging |
|
|
443 | // GLIB debugging |
|
|
444 | #endif |
|
|
445 | |
412 | int thread_id = gettid(); |
446 | int thread_id = gettid(); |
413 | // dbg(0, "THREAD ID=%d\n", thread_id); |
447 | // dbg(0, "THREAD ID=%d\n", thread_id); |
414 | |
448 | |
415 | char *strings[] = { "/data/data/com.zoffcc.applications.zanavi/bin/navit", NULL }; |
449 | char *strings[] = { "/data/data/com.zoffcc.applications.zanavi/bin/navit", NULL }; |
416 | const char *langstr; |
450 | const char *langstr; |
… | |
… | |
447 | (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr); |
481 | (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr); |
448 | |
482 | |
449 | //// dbg(0,"before main_real call\n"); |
483 | //// dbg(0,"before main_real call\n"); |
450 | //main_real(1, strings); |
484 | //main_real(1, strings); |
451 | //// dbg(0,"after main_real call\n"); |
485 | //// dbg(0,"after main_real call\n"); |
|
|
486 | |
|
|
487 | /* -- mem test -- |
|
|
488 | char *dummy_99; |
|
|
489 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
490 | g_free(dummy_99); |
|
|
491 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
492 | g_free(dummy_99); |
|
|
493 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
494 | g_free(dummy_99); |
|
|
495 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
496 | g_free(dummy_99); |
|
|
497 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
498 | g_free(dummy_99); |
|
|
499 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
500 | g_free(dummy_99); |
|
|
501 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
502 | g_free(dummy_99); |
|
|
503 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
504 | g_free(dummy_99); |
|
|
505 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
506 | g_free(dummy_99); |
|
|
507 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
|
|
508 | g_free(dummy_99); |
|
|
509 | dummy_997 = NULL; |
|
|
510 | */ |
452 | |
511 | |
453 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
512 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
454 | // dbg(0,"+#+:leave\n"); |
513 | // dbg(0,"+#+:leave\n"); |
455 | #endif |
514 | #endif |
456 | |
515 | |
… | |
… | |
731 | void android_return_search_result(struct jni_object *jni_o, char *str) |
790 | void android_return_search_result(struct jni_object *jni_o, char *str) |
732 | { |
791 | { |
733 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
792 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
734 | // dbg(0,"+#+:enter\n"); |
793 | // dbg(0,"+#+:enter\n"); |
735 | #endif |
794 | #endif |
736 | //DBG // dbg(0,"EEnter\n"); |
795 | // dbg(0,"EEnter\n"); |
737 | |
796 | |
738 | // int thread_id = gettid(); |
797 | // int thread_id = gettid(); |
739 | // dbg(0, "THREAD ID=%d\n", thread_id); |
798 | // dbg(0, "THREAD ID=%d\n", thread_id); |
740 | |
799 | |
741 | jstring js2 = NULL; |
800 | jstring js2 = NULL; |
… | |
… | |
784 | // -works- (*jnienv2)->CallStaticObjectMethod(jnienv2, NavitGraphicsClass2, return_generic_int, id, i); |
843 | // -works- (*jnienv2)->CallStaticObjectMethod(jnienv2, NavitGraphicsClass2, return_generic_int, id, i); |
785 | //DBG // dbg(0,"xa2\n"); |
844 | //DBG // dbg(0,"xa2\n"); |
786 | } |
845 | } |
787 | |
846 | |
788 | JNIEXPORT void JNICALL |
847 | JNIEXPORT void JNICALL |
789 | 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) |
848 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackSearchResultList(JNIEnv* env, jobject thiz, int id, int partial, jobject str, jobject str_town, jobject str_hn, int search_flags, jobject search_country, jobject latlon, int radius) |
790 | { |
849 | { |
791 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
850 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
792 | // dbg(0,"+#+:enter\n"); |
851 | // dbg(0,"+#+:enter\n"); |
793 | #endif |
852 | #endif |
794 | |
853 | |
… | |
… | |
822 | // search for town in variable "s" within current country -> return a list of towns as result |
881 | // search for town in variable "s" within current country -> return a list of towns as result |
823 | if (id == 1) |
882 | if (id == 1) |
824 | { |
883 | { |
825 | // unused now!! |
884 | // unused now!! |
826 | } |
885 | } |
|
|
886 | // new experimental street-index search |
|
|
887 | else if (id == 2) |
|
|
888 | { |
|
|
889 | offline_search_break_searching = 0; |
|
|
890 | |
|
|
891 | struct jni_object my_jni_object; |
|
|
892 | my_jni_object.env = env; |
|
|
893 | my_jni_object.jo = thiz; |
|
|
894 | my_jni_object.jm = aMethodID; |
|
|
895 | |
|
|
896 | const char *s_town; |
|
|
897 | s_town = (*env)->GetStringUTFChars(env, str_town, NULL); |
|
|
898 | const char *s_hn; |
|
|
899 | s_hn = (*env)->GetStringUTFChars(env, str_hn, NULL); |
|
|
900 | |
|
|
901 | search_v2(s, s_town, s_hn, partial, &my_jni_object); |
|
|
902 | |
|
|
903 | (*env)->ReleaseStringUTFChars(env, str_town, s_town); |
|
|
904 | (*env)->ReleaseStringUTFChars(env, str_hn, s_hn); |
|
|
905 | |
|
|
906 | } |
827 | // search for street in variable "s" within "search_country" -> return a list of streets as result |
907 | // search for street in variable "s" within "search_country" -> return a list of streets as result |
828 | else if (id == 2) |
908 | else if (id == 29) |
829 | { |
909 | { |
830 | //struct attr s_attr4; |
910 | //struct attr s_attr4; |
831 | //struct gui_priv *gp4; |
911 | //struct gui_priv *gp4; |
832 | //struct gui_priv gp_24; |
912 | //struct gui_priv gp_24; |
833 | |
913 | |
… | |
… | |
1557 | c24.x = c22.x; |
1637 | c24.x = c22.x; |
1558 | c24.y = c22.y; |
1638 | c24.y = c22.y; |
1559 | c24.pro = transform_get_projection(global_navit->trans); |
1639 | c24.pro = transform_get_projection(global_navit->trans); |
1560 | result = navit_find_nearest_item_dump(global_navit->mapsets->data, &c24, 1); |
1640 | result = navit_find_nearest_item_dump(global_navit->mapsets->data, &c24, 1); |
1561 | } |
1641 | } |
|
|
1642 | else if (i == 11) |
|
|
1643 | { |
|
|
1644 | // coord to pixel-on-screen |
|
|
1645 | struct coord c99; |
|
|
1646 | c99.x = a; |
|
|
1647 | c99.y = b; |
|
|
1648 | struct point pnt; |
|
|
1649 | transform(global_navit->trans, projection_mg, &c99, &pnt, 1, 0, 0, NULL); |
|
|
1650 | result = g_strdup_printf("%d:%d", pnt.x, pnt.y); |
|
|
1651 | } |
1562 | |
1652 | |
1563 | // // dbg(0, "result=%s\n", result); |
1653 | // // dbg(0, "result=%s\n", result); |
1564 | jstring js = (*env)->NewStringUTF(env, result); |
1654 | jstring js = (*env)->NewStringUTF(env, result); |
1565 | g_free(result); |
1655 | g_free(result); |
1566 | |
1656 | |
… | |
… | |
1640 | else if (i == 2) |
1730 | else if (i == 2) |
1641 | { |
1731 | { |
1642 | // zoom out |
1732 | // zoom out |
1643 | navit_zoom_out_cursor(global_navit, 2); |
1733 | navit_zoom_out_cursor(global_navit, 2); |
1644 | // navit_zoom_out_cursor(attr.u.navit, 2); |
1734 | // navit_zoom_out_cursor(attr.u.navit, 2); |
|
|
1735 | } |
|
|
1736 | else if (i == 79) |
|
|
1737 | { |
|
|
1738 | // set traffic light delay |
|
|
1739 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
1740 | global_traffic_light_delay = atoi(s); |
|
|
1741 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
1742 | } |
|
|
1743 | else if (i == 78) |
|
|
1744 | { |
|
|
1745 | // shift layout "order" values |
|
|
1746 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
1747 | displaylist_shift_order_in_map_layers(global_navit, atoi(s)); |
|
|
1748 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
1749 | } |
|
|
1750 | else if (i == 77) |
|
|
1751 | { |
|
|
1752 | // do not show route rectangles |
|
|
1753 | global_show_route_rectangles = 0; |
|
|
1754 | } |
|
|
1755 | else if (i == 76) |
|
|
1756 | { |
|
|
1757 | // show route rectangles |
|
|
1758 | global_show_route_rectangles = 1; |
1645 | } |
1759 | } |
1646 | else if (i == 75) |
1760 | else if (i == 75) |
1647 | { |
1761 | { |
1648 | // stop demo vechile |
1762 | // stop demo vechile |
1649 | global_stop_demo_vehicle = 1; |
1763 | global_stop_demo_vehicle = 1; |
… | |
… | |
1706 | shift_order = atoi(s); |
1820 | shift_order = atoi(s); |
1707 | (*env)->ReleaseStringUTFChars(env, str, s); |
1821 | (*env)->ReleaseStringUTFChars(env, str, s); |
1708 | } |
1822 | } |
1709 | else if (i == 67) |
1823 | else if (i == 67) |
1710 | { |
1824 | { |
1711 | // disable "water from relations" |
1825 | // disable "multipolygons" |
1712 | enable_water_from_relations = 0; |
1826 | global_draw_multipolygons = 0; |
1713 | } |
1827 | } |
1714 | else if (i == 66) |
1828 | else if (i == 66) |
1715 | { |
1829 | { |
1716 | // enable "water from relations" |
1830 | // enable "multipolygons" |
1717 | enable_water_from_relations = 1; |
1831 | global_draw_multipolygons = 1; |
1718 | } |
1832 | } |
1719 | else if (i == 65) |
1833 | else if (i == 65) |
1720 | { |
1834 | { |
1721 | // draw map async |
1835 | // draw map async |
1722 | navit_draw_async(global_navit, 1); |
1836 | navit_draw_async(global_navit, 1); |
… | |
… | |
2146 | { |
2260 | { |
2147 | // stop navigation |
2261 | // stop navigation |
2148 | if (attr.u.navit->destination_valid != 0) |
2262 | if (attr.u.navit->destination_valid != 0) |
2149 | { |
2263 | { |
2150 | navit_set_destination(&attr.u.navit->self, NULL, NULL, 0); |
2264 | navit_set_destination(&attr.u.navit->self, NULL, NULL, 0); |
|
|
2265 | #ifdef DEBUG_GLIB_MEM_FUNCTIONS |
|
|
2266 | g_mem_profile(); |
|
|
2267 | #endif |
2151 | } |
2268 | } |
2152 | } |
2269 | } |
2153 | else if (i == 6) |
2270 | else if (i == 6) |
2154 | { |
2271 | { |
2155 | // not used now! |
2272 | // not used now! |
… | |
… | |
2444 | } |
2561 | } |
2445 | |
2562 | |
2446 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_set_vehicle_values3, dx, dy, dangle); |
2563 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_set_vehicle_values3, dx, dy, dangle); |
2447 | } |
2564 | } |
2448 | |
2565 | |
|
|
2566 | void send_route_rect_to_java(int x1, int y1, int x2, int y2, int order) |
|
|
2567 | { |
|
|
2568 | JNIEnv *jnienv2; |
|
|
2569 | jnienv2 = jni_getenv(); |
|
|
2570 | |
|
|
2571 | //int thread_id = gettid(); |
|
|
2572 | //dbg(0, "THREAD ID=%d\n", thread_id); |
|
|
2573 | |
|
|
2574 | if (NavitGraphicsClass2 == NULL) |
|
|
2575 | { |
|
|
2576 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitGraphics", &NavitGraphicsClass2)) |
|
|
2577 | { |
|
|
2578 | NavitGraphicsClass2 = NULL; |
|
|
2579 | return; |
|
|
2580 | } |
|
|
2581 | } |
|
|
2582 | |
|
|
2583 | if (NavitGraphics_send_route_rect_to_java == NULL) |
|
|
2584 | { |
|
|
2585 | if (!android_find_static_method(NavitGraphicsClass2, "send_route_rect_to_java", "(IIIII)V", &NavitGraphics_send_route_rect_to_java)) |
|
|
2586 | { |
|
|
2587 | return; |
|
|
2588 | } |
|
|
2589 | } |
|
|
2590 | |
|
|
2591 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_send_route_rect_to_java, x1, y1, x2, y2, order); |
|
|
2592 | } |
|
|
2593 | |