… | |
… | |
54 | jmethodID DrawMapPreview_polyline = NULL; |
54 | jmethodID DrawMapPreview_polyline = NULL; |
55 | jmethodID DrawMapPreview_text = NULL; |
55 | jmethodID DrawMapPreview_text = NULL; |
56 | |
56 | |
57 | struct attr attr; |
57 | struct attr attr; |
58 | |
58 | |
|
|
59 | |
|
|
60 | |
|
|
61 | |
|
|
62 | |
|
|
63 | |
|
|
64 | |
|
|
65 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
|
|
66 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
|
|
67 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
|
|
68 | |
|
|
69 | |
|
|
70 | // copyied from config_.c !!! (always keep in sync!!!) |
59 | struct config |
71 | struct config { |
60 | { |
|
|
61 | struct attr **attrs; |
72 | struct attr **attrs; |
62 | struct callback_list *cbl; |
73 | struct callback_list *cbl; |
63 | }*config; |
74 | } *config; |
64 | |
75 | |
|
|
76 | |
|
|
77 | // copied from gui_internal.c (always keep in sync!!!) |
65 | struct gui_config_settings |
78 | struct gui_config_settings { |
66 | { |
79 | int font_size; |
|
|
80 | int icon_xs; |
|
|
81 | int icon_s; |
|
|
82 | int icon_l; |
|
|
83 | int spacing; |
|
|
84 | }; |
|
|
85 | |
|
|
86 | |
|
|
87 | // dummy def!! |
|
|
88 | struct gui_internal_methods { |
67 | int dummy; |
89 | int dummy; |
68 | }; |
90 | }; |
69 | |
91 | |
70 | struct gui_internal_data |
92 | // dummy def!! |
71 | { |
93 | struct gui_internal_widget_methods { |
72 | int dummy; |
94 | int dummy; |
73 | }; |
95 | }; |
74 | |
96 | |
75 | struct route_data |
97 | |
76 | { |
98 | // forward def |
77 | int dummy; |
99 | struct gui_priv; |
|
|
100 | |
|
|
101 | // copied from gui_internal.h (always keep in sync!!!) |
|
|
102 | struct gui_internal_data { |
|
|
103 | struct gui_priv *priv; |
|
|
104 | struct gui_internal_methods *gui; |
|
|
105 | struct gui_internal_widget_methods *widget; |
78 | }; |
106 | }; |
79 | |
107 | |
80 | struct widget |
108 | // copied from gui_internal.c (always keep in sync!!!) |
81 | { |
109 | struct route_data { |
82 | int dummy; |
110 | struct widget * route_table; |
|
|
111 | int route_showing; |
|
|
112 | |
83 | }; |
113 | }; |
84 | |
114 | |
|
|
115 | // copied from gui_internal.h (always keep in sync!!!) |
|
|
116 | enum flags { |
|
|
117 | gravity_none=0x00, |
|
|
118 | gravity_left=1, |
|
|
119 | gravity_xcenter=2, |
|
|
120 | gravity_right=4, |
|
|
121 | gravity_top=8, |
|
|
122 | gravity_ycenter=16, |
|
|
123 | gravity_bottom=32, |
|
|
124 | gravity_left_top=gravity_left|gravity_top, |
|
|
125 | gravity_top_center=gravity_xcenter|gravity_top, |
|
|
126 | gravity_right_top=gravity_right|gravity_top, |
|
|
127 | gravity_left_center=gravity_left|gravity_ycenter, |
|
|
128 | gravity_center=gravity_xcenter|gravity_ycenter, |
|
|
129 | gravity_right_center=gravity_right|gravity_ycenter, |
|
|
130 | gravity_left_bottom=gravity_left|gravity_bottom, |
|
|
131 | gravity_bottom_center=gravity_xcenter|gravity_bottom, |
|
|
132 | gravity_right_bottom=gravity_right|gravity_bottom, |
|
|
133 | flags_expand=0x100, |
|
|
134 | flags_fill=0x200, |
|
|
135 | orientation_horizontal=0x10000, |
|
|
136 | orientation_vertical=0x20000, |
|
|
137 | orientation_horizontal_vertical=0x40000, |
|
|
138 | }; |
|
|
139 | |
|
|
140 | // copied from gui_internal.h (always keep in sync!!!) |
|
|
141 | enum widget_type { |
|
|
142 | widget_box=1, |
|
|
143 | widget_button, |
|
|
144 | widget_label, |
|
|
145 | widget_image, |
|
|
146 | widget_table, |
|
|
147 | widget_table_row |
|
|
148 | }; |
|
|
149 | |
|
|
150 | // copied from gui_internal.c (always keep in sync!!!) |
|
|
151 | struct widget { |
|
|
152 | enum widget_type type; |
|
|
153 | struct graphics_gc *background,*text_background; |
|
|
154 | struct graphics_gc *foreground_frame; |
|
|
155 | struct graphics_gc *foreground; |
|
|
156 | char *text; |
|
|
157 | struct graphics_image *img; |
|
|
158 | void (*func)(struct gui_priv *priv, struct widget *widget, void *data); |
|
|
159 | int reason; |
|
|
160 | int datai; |
|
|
161 | void *data; |
|
|
162 | void (*data_free)(void *data); |
|
|
163 | void (*free) (struct gui_priv *this_, struct widget * w); |
|
|
164 | char *prefix; |
|
|
165 | char *name; |
|
|
166 | char *speech; |
|
|
167 | char *command; |
|
|
168 | struct pcoord c; |
|
|
169 | struct item item; |
|
|
170 | int selection_id; |
|
|
171 | int state; |
|
|
172 | struct point p; |
|
|
173 | int wmin,hmin; |
|
|
174 | int w,h; |
|
|
175 | int textw,texth; |
|
|
176 | int font_idx; |
|
|
177 | int bl,br,bt,bb,spx,spy; |
|
|
178 | int border; |
|
|
179 | int packed; |
|
|
180 | int cols; |
|
|
181 | enum flags flags; |
|
|
182 | int flags2; |
|
|
183 | void *instance; |
|
|
184 | int (*set_attr)(void *, struct attr *); |
|
|
185 | int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *); |
|
|
186 | void (*remove_cb)(void *, struct callback *cb); |
|
|
187 | struct callback *cb; |
|
|
188 | struct attr on; |
|
|
189 | struct attr off; |
|
|
190 | int deflt; |
|
|
191 | int is_on; |
|
|
192 | int redraw; |
|
|
193 | struct menu_data *menu_data; |
|
|
194 | struct form *form; |
|
|
195 | GList *children; |
|
|
196 | }; |
|
|
197 | |
|
|
198 | |
|
|
199 | // copied from gui_internal.c !!!!!! (always keep in sync!!!) |
85 | struct gui_priv |
200 | struct gui_priv { |
86 | { |
|
|
87 | struct navit *nav; |
201 | struct navit *nav; |
88 | struct attr self; |
202 | struct attr self; |
89 | struct window *win; |
203 | struct window *win; |
90 | struct graphics *gra; |
204 | struct graphics *gra; |
91 | struct graphics_gc *background; |
205 | struct graphics_gc *background; |
… | |
… | |
97 | struct color background_color, background2_color, text_foreground_color, text_background_color; |
211 | struct color background_color, background2_color, text_foreground_color, text_background_color; |
98 | int spacing; |
212 | int spacing; |
99 | int font_size; |
213 | int font_size; |
100 | int fullscreen; |
214 | int fullscreen; |
101 | struct graphics_font *fonts[3]; |
215 | struct graphics_font *fonts[3]; |
102 | /** |
|
|
103 | * The size (in pixels) that xs style icons should be scaled to. |
|
|
104 | * This icon size can be too small to click it on some devices. |
|
|
105 | */ |
|
|
106 | int icon_xs; |
216 | int icon_xs; |
107 | /** |
|
|
108 | * The size (in pixels) that s style icons (small) should be scaled to |
|
|
109 | */ |
|
|
110 | int icon_s; |
217 | int icon_s; |
111 | /** |
|
|
112 | * The size (in pixels) that l style icons should be scaled to |
|
|
113 | */ |
|
|
114 | int icon_l; |
218 | int icon_l; |
115 | int pressed; |
219 | int pressed; |
116 | struct widget *widgets; |
220 | struct widget *widgets; |
117 | int widgets_count; |
221 | int widgets_count; |
118 | int redraw; |
222 | int redraw; |
119 | struct widget root; |
223 | struct widget root; |
120 | struct widget *highlighted, *editable; |
224 | struct widget *highlighted,*editable; |
121 | struct widget *highlighted_menu; |
225 | struct widget *highlighted_menu; |
122 | int clickp_valid, vehicle_valid; |
226 | int clickp_valid, vehicle_valid; |
123 | struct pcoord clickp, vehiclep; |
227 | struct pcoord clickp, vehiclep; |
124 | struct attr *click_coord_geo, *position_coord_geo; |
228 | struct attr *click_coord_geo, *position_coord_geo; |
125 | struct search_list *sl; |
229 | struct search_list *sl; |
… | |
… | |
128 | int signal_on_map_click; |
232 | int signal_on_map_click; |
129 | char *country_iso2; |
233 | char *country_iso2; |
130 | int speech; |
234 | int speech; |
131 | int keyboard; |
235 | int keyboard; |
132 | int keyboard_required; |
236 | int keyboard_required; |
133 | /** |
|
|
134 | * The setting information read from the configuration file. |
|
|
135 | * values of -1 indicate no value was specified in the config file. |
|
|
136 | */ |
|
|
137 | struct gui_config_settings config; |
237 | struct gui_config_settings config; |
138 | struct event_idle *idle; |
238 | struct event_idle *idle; |
139 | struct callback *motion_cb, *button_cb, *resize_cb, *keypress_cb, *window_closed_cb, *idle_cb, *motion_timeout_callback; |
239 | struct callback *motion_cb,*button_cb,*resize_cb,*keypress_cb,*window_closed_cb,*idle_cb, *motion_timeout_callback; |
140 | struct event_timeout *motion_timeout_event; |
240 | struct event_timeout *motion_timeout_event; |
141 | struct point current; |
241 | struct point current; |
142 | |
|
|
143 | struct callback * vehicle_cb; |
242 | struct callback * vehicle_cb; |
144 | /** |
|
|
145 | * Stores information about the route. |
|
|
146 | */ |
|
|
147 | struct route_data route_data; |
243 | struct route_data route_data; |
148 | |
|
|
149 | struct gui_internal_data data; |
244 | struct gui_internal_data data; |
150 | struct callback_list *cbl; |
245 | struct callback_list *cbl; |
151 | int flags; |
246 | int flags; |
152 | int cols; |
247 | int cols; |
153 | struct attr osd_configuration; |
248 | struct attr osd_configuration; |
154 | int pitch; |
249 | int pitch; |
155 | int flags_town, flags_street, flags_house_number; |
250 | int flags_town,flags_street,flags_house_number; |
156 | int radius; |
251 | int radius; |
157 | /* html */ |
|
|
158 | char *html_text; |
252 | char *html_text; |
159 | int html_depth; |
253 | int html_depth; |
160 | struct widget *html_container; |
254 | struct widget *html_container; |
161 | int html_skip; |
255 | int html_skip; |
162 | char *html_anchor; |
256 | char *html_anchor; |
163 | char *href; |
257 | char *href; |
164 | int html_anchor_found; |
258 | int html_anchor_found; |
165 | struct form *form; |
259 | struct form *form; |
166 | struct html |
260 | struct html { |
167 | { |
|
|
168 | int skip; |
261 | int skip; |
169 | enum html_tag |
262 | enum html_tag { |
170 | { |
263 | html_tag_none, |
171 | html_tag_none, html_tag_a, html_tag_h1, html_tag_html, html_tag_img, html_tag_script, html_tag_form, html_tag_input, html_tag_div, |
264 | html_tag_a, |
|
|
265 | html_tag_h1, |
|
|
266 | html_tag_html, |
|
|
267 | html_tag_img, |
|
|
268 | html_tag_script, |
|
|
269 | html_tag_form, |
|
|
270 | html_tag_input, |
|
|
271 | html_tag_div, |
172 | } tag; |
272 | } tag; |
173 | char *command; |
273 | char *command; |
174 | char *name; |
274 | char *name; |
175 | char *href; |
275 | char *href; |
176 | char *refresh_cond; |
276 | char *refresh_cond; |
177 | struct widget *w; |
277 | struct widget *w; |
178 | struct widget *container; |
278 | struct widget *container; |
179 | } html[10]; |
279 | } html[10]; |
180 | }; |
280 | }; |
181 | |
281 | |
|
|
282 | |
|
|
283 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
|
|
284 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
|
|
285 | // ------------------------- COPIED STUFF --- this is generally bad ------------------ |
|
|
286 | |
|
|
287 | |
|
|
288 | |
|
|
289 | |
|
|
290 | |
|
|
291 | |
|
|
292 | |
182 | static void gui_internal_search_list_set_default_country2(struct gui_priv *this) |
293 | static void gui_internal_search_list_set_default_country2(struct gui_priv *this) |
183 | { |
294 | { |
|
|
295 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
296 | dbg(0,"+#+:enter\n"); |
|
|
297 | #endif |
184 | struct attr search_attr, country_name, country_iso2, *country_attr; |
298 | struct attr search_attr, country_name, country_iso2, *country_attr; |
185 | struct item *item; |
299 | struct item *item; |
186 | struct country_search *cs; |
300 | struct country_search *cs; |
187 | struct tracking *tracking; |
301 | struct tracking *tracking; |
188 | struct search_list_result *res; |
302 | struct search_list_result *res; |
… | |
… | |
238 | |
352 | |
239 | struct navit *global_navit; |
353 | struct navit *global_navit; |
240 | |
354 | |
241 | int android_find_class_global(char *name, jclass *ret) |
355 | int android_find_class_global(char *name, jclass *ret) |
242 | { |
356 | { |
|
|
357 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
358 | dbg(0,"+#+:enter\n"); |
|
|
359 | #endif |
243 | *ret = (*jnienv)->FindClass(jnienv, name); |
360 | *ret = (*jnienv)->FindClass(jnienv, name); |
244 | if (!*ret) |
361 | if (!*ret) |
245 | { |
362 | { |
246 | //DBG dbg(0, "Failed to get Class %s\n", name); |
363 | //DBG dbg(0, "Failed to get Class %s\n", name); |
247 | return 0; |
364 | return 0; |
… | |
… | |
253 | return 1; |
370 | return 1; |
254 | } |
371 | } |
255 | |
372 | |
256 | int android_find_method(jclass class, char *name, char *args, jmethodID *ret) |
373 | int android_find_method(jclass class, char *name, char *args, jmethodID *ret) |
257 | { |
374 | { |
|
|
375 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
376 | dbg(0,"+#+:enter\n"); |
|
|
377 | #endif |
258 | *ret = (*jnienv)->GetMethodID(jnienv, class, name, args); |
378 | *ret = (*jnienv)->GetMethodID(jnienv, class, name, args); |
259 | if (*ret == NULL) |
379 | if (*ret == NULL) |
260 | { |
380 | { |
261 | //DBG dbg(0, "Failed to get Method %s with signature %s\n", name, args); |
381 | //DBG dbg(0, "Failed to get Method %s with signature %s\n", name, args); |
262 | return 0; |
382 | return 0; |
… | |
… | |
265 | return 1; |
385 | return 1; |
266 | } |
386 | } |
267 | |
387 | |
268 | int android_find_static_method(jclass class, char *name, char *args, jmethodID *ret) |
388 | int android_find_static_method(jclass class, char *name, char *args, jmethodID *ret) |
269 | { |
389 | { |
|
|
390 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
391 | dbg(0,"+#+:enter\n"); |
|
|
392 | #endif |
270 | *ret = (*jnienv)->GetStaticMethodID(jnienv, class, name, args); |
393 | *ret = (*jnienv)->GetStaticMethodID(jnienv, class, name, args); |
271 | if (*ret == NULL) |
394 | if (*ret == NULL) |
272 | { |
395 | { |
273 | //DBG dbg(0, "Failed to get static Method %s with signature %s\n", name, args); |
396 | //DBG dbg(0, "Failed to get static Method %s with signature %s\n", name, args); |
274 | return 0; |
397 | return 0; |
… | |
… | |
278 | } |
401 | } |
279 | |
402 | |
280 | JNIEXPORT void JNICALL |
403 | JNIEXPORT void JNICALL |
281 | Java_com_zoffcc_applications_zanavi_Navit_NavitMain(JNIEnv* env, jobject thiz, jobject activity, jobject lang, int version, jobject display_density_string) |
404 | Java_com_zoffcc_applications_zanavi_Navit_NavitMain(JNIEnv* env, jobject thiz, jobject activity, jobject lang, int version, jobject display_density_string) |
282 | { |
405 | { |
|
|
406 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
407 | dbg(0,"+#+:enter\n"); |
|
|
408 | #endif |
283 | char *strings[] = |
409 | char *strings[] = |
284 | { "/data/data/com.zoffcc.applications.zanavi/bin/navit", NULL }; |
410 | { "/data/data/com.zoffcc.applications.zanavi/bin/navit", NULL }; |
285 | const char *langstr; |
411 | const char *langstr; |
286 | const char *displaydensitystr; |
412 | const char *displaydensitystr; |
287 | android_version = version; |
413 | android_version = version; |
… | |
… | |
290 | |
416 | |
291 | // set global JNIenv here ---------- |
417 | // set global JNIenv here ---------- |
292 | // set global JNIenv here ---------- |
418 | // set global JNIenv here ---------- |
293 | // set global JNIenv here ---------- |
419 | // set global JNIenv here ---------- |
294 | jnienv = env; |
420 | jnienv = env; |
|
|
421 | //dbg(0,"jnienv=%p\n", jnienv); |
295 | // set global JNIenv here ---------- |
422 | // set global JNIenv here ---------- |
296 | // set global JNIenv here ---------- |
423 | // set global JNIenv here ---------- |
297 | // set global JNIenv here ---------- |
424 | // set global JNIenv here ---------- |
298 | |
425 | |
299 | //jclass someClass = env->FindClass("SomeClass"); |
426 | //jclass someClass = env->FindClass("SomeClass"); |
… | |
… | |
312 | displaydensitystr = (*env)->GetStringUTFChars(env, display_density_string, NULL); |
439 | displaydensitystr = (*env)->GetStringUTFChars(env, display_density_string, NULL); |
313 | //DBG dbg(0, "*****displaydensity=%s\n", displaydensitystr); |
440 | //DBG dbg(0, "*****displaydensity=%s\n", displaydensitystr); |
314 | setenv("ANDROID_DENSITY", displaydensitystr, 1); |
441 | setenv("ANDROID_DENSITY", displaydensitystr, 1); |
315 | (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr); |
442 | (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr); |
316 | main_real(1, strings); |
443 | main_real(1, strings); |
|
|
444 | |
|
|
445 | dbg(0,"after main_real call\n"); |
|
|
446 | |
|
|
447 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
448 | dbg(0,"+#+:leave\n"); |
|
|
449 | #endif |
|
|
450 | |
317 | } |
451 | } |
318 | |
452 | |
319 | JNIEXPORT void JNICALL |
453 | JNIEXPORT void JNICALL |
320 | Java_com_zoffcc_applications_zanavi_Navit_NavitActivity(JNIEnv* env, jobject thiz, int param) |
454 | Java_com_zoffcc_applications_zanavi_Navit_NavitActivity(JNIEnv* env, jobject thiz, int param) |
321 | { |
455 | { |
|
|
456 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
457 | dbg(0,"+#+:enter\n"); |
|
|
458 | #endif |
322 | dbg(0, "enter %d\n", param); |
459 | dbg(0, "enter %d\n", param); |
323 | |
460 | |
324 | if (param == -2) |
461 | if (param == -2) |
325 | { |
462 | { |
326 | // onStop() -> called in Java app |
463 | // onStop() -> called in Java app |
… | |
… | |
329 | { |
466 | { |
330 | config_get_attr(config, attr_navit, &attr, NULL); |
467 | config_get_attr(config, attr_navit, &attr, NULL); |
331 | //DBG dbg(0, "save position to file"); |
468 | //DBG dbg(0, "save position to file"); |
332 | char *center_file = bookmarks_get_center_file(TRUE); |
469 | char *center_file = bookmarks_get_center_file(TRUE); |
333 | bookmarks_write_center_to_file(attr.u.navit->bookmarks, center_file); |
470 | bookmarks_write_center_to_file(attr.u.navit->bookmarks, center_file); |
334 | dbg(0,"save pos to file -> ready"); |
471 | dbg(0, "save pos to file -> ready"); |
335 | g_free(center_file); |
472 | g_free(center_file); |
336 | // bookmarks_destroy(global_navit->bookmarks); |
473 | // bookmarks_destroy(global_navit->bookmarks); |
337 | } |
474 | } |
338 | } |
475 | } |
339 | |
476 | |
|
|
477 | // param == 3 // onCreate |
|
|
478 | // param == 2 // onStart |
|
|
479 | // param == 1 // onResume |
|
|
480 | // param == 0 // onRestart |
|
|
481 | // param == -1 // onPause |
|
|
482 | // param == -2 // onStop |
|
|
483 | // param == -3 // onDestroy |
|
|
484 | // param == -4 // exit() [java function] |
|
|
485 | |
|
|
486 | if (param == 3) |
|
|
487 | { |
|
|
488 | navit_draw(global_navit); |
|
|
489 | } |
|
|
490 | |
340 | dbg(0,"acti: 001\n"); |
491 | dbg(0, "acti: 001\n"); |
341 | callback_list_call_1(android_activity_cbl, param); |
492 | // callback_list_call_1(android_activity_cbl, param); |
342 | dbg(0,"acti: 002\n"); |
493 | //dbg(0, "acti: 002\n"); |
|
|
494 | |
|
|
495 | //if (param == -4) |
|
|
496 | //{ |
|
|
497 | // dbg(0, "acti: 003\n"); |
|
|
498 | // // *********EXIT******EXIT******** // exit(0); |
|
|
499 | //} |
|
|
500 | |
343 | if (param == -4) |
501 | if (param == -4) |
344 | { |
502 | { |
345 | dbg(0,"acti: 003\n"); |
503 | dbg(0, "acti: 004\n"); |
346 | exit(0); |
504 | navit_destroy(global_navit); |
347 | } |
505 | dbg(0, "acti: 005\n"); |
348 | //if (param == -3) |
|
|
349 | //{ |
|
|
350 | // event_main_loop_quit(); |
506 | event_main_loop_quit(); |
351 | //} |
507 | dbg(0, "acti: 006\n"); |
|
|
508 | } |
352 | } |
509 | } |
|
|
510 | |
353 | |
511 | |
354 | JNIEXPORT void JNICALL |
512 | JNIEXPORT void JNICALL |
355 | Java_com_zoffcc_applications_zanavi_NavitGraphics_SizeChangedCallback(JNIEnv* env, jobject thiz, int id, int w, int h) |
513 | Java_com_zoffcc_applications_zanavi_NavitGraphics_SizeChangedCallback(JNIEnv* env, jobject thiz, int w, int h) |
356 | { |
514 | { |
|
|
515 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
516 | dbg(0,"+#+:enter\n"); |
|
|
517 | #endif |
357 | //DBG dbg(0,"enter %p %d %d\n", id, w, h); |
518 | dbg(0,"enter %d %d\n", w, h); |
358 | navit_handle_resize(global_navit, w, h); |
519 | navit_handle_resize(global_navit, w, h); |
359 | |
520 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
360 | // //DBG dbg(0,"== part2 ==\n"); |
|
|
361 | |
|
|
362 | //if (id) |
|
|
363 | //{ |
|
|
364 | // callback_call_2((struct callback *) id, w, h); |
|
|
365 | //} |
|
|
366 | |
|
|
367 | //DBG dbg(0,"leave\n"); |
521 | dbg(0,"+#+:leave\n"); |
|
|
522 | #endif |
368 | } |
523 | } |
|
|
524 | |
369 | |
525 | |
370 | JNIEXPORT void JNICALL |
526 | JNIEXPORT void JNICALL |
371 | Java_com_zoffcc_applications_zanavi_NavitGraphics_ButtonCallback(JNIEnv* env, jobject thiz, int id, int pressed, int button, int x, int y) |
|
|
372 | { |
|
|
373 | //DBG dbg(0, "enter %p %d %d\n", (struct callback *) id, pressed, button); |
|
|
374 | if (id) |
|
|
375 | callback_call_4((struct callback *) id, pressed, button, x, y); |
|
|
376 | } |
|
|
377 | |
|
|
378 | JNIEXPORT void JNICALL |
|
|
379 | Java_com_zoffcc_applications_zanavi_NavitGraphics_MotionCallback(JNIEnv* env, jobject thiz, int id, int x, int y) |
527 | Java_com_zoffcc_applications_zanavi_NavitGraphics_MotionCallback(JNIEnv* env, jobject thiz, int x1, int y1, int x2, int y2) |
380 | { |
528 | { |
381 | //DBG dbg(0, "enter %p %d %d\n", (struct callback *) id, x, y); |
529 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
382 | if (id) |
530 | dbg(0,"+#+:enter\n"); |
383 | callback_call_2((struct callback *) id, x, y); |
531 | #endif |
384 | } |
|
|
385 | |
532 | |
386 | JNIEXPORT void JNICALL |
533 | struct point p_end; |
387 | Java_com_zoffcc_applications_zanavi_NavitGraphics_KeypressCallback(JNIEnv* env, jobject thiz, int id, jobject str) |
534 | struct point p_start; |
388 | { |
535 | |
389 | //DBG dbg(0,"EEnter\n"); |
536 | p_start.x = x1; |
390 | const char *s; |
537 | p_start.y = y1; |
391 | ////DBG dbg(0,"enter %p %p\n",(struct callback *)id,str); |
538 | p_end.x = x2; |
392 | s = (*env)->GetStringUTFChars(env, str, NULL); |
539 | p_end.y = y2; |
393 | ////DBG dbg(0,"key=%s\n",s); |
540 | update_transformation(global_navit->trans, &p_start, &p_end, NULL); |
394 | if (id) |
541 | // graphics_draw_drag(this_->gra, NULL); |
395 | { |
542 | transform_copy(global_navit->trans, global_navit->trans_cursor); |
396 | callback_call_1((struct callback *) id, s); |
543 | global_navit->moved = 1; |
397 | } |
544 | |
398 | (*env)->ReleaseStringUTFChars(env, str, s); |
545 | /* |
|
|
546 | struct coord c; |
|
|
547 | struct pcoord pc; |
|
|
548 | p.x = x; |
|
|
549 | p.y = y; |
|
|
550 | transform_reverse(global_navit->trans, &p, &c); |
|
|
551 | pc.x = c.x; |
|
|
552 | pc.y = c.y; |
|
|
553 | pc.pro = transform_get_projection(global_navit->trans); |
|
|
554 | navit_set_position(global_navit, &pc); |
|
|
555 | */ |
|
|
556 | |
|
|
557 | navit_draw(global_navit); |
399 | } |
558 | } |
|
|
559 | |
400 | |
560 | |
401 | JNIEXPORT void JNICALL |
561 | JNIEXPORT void JNICALL |
402 | Java_com_zoffcc_applications_zanavi_NavitTimeout_TimeoutCallback(JNIEnv* env, jobject thiz, int delete, int id) |
562 | Java_com_zoffcc_applications_zanavi_NavitTimeout_TimeoutCallback(JNIEnv* env, jobject thiz, int delete, int id) |
403 | { |
563 | { |
|
|
564 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
565 | dbg(0,"+#+:enter\n"); |
|
|
566 | #endif |
404 | //DBG dbg(0,"enter %p %d %p\n",thiz, delete, (void *)id); |
567 | //DBG dbg(0,"enter %p %d %p\n",thiz, delete, (void *)id); |
405 | //DBG dbg(0,"timeout 1\n"); |
568 | //dbg(0,"timeout 1\n"); |
406 | // ICS |
569 | // ICS |
407 | callback_call_0((struct callback *) id); |
570 | callback_call_0((struct callback *) id); |
408 | // ICS |
571 | // ICS |
409 | //DBG dbg(0,"timeout 2\n"); |
572 | //dbg(0,"timeout 2\n"); |
410 | if (delete) |
573 | if (delete) |
411 | { |
574 | { |
412 | //DBG dbg(0,"timeout 3\n"); |
575 | //dbg(0,"timeout 3\n"); |
413 | // ICS |
576 | // ICS |
414 | // (*jnienv)->DeleteGlobalRef(jnienv, thiz); |
577 | (*jnienv)->DeleteGlobalRef(jnienv, thiz); |
415 | // ICS |
578 | // ICS |
416 | //DBG dbg(0,"timeout 4\n"); |
579 | //dbg(0,"timeout 4\n"); |
417 | } |
580 | } |
418 | } |
|
|
419 | |
|
|
420 | JNIEXPORT void JNICALL |
|
|
421 | Java_com_zoffcc_applications_zanavi_NavitVehicle_VehicleCallback(JNIEnv * env, jobject thiz, int id, jobject location) |
|
|
422 | { |
|
|
423 | //DBG dbg(0,"enter %p %p\n",thiz, (void *)id); |
|
|
424 | |
|
|
425 | // ***** calls: vehicle_android.c -> vehicle_android_callback() |
|
|
426 | callback_call_1((struct callback *) id, (void *) location); |
|
|
427 | } |
581 | } |
428 | |
582 | |
429 | JNIEXPORT void JNICALL |
583 | JNIEXPORT void JNICALL |
430 | Java_com_zoffcc_applications_zanavi_NavitIdle_IdleCallback(JNIEnv* env, jobject thiz, int id) |
584 | Java_com_zoffcc_applications_zanavi_NavitIdle_IdleCallback(JNIEnv* env, jobject thiz, int id) |
431 | { |
585 | { |
|
|
586 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
587 | dbg(0,"+#+:enter\n"); |
|
|
588 | #endif |
432 | //DBG dbg(0,"enter %p %p\n",thiz, (void *)id); |
589 | //DBG dbg(0,"enter %p %p\n",thiz, (void *)id); |
433 | callback_call_0((struct callback *) id); |
590 | callback_call_0((struct callback *) id); |
434 | } |
591 | } |
435 | |
592 | |
436 | JNIEXPORT void JNICALL |
593 | JNIEXPORT void JNICALL |
437 | Java_com_zoffcc_applications_zanavi_NavitWatch_poll(JNIEnv* env, jobject thiz, int fd, int cond) |
594 | Java_com_zoffcc_applications_zanavi_NavitWatch_poll(JNIEnv* env, jobject thiz, int fd, int cond) |
438 | { |
595 | { |
|
|
596 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
597 | dbg(0,"+#+:enter\n"); |
|
|
598 | #endif |
439 | struct pollfd pfd; |
599 | struct pollfd pfd; |
440 | pfd.fd = fd; |
600 | pfd.fd = fd; |
441 | //DBG dbg(0, "%p poll called for %d %d\n", env, fd, cond); |
601 | //DBG dbg(0, "%p poll called for %d %d\n", env, fd, cond); |
442 | switch ((enum event_watch_cond) cond) |
602 | switch ((enum event_watch_cond) cond) |
443 | { |
603 | { |
… | |
… | |
458 | } |
618 | } |
459 | |
619 | |
460 | JNIEXPORT void JNICALL |
620 | JNIEXPORT void JNICALL |
461 | Java_com_zoffcc_applications_zanavi_NavitWatch_WatchCallback(JNIEnv* env, jobject thiz, int id) |
621 | Java_com_zoffcc_applications_zanavi_NavitWatch_WatchCallback(JNIEnv* env, jobject thiz, int id) |
462 | { |
622 | { |
|
|
623 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
624 | dbg(0,"+#+:enter\n"); |
|
|
625 | #endif |
463 | //DBG dbg(0, "enter %p %p\n", thiz, (void *) id); |
626 | //DBG dbg(0, "enter %p %p\n", thiz, (void *) id); |
464 | callback_call_0((struct callback *) id); |
627 | callback_call_0((struct callback *) id); |
465 | } |
628 | } |
466 | |
629 | |
467 | JNIEXPORT void JNICALL |
630 | JNIEXPORT void JNICALL |
468 | Java_com_zoffcc_applications_zanavi_NavitSensors_SensorCallback(JNIEnv* env, jobject thiz, int id, int sensor, float x, float y, float z) |
631 | Java_com_zoffcc_applications_zanavi_NavitSensors_SensorCallback(JNIEnv* env, jobject thiz, int id, int sensor, float x, float y, float z) |
469 | { |
632 | { |
|
|
633 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
634 | dbg(0,"+#+:enter\n"); |
|
|
635 | #endif |
470 | //DBG dbg(0, "enter %p %p %f %f %f\n", thiz, (void *) id, x, y, z); |
636 | //DBG dbg(0, "enter %p %p %f %f %f\n", thiz, (void *) id, x, y, z); |
471 | callback_call_4((struct callback *) id, sensor, &x, &y, &z); |
637 | callback_call_4((struct callback *) id, sensor, &x, &y, &z); |
472 | } |
638 | } |
473 | |
639 | |
|
|
640 | |
|
|
641 | JNIEXPORT void JNICALL |
|
|
642 | Java_com_zoffcc_applications_zanavi_NavitVehicle_VehicleCallback(JNIEnv * env, jobject thiz, jobject location) |
|
|
643 | { |
|
|
644 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
645 | dbg(0,"+#+:enter\n"); |
|
|
646 | #endif |
|
|
647 | //dbg(0,"location=%p\n", location); |
|
|
648 | jobject location2 = (*jnienv)->NewGlobalRef(jnienv, location); |
|
|
649 | (*jnienv)->DeleteLocalRef(jnienv, location); |
|
|
650 | //dbg(0,"location=%p\n", location2); |
|
|
651 | |
|
|
652 | vehicle_update_(global_navit->vehicle->vehicle, location2); |
|
|
653 | |
|
|
654 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
655 | dbg(0,"+#+:leave\n"); |
|
|
656 | #endif |
|
|
657 | } |
|
|
658 | |
|
|
659 | |
474 | void android_return_search_result(struct jni_object *jni_o, char *str) |
660 | void android_return_search_result(struct jni_object *jni_o, char *str) |
475 | { |
661 | { |
|
|
662 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
663 | dbg(0,"+#+:enter\n"); |
|
|
664 | #endif |
476 | //DBG dbg(0,"EEnter\n"); |
665 | //DBG dbg(0,"EEnter\n"); |
477 | jstring js2 = NULL; |
666 | jstring js2 = NULL; |
478 | JNIEnv* env2; |
667 | JNIEnv* env2; |
479 | env2 = jni_o->env; |
668 | env2 = jni_o->env; |
480 | js2 = (*env2)->NewStringUTF(jni_o->env, str); |
669 | js2 = (*env2)->NewStringUTF(jni_o->env, str); |
… | |
… | |
482 | (*env2)->DeleteLocalRef(jni_o->env, js2); |
671 | (*env2)->DeleteLocalRef(jni_o->env, js2); |
483 | } |
672 | } |
484 | |
673 | |
485 | void android_return_generic_int(int id, int i) |
674 | void android_return_generic_int(int id, int i) |
486 | { |
675 | { |
|
|
676 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
677 | dbg(0,"+#+:enter\n"); |
|
|
678 | #endif |
487 | //DBG dbg(0,"Enter\n"); |
679 | //DBG dbg(0,"Enter\n"); |
488 | if (NavitGraphicsClass2 == NULL) |
680 | if (NavitGraphicsClass2 == NULL) |
489 | { |
681 | { |
490 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitGraphics", &NavitGraphicsClass2)) |
682 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitGraphics", &NavitGraphicsClass2)) |
491 | { |
683 | { |
… | |
… | |
512 | } |
704 | } |
513 | |
705 | |
514 | JNIEXPORT void JNICALL |
706 | JNIEXPORT void JNICALL |
515 | 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) |
707 | 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) |
516 | { |
708 | { |
|
|
709 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
710 | dbg(0,"+#+:enter\n"); |
|
|
711 | #endif |
517 | const char *s; |
712 | const char *s; |
518 | s = (*env)->GetStringUTFChars(env, str, NULL); |
713 | s = (*env)->GetStringUTFChars(env, str, NULL); |
519 | ////DBG dbg(0,"*****string=%s\n",s); |
714 | ////DBG dbg(0,"*****string=%s\n",s); |
520 | |
715 | |
521 | |
716 | |
… | |
… | |
599 | |
794 | |
600 | struct jni_object my_jni_object; |
795 | struct jni_object my_jni_object; |
601 | my_jni_object.env = env; |
796 | my_jni_object.env = env; |
602 | my_jni_object.jo = thiz; |
797 | my_jni_object.jo = thiz; |
603 | my_jni_object.jm = aMethodID; |
798 | my_jni_object.jm = aMethodID; |
|
|
799 | |
|
|
800 | offline_search_break_searching = 0; |
|
|
801 | |
604 | // search_flags --> is search_order (search at what "order" level) |
802 | // search_flags --> is search_order (search at what "order" level) |
605 | search_full_world(s, partial, search_flags, &my_jni_object, &g7, radius); |
803 | search_full_world(s, partial, search_flags, &my_jni_object, &g7, radius); |
606 | } |
804 | } |
607 | } |
805 | } |
608 | |
806 | |
… | |
… | |
610 | } |
808 | } |
611 | |
809 | |
612 | JNIEXPORT jint JNICALL |
810 | JNIEXPORT jint JNICALL |
613 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackDestinationValid(JNIEnv* env, jobject thiz) |
811 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackDestinationValid(JNIEnv* env, jobject thiz) |
614 | { |
812 | { |
|
|
813 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
814 | dbg(0,"+#+:enter\n"); |
|
|
815 | #endif |
615 | //DBG dbg(0,"EEnter\n"); |
816 | //DBG dbg(0,"EEnter\n"); |
616 | config_get_attr(config, attr_navit, &attr, NULL); |
817 | config_get_attr(config, attr_navit, &attr, NULL); |
617 | // //DBG dbg(0,"destination_valid=%d\n",attr.u.navit->destination_valid); |
818 | // //DBG dbg(0,"destination_valid=%d\n",attr.u.navit->destination_valid); |
618 | jint i = 0; |
819 | jint i = 0; |
619 | if (attr.u.navit->route) |
820 | if (attr.u.navit->route) |
… | |
… | |
626 | return i; |
827 | return i; |
627 | } |
828 | } |
628 | |
829 | |
629 | static void map_preview_label_line(struct point *p, int count, char *label, int font_size) |
830 | static void map_preview_label_line(struct point *p, int count, char *label, int font_size) |
630 | { |
831 | { |
|
|
832 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
833 | dbg(0,"+#+:enter\n"); |
|
|
834 | #endif |
631 | int i, x, y, tl, tlm, th, thm, tlsq, l; |
835 | int i, x, y, tl, tlm, th, thm, tlsq, l; |
632 | float lsq; |
836 | float lsq; |
633 | double dx, dy; |
837 | double dx, dy; |
634 | struct point p_t; |
838 | struct point p_t; |
635 | struct point pb[5]; |
839 | struct point pb[5]; |
… | |
… | |
707 | } |
911 | } |
708 | |
912 | |
709 | JNIEXPORT void JNICALL |
913 | JNIEXPORT void JNICALL |
710 | 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) |
914 | 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) |
711 | { |
915 | { |
|
|
916 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
917 | dbg(0,"+#+:enter\n"); |
|
|
918 | #endif |
712 | // config_get_attr(config, attr_navit, &attr, NULL); |
919 | // config_get_attr(config, attr_navit, &attr, NULL); |
713 | |
920 | |
714 | const char *s; |
921 | const char *s; |
715 | int zoom; |
922 | int zoom; |
716 | s = (*env)->GetStringUTFChars(env, latlonzoom, NULL); |
923 | s = (*env)->GetStringUTFChars(env, latlonzoom, NULL); |
… | |
… | |
975 | android_DrawMapPreview_target(pnt.x, pnt.y); |
1182 | android_DrawMapPreview_target(pnt.x, pnt.y); |
976 | } |
1183 | } |
977 | |
1184 | |
978 | void android_DrawMapPreview_target(int x, int y) |
1185 | void android_DrawMapPreview_target(int x, int y) |
979 | { |
1186 | { |
|
|
1187 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
1188 | dbg(0,"+#+:enter\n"); |
|
|
1189 | #endif |
980 | if (NavitMapPreviewActivityClass == NULL) |
1190 | if (NavitMapPreviewActivityClass == NULL) |
981 | { |
1191 | { |
982 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitMapPreviewActivity", &NavitMapPreviewActivityClass)) |
1192 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitMapPreviewActivity", &NavitMapPreviewActivityClass)) |
983 | { |
1193 | { |
984 | NavitMapPreviewActivityClass = NULL; |
1194 | NavitMapPreviewActivityClass = NULL; |
… | |
… | |
997 | (*jnienv)->CallStaticVoidMethod(jnienv, NavitMapPreviewActivityClass, DrawMapPreview_target, x, y); |
1207 | (*jnienv)->CallStaticVoidMethod(jnienv, NavitMapPreviewActivityClass, DrawMapPreview_target, x, y); |
998 | } |
1208 | } |
999 | |
1209 | |
1000 | void android_DrawMapPreview_text(int x, int y, char *text, int size, int dx, int dy) |
1210 | void android_DrawMapPreview_text(int x, int y, char *text, int size, int dx, int dy) |
1001 | { |
1211 | { |
|
|
1212 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
1213 | dbg(0,"+#+:enter\n"); |
|
|
1214 | #endif |
1002 | |
1215 | |
1003 | if (NavitMapPreviewActivityClass == NULL) |
1216 | if (NavitMapPreviewActivityClass == NULL) |
1004 | { |
1217 | { |
1005 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitMapPreviewActivity", &NavitMapPreviewActivityClass)) |
1218 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitMapPreviewActivity", &NavitMapPreviewActivityClass)) |
1006 | { |
1219 | { |
… | |
… | |
1025 | (*jnienv)->DeleteLocalRef(jnienv, string1); |
1238 | (*jnienv)->DeleteLocalRef(jnienv, string1); |
1026 | } |
1239 | } |
1027 | |
1240 | |
1028 | void android_DrawMapPreview_polyline(struct point *p, int count, int type) |
1241 | void android_DrawMapPreview_polyline(struct point *p, int count, int type) |
1029 | { |
1242 | { |
|
|
1243 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
1244 | dbg(0,"+#+:enter\n"); |
|
|
1245 | #endif |
1030 | // type: |
1246 | // type: |
1031 | // 0 -> normal street |
1247 | // 0 -> normal street |
1032 | // 2 -> country border |
1248 | // 2 -> country border |
1033 | |
1249 | |
1034 | if (NavitMapPreviewActivityClass == NULL) |
1250 | if (NavitMapPreviewActivityClass == NULL) |
… | |
… | |
1068 | } |
1284 | } |
1069 | |
1285 | |
1070 | JNIEXPORT jstring JNICALL |
1286 | JNIEXPORT jstring JNICALL |
1071 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackGeoCalc(JNIEnv* env, jobject thiz, int i, float a, float b) |
1287 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackGeoCalc(JNIEnv* env, jobject thiz, int i, float a, float b) |
1072 | { |
1288 | { |
|
|
1289 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
1290 | dbg(0,"+#+:enter\n"); |
|
|
1291 | #endif |
1073 | // dbg(0,"EEnter i=%d\n", i); |
1292 | // dbg(0,"EEnter i=%d\n", i); |
1074 | |
1293 | |
1075 | // const char *result; |
1294 | // const char *result; |
1076 | gchar *result; |
1295 | gchar *result; |
1077 | |
1296 | |
… | |
… | |
1148 | c99.y = c22.y; |
1367 | c99.y = c22.y; |
1149 | |
1368 | |
1150 | transform_to_geo(projection_mg, &c99, &g22); |
1369 | transform_to_geo(projection_mg, &c99, &g22); |
1151 | result = g_strdup_printf("%f:%f", g22.lat, g22.lng); |
1370 | result = g_strdup_printf("%f:%f", g22.lat, g22.lng); |
1152 | } |
1371 | } |
|
|
1372 | else if (i == 5) |
|
|
1373 | { |
|
|
1374 | // input: x,y pixel on screen |
|
|
1375 | // output: streetname nearest that position |
|
|
1376 | struct coord c22; |
|
|
1377 | struct point p; |
|
|
1378 | struct pcoord c24; |
|
|
1379 | p.x = a; |
|
|
1380 | p.y = b; |
|
|
1381 | transform_reverse(global_navit->trans, &p, &c22); |
|
|
1382 | c24.x = c22.x; |
|
|
1383 | c24.y = c22.y; |
|
|
1384 | c24.pro = transform_get_projection(global_navit->trans); |
|
|
1385 | result = navit_find_nearest_street(global_navit->mapsets->data, &c24); |
|
|
1386 | } |
|
|
1387 | else if (i == 6) |
|
|
1388 | { |
|
|
1389 | // input: lat, lon |
|
|
1390 | // output: streetname nearest that position |
|
|
1391 | struct coord c22; |
|
|
1392 | struct point p; |
|
|
1393 | struct pcoord c24; |
|
|
1394 | struct coord_geo g99; |
|
|
1395 | g99.lat = a; |
|
|
1396 | g99.lng = b; |
|
|
1397 | transform_from_geo(projection_mg, &g99, &c22); |
|
|
1398 | c24.x = c22.x; |
|
|
1399 | c24.y = c22.y; |
|
|
1400 | c24.pro = transform_get_projection(global_navit->trans); |
|
|
1401 | result = navit_find_nearest_street(global_navit->mapsets->data, &c24); |
|
|
1402 | } |
|
|
1403 | else if (i == 7) |
|
|
1404 | { |
|
|
1405 | // input: x,y pixel on screen |
|
|
1406 | // output: 0xFFFF 0xFFFF\n... -> string that can be used for traffic distortion file |
|
|
1407 | struct coord c22; |
|
|
1408 | struct point p; |
|
|
1409 | struct pcoord c24; |
|
|
1410 | p.x = a; |
|
|
1411 | p.y = b; |
|
|
1412 | transform_reverse(global_navit->trans, &p, &c22); |
|
|
1413 | c24.x = c22.x; |
|
|
1414 | c24.y = c22.y; |
|
|
1415 | c24.pro = transform_get_projection(global_navit->trans); |
|
|
1416 | result = navit_find_nearest_street_coords(global_navit->mapsets->data, &c24); |
|
|
1417 | } |
|
|
1418 | |
1153 | |
1419 | |
1154 | // dbg(0, "result=%s\n", result); |
1420 | // dbg(0, "result=%s\n", result); |
1155 | jstring js = (*env)->NewStringUTF(env, result); |
1421 | jstring js = (*env)->NewStringUTF(env, result); |
1156 | g_free(result); |
1422 | g_free(result); |
1157 | |
1423 | |
… | |
… | |
1159 | } |
1425 | } |
1160 | |
1426 | |
1161 | JNIEXPORT jstring JNICALL |
1427 | JNIEXPORT jstring JNICALL |
1162 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackLocalizedString(JNIEnv* env, jobject thiz, jobject str) |
1428 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackLocalizedString(JNIEnv* env, jobject thiz, jobject str) |
1163 | { |
1429 | { |
|
|
1430 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
1431 | dbg(0,"+#+:enter\n"); |
|
|
1432 | #endif |
1164 | //DBG dbg(0,"EEnter\n"); |
1433 | //DBG dbg(0,"EEnter\n"); |
1165 | |
1434 | |
1166 | const char *s; |
1435 | const char *s; |
1167 | const char *localized_str; |
1436 | const char *localized_str; |
1168 | |
1437 | |
… | |
… | |
1181 | } |
1450 | } |
1182 | |
1451 | |
1183 | JNIEXPORT void JNICALL |
1452 | JNIEXPORT void JNICALL |
1184 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackMessageChannel(JNIEnv* env, jobject thiz, int i, jobject str2) |
1453 | Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackMessageChannel(JNIEnv* env, jobject thiz, int i, jobject str2) |
1185 | { |
1454 | { |
|
|
1455 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
1456 | dbg(0,"+#+:enter\n"); |
|
|
1457 | #endif |
1186 | const char *s; |
1458 | const char *s; |
1187 | jobject str = (*env)->NewGlobalRef(env, str2); |
1459 | jobject str = (*env)->NewGlobalRef(env, str2); |
1188 | |
1460 | |
1189 | //DBG dbg(0,"enter %d %p\n",i,str); |
1461 | //DBG dbg(0,"enter %d %p\n",i,str); |
1190 | |
1462 | |
… | |
… | |
1204 | else if (i == 2) |
1476 | else if (i == 2) |
1205 | { |
1477 | { |
1206 | // zoom out |
1478 | // zoom out |
1207 | navit_zoom_out_cursor(global_navit, 2); |
1479 | navit_zoom_out_cursor(global_navit, 2); |
1208 | // navit_zoom_out_cursor(attr.u.navit, 2); |
1480 | // navit_zoom_out_cursor(attr.u.navit, 2); |
|
|
1481 | } |
|
|
1482 | else if (i == 73) |
|
|
1483 | { |
|
|
1484 | // update the route path and route graph (e.g. after setting new roadblocks) |
|
|
1485 | // this destroys the route graph and calcs everything totally new! |
|
|
1486 | if (global_navit->route) |
|
|
1487 | { |
|
|
1488 | if (global_navit->route->destinations) |
|
|
1489 | { |
|
|
1490 | route_path_update(global_navit->route, 1, 1); |
|
|
1491 | } |
|
|
1492 | } |
|
|
1493 | } |
|
|
1494 | else if (i == 72) |
|
|
1495 | { |
|
|
1496 | // update the route path and route graph (e.g. after setting new roadblocks) |
|
|
1497 | // does not update destinations!!! |
|
|
1498 | if (global_navit->route) |
|
|
1499 | { |
|
|
1500 | if (global_navit->route->destinations) |
|
|
1501 | { |
|
|
1502 | route_path_update(global_navit->route, 0, 1); |
|
|
1503 | } |
|
|
1504 | } |
|
|
1505 | } |
|
|
1506 | else if (i == 71) |
|
|
1507 | { |
|
|
1508 | // activate/deactivate "route graph" display |
|
|
1509 | // 0 -> deactivate |
|
|
1510 | // 1 -> activate |
|
|
1511 | |
|
|
1512 | // _ms_route_graph |
|
|
1513 | // _ms_navigation |
|
|
1514 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
1515 | navit_map_active_flag(global_navit, atoi(s), "_ms_route_graph"); |
|
|
1516 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
1517 | } |
|
|
1518 | else if (i == 70) |
|
|
1519 | { |
|
|
1520 | // allow drawing map |
|
|
1521 | hold_drawing = 0; |
|
|
1522 | } |
|
|
1523 | else if (i == 69) |
|
|
1524 | { |
|
|
1525 | // stop drawing map |
|
|
1526 | hold_drawing = 1; |
|
|
1527 | } |
|
|
1528 | else if (i == 68) |
|
|
1529 | { |
|
|
1530 | // shift "order" by this value (only for drawing objects) |
|
|
1531 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
1532 | shift_order = atoi(s); |
|
|
1533 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
1534 | } |
|
|
1535 | else if (i == 67) |
|
|
1536 | { |
|
|
1537 | // disable "water from relations" |
|
|
1538 | enable_water_from_relations = 0; |
|
|
1539 | } |
|
|
1540 | else if (i == 66) |
|
|
1541 | { |
|
|
1542 | // enable "water from relations" |
|
|
1543 | enable_water_from_relations = 1; |
|
|
1544 | } |
|
|
1545 | else if (i == 65) |
|
|
1546 | { |
|
|
1547 | // draw map async |
|
|
1548 | navit_draw_async(global_navit, 1); |
|
|
1549 | } |
|
|
1550 | else if (i == 64) |
|
|
1551 | { |
|
|
1552 | // draw map |
|
|
1553 | navit_draw(global_navit); |
|
|
1554 | } |
|
|
1555 | else if (i == 63) |
|
|
1556 | { |
|
|
1557 | // enable map drawing |
|
|
1558 | disable_map_drawing = 0; |
|
|
1559 | } |
|
|
1560 | else if (i == 62) |
|
|
1561 | { |
|
|
1562 | // disable map drawing |
|
|
1563 | disable_map_drawing = 1; |
|
|
1564 | } |
|
|
1565 | else if (i == 61) |
|
|
1566 | { |
|
|
1567 | // zoom to specific zoomlevel at given point as center |
|
|
1568 | struct point p; |
|
|
1569 | char *pstr; |
|
|
1570 | |
|
|
1571 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
1572 | char parse_str[strlen(s) + 1]; |
|
|
1573 | strcpy(parse_str, s); |
|
|
1574 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
1575 | // (pixel-x#pixel-y#zoom-level) |
|
|
1576 | // pixel-x |
|
|
1577 | pstr = strtok(parse_str, "#"); |
|
|
1578 | p.x = atoi(pstr); |
|
|
1579 | // pixel-y |
|
|
1580 | pstr = strtok(NULL, "#"); |
|
|
1581 | p.y = atoi(pstr); |
|
|
1582 | // zoom |
|
|
1583 | pstr = strtok(NULL, "#"); |
|
|
1584 | int zoom_level = atoi(pstr); |
|
|
1585 | // now call zoom function |
|
|
1586 | navit_zoom_to_scale_with_center_point(global_navit, zoom_level, &p); |
|
|
1587 | } |
|
|
1588 | else if (i == 60) |
|
|
1589 | { |
|
|
1590 | // disable layer "name" |
|
|
1591 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
1592 | navit_layer_set_active(global_navit, s, 0, 0); |
|
|
1593 | (*env)->ReleaseStringUTFChars(env, str, s); |
|
|
1594 | } |
|
|
1595 | else if (i == 59) |
|
|
1596 | { |
|
|
1597 | // enable layer "name" |
|
|
1598 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
1599 | navit_layer_set_active(global_navit, s, 1, 0); |
|
|
1600 | (*env)->ReleaseStringUTFChars(env, str, s); |
1209 | } |
1601 | } |
1210 | else if (i == 58) |
1602 | else if (i == 58) |
1211 | { |
1603 | { |
1212 | // make street search radius bigger to the factor "s" |
1604 | // make street search radius bigger to the factor "s" |
1213 | s = (*env)->GetStringUTFChars(env, str, NULL); |
1605 | s = (*env)->GetStringUTFChars(env, str, NULL); |
… | |
… | |
1232 | (*env)->ReleaseStringUTFChars(env, str, s); |
1624 | (*env)->ReleaseStringUTFChars(env, str, s); |
1233 | } |
1625 | } |
1234 | else if (i == 55) |
1626 | else if (i == 55) |
1235 | { |
1627 | { |
1236 | // set cache size for (map-)files |
1628 | // set cache size for (map-)files |
1237 | dbg(0, "csf1\n"); |
1629 | //dbg(0, "csf1\n"); |
1238 | s = (*env)->GetStringUTFChars(env, str, NULL); |
1630 | s = (*env)->GetStringUTFChars(env, str, NULL); |
1239 | dbg(0, "csf2\n"); |
1631 | //dbg(0, "csf2\n"); |
1240 | cache_size_file = atoi(s); |
1632 | cache_size_file = atoi(s); |
1241 | file_cache_init(); |
1633 | file_cache_init(); |
1242 | dbg(0, "csf=%d\n", cache_size_file); |
1634 | dbg(0, "csf=%d\n", cache_size_file); |
1243 | (*env)->ReleaseStringUTFChars(env, str, s); |
1635 | (*env)->ReleaseStringUTFChars(env, str, s); |
1244 | } |
1636 | } |
… | |
… | |
1253 | global_speak_streetnames = 0; |
1645 | global_speak_streetnames = 0; |
1254 | } |
1646 | } |
1255 | else if (i == 52) |
1647 | else if (i == 52) |
1256 | { |
1648 | { |
1257 | // switch to demo vehicle |
1649 | // switch to demo vehicle |
|
|
1650 | |
|
|
1651 | s = (*env)->GetStringUTFChars(env, str, NULL); |
|
|
1652 | |
1258 | if (global_navit->vehicle) |
1653 | if (global_navit->vehicle) |
1259 | { |
1654 | { |
1260 | navit_remove_cursors(global_navit); |
1655 | navit_remove_cursors(global_navit); |
1261 | vehicle_destroy(global_navit->vehicle->vehicle); |
1656 | vehicle_destroy(global_navit->vehicle->vehicle); |
1262 | global_navit->vehicles = NULL; |
1657 | global_navit->vehicles = NULL; |
… | |
… | |
1281 | |
1676 | |
1282 | follow.type = attr_follow; |
1677 | follow.type = attr_follow; |
1283 | follow.u.num = 1; |
1678 | follow.u.num = 1; |
1284 | |
1679 | |
1285 | speed.type = attr_speed; |
1680 | speed.type = attr_speed; |
1286 | speed.u.num = 45; |
1681 | speed.u.num = atoi(s); |
1287 | |
1682 | |
1288 | interval.type = attr_interval; |
1683 | interval.type = attr_interval; |
1289 | interval.u.num = 1000; |
1684 | interval.u.num = 1000; |
1290 | |
1685 | |
1291 | attrs[0] = &source; |
1686 | attrs[0] = &source; |
… | |
… | |
1323 | { |
1718 | { |
1324 | //DBG dbg(0, "ERROR adding demo vehicle\n"); |
1719 | //DBG dbg(0, "ERROR adding demo vehicle\n"); |
1325 | } |
1720 | } |
1326 | // **no** navit_set_vehicle(global_navit, global_navit->vehicle); |
1721 | // **no** navit_set_vehicle(global_navit, global_navit->vehicle); |
1327 | //DBG dbg(0, "ready\n"); |
1722 | //DBG dbg(0, "ready\n"); |
|
|
1723 | |
|
|
1724 | (*env)->ReleaseStringUTFChars(env, str, s); |
1328 | } |
1725 | } |
1329 | else if (i == 51) |
1726 | else if (i == 51) |
1330 | { |
1727 | { |
1331 | // set position to pixel x,y |
1728 | // set position to pixel x,y |
1332 | //DBG dbg(0, "sp 1\n"); |
1729 | //DBG dbg(0, "sp 1\n"); |
… | |
… | |
1743 | |
2140 | |
1744 | } |
2141 | } |
1745 | |
2142 | |
1746 | void android_send_generic_text(int id, char *text) |
2143 | void android_send_generic_text(int id, char *text) |
1747 | { |
2144 | { |
|
|
2145 | #ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT |
|
|
2146 | dbg(0,"+#+:enter\n"); |
|
|
2147 | #endif |
1748 | //DBG dbg(0,"Enter\n"); |
2148 | //DBG dbg(0,"Enter\n"); |
1749 | |
2149 | |
1750 | if (NavitGraphicsClass2 == NULL) |
2150 | if (NavitGraphicsClass2 == NULL) |
1751 | { |
2151 | { |
1752 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitGraphics", &NavitGraphicsClass2)) |
2152 | if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitGraphics", &NavitGraphicsClass2)) |