1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 #define MARKER_MAX 1000
9 #define NAME_ENTRY_TEXT "Enter freeform address"
11 typedef struct Overlay_Data
16 typedef struct Map_Source
22 Overlay_Data data1 = {PACKAGE_DATA_DIR"/images/logo.png"};
23 Overlay_Data data2 = {PACKAGE_DATA_DIR"/images/logo_small.png"};
24 Overlay_Data data3 = {PACKAGE_DATA_DIR"/images/panel_01.jpg"};
25 Overlay_Data data4 = {PACKAGE_DATA_DIR"/images/plant_01.jpg"};
26 Overlay_Data data5 = {PACKAGE_DATA_DIR"/images/rock_01.jpg"};
27 Overlay_Data data6 = {PACKAGE_DATA_DIR"/images/rock_02.jpg"};
28 Overlay_Data data7 = {PACKAGE_DATA_DIR"/images/sky_01.jpg"};
29 Overlay_Data data8 = {PACKAGE_DATA_DIR"/images/sky_02.jpg"};
30 Overlay_Data data9 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"};
31 Overlay_Data data10 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"};
32 Overlay_Data data11= {PACKAGE_DATA_DIR"/images/wood_01.jpg"};
33 Overlay_Data parking= {PACKAGE_DATA_DIR"/images/parking.png"};
34 Overlay_Data icon_data = {PACKAGE_DATA_DIR"/images/icon_14.png"};
36 static Elm_Map_Overlay *route_start, *route_end, *route_clas;
37 static Elm_Map_Overlay *bubble_img;
38 static Elm_Map_Overlay *bubble_parking;
39 static Elm_Map_Overlay *route_ovl;
41 static Evas_Object *menu, *fs_win;
42 static Elm_Map_Route *route;
43 static Elm_Map_Name *name;
44 static Evas_Object *track;
45 static const char **source_names = NULL;
46 static Evas_Coord old_x, old_y;
47 static Evas_Coord old_d;
48 static Map_Source ms[SOURCE_MAX];
52 my_map_gpx_fileselector_done(void *data, Evas_Object *obj __UNUSED__, void *event_info)
54 my_map_gpx_fileselector_done(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
57 const char *selected = event_info;
61 printf("Selected file: %s\n", selected);
63 EMap_Route *emap = emap_route_gpx_new(selected);
64 track = elm_map_track_add(data, emap);
66 printf("libEMap is required !\n");
69 evas_object_del(fs_win);
73 _route_icon_get(Evas_Object *obj)
75 Evas_Object *icon = elm_icon_add(obj);
76 elm_icon_file_set(icon, PACKAGE_DATA_DIR"/images/bubble.png", NULL);
77 evas_object_show(icon);
83 _map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
89 _map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info)
91 printf("clicked,double\n");
93 Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info;
95 if (elm_map_zoom_get(obj) < 5) return;
97 elm_map_canvas_to_region_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat);
98 printf("x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat);
102 route_clas = elm_map_overlay_class_add(obj);
103 elm_map_overlay_icon_set(route_clas, _route_icon_get(obj));
104 elm_map_overlay_displayed_zoom_min_set(route_clas, 5);
107 if (route_start && route_end)
109 elm_map_overlay_del(route_start);
110 elm_map_overlay_del(route_end);
116 if (!route_start) route_start = elm_map_overlay_add(obj, lon, lat);
117 else route_end = elm_map_overlay_add(obj, lon, lat);
119 if (route_start && route_end)
121 double start_lon, start_lat, end_lon, end_lat;
122 elm_map_overlay_class_append(route_clas, route_start);
123 elm_map_overlay_class_append(route_clas, route_end);
124 elm_map_overlay_region_get(route_start, &start_lon, &start_lat);
125 elm_map_overlay_region_get(route_end, &end_lon, &end_lat);
126 route = elm_map_route_add(obj, ELM_MAP_ROUTE_TYPE_MOTOCAR,
127 ELM_MAP_ROUTE_METHOD_FASTEST,
128 start_lon, start_lat, end_lon, end_lat,
134 _map_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
140 _map_longpressed(void *data __UNUSED__, Evas_Object *obj, void *event_info)
142 if (!event_info) return;
144 Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info;
145 elm_map_canvas_to_region_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat);
146 printf("longpressed, x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat);
148 if (elm_map_zoom_get(obj) < 8) return;
149 if (name) elm_map_name_del(name);
150 name = elm_map_name_add(obj, NULL, lon, lat, NULL, NULL);
154 _map_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
157 elm_map_region_get(obj, &lon, &lat);
158 printf("scroll, longitude: %f latitude: %f\n", lon, lat);
162 _map_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
164 printf("scroll,drag,start\n");
165 evas_object_smart_callback_del(data, "longpressed", _map_longpressed);
169 _map_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
171 printf("scroll,drag,stop\n");
172 evas_object_smart_callback_add(data, "longpressed", _map_longpressed, data);
176 _map_anim_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
178 printf("scroll,anim,start\n");
182 _map_anim_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
184 printf("scroll,anim,stop\n");
188 _map_zoom_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
190 printf("zoom,start\n");
194 _map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
196 printf("zoom,stop\n");
200 _map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
202 printf("zoom,change\n");
206 _map_tile_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
208 printf("tile,load\n");
212 _map_tile_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
214 int try_num, finish_num;
215 elm_map_tile_load_status_get(data, &try_num, &finish_num);
216 printf("tile,loaded: %d / %d\n", finish_num, try_num);
220 _map_tile_loaded_fail(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
222 int try_num, finish_num;
223 elm_map_tile_load_status_get(data, &try_num, &finish_num);
224 printf("tile,loaded,fail: %d / %d\n", finish_num, try_num);
228 _map_route_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
230 printf("route,load\n");
234 _map_route_loaded(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
236 printf("route,loaded\n");
240 d = elm_map_route_distance_get(route);
241 printf("route distance = %lf km\n", d);
243 w = elm_map_route_waypoint_get(route);
244 if (w) printf("[waypoints]\n%s\n", w);
246 n = elm_map_route_node_get(route);
247 if (n) printf("[nodes]\n%s\n", n);
249 if (route_ovl) elm_map_overlay_del(route_ovl);
250 route_ovl = elm_map_overlay_route_add(obj, route);
251 elm_map_overlay_color_set(route_ovl, 255, 0, 0, 255);
255 _map_route_loaded_fail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
257 printf("route,loaded,fail\n");
261 _map_name_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
263 printf("name,load\n");
267 _map_name_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
269 printf("name,loaded\n");
272 const char *addr = elm_map_name_address_get(name);
273 elm_map_name_region_get(name, &lon, &lat);
276 printf("name of [lon = %lf, lat = %lf] is %s\n", lon, lat, addr);
277 if ((lon != 0.0) && (lat !=0.0))
279 Eina_Bool b = elm_map_paused_get(data);
280 elm_map_paused_set(data, EINA_TRUE);
281 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
282 elm_map_zoom_set(data, elm_map_zoom_max_get(data));
283 elm_map_region_show(data, lon, lat);
284 elm_map_paused_set(data, b);
288 elm_map_name_del(name);
293 _map_name_loaded_fail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
295 printf("name,loaded,fail\n");
299 map_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
301 Eina_Bool b = elm_map_paused_get(data);
302 elm_map_paused_set(data, EINA_TRUE);
303 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
304 elm_map_region_show(data,7.325201, 48.526813);
305 elm_map_zoom_set(data, 12);
306 elm_map_paused_set(data, b);
310 map_bring_seoul(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
312 elm_map_region_bring_in(data, 126.977969, 37.566535);
316 map_paused_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
318 elm_map_paused_set(data, EINA_TRUE);
322 map_paused_unset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
324 elm_map_paused_set(data, EINA_FALSE);
328 map_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
332 zoom = elm_map_zoom_get(data) + 1;
333 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
334 elm_map_zoom_set(data, zoom);
338 map_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
342 zoom = elm_map_zoom_get(data) - 1;
343 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
344 elm_map_zoom_set(data, zoom);
348 map_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
350 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT);
354 map_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
356 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL);
360 map_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
362 Evas_Object *fs, *bg, *vbox, *hbox, *sep;
365 fs_win = elm_win_add(NULL, "fileselector", ELM_WIN_BASIC);
366 elm_win_title_set(fs_win, "File Selector");
367 elm_win_autodel_set(fs_win, 1);
369 bg = elm_bg_add(fs_win);
370 elm_win_resize_object_add(fs_win, bg);
371 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
372 evas_object_show(bg);
374 vbox = elm_box_add(fs_win);
375 elm_win_resize_object_add(fs_win, vbox);
376 evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
377 evas_object_show(vbox);
379 fs = elm_fileselector_add(fs_win);
380 elm_fileselector_is_save_set(fs, EINA_TRUE);
381 elm_fileselector_expandable_set(fs, EINA_FALSE);
382 path = getenv("HOME");
383 //if "HOME" is not available, set current dir. path
386 elm_fileselector_path_set(fs, path);
387 evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
388 evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
389 elm_box_pack_end(vbox, fs);
390 evas_object_show(fs);
392 evas_object_smart_callback_add(fs, "done", my_map_gpx_fileselector_done, data);
394 sep = elm_separator_add(fs_win);
395 elm_separator_horizontal_set(sep, EINA_TRUE);
396 elm_box_pack_end(vbox, sep);
397 evas_object_show(sep);
399 hbox = elm_box_add(fs_win);
400 elm_box_horizontal_set(hbox, EINA_TRUE);
401 elm_box_pack_end(vbox, hbox);
402 evas_object_show(hbox);
404 evas_object_resize(fs_win, 240, 350);
405 evas_object_show(fs_win);
410 map_track_remove(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
412 elm_map_track_remove(data, track);
416 map_rotate_cw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
419 Evas_Coord x, y, w, h;
420 float half_w, half_h;
421 evas_object_geometry_get(data, &x, &y, &w, &h);
422 half_w = (float)w * 0.5;
423 half_h = (float)h * 0.5;
425 elm_map_rotate_get(data, &d, NULL, NULL);
427 elm_map_rotate_set(data, d, x + half_w, y + half_h);
431 map_rotate_ccw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
434 Evas_Coord x, y, w, h;
435 float half_w, half_h;
436 evas_object_geometry_get(data, &x, &y, &w, &h);
437 half_w = (float)w * 0.5;
438 half_h = (float)h * 0.5;
440 elm_map_rotate_get(data, &d, NULL, NULL);
442 elm_map_rotate_set(data, d, x + half_w, y + half_h);
446 map_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
448 Evas_Coord x, y, w, h;
449 float half_w, half_h;
450 evas_object_geometry_get(data, &x, &y, &w, &h);
451 half_w = (float)w * 0.5;
452 half_h = (float)h * 0.5;
454 elm_map_rotate_set(data, 0.0, x + half_w, y + half_h);
458 map_zoom_min_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
460 elm_map_zoom_min_set(data, 1);
464 map_zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
466 elm_map_zoom_max_set(data, 10);
470 map_source(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
472 Map_Source *s = data;
475 elm_map_source_set(s->map, ELM_MAP_SOURCE_TYPE_TILE, s->source_name);
480 map_marker_add(void *data)
483 Elm_Map_Group_Class *g_clas;
484 Elm_Map_Marker_Class *m_clas;
485 Overlay_Data *d = &data7;
487 if (*markers) return;
488 for (i =0; i<MARKER_MAX; i++)
492 int r1 = rand() % (180*2*100);
493 if (r1<=180) r1 = -r1;
494 else r1 = r1 - 180*100;
496 int r2 = rand() % (85*2*100);
497 if (r2<=85) r2 = -r2;
498 else r2 = r2 - 85*100;
500 int style = rand() % 3;
501 if (!style) m_clas = itc1;
502 else if (style == 1) m_clas = itc2;
505 m_clas = itc_parking;
510 if (!style) g_clas = itc_group1;
511 else g_clas = itc_group2;
513 markers[i] = elm_map_marker_add(data, r1/100., r2/100., m_clas, g_clas, d);
516 printf("nb elements: %d\n", nb_elts);
520 map_marker_remove(void *data __UNUSED__)
524 for (i = 0; i<MARKER_MAX; i++)
528 elm_map_marker_remove(markers[i]);
535 my_map_entry_focused(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
537 const char *s = elm_scrolled_entry_entry_get(obj);
538 if (!strcmp(s, NAME_ENTRY_TEXT)) elm_scrolled_entry_entry_set(obj, "");
542 my_map_entry_activated(void *data, Evas_Object *obj, void *event_info __UNUSED__)
544 const char *s = elm_scrolled_entry_entry_get(obj);
545 char *addr = strdup(s);
546 name = elm_map_utils_convert_name_into_coord(data, addr);
547 if (addr) free (addr);
552 _box_get(Evas_Object *obj, Overlay_Data *data)
554 Evas_Object *bx, *img, *label;
555 bx = elm_box_add(obj);
556 evas_object_show(bx);
558 img = evas_object_image_add(evas_object_evas_get(obj));
559 evas_object_image_file_set(img, data->file, NULL);
560 evas_object_image_filled_set(img, EINA_TRUE);
561 evas_object_size_hint_min_set(img, 64, 64);
562 evas_object_show(img);
563 elm_box_pack_end(bx, img);
565 label = elm_label_add(obj);
566 elm_object_text_set(label, "Wolves go!!");
567 evas_object_show(label);
568 elm_box_pack_end(bx, label);
573 _icon_get(Evas_Object *obj, Overlay_Data *data)
575 Evas_Object *icon = elm_icon_add(obj);
576 elm_icon_file_set(icon, data->file, NULL);
577 evas_object_show(icon);
583 _populate(void *data, Elm_Object_Item *menu_it)
587 if ((!data) || (!menu_it) || (!source_names)) return;
588 for (idx = 0; source_names[idx]; idx++)
590 if (idx >= SOURCE_MAX) break;
592 ms[idx].source_name = strdup(source_names[idx]);
593 elm_menu_item_add(menu, menu_it, "", source_names[idx], map_source,
599 _map_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
601 Evas_Event_Mouse_Down *down = event_info;
602 Elm_Object_Item *menu_it;
605 if (down->button == 2)
607 old_x = down->canvas.x;
608 old_y = down->canvas.y;
611 else if (down->button == 3)
613 menu = elm_menu_add(obj);
614 menu_it = elm_menu_item_add(menu, NULL, NULL, "Source", NULL, NULL);
615 _populate(data, menu_it);
616 elm_menu_item_add(menu, NULL, NULL, "Show Urmatt", map_show_urmatt, data);
617 elm_menu_item_add(menu, NULL, NULL, "Bring Seoul", map_bring_seoul, data);
618 elm_menu_item_add(menu, NULL, NULL, "Paused Set", map_paused_set, data);
619 elm_menu_item_add(menu, NULL, NULL, "Paused Unset", map_paused_unset, data);
620 elm_menu_item_add(menu, NULL, NULL, "Zoom +", map_zoom_in, data);
621 elm_menu_item_add(menu, NULL, NULL, "Zoom -", map_zoom_out, data);
622 elm_menu_item_add(menu, NULL, NULL, "Zoom Fit", map_zoom_fit, data);
623 elm_menu_item_add(menu, NULL, NULL, "Zoom Fill", map_zoom_fill, data);
624 elm_menu_item_add(menu, NULL, NULL, "Add Track", map_track_add, data);
625 elm_menu_item_add(menu, NULL, NULL, "Remove Track", map_track_remove, data);
626 elm_menu_item_add(menu, NULL, NULL, "Add Marker", NULL, NULL);
627 elm_menu_item_add(menu, NULL, NULL, "Rotate CW", map_rotate_cw, data);
628 elm_menu_item_add(menu, NULL, NULL, "Rotate CCW", map_rotate_ccw, data);
629 elm_menu_item_add(menu, NULL, NULL, "Reset Rotate", map_rotate_reset, data);
630 elm_menu_item_add(menu, NULL, NULL, "Set Zoom Min to 1", map_zoom_min_set, data);
631 elm_menu_item_add(menu, NULL, NULL, "Set Zoom Max to 10", map_zoom_max_set, data);
633 elm_menu_move(menu, down->canvas.x, down->canvas.y);
634 evas_object_show(menu);
639 _map_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
641 Evas_Event_Mouse_Move *move = event_info;
642 Evas_Coord x, y, w, h;
643 float half_w, half_h;
648 if (move->buttons == 2)
650 evas_object_geometry_get(data, &x, &y, &w, &h);
651 half_w = (float)w * 0.5;
652 half_h = (float)h * 0.5;
653 elm_map_rotate_get(data, &cur_d, NULL, NULL);
655 d = move->cur.canvas.x - old_x;
656 if (!old_d) old_d = d;
671 elm_map_rotate_set(data, cur_d, x + half_w, y + half_h);
677 _map_mouse_up(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
679 Evas_Event_Mouse_Up *up = event_info;
690 _overlay_cb(void *data __UNUSED__, Evas_Object *map, void *ev)
692 printf("Overlay clicked: ");
693 Elm_Map_Overlay *overlay = ev;
696 Overlay_Data *od = elm_map_overlay_data_get(overlay);
699 printf("No overlay data\n");
701 else if (elm_map_overlay_type_get(overlay) == ELM_MAP_OVERLAY_TYPE_DEFAULT)
703 // prevent duplication
704 if (!bubble_img) bubble_img = elm_map_overlay_bubble_add(map);
706 elm_map_overlay_bubble_follow(bubble_img, overlay);
707 bx = _box_get(map, od);
708 elm_map_overlay_bubble_content_clear(bubble_img);
709 elm_map_overlay_bubble_content_append(bubble_img, bx);
710 printf("overlay rendered\n");
712 else printf("not default type\n");
716 _parking_cb(void *data __UNUSED__, Evas_Object *map, const Elm_Map_Overlay *ovl)
718 if (elm_map_overlay_type_get(ovl) != ELM_MAP_OVERLAY_TYPE_DEFAULT) return;
722 elm_map_overlay_region_get(ovl, &lon, &lat);
723 elm_map_region_to_canvas_convert(map, lon, lat, &x, &y);
724 printf("Parking clicked: %lf %lf %d %d\n", lon, lat, x, y);
728 Evas_Object *bubble, *label;
729 bubble = elm_bubble_add(map);
730 elm_bubble_pos_set(bubble, ELM_BUBBLE_POS_BOTTOM_LEFT);
731 elm_object_text_set(bubble, "Overlay object");
732 elm_object_part_text_set(bubble, "info", "Bubble is overlayed");
734 label = elm_label_add(bubble);
735 elm_object_text_set(label, "Parking Here !!");
736 evas_object_show(label);
737 elm_object_content_set(bubble, label);
739 evas_object_resize(bubble, 125, 50);
740 evas_object_show(bubble);
742 bubble_parking = elm_map_overlay_add(map, lon + 0.0006, lat + 0.0006);
743 elm_map_overlay_content_set(bubble_parking, bubble);
745 elm_map_overlay_region_set(bubble_parking, lon + 0.0006, lat + 0.0006);
749 _del_map(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ei __UNUSED__)
751 if (route_start) elm_map_overlay_del(route_start);
752 if (route_end) elm_map_overlay_del(route_end);
753 if (route_clas) elm_map_overlay_del(route_clas);
754 if (bubble_img) elm_map_overlay_del(bubble_img);
755 if (bubble_parking) elm_map_overlay_del(bubble_parking);
756 if (route_ovl) elm_map_overlay_del(route_ovl);
761 bubble_parking = NULL;
764 if (route) elm_map_route_del(route);
765 if (name) elm_map_name_del(name);
771 test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
773 Evas_Object *win, *bg, *map;
776 win = elm_win_add(NULL, "map", ELM_WIN_BASIC);
777 elm_win_title_set(win, "Map");
778 elm_win_autodel_set(win, EINA_TRUE);
780 bg = elm_bg_add(win);
781 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
782 elm_win_resize_object_add(win, bg);
783 evas_object_show(bg);
785 map = elm_map_add(win);
788 Elm_Map_Overlay *ovl_1, *ovl_2, *ovl_3, *ovl_4, *ovl_5, *ovl6;
789 Elm_Map_Overlay *ovl_7, *ovl_8, *ovl_9, *ovl_10, *ovl_11;
790 Elm_Map_Overlay *parking1, *parking2, *parking3, *parking4, *parking5;
791 Elm_Map_Overlay *grp1, *grp2, *grp_parking;
793 evas_object_event_callback_add(map, EVAS_CALLBACK_DEL, _del_map, NULL);
797 source_names = elm_map_sources_get(map, ELM_MAP_SOURCE_TYPE_TILE);
799 if (!source_names) return;
800 printf("map sources [ ");
801 for (idx = 0; source_names[idx] ; idx++) printf("%s, ", source_names[idx]);
804 evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
805 elm_win_resize_object_add(win, map);
806 evas_object_data_set(map, "window", win);
808 evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_DOWN,
809 _map_mouse_down, map);
810 evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_MOVE,
811 _map_mouse_move, map);
812 evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_UP,
815 evas_object_smart_callback_add(map, "clicked", _map_clicked, map);
816 evas_object_smart_callback_add(map, "clicked,double", _map_clicked_double, map);
817 evas_object_smart_callback_add(map, "press", _map_press, map);
818 evas_object_smart_callback_add(map, "longpressed", _map_longpressed, map);
819 evas_object_smart_callback_add(map, "scroll", _map_scroll, map);
820 evas_object_smart_callback_add(map, "scroll,drag,start", _map_drag_start, map);
821 evas_object_smart_callback_add(map, "scroll,drag,stop", _map_drag_stop, map);
822 evas_object_smart_callback_add(map, "scroll,anim,start", _map_anim_start, map);
823 evas_object_smart_callback_add(map, "scroll,anim,stop", _map_anim_stop, map);
824 evas_object_smart_callback_add(map, "zoom,start", _map_zoom_start, map);
825 evas_object_smart_callback_add(map, "zoom,stop", _map_zoom_stop, map);
826 evas_object_smart_callback_add(map, "zoom,change", _map_zoom_change, map);
827 evas_object_smart_callback_add(map, "tile,load", _map_tile_load, map);
828 evas_object_smart_callback_add(map, "tile,loaded", _map_tile_loaded, map);
829 evas_object_smart_callback_add(map, "tile,loaded,fail", _map_tile_loaded_fail, map);
830 evas_object_smart_callback_add(map, "route,load", _map_route_load, map);
831 evas_object_smart_callback_add(map, "route,loaded", _map_route_loaded, map);
832 evas_object_smart_callback_add(map, "route,loaded,fail", _map_route_loaded_fail, map);
833 evas_object_smart_callback_add(map, "name,load", _map_name_load, map);
834 evas_object_smart_callback_add(map, "name,loaded", _map_name_loaded, map);
835 evas_object_smart_callback_add(map, "name,loaded,fail", _map_name_loaded_fail, map);
836 evas_object_smart_callback_add(map, "overlay,clicked", _overlay_cb, map);
839 ovl_1 = elm_map_overlay_add(map, 2.352, 48.857);
840 ovl_2 = elm_map_overlay_add(map, 3, 48.857);
841 ovl_3 = elm_map_overlay_add(map, 2.352, 49);
842 ovl_4 = elm_map_overlay_add(map, 7.31451, 48.857127);
843 ovl_5 = elm_map_overlay_add(map, 7.314704, 48.857119);
844 ovl6 = elm_map_overlay_add(map, 7.31432, 48.856785);
845 ovl_7 = elm_map_overlay_add(map, 7.3148, 48.85725);
846 ovl_8 = elm_map_overlay_add(map, 7.316445, 48.8572210000694);
847 ovl_9 = elm_map_overlay_add(map, 7.316527000125, 48.85609);
848 ovl_10 = elm_map_overlay_add(map, 7.3165409990833, 48.856078);
849 ovl_11 = elm_map_overlay_add(map, 7.319812, 48.856561);
850 elm_map_overlay_data_set(ovl_1, &data1);
851 elm_map_overlay_data_set(ovl_2, &data2);
852 elm_map_overlay_data_set(ovl_3, &data3);
853 elm_map_overlay_data_set(ovl_4, &data4);
854 elm_map_overlay_data_set(ovl_5, &data5);
855 elm_map_overlay_data_set(ovl6, &data6);
856 elm_map_overlay_data_set(ovl_7, &data7);
857 elm_map_overlay_data_set(ovl_8, &data8);
858 elm_map_overlay_data_set(ovl_9, &data9);
859 elm_map_overlay_data_set(ovl_10, &data10);
860 elm_map_overlay_data_set(ovl_11, &data11);
862 // Append overlays to groups
863 grp1 = elm_map_overlay_class_add(map);
864 elm_map_overlay_displayed_zoom_min_set(grp1, 3);
865 elm_map_overlay_class_append(grp1, ovl_1);
866 elm_map_overlay_class_append(grp1, ovl_2);
867 elm_map_overlay_class_append(grp1, ovl_3);
868 elm_map_overlay_class_append(grp1, ovl_4);
869 elm_map_overlay_class_append(grp1, ovl_5);
870 elm_map_overlay_class_append(grp1, ovl6);
871 evas_object_smart_callback_add(map, "overlay,clicked", _overlay_cb, map);
873 // Append overlays to groups
874 grp2 = elm_map_overlay_class_add(map);
875 elm_map_overlay_class_append(grp2, ovl_7);
876 elm_map_overlay_class_append(grp2, ovl_8);
877 elm_map_overlay_class_append(grp2, ovl_9);
878 elm_map_overlay_class_append(grp2, ovl_10);
879 elm_map_overlay_class_append(grp2, ovl_11);
882 parking1 = elm_map_overlay_add(map, 127.04871, 37.25730);
883 parking2 = elm_map_overlay_add(map, 127.05578, 37.25545);
884 parking3 = elm_map_overlay_add(map, 127.05515, 37.25439);
885 parking4 = elm_map_overlay_add(map, 127.05328, 37.25721);
886 parking5 = elm_map_overlay_add(map, 127.05431, 37.25873);
887 elm_map_overlay_icon_set(parking4, _icon_get(map, &icon_data));
888 elm_map_overlay_get_cb_set(parking1, _parking_cb, NULL);
889 elm_map_overlay_get_cb_set(parking2, _parking_cb, NULL);
890 elm_map_overlay_get_cb_set(parking3, _parking_cb, NULL);
891 elm_map_overlay_get_cb_set(parking4, _parking_cb, NULL);
892 elm_map_overlay_get_cb_set(parking5, _parking_cb, NULL);
894 // Append overlays to groups
895 grp_parking = elm_map_overlay_class_add(map);
896 elm_map_overlay_icon_set(grp_parking, _icon_get(map, &parking));
897 elm_map_overlay_class_append(grp_parking, parking1);
898 elm_map_overlay_class_append(grp_parking, parking2);
899 elm_map_overlay_class_append(grp_parking, parking3);
900 elm_map_overlay_class_append(grp_parking, parking4);
901 elm_map_overlay_class_append(grp_parking, parking5);
903 evas_object_show(map);
906 evas_object_resize(win, 800, 800);
907 evas_object_show(win);