summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorBluezery <ohpowel@gmail.com>2012-03-22 05:23:19 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-03-22 05:23:19 +0000
commitce32c434b0d173aec0adcb4ca790d961e746b6e5 (patch)
treeeb482096322d026298d16d8de829b56e90463e4e /src/bin
parentf114c0f9da3a1cb35ce3a6598393880785d195fe (diff)
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Map overlay color & grouping & route Fix This is patch for elm_map 1. Default and Class overlay can be set color by elm_map_overlay_color_set(). 2. Fix test application for map API testing more. 3. Fix grouping for enabling group callbacks. If overlay group is clicked, callback will be called. And elm_map_overlay_group_members_set() API will be added later to get list of overlays in the group. 4. Simplify route overlay: Previously, many polygon objects are needed for one route overlay. But now just one is needed. SVN revision: 69554
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test_map.c405
1 files changed, 260 insertions, 145 deletions
diff --git a/src/bin/test_map.c b/src/bin/test_map.c
index 5a9f96750..5ed2f8d73 100644
--- a/src/bin/test_map.c
+++ b/src/bin/test_map.c
@@ -16,6 +16,7 @@ typedef struct Overlay_Data
16typedef struct Map_Source 16typedef struct Map_Source
17{ 17{
18 Evas_Object *map; 18 Evas_Object *map;
19 Elm_Map_Source_Type type;
19 char *source_name; 20 char *source_name;
20} Map_Source; 21} Map_Source;
21 22
@@ -42,10 +43,11 @@ static Evas_Object *menu, *fs_win;
42static Elm_Map_Route *route; 43static Elm_Map_Route *route;
43static Elm_Map_Name *name; 44static Elm_Map_Name *name;
44static Evas_Object *track; 45static Evas_Object *track;
45static const char **source_names = NULL; 46static Evas_Coord down_x, down_y;
46static Evas_Coord old_x, old_y; 47static Evas_Coord old_x, old_y, old_d;
47static Evas_Coord old_d; 48static Map_Source ts[SOURCE_MAX];
48static Map_Source ms[SOURCE_MAX]; 49static Map_Source rs[SOURCE_MAX];
50static Map_Source ns[SOURCE_MAX];
49 51
50static void 52static void
51#ifdef ELM_EMAP 53#ifdef ELM_EMAP
@@ -80,6 +82,22 @@ _route_icon_get(Evas_Object *obj)
80} 82}
81 83
82static void 84static void
85_bubble_parking_follow(Evas_Object *map)
86{
87 double lon, lat;
88 Evas_Coord x, y;
89
90 if (bubble_parking)
91 {
92 Elm_Map_Overlay *ovl = elm_map_overlay_data_get(bubble_parking);
93 elm_map_overlay_region_get(ovl, &lon, &lat);
94 elm_map_region_to_canvas_convert(map, lon, lat, &x, &y);
95 elm_map_canvas_to_region_convert(map, x+40, y+50, &lon, &lat);
96 elm_map_overlay_region_set(bubble_parking, lon, lat);
97 }
98}
99
100static void
83_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 101_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
84{ 102{
85 printf("clicked\n"); 103 printf("clicked\n");
@@ -157,6 +175,7 @@ _map_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__
157 double lon, lat; 175 double lon, lat;
158 elm_map_region_get(obj, &lon, &lat); 176 elm_map_region_get(obj, &lon, &lat);
159 printf("scroll, longitude: %f latitude: %f\n", lon, lat); 177 printf("scroll, longitude: %f latitude: %f\n", lon, lat);
178 _bubble_parking_follow(obj);
160} 179}
161 180
162static void 181static void
@@ -195,6 +214,7 @@ static void
195_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 214_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
196{ 215{
197 printf("zoom,stop\n"); 216 printf("zoom,stop\n");
217 _bubble_parking_follow(obj);
198} 218}
199 219
200static void 220static void
@@ -249,7 +269,6 @@ _map_route_loaded(void *data __UNUSED__, Evas_Object *obj, void *event_info __UN
249 269
250 if (route_ovl) elm_map_overlay_del(route_ovl); 270 if (route_ovl) elm_map_overlay_del(route_ovl);
251 route_ovl = elm_map_overlay_route_add(obj, route); 271 route_ovl = elm_map_overlay_route_add(obj, route);
252 elm_map_overlay_color_set(route_ovl, 255, 0, 0, 255);
253} 272}
254 273
255static void 274static void
@@ -313,19 +332,19 @@ map_bring_seoul(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUS
313} 332}
314 333
315static void 334static void
316map_paused_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 335_paused_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
317{ 336{
318 elm_map_paused_set(data, EINA_TRUE); 337 elm_map_paused_set(data, EINA_TRUE);
319} 338}
320 339
321static void 340static void
322map_paused_unset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 341_paused_unset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
323{ 342{
324 elm_map_paused_set(data, EINA_FALSE); 343 elm_map_paused_set(data, EINA_FALSE);
325} 344}
326 345
327static void 346static void
328map_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 347_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
329{ 348{
330 int zoom; 349 int zoom;
331 350
@@ -335,7 +354,7 @@ map_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__
335} 354}
336 355
337static void 356static void
338map_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 357_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
339{ 358{
340 int zoom; 359 int zoom;
341 360
@@ -345,19 +364,25 @@ map_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED_
345} 364}
346 365
347static void 366static void
348map_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 367_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
349{ 368{
350 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT); 369 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT);
351} 370}
352 371
353static void 372static void
354map_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 373_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
355{ 374{
356 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL); 375 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL);
357} 376}
358 377
359static void 378static void
360map_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 379_zoom_manual(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
380{
381 elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
382}
383
384static void
385_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
361{ 386{
362 Evas_Object *fs, *bg, *vbox, *hbox, *sep; 387 Evas_Object *fs, *bg, *vbox, *hbox, *sep;
363 char *path = NULL; 388 char *path = NULL;
@@ -407,13 +432,13 @@ map_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED
407 432
408 433
409static void 434static void
410map_track_remove(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 435_track_remove(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
411{ 436{
412 elm_map_track_remove(data, track); 437 elm_map_track_remove(data, track);
413} 438}
414 439
415static void 440static void
416map_rotate_cw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 441_rotate_cw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
417{ 442{
418 double d; 443 double d;
419 Evas_Coord x, y, w, h; 444 Evas_Coord x, y, w, h;
@@ -428,7 +453,7 @@ map_rotate_cw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED
428} 453}
429 454
430static void 455static void
431map_rotate_ccw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 456_rotate_ccw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
432{ 457{
433 double d; 458 double d;
434 Evas_Coord x, y, w, h; 459 Evas_Coord x, y, w, h;
@@ -443,7 +468,7 @@ map_rotate_ccw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSE
443} 468}
444 469
445static void 470static void
446map_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 471_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
447{ 472{
448 Evas_Coord x, y, w, h; 473 Evas_Coord x, y, w, h;
449 float half_w, half_h; 474 float half_w, half_h;
@@ -455,121 +480,132 @@ map_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU
455} 480}
456 481
457static void 482static void
458map_zoom_min_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 483_wheel_disable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
484{
485 elm_map_wheel_disabled_set(data, EINA_TRUE);
486}
487
488static void
489_wheel_enable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
490{
491 elm_map_wheel_disabled_set(data, EINA_FALSE);
492}
493
494static void
495_zoom_min_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
459{ 496{
460 elm_map_zoom_min_set(data, 1); 497 elm_map_zoom_min_set(data, 1);
461} 498}
462 499
463static void 500static void
464map_zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 501_zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
465{ 502{
466 elm_map_zoom_max_set(data, 10); 503 elm_map_zoom_max_set(data, 10);
467} 504}
468 505
469static void 506static void
470map_source(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 507src_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
471{ 508{
472 Map_Source *s = data; 509 Map_Source *s = data;
473 510
474 if (!s) return; 511 if (!s) return;
475 elm_map_source_set(s->map, ELM_MAP_SOURCE_TYPE_TILE, s->source_name); 512 elm_map_source_set(s->map, s->type, s->source_name);
476} 513}
477 514
478/* 515static Evas_Object *
479static void 516_box_get(Evas_Object *obj, Overlay_Data *data, Elm_Map_Overlay *ovl)
480map_marker_add(void *data)
481{ 517{
482 int i; 518 Evas_Object *bx, *img, *label;
483 Elm_Map_Group_Class *g_clas; 519 double lon, lat;
484 Elm_Map_Marker_Class *m_clas; 520 char buf[256];
485 Overlay_Data *d = &data7; 521 bx = elm_box_add(obj);
486 522 evas_object_show(bx);
487 if (*markers) return;
488 for (i =0; i<MARKER_MAX; i++)
489 {
490 d = &data7;
491
492 int r1 = rand() % (180*2*100);
493 if (r1<=180) r1 = -r1;
494 else r1 = r1 - 180*100;
495
496 int r2 = rand() % (85*2*100);
497 if (r2<=85) r2 = -r2;
498 else r2 = r2 - 85*100;
499
500 int style = rand() % 3;
501 if (!style) m_clas = itc1;
502 else if (style == 1) m_clas = itc2;
503 else
504 {
505 m_clas = itc_parking;
506 d = &parking;
507 }
508 523
509 style = rand() % 2; 524 img = evas_object_image_add(evas_object_evas_get(obj));
510 if (!style) g_clas = itc_group1; 525 evas_object_image_file_set(img, data->file, NULL);
511 else g_clas = itc_group2; 526 evas_object_image_filled_set(img, EINA_TRUE);
527 evas_object_size_hint_min_set(img, 64, 64);
528 evas_object_show(img);
529 elm_box_pack_end(bx, img);
512 530
513 markers[i] = elm_map_marker_add(data, r1/100., r2/100., m_clas, g_clas, d); 531 label = elm_label_add(bx);
514 } 532 elm_map_overlay_region_get(ovl, &lon, &lat);
515 nb_elts += 1000; 533 snprintf(buf, sizeof(buf), "%0.4lf %0.4lf", lon, lat);
516 printf("nb elements: %d\n", nb_elts); 534 elm_object_text_set(label, buf);
535 evas_object_show(label);
536 elm_box_pack_end(bx, label);
537 return bx;
517} 538}
518 539
519static void 540static void
520map_marker_remove(void *data __UNUSED__) 541_overlay_hide(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
521{ 542{
522 int i; 543 elm_map_overlay_hide_set(data, EINA_TRUE);
544}
523 545
524 for (i = 0; i<MARKER_MAX; i++) 546static void
525 { 547_overlay_pause(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
526 if (markers[i]) 548{
527 { 549 elm_map_overlay_paused_set(data, EINA_TRUE);
528 elm_map_marker_remove(markers[i]);
529 markers[i] = NULL;
530 }
531 }
532} 550}
533 551
534static void 552static void
535my_map_entry_focused(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) 553_overlay_unpause(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
536{ 554{
537 const char *s = elm_scrolled_entry_entry_get(obj); 555 elm_map_overlay_paused_set(data, EINA_FALSE);
538 if (!strcmp(s, NAME_ENTRY_TEXT)) elm_scrolled_entry_entry_set(obj, "");
539} 556}
540 557
541static void 558static void
542my_map_entry_activated(void *data, Evas_Object *obj, void *event_info __UNUSED__) 559_overlay_show(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
543{ 560{
544 const char *s = elm_scrolled_entry_entry_get(obj); 561 elm_map_overlay_show(data);
545 char *addr = strdup(s);
546 name = elm_map_name_add(data, addr, 0, 0, NULL, NULL);
547 if (addr) free (addr);
548} 562}
549*/
550 563
551static Evas_Object * 564static Evas_Object *
552_box_get(Evas_Object *obj, Overlay_Data *data) 565_btn_box_get(Evas_Object *obj, Elm_Map_Overlay *ovl)
553{ 566{
554 Evas_Object *bx, *img, *label; 567 Evas_Object *bx, *btn, *btn2, *btn3, *btn4;
555 bx = elm_box_add(obj); 568 bx = elm_box_add(obj);
569 elm_box_horizontal_set(bx, EINA_TRUE);
556 evas_object_show(bx); 570 evas_object_show(bx);
557 571
558 img = evas_object_image_add(evas_object_evas_get(obj)); 572 btn = elm_button_add(bx);
559 evas_object_image_file_set(img, data->file, NULL); 573 elm_object_text_set(btn, "Hide");
560 evas_object_image_filled_set(img, EINA_TRUE); 574 evas_object_smart_callback_add(btn, "clicked", _overlay_hide, ovl);
561 evas_object_size_hint_min_set(img, 64, 64); 575 evas_object_show(btn);
562 evas_object_show(img); 576 elm_box_pack_end(bx, btn);
563 elm_box_pack_end(bx, img); 577
578 btn2 = elm_button_add(bx);
579 elm_object_text_set(btn2, "Pause");
580 evas_object_smart_callback_add(btn2, "clicked", _overlay_pause, ovl);
581 evas_object_show(btn2);
582 elm_box_pack_end(bx, btn2);
583
584 btn3 = elm_button_add(bx);
585 elm_object_text_set(btn3, "Unpause");
586 evas_object_smart_callback_add(btn3, "clicked", _overlay_unpause, ovl);
587 evas_object_show(btn3);
588 elm_box_pack_end(bx, btn3);
589
590 btn4 = elm_button_add(bx);
591 elm_object_text_set(btn4, "Show");
592 evas_object_smart_callback_add(btn4, "clicked", _overlay_show, ovl);
593 evas_object_show(btn4);
594 elm_box_pack_end(bx, btn4);
564 595
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);
569 return bx; 596 return bx;
570} 597}
571 598
572static Evas_Object * 599static Evas_Object *
600_label_get(Evas_Object *obj)
601{
602 Evas_Object *label;
603 label = elm_label_add(obj);
604 elm_object_text_set(label, "Here is a parking lot.");
605 return label;
606}
607
608static Evas_Object *
573_icon_get(Evas_Object *obj, Overlay_Data *data) 609_icon_get(Evas_Object *obj, Overlay_Data *data)
574{ 610{
575 Evas_Object *icon = elm_icon_add(obj); 611 Evas_Object *icon = elm_icon_add(obj);
@@ -580,19 +616,86 @@ _icon_get(Evas_Object *obj, Overlay_Data *data)
580} 616}
581 617
582static void 618static void
583_populate(void *data, Elm_Object_Item *menu_it) 619_submenu_src_add(void *data, Elm_Object_Item *parent)
584{ 620{
585 int idx; 621 int idx;
622 const char **tile_srcs;
623 const char **route_srcs;
624 const char **name_srcs;
625
626 if ((!data) || (!parent)) return;
586 627
587 if ((!data) || (!menu_it) || (!source_names)) return; 628 tile_srcs = elm_map_sources_get(data, ELM_MAP_SOURCE_TYPE_TILE);
588 for (idx = 0; source_names[idx]; idx++) 629 route_srcs = elm_map_sources_get(data, ELM_MAP_SOURCE_TYPE_ROUTE);
630 name_srcs = elm_map_sources_get(data, ELM_MAP_SOURCE_TYPE_NAME);
631
632 for (idx = 0; tile_srcs[idx]; idx++)
589 { 633 {
590 if (idx >= SOURCE_MAX) break; 634 if (idx >= SOURCE_MAX) break;
591 ms[idx].map = data; 635 ts[idx].map = data;
592 ms[idx].source_name = strdup(source_names[idx]); 636 ts[idx].type = ELM_MAP_SOURCE_TYPE_TILE;
593 elm_menu_item_add(menu, menu_it, "", source_names[idx], map_source, 637 ts[idx].source_name = strdup(tile_srcs[idx]);
594 &ms[idx]); 638 elm_menu_item_add(menu, parent, "", tile_srcs[idx], src_set, &ts[idx]);
595 } 639 }
640 for (idx = 0; route_srcs[idx]; idx++)
641 {
642 if (idx >= SOURCE_MAX) break;
643 rs[idx].map = data;
644 rs[idx].type = ELM_MAP_SOURCE_TYPE_ROUTE;
645 rs[idx].source_name = strdup(route_srcs[idx]);
646 elm_menu_item_add(menu, parent, "", route_srcs[idx], src_set, &rs[idx]);
647 }
648 for (idx = 0; name_srcs[idx]; idx++)
649 {
650 if (idx >= SOURCE_MAX) break;
651 ns[idx].map = data;
652 ns[idx].type = ELM_MAP_SOURCE_TYPE_NAME;
653 ns[idx].source_name = strdup(name_srcs[idx]);
654 elm_menu_item_add(menu, parent, "", name_srcs[idx], src_set, &ns[idx]);
655 }
656}
657
658static void
659_submenu_move_add(void *data, Elm_Object_Item *parent)
660{
661 if ((!data) || (!parent)) return;
662 elm_menu_item_add(menu, parent, NULL, "Show Urmatt", map_show_urmatt, data);
663 elm_menu_item_add(menu, parent, NULL, "Bring Seoul", map_bring_seoul, data);
664
665}
666
667static void
668_submenu_zoom_add(void *data, Elm_Object_Item *parent)
669{
670 if ((!data) || (!parent)) return;
671 elm_menu_item_add(menu, parent, NULL, "Zoom +", _zoom_in, data);
672 elm_menu_item_add(menu, parent, NULL, "Zoom -", _zoom_out, data);
673 elm_menu_item_add(menu, parent, NULL, "Zoom Fit", _zoom_fit, data);
674 elm_menu_item_add(menu, parent, NULL, "Zoom Fill", _zoom_fill, data);
675 elm_menu_item_add(menu, parent, NULL, "Zoom Manual", _zoom_manual, data);
676 elm_menu_item_add(menu, parent, NULL, "Zoom Min to 1", _zoom_min_set, data);
677 elm_menu_item_add(menu, parent, NULL, "Zoom Max to 10", _zoom_max_set, data);
678}
679
680static void
681_submenu_prop_add(void *data, Elm_Object_Item *parent)
682{
683 if ((!data) || (!parent)) return;
684 elm_menu_item_add(menu, parent, NULL, "Paused Set", _paused_set, data);
685 elm_menu_item_add(menu, parent, NULL, "Paused Unset", _paused_unset, data);
686 elm_menu_item_add(menu, parent, NULL, "Rotate CW", _rotate_cw, data);
687 elm_menu_item_add(menu, parent, NULL, "Rotate CCW", _rotate_ccw, data);
688 elm_menu_item_add(menu, parent, NULL, "Reset Rotate", _rotate_reset, data);
689 elm_menu_item_add(menu, parent, NULL, "Disable Wheel", _wheel_disable, data);
690 elm_menu_item_add(menu, parent, NULL, "Enable Wheel", _wheel_enable, data);
691}
692
693static void
694_submenu_track_add(void *data, Elm_Object_Item *parent)
695{
696 if ((!data) || (!parent)) return;
697 elm_menu_item_add(menu, parent, NULL, "Add Track", _track_add, data);
698 elm_menu_item_add(menu, parent, NULL, "Remove Track", _track_remove, data);
596} 699}
597 700
598static void 701static void
@@ -610,25 +713,19 @@ _map_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event
610 } 713 }
611 else if (down->button == 3) 714 else if (down->button == 3)
612 { 715 {
716 down_x = down->canvas.x;
717 down_y = down->canvas.y;
613 menu = elm_menu_add(obj); 718 menu = elm_menu_add(obj);
614 menu_it = elm_menu_item_add(menu, NULL, NULL, "Source", NULL, NULL); 719 menu_it = elm_menu_item_add(menu, NULL, "", "Source", NULL, NULL);
615 _populate(data, menu_it); 720 _submenu_src_add(data, menu_it);
616 elm_menu_item_add(menu, NULL, NULL, "Show Urmatt", map_show_urmatt, data); 721 menu_it = elm_menu_item_add(menu, NULL, "", "Move", NULL, NULL);
617 elm_menu_item_add(menu, NULL, NULL, "Bring Seoul", map_bring_seoul, data); 722 _submenu_move_add(data, menu_it);
618 elm_menu_item_add(menu, NULL, NULL, "Paused Set", map_paused_set, data); 723 menu_it = elm_menu_item_add(menu, NULL, "", "Zoom", NULL, NULL);
619 elm_menu_item_add(menu, NULL, NULL, "Paused Unset", map_paused_unset, data); 724 _submenu_zoom_add(data, menu_it);
620 elm_menu_item_add(menu, NULL, NULL, "Zoom +", map_zoom_in, data); 725 menu_it = elm_menu_item_add(menu, NULL, "", "Prop", NULL, NULL);
621 elm_menu_item_add(menu, NULL, NULL, "Zoom -", map_zoom_out, data); 726 _submenu_prop_add(data, menu_it);
622 elm_menu_item_add(menu, NULL, NULL, "Zoom Fit", map_zoom_fit, data); 727 menu_it = elm_menu_item_add(menu, NULL, "", "Track", NULL, NULL);
623 elm_menu_item_add(menu, NULL, NULL, "Zoom Fill", map_zoom_fill, data); 728 _submenu_track_add(data, menu_it);
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);
632 729
633 elm_menu_move(menu, down->canvas.x, down->canvas.y); 730 elm_menu_move(menu, down->canvas.x, down->canvas.y);
634 evas_object_show(menu); 731 evas_object_show(menu);
@@ -691,29 +788,25 @@ _overlay_cb(void *data __UNUSED__, Evas_Object *map, void *ev)
691{ 788{
692 printf("Overlay clicked: "); 789 printf("Overlay clicked: ");
693 Elm_Map_Overlay *overlay = ev; 790 Elm_Map_Overlay *overlay = ev;
694 Evas_Object *bx; 791 Overlay_Data *od;
792 Elm_Map_Overlay_Type type = elm_map_overlay_type_get(overlay);
695 793
696 Overlay_Data *od = elm_map_overlay_data_get(overlay); 794 if (type != ELM_MAP_OVERLAY_TYPE_DEFAULT) return;
697 if (!od) 795
698 { 796 if (!bubble_img) bubble_img = elm_map_overlay_bubble_add(map);
699 printf("No overlay data\n"); 797 elm_map_overlay_bubble_follow(bubble_img, overlay);
700 } 798 elm_map_overlay_bubble_content_clear(bubble_img);
701 else if (elm_map_overlay_type_get(overlay) == ELM_MAP_OVERLAY_TYPE_DEFAULT) 799
702 { 800 od = elm_map_overlay_data_get(overlay);
703 // prevent duplication 801 if (od)
704 if (!bubble_img) bubble_img = elm_map_overlay_bubble_add(map); 802 elm_map_overlay_bubble_content_append(bubble_img,
705 803 _box_get(map, od, overlay));
706 elm_map_overlay_bubble_follow(bubble_img, overlay); 804 elm_map_overlay_bubble_content_append(bubble_img,
707 bx = _box_get(map, od); 805 _btn_box_get(map, overlay));
708 elm_map_overlay_bubble_content_clear(bubble_img);
709 elm_map_overlay_bubble_content_append(bubble_img, bx);
710 printf("overlay rendered\n");
711 }
712 else printf("not default type\n");
713} 806}
714 807
715static void 808static void
716_parking_cb(void *data __UNUSED__, Evas_Object *map, const Elm_Map_Overlay *ovl) 809_parking_cb(void *data __UNUSED__, Evas_Object *map, Elm_Map_Overlay *ovl)
717{ 810{
718 if (elm_map_overlay_type_get(ovl) != ELM_MAP_OVERLAY_TYPE_DEFAULT) return; 811 if (elm_map_overlay_type_get(ovl) != ELM_MAP_OVERLAY_TYPE_DEFAULT) return;
719 812
@@ -723,11 +816,12 @@ _parking_cb(void *data __UNUSED__, Evas_Object *map, const Elm_Map_Overlay *ovl)
723 elm_map_region_to_canvas_convert(map, lon, lat, &x, &y); 816 elm_map_region_to_canvas_convert(map, lon, lat, &x, &y);
724 printf("Parking clicked: %lf %lf %d %d\n", lon, lat, x, y); 817 printf("Parking clicked: %lf %lf %d %d\n", lon, lat, x, y);
725 818
819 elm_map_canvas_to_region_convert(map, x+40, y+50, &lon, &lat);
726 if (!bubble_parking) 820 if (!bubble_parking)
727 { 821 {
728 Evas_Object *bubble, *label; 822 Evas_Object *bubble, *label;
729 bubble = elm_bubble_add(map); 823 bubble = elm_bubble_add(map);
730 elm_bubble_pos_set(bubble, ELM_BUBBLE_POS_BOTTOM_LEFT); 824 elm_bubble_pos_set(bubble, ELM_BUBBLE_POS_TOP_LEFT);
731 elm_object_text_set(bubble, "Overlay object"); 825 elm_object_text_set(bubble, "Overlay object");
732 elm_object_part_text_set(bubble, "info", "Bubble is overlayed"); 826 elm_object_part_text_set(bubble, "info", "Bubble is overlayed");
733 827
@@ -739,10 +833,11 @@ _parking_cb(void *data __UNUSED__, Evas_Object *map, const Elm_Map_Overlay *ovl)
739 evas_object_resize(bubble, 125, 50); 833 evas_object_resize(bubble, 125, 50);
740 evas_object_show(bubble); 834 evas_object_show(bubble);
741 835
742 bubble_parking = elm_map_overlay_add(map, lon + 0.0006, lat + 0.0006); 836 bubble_parking = elm_map_overlay_add(map, lon, lat);
743 elm_map_overlay_content_set(bubble_parking, bubble); 837 elm_map_overlay_content_set(bubble_parking, bubble);
744 } 838 }
745 elm_map_overlay_region_set(bubble_parking, lon + 0.0006, lat + 0.0006); 839 else elm_map_overlay_region_set(bubble_parking, lon, lat);
840 elm_map_overlay_data_set(bubble_parking, ovl);
746} 841}
747 842
748static void 843static void
@@ -772,6 +867,9 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
772{ 867{
773 Evas_Object *win, *bg, *map; 868 Evas_Object *win, *bg, *map;
774 int idx = 0; 869 int idx = 0;
870 const char **tile_srcs;
871 const char **route_srcs;
872 const char **name_srcs;
775 873
776 win = elm_win_add(NULL, "map", ELM_WIN_BASIC); 874 win = elm_win_add(NULL, "map", ELM_WIN_BASIC);
777 elm_win_title_set(win, "Map"); 875 elm_win_title_set(win, "Map");
@@ -785,7 +883,7 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
785 map = elm_map_add(win); 883 map = elm_map_add(win);
786 if (map) 884 if (map)
787 { 885 {
788 Elm_Map_Overlay *ovl_1, *ovl_2, *ovl_3, *ovl_4, *ovl_5, *ovl6; 886 Elm_Map_Overlay *ovl_1, *ovl_2, *ovl_3, *ovl_4, *ovl_5, *ovl_6;
789 Elm_Map_Overlay *ovl_7, *ovl_8, *ovl_9, *ovl_10, *ovl_11; 887 Elm_Map_Overlay *ovl_7, *ovl_8, *ovl_9, *ovl_10, *ovl_11;
790 Elm_Map_Overlay *parking1, *parking2, *parking3, *parking4, *parking5; 888 Elm_Map_Overlay *parking1, *parking2, *parking3, *parking4, *parking5;
791 Elm_Map_Overlay *grp1, *grp2, *grp_parking; 889 Elm_Map_Overlay *grp1, *grp2, *grp_parking;
@@ -794,11 +892,21 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
794 892
795 srand(time(NULL)); 893 srand(time(NULL));
796 894
797 source_names = elm_map_sources_get(map, ELM_MAP_SOURCE_TYPE_TILE); 895 tile_srcs = elm_map_sources_get(map, ELM_MAP_SOURCE_TYPE_TILE);
896 route_srcs = elm_map_sources_get(map, ELM_MAP_SOURCE_TYPE_ROUTE);
897 name_srcs = elm_map_sources_get(map, ELM_MAP_SOURCE_TYPE_NAME);
798 898
799 if (!source_names) return; 899 if (!tile_srcs) return;
800 printf("map sources [ "); 900 printf("Tile sources [ ");
801 for (idx = 0; source_names[idx] ; idx++) printf("%s, ", source_names[idx]); 901 for (idx = 0; tile_srcs[idx] ; idx++) printf("%s, ", tile_srcs[idx]);
902 printf("]\n");
903 if (!route_srcs) return;
904 printf("Route sources [ ");
905 for (idx = 0; route_srcs[idx] ; idx++) printf("%s, ", route_srcs[idx]);
906 printf("]\n");
907 if (!name_srcs) return;
908 printf("Name sources [ ");
909 for (idx = 0; name_srcs[idx] ; idx++) printf("%s, ", name_srcs[idx]);
802 printf("]\n"); 910 printf("]\n");
803 911
804 evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 912 evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -837,11 +945,16 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
837 945
838 // Create Overlays 946 // Create Overlays
839 ovl_1 = elm_map_overlay_add(map, 2.352, 48.857); 947 ovl_1 = elm_map_overlay_add(map, 2.352, 48.857);
948 elm_map_overlay_color_set(ovl_1, 0x00, 0xfa, 0x9a, 0xff);
949 elm_map_overlay_displayed_zoom_min_set(ovl_1, 5);
840 ovl_2 = elm_map_overlay_add(map, 3, 48.857); 950 ovl_2 = elm_map_overlay_add(map, 3, 48.857);
951 elm_map_overlay_color_set(ovl_2, 0xff, 0xd7, 0x00, 0xff);
952 elm_map_overlay_displayed_zoom_min_set(ovl_2, 4);
841 ovl_3 = elm_map_overlay_add(map, 2.352, 49); 953 ovl_3 = elm_map_overlay_add(map, 2.352, 49);
954 elm_map_overlay_displayed_zoom_min_set(ovl_3, 3);
842 ovl_4 = elm_map_overlay_add(map, 7.31451, 48.857127); 955 ovl_4 = elm_map_overlay_add(map, 7.31451, 48.857127);
843 ovl_5 = elm_map_overlay_add(map, 7.314704, 48.857119); 956 ovl_5 = elm_map_overlay_add(map, 7.314704, 48.857119);
844 ovl6 = elm_map_overlay_add(map, 7.31432, 48.856785); 957 ovl_6 = elm_map_overlay_add(map, 7.31432, 48.856785);
845 ovl_7 = elm_map_overlay_add(map, 7.3148, 48.85725); 958 ovl_7 = elm_map_overlay_add(map, 7.3148, 48.85725);
846 ovl_8 = elm_map_overlay_add(map, 7.316445, 48.8572210000694); 959 ovl_8 = elm_map_overlay_add(map, 7.316445, 48.8572210000694);
847 ovl_9 = elm_map_overlay_add(map, 7.316527000125, 48.85609); 960 ovl_9 = elm_map_overlay_add(map, 7.316527000125, 48.85609);
@@ -852,7 +965,7 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
852 elm_map_overlay_data_set(ovl_3, &data3); 965 elm_map_overlay_data_set(ovl_3, &data3);
853 elm_map_overlay_data_set(ovl_4, &data4); 966 elm_map_overlay_data_set(ovl_4, &data4);
854 elm_map_overlay_data_set(ovl_5, &data5); 967 elm_map_overlay_data_set(ovl_5, &data5);
855 elm_map_overlay_data_set(ovl6, &data6); 968 elm_map_overlay_data_set(ovl_6, &data6);
856 elm_map_overlay_data_set(ovl_7, &data7); 969 elm_map_overlay_data_set(ovl_7, &data7);
857 elm_map_overlay_data_set(ovl_8, &data8); 970 elm_map_overlay_data_set(ovl_8, &data8);
858 elm_map_overlay_data_set(ovl_9, &data9); 971 elm_map_overlay_data_set(ovl_9, &data9);
@@ -861,17 +974,17 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
861 974
862 // Append overlays to groups 975 // Append overlays to groups
863 grp1 = elm_map_overlay_class_add(map); 976 grp1 = elm_map_overlay_class_add(map);
864 elm_map_overlay_displayed_zoom_min_set(grp1, 3); 977 elm_map_overlay_class_zoom_max_set(grp1, 6);
865 elm_map_overlay_class_append(grp1, ovl_1); 978 elm_map_overlay_class_append(grp1, ovl_1);
866 elm_map_overlay_class_append(grp1, ovl_2); 979 elm_map_overlay_class_append(grp1, ovl_2);
867 elm_map_overlay_class_append(grp1, ovl_3); 980 elm_map_overlay_class_append(grp1, ovl_3);
868 elm_map_overlay_class_append(grp1, ovl_4); 981 elm_map_overlay_class_append(grp1, ovl_4);
869 elm_map_overlay_class_append(grp1, ovl_5); 982 elm_map_overlay_class_append(grp1, ovl_5);
870 elm_map_overlay_class_append(grp1, ovl6); 983 elm_map_overlay_class_append(grp1, ovl_6);
871 evas_object_smart_callback_add(map, "overlay,clicked", _overlay_cb, map);
872 984
873 // Append overlays to groups 985 // Append overlays to groups
874 grp2 = elm_map_overlay_class_add(map); 986 grp2 = elm_map_overlay_class_add(map);
987 elm_map_overlay_displayed_zoom_min_set(grp2, 9);
875 elm_map_overlay_class_append(grp2, ovl_7); 988 elm_map_overlay_class_append(grp2, ovl_7);
876 elm_map_overlay_class_append(grp2, ovl_8); 989 elm_map_overlay_class_append(grp2, ovl_8);
877 elm_map_overlay_class_append(grp2, ovl_9); 990 elm_map_overlay_class_append(grp2, ovl_9);
@@ -883,8 +996,9 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
883 parking2 = elm_map_overlay_add(map, 127.05578, 37.25545); 996 parking2 = elm_map_overlay_add(map, 127.05578, 37.25545);
884 parking3 = elm_map_overlay_add(map, 127.05515, 37.25439); 997 parking3 = elm_map_overlay_add(map, 127.05515, 37.25439);
885 parking4 = elm_map_overlay_add(map, 127.05328, 37.25721); 998 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)); 999 elm_map_overlay_icon_set(parking4, _icon_get(map, &icon_data));
1000 parking5 = elm_map_overlay_add(map, 127.05431, 37.25873);
1001 elm_map_overlay_content_set(parking5, _label_get(map));
888 elm_map_overlay_get_cb_set(parking1, _parking_cb, NULL); 1002 elm_map_overlay_get_cb_set(parking1, _parking_cb, NULL);
889 elm_map_overlay_get_cb_set(parking2, _parking_cb, NULL); 1003 elm_map_overlay_get_cb_set(parking2, _parking_cb, NULL);
890 elm_map_overlay_get_cb_set(parking3, _parking_cb, NULL); 1004 elm_map_overlay_get_cb_set(parking3, _parking_cb, NULL);
@@ -894,6 +1008,7 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
894 // Append overlays to groups 1008 // Append overlays to groups
895 grp_parking = elm_map_overlay_class_add(map); 1009 grp_parking = elm_map_overlay_class_add(map);
896 elm_map_overlay_icon_set(grp_parking, _icon_get(map, &parking)); 1010 elm_map_overlay_icon_set(grp_parking, _icon_get(map, &parking));
1011 elm_map_overlay_get_cb_set(grp_parking, _parking_cb, NULL);
897 elm_map_overlay_class_append(grp_parking, parking1); 1012 elm_map_overlay_class_append(grp_parking, parking1);
898 elm_map_overlay_class_append(grp_parking, parking2); 1013 elm_map_overlay_class_append(grp_parking, parking2);
899 elm_map_overlay_class_append(grp_parking, parking3); 1014 elm_map_overlay_class_append(grp_parking, parking3);