… | |
… | |
624 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
624 | dummy_99 = g_malloc(1024*1024*10); // 10 MByte |
625 | g_free(dummy_99); |
625 | g_free(dummy_99); |
626 | dummy_997 = NULL; |
626 | dummy_997 = NULL; |
627 | */ |
627 | */ |
628 | |
628 | |
|
|
629 | |
|
|
630 | |
|
|
631 | #if 0 |
|
|
632 | |
|
|
633 | double lat = 48.6936931; |
|
|
634 | double lon = 16.0135909; |
|
|
635 | float latf = 48.6936931; |
|
|
636 | float lonf = 16.0135909; |
|
|
637 | |
|
|
638 | |
|
|
639 | //transform_to_geo_lat(transform_from_geo_lat(lat)); |
|
|
640 | //transform_to_geo_lon(transform_from_geo_lon(lon)); |
|
|
641 | |
|
|
642 | |
|
|
643 | long long j=0; |
|
|
644 | double ddd; |
|
|
645 | int in_y=12278278; |
|
|
646 | |
|
|
647 | clock_t s_; |
|
|
648 | clock_t diff_time; |
|
|
649 | |
|
|
650 | s_ = clock(); |
|
|
651 | for(j=0;j<10000000L;j++) |
|
|
652 | { |
|
|
653 | ddd = atan(exp((in_y/2.00) / 6378137.0)) / M_PI * 360 - 90; |
|
|
654 | } |
|
|
655 | diff_time = clock() - s_; |
|
|
656 | dbg(0, "1:%fs\n", (double) ((double) diff_time / (double) CLOCKS_PER_SEC)); |
|
|
657 | |
|
|
658 | s_ = clock(); |
|
|
659 | for(j=0;j<10000000L;j++) |
|
|
660 | { |
|
|
661 | ddd = TO_GEO_LAT_(in_y); |
|
|
662 | // fprintf(stderr, "lon=%.17f\n", ddd); |
|
|
663 | } |
|
|
664 | diff_time = clock() - s_; |
|
|
665 | dbg(0, "2:%fs\n", (double) ((double) diff_time / (double) CLOCKS_PER_SEC)); |
|
|
666 | |
|
|
667 | s_ = clock(); |
|
|
668 | for(j=0;j<10000000L;j++) |
|
|
669 | { |
|
|
670 | ddd = TO_GEO_LAT_FAST_(in_y); |
|
|
671 | } |
|
|
672 | diff_time = clock() - s_; |
|
|
673 | dbg(0, "3:%fs\n", (double) ((double) diff_time / (double) CLOCKS_PER_SEC)); |
|
|
674 | |
|
|
675 | |
|
|
676 | #endif |
|
|
677 | |
|
|
678 | |
|
|
679 | |
|
|
680 | |
|
|
681 | |
629 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
682 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
630 | dbg(0,"+#+:leave\n"); |
683 | dbg(0,"+#+:leave\n"); |
631 | #endif |
684 | #endif |
632 | |
685 | |
633 | } |
686 | } |
… | |
… | |
675 | |
728 | |
676 | if (param == 3) |
729 | if (param == 3) |
677 | { |
730 | { |
678 | // in onCreate at startup |
731 | // in onCreate at startup |
679 | char *strings[] = { "/data/data/com.zoffcc.applications.zanavi/bin/navit", NULL }; |
732 | char *strings[] = { "/data/data/com.zoffcc.applications.zanavi/bin/navit", NULL }; |
|
|
733 | |
|
|
734 | // ------------ send initial values for GEO calcs to Java --------------- |
|
|
735 | // ------------ send initial values for GEO calcs to Java --------------- |
|
|
736 | char *temp_t = NULL; |
|
|
737 | |
|
|
738 | temp_t = g_strdup_printf("%.17f\n", (double)__EARTH_RADIUS__); |
|
|
739 | android_send_generic_text(21, temp_t); |
|
|
740 | g_free(temp_t); |
|
|
741 | |
|
|
742 | temp_t = g_strdup_printf("%.17f\n", (double)__GEO_ACCURACY_FACTOR__); |
|
|
743 | android_send_generic_text(22, temp_t); |
|
|
744 | g_free(temp_t); |
|
|
745 | |
|
|
746 | temp_t = NULL; |
|
|
747 | // ------------ send initial values for GEO calcs to Java --------------- |
|
|
748 | // ------------ send initial values for GEO calcs to Java --------------- |
680 | |
749 | |
681 | // dbg(0,"before main_real call\n"); |
750 | // dbg(0,"before main_real call\n"); |
682 | main_real(1, strings); |
751 | main_real(1, strings); |
683 | // dbg(0,"after main_real call\n"); |
752 | // dbg(0,"after main_real call\n"); |
684 | |
753 | |
… | |
… | |
1620 | (*jnienv2)->SetIntArrayRegion(jnienv2, points, 0, count * 2, pc); |
1689 | (*jnienv2)->SetIntArrayRegion(jnienv2, points, 0, count * 2, pc); |
1621 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitMapPreviewActivityClass, DrawMapPreview_polyline, type, points); |
1690 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitMapPreviewActivityClass, DrawMapPreview_polyline, type, points); |
1622 | (*jnienv2)->DeleteLocalRef(jnienv2, points); |
1691 | (*jnienv2)->DeleteLocalRef(jnienv2, points); |
1623 | } |
1692 | } |
1624 | |
1693 | |
|
|
1694 | |
|
|
1695 | JNIEXPORT jobjectArray JNICALL |
|
|
1696 | Java_com_zoffcc_applications_zanavi_NavitGraphics_GetRoadBookItems(JNIEnv *env, jobject thiz, int result_id) |
|
|
1697 | { |
|
|
1698 | jobjectArray ret; |
|
|
1699 | int i; |
|
|
1700 | jclass *string_class = (*env)->FindClass(env, "java/lang/String"); |
|
|
1701 | |
|
|
1702 | // get roadbook |
|
|
1703 | GList *result = navit_route_export_to_java_string(global_navit, result_id); |
|
|
1704 | |
|
|
1705 | if (result == NULL) |
|
|
1706 | { |
|
|
1707 | return NULL; |
|
|
1708 | } |
|
|
1709 | |
|
|
1710 | ret = (jobjectArray)(*env)->NewObjectArray(env, g_list_length(result), string_class, (*env)->NewStringUTF(env, "")); |
|
|
1711 | |
|
|
1712 | GList *result2 = result; |
|
|
1713 | i = 0; |
|
|
1714 | while (result2) |
|
|
1715 | { |
|
|
1716 | char *str = result2->data; |
|
|
1717 | |
|
|
1718 | if (str != NULL) |
|
|
1719 | { |
|
|
1720 | (*env)->SetObjectArrayElement(env, ret, i, (*env)->NewStringUTF(env, str)); |
|
|
1721 | g_free(str); |
|
|
1722 | } |
|
|
1723 | else |
|
|
1724 | { |
|
|
1725 | (*env)->SetObjectArrayElement(env, ret, i, (*env)->NewStringUTF(env, "")); |
|
|
1726 | } |
|
|
1727 | i++; |
|
|
1728 | |
|
|
1729 | result2 = g_list_next(result2); |
|
|
1730 | } |
|
|
1731 | |
|
|
1732 | g_list_free(result); |
|
|
1733 | |
|
|
1734 | return(ret); |
|
|
1735 | } |
|
|
1736 | |
|
|
1737 | |
|
|
1738 | |
|
|
1739 | |
|
|
1740 | |
1625 | JNIEXPORT jstring JNICALL |
1741 | JNIEXPORT jstring JNICALL |
1626 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackGeoCalc(JNIEnv* env, jobject thiz, int i, float a, float b) |
1742 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackGeoCalc(JNIEnv* env, jobject thiz, int i, float a, float b) |
1627 | { |
1743 | { |
1628 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
1744 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
1629 | dbg(0,"+#+:enter\n"); |
1745 | dbg(0,"+#+:enter\n"); |
… | |
… | |
1633 | |
1749 | |
1634 | int thread_id = gettid(); |
1750 | int thread_id = gettid(); |
1635 | // dbg(0, "THREAD ID=%d\n", thread_id); |
1751 | // dbg(0, "THREAD ID=%d\n", thread_id); |
1636 | |
1752 | |
1637 | // const char *result; |
1753 | // const char *result; |
1638 | gchar *result; |
1754 | gchar *result = NULL; |
1639 | |
1755 | |
1640 | #ifndef NAVIT_DEBUG_BAREMETAL |
1756 | #ifndef NAVIT_DEBUG_BAREMETAL |
1641 | |
1757 | |
1642 | if (i == 1) |
1758 | if (i == 1) |
1643 | { |
1759 | { |
… | |
… | |
1813 | c99.y = b; |
1929 | c99.y = b; |
1814 | struct point pnt; |
1930 | struct point pnt; |
1815 | transform(global_navit->trans, projection_mg, &c99, &pnt, 1, 0, 0, NULL); |
1931 | transform(global_navit->trans, projection_mg, &c99, &pnt, 1, 0, 0, NULL); |
1816 | result = g_strdup_printf("%d:%d", pnt.x, pnt.y); |
1932 | result = g_strdup_printf("%d:%d", pnt.x, pnt.y); |
1817 | } |
1933 | } |
|
|
1934 | // else if (i == 13) |
|
|
1935 | // { |
|
|
1936 | // // get roadbook |
|
|
1937 | // result = navit_route_export_to_java_string(global_navit, NULL, (int)a); |
|
|
1938 | // } |
1818 | else if (i == 12) |
1939 | else if (i == 12) |
1819 | { |
1940 | { |
1820 | // calculate next position in interpolation on route |
1941 | // calculate next position in interpolation on route |
1821 | // return string: lat:lon:direction |
1942 | // return string: lat:lon:direction |
1822 | // example : 48.62:16.775:45.5 |
1943 | // example : 48.62:16.775:45.5 |
… | |
… | |
1977 | else |
2098 | else |
1978 | { |
2099 | { |
1979 | result = g_strdup("*ERROR*"); |
2100 | result = g_strdup("*ERROR*"); |
1980 | } |
2101 | } |
1981 | } |
2102 | } |
|
|
2103 | else if (i == 14) |
|
|
2104 | { |
|
|
2105 | // return current position |
|
|
2106 | // dbg(0, "PPPOS:2:%f %f", ggggg_lat, ggggg_lon); |
|
|
2107 | result = g_strdup_printf("%f:%f", (float)ggggg_lat, (float)ggggg_lon); |
|
|
2108 | } |
|
|
2109 | else if (i == 15) |
|
|
2110 | { |
|
|
2111 | // show lat,lng position on screen center, without map redraw! |
|
|
2112 | struct coord c99; |
|
|
2113 | struct pcoord pc99; |
|
|
2114 | struct coord_geo g99; |
|
|
2115 | g99.lat = a; |
|
|
2116 | g99.lng = b; |
|
|
2117 | ////DBG // dbg(0,"zzzzz %f, %f\n",a, b); |
|
|
2118 | ////DBG // dbg(0,"yyyyy %f, %f\n",g99.lat, g99.lng); |
|
|
2119 | transform_from_geo(projection_mg, &g99, &c99); |
|
|
2120 | ////DBG // dbg(0,"%d %d %f %f\n",c99.x, c99.y, g99.lat, g99.lng); |
|
|
2121 | |
|
|
2122 | //enum projection pro=transform_get_projection(global_navit->trans_cursor); |
|
|
2123 | //struct point pnt; |
|
|
2124 | //transform(global_navit->trans, pro, &c99, &pnt, 1, 0, 0, NULL); |
|
|
2125 | ////DBG // dbg(0,"x=%d\n",pnt.x); |
|
|
2126 | ////DBG // dbg(0,"y=%d\n",pnt.y); |
|
|
2127 | pc99.x = c99.x; |
|
|
2128 | pc99.y = c99.y; |
|
|
2129 | pc99.pro = projection_mg; |
|
|
2130 | |
|
|
2131 | navit_set_center_no_draw(global_navit, &pc99, 0); |
|
|
2132 | |
|
|
2133 | result = g_strdup("1:1"); |
|
|
2134 | } |
|
|
2135 | |
|
|
2136 | |
1982 | |
2137 | |
1983 | #else |
2138 | #else |
1984 | result = g_strdup("*ERROR*"); |
2139 | result = g_strdup("*ERROR*"); |
1985 | #endif |
2140 | #endif |
1986 | |
2141 | |
1987 | // // dbg(0, "result=%s\n", result); |
2142 | // // dbg(0, "result=%s\n", result); |
1988 | jstring js = (*env)->NewStringUTF(env, result); |
2143 | jstring js = (*env)->NewStringUTF(env, result); |
|
|
2144 | |
|
|
2145 | if (result) |
|
|
2146 | { |
1989 | g_free(result); |
2147 | g_free(result); |
|
|
2148 | } |
1990 | |
2149 | |
1991 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
2150 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
1992 | dbg(0,"+#+:leave\n"); |
2151 | dbg(0,"+#+:leave\n"); |
1993 | #endif |
2152 | #endif |
1994 | |
2153 | |
… | |
… | |
2071 | else if (i == 2) |
2230 | else if (i == 2) |
2072 | { |
2231 | { |
2073 | // zoom out |
2232 | // zoom out |
2074 | navit_zoom_out_cursor(global_navit, 2); |
2233 | navit_zoom_out_cursor(global_navit, 2); |
2075 | // navit_zoom_out_cursor(attr.u.navit, 2); |
2234 | // navit_zoom_out_cursor(attr.u.navit, 2); |
|
|
2235 | } |
|
|
2236 | else if (i == 111) |
|
|
2237 | { |
|
|
2238 | // show real gps position on map |
|
|
2239 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
2240 | global_tracking_show_real_gps_pos = atoi(s); |
|
|
2241 | // dbg(0, "show_real_gps_pos=%d\n", global_tracking_show_real_gps_pos); |
|
|
2242 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
2243 | } |
|
|
2244 | else if (i == 110) |
|
|
2245 | { |
|
|
2246 | // generic int option CallBack [<option name>:<option value "int">] |
|
|
2247 | s = (*env)->GetStringUTFChars(env, str, NULL); |
2076 | |
2248 | |
|
|
2249 | char *str_copy = strdup(s); |
|
|
2250 | char *option_name = NULL; |
|
|
2251 | char *option_value = NULL; |
|
|
2252 | |
|
|
2253 | option_name = strsep(&str_copy, ":"); |
|
|
2254 | option_value = strsep(&str_copy, ":"); |
|
|
2255 | |
|
|
2256 | // dbg(0, "a=%s b=%s\n", option_name, option_value); |
|
|
2257 | |
|
|
2258 | /* |
|
|
2259 | street_0,living_street" speed="20" route_weight="20" route_prio_weight="30"> |
|
|
2260 | street_1_city" speed="35" route_weight="35" route_prio_weight="30"> |
|
|
2261 | track_paved" speed="35" route_weight="35" route_prio_weight="30"> |
|
|
2262 | street_2_city,ramp_street_2_city" speed="50" route_weight="50" route_prio_weight="30"> |
|
|
2263 | street_3_city,ramp_street_3_city" speed="50" route_weight="50" route_prio_weight="20"> |
|
|
2264 | ramp_street_4_city" speed="49" route_weight="49" route_prio_weight="12"> |
|
|
2265 | street_4_city" speed="50" route_weight="50" route_prio_weight="11"> |
|
|
2266 | highway_city" speed="80" route_weight="80" route_prio_weight="9"> |
|
|
2267 | street_1_land" speed="35" route_weight="35" route_prio_weight="30"> |
|
|
2268 | street_2_land" speed="50" route_weight="50" route_prio_weight="11"> |
|
|
2269 | street_3_land" speed="50" route_weight="50" route_prio_weight="11"> |
|
|
2270 | street_4_land" speed="80" route_weight="80" route_prio_weight="11"> |
|
|
2271 | street_n_lanes" speed="120" route_weight="120" route_prio_weight="9"> |
|
|
2272 | ramp_highway_land" speed="119" route_weight="119" route_prio_weight="10"> |
|
|
2273 | highway_land" speed="120" route_weight="120" route_prio_weight="9"> |
|
|
2274 | */ |
|
|
2275 | |
|
|
2276 | struct roadprofile *roadprofile = NULL; |
|
|
2277 | int value_ = 0; |
|
|
2278 | |
|
|
2279 | if (strcmp(option_name, "street_1_city#route_prio_weight") == 0) |
|
|
2280 | { |
|
|
2281 | roadprofile = vehicleprofile_get_roadprofile(global_navit->vehicleprofile, type_street_1_city); |
|
|
2282 | if (roadprofile) |
|
|
2283 | { |
|
|
2284 | value_ = roadprofile->route_prio_weight; |
|
|
2285 | dbg(0, "VPR:old=%d\n", value_); |
|
|
2286 | roadprofile->route_prio_weight = atoi(option_value); |
|
|
2287 | dbg(0, "VPR:new=%d\n", roadprofile->route_prio_weight); |
|
|
2288 | vehicleprofile_change_roadprofile_attr(global_navit->vehicleprofile, roadprofile, type_street_1_city, roadprofile->route_prio_weight); |
|
|
2289 | } |
|
|
2290 | |
|
|
2291 | |
|
|
2292 | roadprofile = vehicleprofile_get_roadprofile(global_navit->vehicleprofile, type_street_1_city); |
|
|
2293 | if (roadprofile) |
|
|
2294 | { |
|
|
2295 | value_ = roadprofile->route_prio_weight; |
|
|
2296 | dbg(0, "VPR:new2=%d\n", value_); |
|
|
2297 | } |
|
|
2298 | } |
|
|
2299 | |
|
|
2300 | // global_level2_announcement = atoi(option_value); |
|
|
2301 | |
|
|
2302 | g_free(str_copy); |
|
|
2303 | |
|
|
2304 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
2305 | } |
|
|
2306 | else if (i == 109) |
|
|
2307 | { |
|
|
2308 | // level 2 announcement seconds |
|
|
2309 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
2310 | global_level2_announcement = (float)atoi(s) / 10.0f; |
|
|
2311 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
2312 | } |
|
|
2313 | else if (i == 108) |
|
|
2314 | { |
|
|
2315 | // level 1 announcement seconds |
|
|
2316 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
2317 | global_level1_announcement = (float)atoi(s) / 10.0f; |
|
|
2318 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
2319 | } |
|
|
2320 | else if (i == 107) |
|
|
2321 | { |
|
|
2322 | // level 0 announcement seconds |
|
|
2323 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
2324 | global_level0_announcement = (float)atoi(s) / 10.0f; |
|
|
2325 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
2326 | } |
|
|
2327 | else if (i == 106) |
|
|
2328 | { |
|
|
2329 | // factor for routing/road speed |
|
|
2330 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
2331 | global_road_speed_factor = (float)atoi(s) / 100.0f; |
|
|
2332 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
2333 | } |
|
|
2334 | else if (i == 105) |
|
|
2335 | { |
|
|
2336 | // zoom to specific zoomlevel without redrawing the map! |
|
|
2337 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
2338 | int zoom_level = atoi(s); |
|
|
2339 | navit_zoom_to_scale_no_draw(global_navit, zoom_level); |
|
|
2340 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
2341 | } |
|
|
2342 | else if (i == 104) |
|
|
2343 | { |
|
|
2344 | // send OVERSPILL_FACTOR to C-code |
|
|
2345 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
2346 | int value = atoi(s); |
|
|
2347 | |
|
|
2348 | global_overspill_factor = (float)((float)value / 100.0f); |
|
|
2349 | |
|
|
2350 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
2351 | } |
|
|
2352 | else if (i == 103) |
|
|
2353 | { |
|
|
2354 | // draw location of self (car) x% lower than screen center |
|
|
2355 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
2356 | int value = atoi(s); |
|
|
2357 | |
|
|
2358 | global_navit->radius = value; |
|
|
2359 | |
|
|
2360 | (*env)->ReleaseStringUTFChars(env, str, s); |
2077 | } |
2361 | } |
2078 | else if (i == 102) |
2362 | else if (i == 102) |
2079 | { |
2363 | { |
2080 | // set gpsfix flag |
2364 | // set gpsfix flag |
2081 | s = (*env)->GetStringUTFChars(env, str, NULL); |
2365 | s = (*env)->GetStringUTFChars(env, str, NULL); |
… | |
… | |
2299 | if (rp) |
2583 | if (rp) |
2300 | { |
2584 | { |
2301 | rp->route_prio_weight = atoi(s); |
2585 | rp->route_prio_weight = atoi(s); |
2302 | } |
2586 | } |
2303 | |
2587 | |
2304 | rp = vehicleprofile_get_roadprofile(global_navit->vehicleprofile, type_ramp); |
2588 | //rp = vehicleprofile_get_roadprofile(global_navit->vehicleprofile, type_ramp); |
2305 | if (rp) |
2589 | //if (rp) |
2306 | { |
2590 | //{ |
2307 | rp->route_prio_weight = atoi(s); |
2591 | // rp->route_prio_weight = atoi(s); |
2308 | } |
2592 | //} |
2309 | |
2593 | |
2310 | // calc route new! |
2594 | // calc route new! |
2311 | if (rp) |
2595 | if (rp) |
2312 | { |
2596 | { |
2313 | if (old_value != atoi(s)) |
2597 | if (old_value != atoi(s)) |
… | |
… | |
2393 | else |
2677 | else |
2394 | { |
2678 | { |
2395 | if (!strcmp(s, "car")) |
2679 | if (!strcmp(s, "car")) |
2396 | { |
2680 | { |
2397 | global_vehicle_profile = 0; // car |
2681 | global_vehicle_profile = 0; // car |
|
|
2682 | |
|
|
2683 | if (global_enhance_cycleway == 1) |
|
|
2684 | { |
|
|
2685 | navit_reset_cycleway(global_navit); |
|
|
2686 | } |
2398 | } |
2687 | } |
2399 | else if (!strcmp(s, "bike-normal")) |
2688 | else if (!strcmp(s, "bike-normal")) |
2400 | { |
2689 | { |
2401 | global_vehicle_profile = 1; // bicycle |
2690 | global_vehicle_profile = 1; // bicycle |
|
|
2691 | |
|
|
2692 | if (global_enhance_cycleway == 0) |
|
|
2693 | { |
|
|
2694 | navit_enhance_cycleway(global_navit); |
|
|
2695 | } |
2402 | } |
2696 | } |
2403 | else if (!strcmp(s, "bike-avoid-roads")) |
2697 | else if (!strcmp(s, "bike-avoid-roads")) |
2404 | { |
2698 | { |
2405 | global_vehicle_profile = 1; // bicycle |
2699 | global_vehicle_profile = 1; // bicycle |
|
|
2700 | |
|
|
2701 | if (global_enhance_cycleway == 0) |
|
|
2702 | { |
|
|
2703 | navit_enhance_cycleway(global_navit); |
|
|
2704 | } |
2406 | } |
2705 | } |
2407 | else if (!strcmp(s, "bike-no-oneway")) |
2706 | else if (!strcmp(s, "bike-no-oneway")) |
2408 | { |
2707 | { |
2409 | global_vehicle_profile = 2; // bicycle no one-way! |
2708 | global_vehicle_profile = 2; // bicycle no one-way! |
|
|
2709 | |
|
|
2710 | if (global_enhance_cycleway == 0) |
|
|
2711 | { |
|
|
2712 | navit_enhance_cycleway(global_navit); |
|
|
2713 | } |
2410 | } |
2714 | } |
2411 | else |
2715 | else |
2412 | { |
2716 | { |
2413 | global_vehicle_profile = 0; // car |
2717 | global_vehicle_profile = 0; // car |
|
|
2718 | |
|
|
2719 | if (global_enhance_cycleway == 1) |
|
|
2720 | { |
|
|
2721 | navit_reset_cycleway(global_navit); |
|
|
2722 | } |
2414 | } |
2723 | } |
2415 | // dbg(0, "global_vehicle_profile=%d\n", global_vehicle_profile); |
2724 | // dbg(0, "global_vehicle_profile=%d\n", global_vehicle_profile); |
2416 | } |
2725 | } |
2417 | (*env)->ReleaseStringUTFChars(env, str, s); |
2726 | (*env)->ReleaseStringUTFChars(env, str, s); |
2418 | } |
2727 | } |
… | |
… | |
2723 | |
3032 | |
2724 | speed.type = attr_speed; |
3033 | speed.type = attr_speed; |
2725 | |
3034 | |
2726 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) |
3035 | if ((global_vehicle_profile == 1) || (global_vehicle_profile == 2)) |
2727 | { |
3036 | { |
2728 | // for bicycle it's always 17 km/h |
3037 | // for bicycle it's always 27 km/h |
2729 | speed.u.num = 17; |
3038 | speed.u.num = 27; |
2730 | } |
3039 | } |
2731 | else |
3040 | else |
2732 | { |
3041 | { |
2733 | // should be 45 km/h |
3042 | // should be 45 km/h |
2734 | speed.u.num = atoi(s); |
3043 | speed.u.num = atoi(s); |
… | |
… | |
3111 | pc.pro = transform_get_projection(global_navit->trans); |
3420 | pc.pro = transform_get_projection(global_navit->trans); |
3112 | |
3421 | |
3113 | // start navigation asynchronous |
3422 | // start navigation asynchronous |
3114 | navit_set_destination(global_navit, &pc, parse_str, 1); |
3423 | navit_set_destination(global_navit, &pc, parse_str, 1); |
3115 | } |
3424 | } |
3116 | else if (i == 48) |
3425 | else if (i == 55548) |
3117 | { |
3426 | { |
3118 | // append waypoint at lat, lng |
3427 | // append waypoint at lat, lng |
3119 | |
3428 | |
3120 | char *name; |
3429 | char *name; |
3121 | s = (*env)->GetStringUTFChars(env, str, NULL); |
3430 | s = (*env)->GetStringUTFChars(env, str, NULL); |
… | |
… | |
3147 | struct pcoord pc; |
3456 | struct pcoord pc; |
3148 | pc.x = c.x; |
3457 | pc.x = c.x; |
3149 | pc.y = c.y; |
3458 | pc.y = c.y; |
3150 | pc.pro = projection_mg; |
3459 | pc.pro = projection_mg; |
3151 | |
3460 | |
3152 | // append new waypoint to navigation |
3461 | if (global_navit->destination_valid == 1) |
3153 | navit_add_waypoint_to_route(global_navit, &pc, name, 1); |
3462 | { |
|
|
3463 | route_add_destination_no_calc(global_navit->route, &pc, 1); |
|
|
3464 | |
|
|
3465 | global_navit->destination = pc; |
|
|
3466 | global_navit->destination_valid = 1; |
3154 | } |
3467 | } |
|
|
3468 | else |
|
|
3469 | { |
|
|
3470 | route_set_destination_no_calc(global_navit->route, &pc, 1); |
|
|
3471 | } |
|
|
3472 | } |
|
|
3473 | else if (i == 55598) |
|
|
3474 | { |
|
|
3475 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
3476 | int value = atoi(s); |
|
|
3477 | |
|
|
3478 | global_routing_engine = value; |
|
|
3479 | |
|
|
3480 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
3481 | } |
|
|
3482 | else if (i == 55599) |
|
|
3483 | { |
|
|
3484 | route_after_destination_start_calc(global_navit->route, 1); |
|
|
3485 | } |
3155 | else if (i == 3) |
3486 | else if (i == 48) |
3156 | { |
3487 | { |
3157 | // set destination to lat, lng |
3488 | // append waypoint at lat, lng |
3158 | |
3489 | |
3159 | char *name; |
3490 | char *name; |
3160 | s = (*env)->GetStringUTFChars(env, str, NULL); |
3491 | s = (*env)->GetStringUTFChars(env, str, NULL); |
3161 | char parse_str[strlen(s) + 1]; |
3492 | char parse_str[strlen(s) + 1]; |
3162 | strcpy(parse_str, s); |
3493 | strcpy(parse_str, s); |
3163 | (*env)->ReleaseStringUTFChars(env, str, s); |
3494 | (*env)->ReleaseStringUTFChars(env, str, s); |
3164 | ////DBG // dbg(0,"*****string=%s\n",s); |
|
|
3165 | |
3495 | |
3166 | // set destination to (lat#lon#title) |
3496 | // waypoint (lat#lon#title) |
3167 | struct coord_geo g; |
3497 | struct coord_geo g; |
3168 | char *p; |
3498 | char *p; |
3169 | char *stopstring; |
3499 | char *stopstring; |
3170 | |
3500 | |
3171 | // lat |
3501 | // lat |
… | |
… | |
3187 | struct pcoord pc; |
3517 | struct pcoord pc; |
3188 | pc.x = c.x; |
3518 | pc.x = c.x; |
3189 | pc.y = c.y; |
3519 | pc.y = c.y; |
3190 | pc.pro = projection_mg; |
3520 | pc.pro = projection_mg; |
3191 | |
3521 | |
|
|
3522 | // append new waypoint to navigation |
|
|
3523 | navit_add_waypoint_to_route(global_navit, &pc, name, 1); |
|
|
3524 | } |
|
|
3525 | else if (i == 55503) |
|
|
3526 | { |
|
|
3527 | |
|
|
3528 | // set destination to lat, lng |
|
|
3529 | |
|
|
3530 | char *name; |
|
|
3531 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
3532 | char parse_str[strlen(s) + 1]; |
|
|
3533 | strcpy(parse_str, s); |
|
|
3534 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
3535 | ////DBG // dbg(0,"*****string=%s\n",s); |
|
|
3536 | |
|
|
3537 | // set destination to (lat#lon#title) |
|
|
3538 | struct coord_geo g; |
|
|
3539 | char *p; |
|
|
3540 | char *stopstring; |
|
|
3541 | |
|
|
3542 | // lat |
|
|
3543 | p = strtok(parse_str, "#"); |
|
|
3544 | g.lat = strtof(p, &stopstring); |
|
|
3545 | // lon |
|
|
3546 | p = strtok(NULL, "#"); |
|
|
3547 | g.lng = strtof(p, &stopstring); |
|
|
3548 | // description |
|
|
3549 | name = strtok(NULL, "#"); |
|
|
3550 | |
|
|
3551 | ////DBG // dbg(0,"lat=%f\n",g.lat); |
|
|
3552 | ////DBG // dbg(0,"lng=%f\n",g.lng); |
|
|
3553 | ////DBG // dbg(0,"str1=%s\n",name); |
|
|
3554 | |
|
|
3555 | struct coord c; |
|
|
3556 | transform_from_geo(projection_mg, &g, &c); |
|
|
3557 | |
|
|
3558 | struct pcoord pc; |
|
|
3559 | pc.x = c.x; |
|
|
3560 | pc.y = c.y; |
|
|
3561 | pc.pro = projection_mg; |
|
|
3562 | |
|
|
3563 | global_navit->destination = pc; |
|
|
3564 | global_navit->destination_valid = 1; |
|
|
3565 | |
|
|
3566 | if (global_navit->route) |
|
|
3567 | { |
|
|
3568 | route_set_destination_no_calc(global_navit->route, &pc, 1); |
|
|
3569 | } |
|
|
3570 | } |
|
|
3571 | else if (i == 3) |
|
|
3572 | { |
|
|
3573 | // set destination to lat, lng |
|
|
3574 | |
|
|
3575 | char *name; |
|
|
3576 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
3577 | char parse_str[strlen(s) + 1]; |
|
|
3578 | strcpy(parse_str, s); |
|
|
3579 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
3580 | ////DBG // dbg(0,"*****string=%s\n",s); |
|
|
3581 | |
|
|
3582 | // set destination to (lat#lon#title) |
|
|
3583 | struct coord_geo g; |
|
|
3584 | char *p; |
|
|
3585 | char *stopstring; |
|
|
3586 | |
|
|
3587 | // lat |
|
|
3588 | p = strtok(parse_str, "#"); |
|
|
3589 | g.lat = strtof(p, &stopstring); |
|
|
3590 | // lon |
|
|
3591 | p = strtok(NULL, "#"); |
|
|
3592 | g.lng = strtof(p, &stopstring); |
|
|
3593 | // description |
|
|
3594 | name = strtok(NULL, "#"); |
|
|
3595 | |
|
|
3596 | ////DBG // dbg(0,"lat=%f\n",g.lat); |
|
|
3597 | ////DBG // dbg(0,"lng=%f\n",g.lng); |
|
|
3598 | ////DBG // dbg(0,"str1=%s\n",name); |
|
|
3599 | |
|
|
3600 | struct coord c; |
|
|
3601 | transform_from_geo(projection_mg, &g, &c); |
|
|
3602 | |
|
|
3603 | struct pcoord pc; |
|
|
3604 | pc.x = c.x; |
|
|
3605 | pc.y = c.y; |
|
|
3606 | pc.pro = projection_mg; |
|
|
3607 | |
3192 | // start navigation asynchronous |
3608 | // start navigation asynchronous |
3193 | navit_set_destination(global_navit, &pc, name, 1); |
3609 | navit_set_destination(global_navit, &pc, name, 1); |
3194 | |
3610 | |
3195 | } |
3611 | } |
3196 | } |
3612 | } |
… | |
… | |
3309 | } |
3725 | } |
3310 | |
3726 | |
3311 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_set_vehicle_values2, x, y, angle, speed); |
3727 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_set_vehicle_values2, x, y, angle, speed); |
3312 | } |
3728 | } |
3313 | |
3729 | |
3314 | void set_vehicle_values_to_java_delta(int dx, int dy, int dangle, int dzoom) |
3730 | void set_vehicle_values_to_java_delta(int dx, int dy, int dangle, int dzoom, int l_old, int l_new) |
3315 | { |
3731 | { |
3316 | JNIEnv *jnienv2; |
3732 | JNIEnv *jnienv2; |
3317 | jnienv2 = jni_getenv(); |
3733 | jnienv2 = jni_getenv(); |
3318 | |
3734 | |
3319 | //int thread_id = gettid(); |
3735 | //int thread_id = gettid(); |
… | |
… | |
3328 | } |
3744 | } |
3329 | } |
3745 | } |
3330 | |
3746 | |
3331 | if (NavitGraphics_set_vehicle_values3 == NULL) |
3747 | if (NavitGraphics_set_vehicle_values3 == NULL) |
3332 | { |
3748 | { |
3333 | if (!android_find_static_method(NavitGraphicsClass2, "set_vehicle_values_delta", "(IIII)V", &NavitGraphics_set_vehicle_values3)) |
3749 | if (!android_find_static_method(NavitGraphicsClass2, "set_vehicle_values_delta", "(IIIIII)V", &NavitGraphics_set_vehicle_values3)) |
3334 | { |
3750 | { |
3335 | return; |
3751 | return; |
3336 | } |
3752 | } |
3337 | } |
3753 | } |
3338 | |
3754 | |
3339 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_set_vehicle_values3, dx, dy, dangle, dzoom); |
3755 | (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_set_vehicle_values3, dx, dy, dangle, dzoom, l_old, l_new); |
3340 | } |
3756 | } |
3341 | |
3757 | |
3342 | void send_route_rect_to_java(int x1, int y1, int x2, int y2, int order) |
3758 | void send_route_rect_to_java(int x1, int y1, int x2, int y2, int order) |
3343 | { |
3759 | { |
3344 | JNIEnv *jnienv2; |
3760 | JNIEnv *jnienv2; |