forked from enlightenment/efl
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Add elm_map_overlays_get & elm_map_overlay_visible_get I want to add 2 new APIs (elm_map_overlays_get & elm_map_overlay_visible_get). There are no way to get the group overlays because group overlay, something like virtual overlay, is created and deleted dynamically. So elm_map_overlays_get returns total overlay's list and user can get any type of overlays including group overlays. Overlays which is grouped can not be visible. Because overlay grouping is performed by elm_map, user do not know whether overlays are visible or not. So elm_map_overlay_visible_get is added for this reason. SVN revision: 71354
This commit is contained in:
parent
ee3484c2d4
commit
3bada185c3
|
@ -88,3 +88,7 @@
|
||||||
|
|
||||||
* Add skeleton for handling remote commands access controls.
|
* Add skeleton for handling remote commands access controls.
|
||||||
|
|
||||||
|
2012-05-23 Tae-Hwan Kim (Bluezery)
|
||||||
|
|
||||||
|
* Map: Add elm_map_overlays_get & elm_map_overlay_visible_get functions.
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ Additions:
|
||||||
* Focus can be moved in all directions by elm_widget_focus_go function.
|
* Focus can be moved in all directions by elm_widget_focus_go function.
|
||||||
* Reload theme when it change on disk.
|
* Reload theme when it change on disk.
|
||||||
* Fileselector: Add a wheel spinner that show/spin while EIO is working
|
* Fileselector: Add a wheel spinner that show/spin while EIO is working
|
||||||
|
* Add elm_map_overlays_get & elm_map_overlay_visible_get functions.
|
||||||
|
|
||||||
Fixes:
|
Fixes:
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,37 @@ _bubble_parking_follow(Evas_Object *map)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_overlays_num_check(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Coord x, y, w, h;
|
||||||
|
double lon, lat, max_lon, max_lat, min_lon, min_lat;
|
||||||
|
Eina_List *overlays, *l;
|
||||||
|
Elm_Map_Overlay *ovl;
|
||||||
|
int cnt = 0;
|
||||||
|
int cnt_visible = 0;
|
||||||
|
|
||||||
|
overlays = elm_map_overlays_get(obj);
|
||||||
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||||
|
elm_map_canvas_to_region_convert(obj, x, y, &min_lon, &max_lat);
|
||||||
|
elm_map_canvas_to_region_convert(obj, x + w, y + h, &max_lon, &min_lat);
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(overlays, l, ovl)
|
||||||
|
{
|
||||||
|
if (elm_map_overlay_type_get(ovl) == ELM_MAP_OVERLAY_TYPE_CLASS)
|
||||||
|
continue;
|
||||||
|
elm_map_overlay_region_get(ovl, &lon, &lat);
|
||||||
|
if ((min_lon <= lon) && (lon <= max_lon) &&
|
||||||
|
(min_lat <= lat) && (lat <= max_lat))
|
||||||
|
{
|
||||||
|
if (elm_map_overlay_visible_get(ovl)) cnt_visible++;
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("Number of (visible/total) overlays in viewport: %d/%d\n",
|
||||||
|
cnt_visible, cnt);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
|
@ -298,6 +329,7 @@ _map_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSE
|
||||||
{
|
{
|
||||||
printf("scroll,drag,stop\n");
|
printf("scroll,drag,stop\n");
|
||||||
evas_object_smart_callback_add(data, "longpressed", _map_longpressed, data);
|
evas_object_smart_callback_add(data, "longpressed", _map_longpressed, data);
|
||||||
|
_overlays_num_check(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -322,13 +354,14 @@ static void
|
||||||
_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
printf("zoom,stop\n");
|
printf("zoom,stop\n");
|
||||||
_bubble_parking_follow(obj);
|
_overlays_num_check(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
_map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
printf("zoom,change\n");
|
printf("zoom,change\n");
|
||||||
|
_bubble_parking_follow(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -150,6 +150,7 @@ struct _Color
|
||||||
struct _Overlay_Group
|
struct _Overlay_Group
|
||||||
{
|
{
|
||||||
Widget_Data *wd;
|
Widget_Data *wd;
|
||||||
|
double lon, lat;
|
||||||
Elm_Map_Overlay *overlay; // virtual group type overlay
|
Elm_Map_Overlay *overlay; // virtual group type overlay
|
||||||
Elm_Map_Overlay *clas; // class overlay for this virtual group
|
Elm_Map_Overlay *clas; // class overlay for this virtual group
|
||||||
Overlay_Default *ovl; // rendered overlay
|
Overlay_Default *ovl; // rendered overlay
|
||||||
|
@ -239,6 +240,7 @@ struct _Elm_Map_Overlay
|
||||||
{
|
{
|
||||||
Widget_Data *wd;
|
Widget_Data *wd;
|
||||||
|
|
||||||
|
Eina_Bool visible : 1;
|
||||||
Eina_Bool paused : 1;
|
Eina_Bool paused : 1;
|
||||||
Eina_Bool hide : 1;
|
Eina_Bool hide : 1;
|
||||||
Evas_Coord zoom_min;
|
Evas_Coord zoom_min;
|
||||||
|
@ -439,6 +441,8 @@ struct _Widget_Data
|
||||||
Eina_List *names;
|
Eina_List *names;
|
||||||
|
|
||||||
Eina_List *overlays;
|
Eina_List *overlays;
|
||||||
|
Eina_List *group_overlays;
|
||||||
|
Eina_List *all_overlays;
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *_mapnik_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom);
|
static char *_mapnik_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom);
|
||||||
|
@ -734,6 +738,8 @@ _grid_item_in_viewport(Grid_Item *gi)
|
||||||
static void
|
static void
|
||||||
_grid_item_update(Grid_Item *gi)
|
_grid_item_update(Grid_Item *gi)
|
||||||
{
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(gi);
|
||||||
|
|
||||||
evas_object_image_file_set(gi->img, gi->file, NULL);
|
evas_object_image_file_set(gi->img, gi->file, NULL);
|
||||||
if (!gi->wd->zoom_timer && !gi->wd->scr_timer)
|
if (!gi->wd->zoom_timer && !gi->wd->scr_timer)
|
||||||
evas_object_image_smooth_scale_set(gi->img, EINA_TRUE);
|
evas_object_image_smooth_scale_set(gi->img, EINA_TRUE);
|
||||||
|
@ -786,7 +792,6 @@ _grid_item_unload(Grid_Item *gi)
|
||||||
gi->wd->try_num--;
|
gi->wd->try_num--;
|
||||||
}
|
}
|
||||||
else gi->wd->download_list = eina_list_remove(gi->wd->download_list, gi);
|
else gi->wd->download_list = eina_list_remove(gi->wd->download_list, gi);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Grid_Item *
|
static Grid_Item *
|
||||||
|
@ -908,8 +913,7 @@ _download_job(void *data)
|
||||||
wd->download_list = eina_list_remove(wd->download_list, gi);
|
wd->download_list = eina_list_remove(wd->download_list, gi);
|
||||||
wd->try_num++;
|
wd->try_num++;
|
||||||
wd->download_num++;
|
wd->download_num++;
|
||||||
evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOAD,
|
evas_object_smart_callback_call(wd->obj, SIG_TILE_LOAD, NULL);
|
||||||
NULL);
|
|
||||||
if (wd->download_num == 1)
|
if (wd->download_num == 1)
|
||||||
edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
|
edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
|
||||||
"elm,state,busy,start", "elm");
|
"elm,state,busy,start", "elm");
|
||||||
|
@ -1005,7 +1009,8 @@ _grid_place(Widget_Data *wd)
|
||||||
if (wd->zoom == g->zoom) _grid_load(g);
|
if (wd->zoom == g->zoom) _grid_load(g);
|
||||||
else _grid_unload(g);
|
else _grid_unload(g);
|
||||||
}
|
}
|
||||||
if (!wd->download_idler) wd->download_idler = ecore_idler_add(_download_job, wd);
|
if (!wd->download_idler)
|
||||||
|
wd->download_idler = ecore_idler_add(_download_job, wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1350,7 +1355,7 @@ _mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi
|
||||||
|
|
||||||
if (!wd->paused)
|
if (!wd->paused)
|
||||||
{
|
{
|
||||||
Evas_Event_Mouse_Wheel *ev = (Evas_Event_Mouse_Wheel*) event_info;
|
Evas_Event_Mouse_Wheel *ev = event_info;
|
||||||
zoom_do(wd, wd->zoom_detail - ((double)ev->z / 10));
|
zoom_do(wd, wd->zoom_detail - ((double)ev->z / 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1646,25 +1651,17 @@ _overlay_group_coord_member_update(Overlay_Group *grp, Evas_Coord x, Evas_Coord
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN(grp);
|
EINA_SAFETY_ON_NULL_RETURN(grp);
|
||||||
if (!grp->ovl) return;
|
if (!grp->ovl) return;
|
||||||
char text[32];
|
|
||||||
|
|
||||||
|
char text[32];
|
||||||
_overlay_default_coord_set(grp->ovl, x, y);
|
_overlay_default_coord_set(grp->ovl, x, y);
|
||||||
|
_coord_to_region_convert(grp->wd, x, y, grp->wd->size.w, &grp->lon, &grp->lat);
|
||||||
|
|
||||||
if (grp->members) eina_list_free(grp->members);
|
if (grp->members) eina_list_free(grp->members);
|
||||||
grp->members = members;
|
grp->members = members;
|
||||||
snprintf(text, sizeof(text), "%d", eina_list_count(members));
|
snprintf(text, sizeof(text), "%d", eina_list_count(members));
|
||||||
_overlay_default_layout_text_update(grp->ovl, text);
|
_overlay_default_layout_text_update(grp->ovl, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_overlay_group_region_get(Overlay_Group *grp, double *lon, double *lat)
|
|
||||||
{
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(grp);
|
|
||||||
Evas_Coord xx, yy;
|
|
||||||
_overlay_default_coord_get(grp->ovl, &xx, &yy, NULL, NULL);
|
|
||||||
_coord_to_canvas(grp->wd, xx, yy, &xx, &yy);
|
|
||||||
elm_map_canvas_to_region_convert(grp->wd->obj, xx, yy, lon, lat);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_overlay_group_icon_update(Overlay_Group *grp, const Evas_Object *icon)
|
_overlay_group_icon_update(Overlay_Group *grp, const Evas_Object *icon)
|
||||||
{
|
{
|
||||||
|
@ -1829,18 +1826,23 @@ _overlay_class_new(Widget_Data *wd)
|
||||||
return ovl;
|
return ovl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_overlay_bubble_hide(Overlay_Bubble *bubble)
|
|
||||||
{
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(bubble);
|
|
||||||
if (bubble->obj) evas_object_hide(bubble->obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_overlay_bubble_coord_update(Overlay_Bubble *bubble)
|
_overlay_bubble_coord_update(Overlay_Bubble *bubble)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN(bubble);
|
EINA_SAFETY_ON_NULL_RETURN(bubble);
|
||||||
if (!(bubble->pobj))
|
if (bubble->pobj)
|
||||||
|
{
|
||||||
|
Evas_Coord x, y, w, h;
|
||||||
|
evas_object_geometry_get(bubble->pobj, &x, &y, &w, &h);
|
||||||
|
bubble->x = x + (w / 2);
|
||||||
|
bubble->y = y - (bubble->h / 2);
|
||||||
|
_canvas_to_coord(bubble->wd, bubble->x, bubble->y,
|
||||||
|
&(bubble->x), &(bubble->y));
|
||||||
|
_coord_to_region_convert(bubble->wd, bubble->x, bubble->y,
|
||||||
|
bubble->wd->size.w,
|
||||||
|
&(bubble->lon), &(bubble->lat));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_region_to_coord_convert(bubble->wd, bubble->lon, bubble->lat,
|
_region_to_coord_convert(bubble->wd, bubble->lon, bubble->lat,
|
||||||
bubble->wd->size.w, &bubble->x, &bubble->y);
|
bubble->wd->size.w, &bubble->x, &bubble->y);
|
||||||
|
@ -1867,45 +1869,27 @@ _overlay_bubble_coord_get(Overlay_Bubble *bubble, Evas_Coord *x, Evas_Coord *y,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_overlay_bubble_show(Overlay_Bubble *bubble)
|
_overlay_bubble_show_hide(Overlay_Bubble *bubble, Eina_Bool visible)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN(bubble);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(bubble, EINA_FALSE);
|
||||||
if (!(bubble->pobj))
|
EINA_SAFETY_ON_NULL_RETURN_VAL(bubble->obj, EINA_FALSE);
|
||||||
|
|
||||||
|
if (!visible) evas_object_hide(bubble->obj);
|
||||||
|
else if (bubble->pobj && !evas_object_visible_get(bubble->pobj))
|
||||||
|
{
|
||||||
|
evas_object_hide(bubble->obj);
|
||||||
|
visible = EINA_FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_coord_to_canvas(bubble->wd, bubble->x, bubble->y,
|
_coord_to_canvas(bubble->wd, bubble->x, bubble->y,
|
||||||
&(bubble->x), &(bubble->y));
|
&(bubble->x), &(bubble->y));
|
||||||
_obj_place(bubble->obj, bubble->x - (bubble->w /2),
|
_obj_place(bubble->obj, bubble->x - (bubble->w /2),
|
||||||
bubble->y - (bubble->h /2), bubble->w, bubble->h);
|
bubble->y - (bubble->h /2), bubble->w, bubble->h);
|
||||||
|
evas_object_raise(bubble->obj);
|
||||||
}
|
}
|
||||||
}
|
return visible;
|
||||||
|
|
||||||
static void
|
|
||||||
_overlay_bubble_chase(Overlay_Bubble *bubble)
|
|
||||||
{
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(bubble);
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(bubble->pobj);
|
|
||||||
|
|
||||||
Evas_Coord x, y, w;
|
|
||||||
evas_object_geometry_get(bubble->pobj, &x, &y, &w, NULL);
|
|
||||||
x = x + (w / 2) - (bubble->w / 2);
|
|
||||||
y = y - bubble->h;
|
|
||||||
_obj_place(bubble->obj, x, y, bubble->w, bubble->h);
|
|
||||||
evas_object_raise(bubble->obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_overlay_bubble_hide_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
||||||
{
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(data);
|
|
||||||
_overlay_bubble_hide(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_overlay_bubble_chase_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
||||||
{
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(data);
|
|
||||||
_overlay_bubble_chase(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1916,15 +1900,6 @@ _overlay_bubble_free(Overlay_Bubble* bubble)
|
||||||
evas_object_del(bubble->bx);
|
evas_object_del(bubble->bx);
|
||||||
evas_object_del(bubble->sc);
|
evas_object_del(bubble->sc);
|
||||||
evas_object_del(bubble->obj);
|
evas_object_del(bubble->obj);
|
||||||
if (bubble->pobj)
|
|
||||||
{
|
|
||||||
evas_object_event_callback_del_full(bubble->pobj, EVAS_CALLBACK_HIDE,
|
|
||||||
_overlay_bubble_hide_cb, bubble);
|
|
||||||
evas_object_event_callback_del_full(bubble->pobj, EVAS_CALLBACK_SHOW,
|
|
||||||
_overlay_bubble_chase_cb, bubble);
|
|
||||||
evas_object_event_callback_del_full(bubble->pobj, EVAS_CALLBACK_MOVE,
|
|
||||||
_overlay_bubble_chase_cb, bubble);
|
|
||||||
}
|
|
||||||
free(bubble);
|
free(bubble);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1941,8 +1916,6 @@ _overlay_bubble_new(Elm_Map_Overlay *overlay)
|
||||||
bubble->obj = edje_object_add(evas_object_evas_get(overlay->wd->obj));
|
bubble->obj = edje_object_add(evas_object_evas_get(overlay->wd->obj));
|
||||||
_elm_theme_object_set(overlay->wd->obj, bubble->obj , "map", "marker_bubble",
|
_elm_theme_object_set(overlay->wd->obj, bubble->obj , "map", "marker_bubble",
|
||||||
elm_widget_style_get(overlay->wd->obj));
|
elm_widget_style_get(overlay->wd->obj));
|
||||||
evas_object_event_callback_add(bubble->obj, EVAS_CALLBACK_MOUSE_UP,
|
|
||||||
_overlay_bubble_chase_cb, bubble);
|
|
||||||
evas_object_event_callback_add(bubble->obj, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add(bubble->obj, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
_overlay_clicked_cb, overlay);
|
_overlay_clicked_cb, overlay);
|
||||||
|
|
||||||
|
@ -2369,6 +2342,10 @@ _overlay_grouping(Eina_List *clas_membs, Elm_Map_Overlay *boss)
|
||||||
sum_y = (sum_y + by) / (cnt + 1);
|
sum_y = (sum_y + by) / (cnt + 1);
|
||||||
grp_membs = eina_list_append(grp_membs, boss);
|
grp_membs = eina_list_append(grp_membs, boss);
|
||||||
_overlay_group_coord_member_update(boss->grp, sum_x, sum_y, grp_membs);
|
_overlay_group_coord_member_update(boss->grp, sum_x, sum_y, grp_membs);
|
||||||
|
|
||||||
|
// Append group to all overlay list
|
||||||
|
boss->wd->group_overlays = eina_list_append(boss->wd->group_overlays,
|
||||||
|
boss->grp->overlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2376,54 +2353,64 @@ static void
|
||||||
_overlay_show(Elm_Map_Overlay *overlay)
|
_overlay_show(Elm_Map_Overlay *overlay)
|
||||||
{
|
{
|
||||||
Widget_Data *wd = overlay->wd;
|
Widget_Data *wd = overlay->wd;
|
||||||
Eina_Bool hide = EINA_FALSE;
|
|
||||||
|
|
||||||
if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) return;
|
|
||||||
|
|
||||||
if (overlay->paused) return;
|
if (overlay->paused) return;
|
||||||
if ((overlay->grp->clas) && (overlay->grp->clas->paused)) return;
|
if ((overlay->grp) && (overlay->grp->clas) &&
|
||||||
|
(overlay->grp->clas->paused)) return;
|
||||||
|
|
||||||
if (((overlay->grp->in) || (overlay->hide) ||
|
overlay->visible = EINA_TRUE;
|
||||||
(overlay->zoom_min > wd->zoom)))
|
if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS)
|
||||||
hide = EINA_TRUE;
|
{
|
||||||
if ((overlay->grp->clas) && ((overlay->grp->clas->hide) ||
|
overlay->visible = EINA_FALSE;
|
||||||
(overlay->grp->clas->zoom_min > wd->zoom)))
|
return;
|
||||||
hide = EINA_TRUE;
|
}
|
||||||
|
if (overlay->grp)
|
||||||
|
{
|
||||||
|
if ((overlay->grp->in) ||
|
||||||
|
(overlay->hide) || (overlay->zoom_min > wd->zoom))
|
||||||
|
overlay->visible = EINA_FALSE;
|
||||||
|
|
||||||
if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT)
|
if ((overlay->grp->clas) &&
|
||||||
{
|
((overlay->grp->clas->hide) ||
|
||||||
if (hide) _overlay_default_hide(overlay->ovl);
|
(overlay->grp->clas->zoom_min > wd->zoom)))
|
||||||
else _overlay_default_show(overlay->ovl);
|
overlay->visible = EINA_FALSE;
|
||||||
}
|
}
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE)
|
|
||||||
|
switch (overlay->type)
|
||||||
{
|
{
|
||||||
if (hide) _overlay_bubble_hide(overlay->ovl);
|
case ELM_MAP_OVERLAY_TYPE_DEFAULT:
|
||||||
else _overlay_bubble_show(overlay->ovl);
|
if (overlay->visible) _overlay_default_show(overlay->ovl);
|
||||||
}
|
else _overlay_default_hide(overlay->ovl);
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_ROUTE)
|
break;
|
||||||
{
|
case ELM_MAP_OVERLAY_TYPE_GROUP:
|
||||||
if (hide) _overlay_route_hide(overlay->ovl);
|
if (overlay->visible) _overlay_group_show(overlay->ovl);
|
||||||
else _overlay_route_show(overlay->ovl);
|
else _overlay_group_hide(overlay->ovl);
|
||||||
}
|
break;
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_LINE)
|
case ELM_MAP_OVERLAY_TYPE_BUBBLE:
|
||||||
{
|
overlay->visible = _overlay_bubble_show_hide(overlay->ovl,
|
||||||
if (hide) _overlay_line_hide(overlay->ovl);
|
overlay->visible);
|
||||||
else _overlay_line_show(overlay->ovl);
|
break;
|
||||||
}
|
case ELM_MAP_OVERLAY_TYPE_ROUTE:
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_POLYGON)
|
if (overlay->visible) _overlay_route_show(overlay->ovl);
|
||||||
{
|
else _overlay_route_hide(overlay->ovl);
|
||||||
if (hide) _overlay_polygon_hide(overlay->ovl);
|
break;
|
||||||
else _overlay_polygon_show(overlay->ovl);
|
case ELM_MAP_OVERLAY_TYPE_LINE:
|
||||||
}
|
if (overlay->visible) _overlay_line_show(overlay->ovl);
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CIRCLE)
|
else _overlay_line_hide(overlay->ovl);
|
||||||
{
|
break;
|
||||||
if (hide) _overlay_circle_hide(overlay->ovl);
|
case ELM_MAP_OVERLAY_TYPE_POLYGON:
|
||||||
else _overlay_circle_show(overlay->ovl);
|
if (overlay->visible) _overlay_polygon_show(overlay->ovl);
|
||||||
}
|
else _overlay_polygon_hide(overlay->ovl);
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_SCALE)
|
break;
|
||||||
{
|
case ELM_MAP_OVERLAY_TYPE_CIRCLE:
|
||||||
if (hide) _overlay_scale_hide(overlay->ovl);
|
if (overlay->visible) _overlay_circle_show(overlay->ovl);
|
||||||
else _overlay_scale_show(overlay->ovl);
|
else _overlay_circle_hide(overlay->ovl);
|
||||||
|
break;
|
||||||
|
case ELM_MAP_OVERLAY_TYPE_SCALE:
|
||||||
|
if (overlay->visible) _overlay_scale_show(overlay->ovl);
|
||||||
|
else _overlay_scale_hide(overlay->ovl);
|
||||||
|
default:
|
||||||
|
ERR("Invalid overlay type to show: %d", overlay->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2435,13 +2422,19 @@ _overlay_place(Widget_Data *wd)
|
||||||
Eina_List *l, *ll;
|
Eina_List *l, *ll;
|
||||||
Elm_Map_Overlay *overlay;
|
Elm_Map_Overlay *overlay;
|
||||||
|
|
||||||
// Reset group & Update overlays coord
|
eina_list_free(wd->group_overlays);
|
||||||
|
wd->group_overlays = NULL;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(wd->overlays, l, overlay)
|
EINA_LIST_FOREACH(wd->overlays, l, overlay)
|
||||||
{
|
{
|
||||||
if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) continue;
|
// Reset groups
|
||||||
|
if ((overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) ||
|
||||||
|
(overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS)) continue;
|
||||||
overlay->grp->in = EINA_FALSE;
|
overlay->grp->in = EINA_FALSE;
|
||||||
overlay->grp->boss = EINA_FALSE;
|
overlay->grp->boss = EINA_FALSE;
|
||||||
|
_overlay_group_hide(overlay->grp);
|
||||||
|
|
||||||
|
// Update overlays' coord
|
||||||
if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT)
|
if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT)
|
||||||
_overlay_default_coord_update(overlay->ovl);
|
_overlay_default_coord_update(overlay->ovl);
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE)
|
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE)
|
||||||
|
@ -2468,16 +2461,9 @@ _overlay_place(Widget_Data *wd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place overlays
|
// Place group overlays and overlays
|
||||||
|
EINA_LIST_FOREACH(wd->group_overlays, l, overlay) _overlay_show(overlay);
|
||||||
EINA_LIST_FOREACH(wd->overlays, l, overlay) _overlay_show(overlay);
|
EINA_LIST_FOREACH(wd->overlays, l, overlay) _overlay_show(overlay);
|
||||||
|
|
||||||
// Place group overlays on top of overlays
|
|
||||||
EINA_LIST_FOREACH(wd->overlays, l, overlay)
|
|
||||||
{
|
|
||||||
if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) continue;
|
|
||||||
if (overlay->grp->boss) _overlay_group_show(overlay->grp);
|
|
||||||
else _overlay_group_hide(overlay->grp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -2897,22 +2883,6 @@ _name_parse(Elm_Map_Name *n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Grid *_get_current_grid(Widget_Data *wd)
|
|
||||||
{
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
|
|
||||||
Eina_List *l;
|
|
||||||
Grid *g = NULL, *ret = NULL;
|
|
||||||
EINA_LIST_FOREACH(wd->grids, l, g)
|
|
||||||
{
|
|
||||||
if (wd->zoom == g->zoom)
|
|
||||||
{
|
|
||||||
ret = g;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_route_cb(void *data, const char *file, int status)
|
_route_cb(void *data, const char *file, int status)
|
||||||
{
|
{
|
||||||
|
@ -3749,6 +3719,8 @@ _del_pre_hook(Evas_Object *obj)
|
||||||
EINA_LIST_FOREACH_SAFE(wd->overlays, l, ll, overlay)
|
EINA_LIST_FOREACH_SAFE(wd->overlays, l, ll, overlay)
|
||||||
elm_map_overlay_del(overlay);
|
elm_map_overlay_del(overlay);
|
||||||
eina_list_free(wd->overlays);
|
eina_list_free(wd->overlays);
|
||||||
|
eina_list_free(wd->group_overlays);
|
||||||
|
eina_list_free(wd->all_overlays);
|
||||||
|
|
||||||
EINA_LIST_FREE(wd->track, track) evas_object_del(track);
|
EINA_LIST_FREE(wd->track, track) evas_object_del(track);
|
||||||
|
|
||||||
|
@ -3889,7 +3861,7 @@ elm_map_add(Evas_Object *parent)
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
|
||||||
_mouse_up, wd);
|
_mouse_up, wd);
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL,
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL,
|
||||||
_mouse_wheel_cb,wd);
|
_mouse_wheel_cb, wd);
|
||||||
wd->obj = obj;
|
wd->obj = obj;
|
||||||
|
|
||||||
wd->scr = elm_smart_scroller_add(e);
|
wd->scr = elm_smart_scroller_add(e);
|
||||||
|
@ -4723,6 +4695,32 @@ elm_map_overlay_add(Evas_Object *obj, double lon, double lat)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_List *
|
||||||
|
elm_map_overlays_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_ELEMENTARY_ECORE_CON
|
||||||
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
|
||||||
|
|
||||||
|
Eina_List *l;
|
||||||
|
Elm_Map_Overlay *ovl;
|
||||||
|
|
||||||
|
eina_list_free(wd->all_overlays);
|
||||||
|
wd->all_overlays = NULL;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(wd->overlays, l, ovl)
|
||||||
|
wd->all_overlays = eina_list_append(wd->all_overlays, ovl);
|
||||||
|
EINA_LIST_FOREACH(wd->group_overlays, l, ovl)
|
||||||
|
wd->all_overlays = eina_list_append(wd->all_overlays, ovl);
|
||||||
|
|
||||||
|
return wd->all_overlays;
|
||||||
|
#else
|
||||||
|
(void) obj;
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_map_overlay_del(Elm_Map_Overlay *overlay)
|
elm_map_overlay_del(Elm_Map_Overlay *overlay)
|
||||||
{
|
{
|
||||||
|
@ -4907,6 +4905,21 @@ elm_map_overlay_paused_get(const Elm_Map_Overlay *overlay)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
elm_map_overlay_visible_get(const Elm_Map_Overlay *overlay)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_ELEMENTARY_ECORE_CON
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, EINA_FALSE);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(overlay->wd, EINA_FALSE);
|
||||||
|
ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype) EINA_FALSE;
|
||||||
|
|
||||||
|
return overlay->visible;
|
||||||
|
#else
|
||||||
|
(void) overlay;
|
||||||
|
return EINA_FALSE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_map_overlay_show(Elm_Map_Overlay *overlay)
|
elm_map_overlay_show(Elm_Map_Overlay *overlay)
|
||||||
{
|
{
|
||||||
|
@ -4980,6 +4993,7 @@ elm_map_overlay_region_set(Elm_Map_Overlay *overlay, double lon, double lat)
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE)
|
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE)
|
||||||
{
|
{
|
||||||
Overlay_Bubble *ovl = overlay->ovl;
|
Overlay_Bubble *ovl = overlay->ovl;
|
||||||
|
ovl->pobj = NULL;
|
||||||
ovl->lon = lon;
|
ovl->lon = lon;
|
||||||
ovl->lat = lat;
|
ovl->lat = lat;
|
||||||
}
|
}
|
||||||
|
@ -5004,7 +5018,8 @@ elm_map_overlay_region_get(const Elm_Map_Overlay *overlay, double *lon, double *
|
||||||
if (overlay->type == ELM_MAP_OVERLAY_TYPE_GROUP)
|
if (overlay->type == ELM_MAP_OVERLAY_TYPE_GROUP)
|
||||||
{
|
{
|
||||||
Overlay_Group *ovl = overlay->ovl;
|
Overlay_Group *ovl = overlay->ovl;
|
||||||
_overlay_group_region_get(ovl, lon, lat);
|
if (lon) *lon = ovl->lon;
|
||||||
|
if (lat) *lat = ovl->lat;
|
||||||
}
|
}
|
||||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT)
|
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT)
|
||||||
{
|
{
|
||||||
|
@ -5392,25 +5407,7 @@ elm_map_overlay_bubble_follow(Elm_Map_Overlay *bubble, const Elm_Map_Overlay *pa
|
||||||
Evas_Object *pobj = _overlay_obj_get(parent);
|
Evas_Object *pobj = _overlay_obj_get(parent);
|
||||||
if (!pobj) return;
|
if (!pobj) return;
|
||||||
|
|
||||||
if (ovl->pobj)
|
|
||||||
{
|
|
||||||
evas_object_event_callback_del_full(ovl->pobj, EVAS_CALLBACK_HIDE,
|
|
||||||
_overlay_bubble_hide_cb, ovl);
|
|
||||||
evas_object_event_callback_del_full(ovl->pobj, EVAS_CALLBACK_SHOW,
|
|
||||||
_overlay_bubble_chase_cb, ovl);
|
|
||||||
evas_object_event_callback_del_full(ovl->pobj, EVAS_CALLBACK_MOVE,
|
|
||||||
_overlay_bubble_chase_cb, ovl);
|
|
||||||
}
|
|
||||||
|
|
||||||
ovl->pobj = pobj;
|
ovl->pobj = pobj;
|
||||||
evas_object_event_callback_add(ovl->pobj, EVAS_CALLBACK_HIDE,
|
|
||||||
_overlay_bubble_hide_cb, ovl);
|
|
||||||
evas_object_event_callback_add(ovl->pobj, EVAS_CALLBACK_SHOW,
|
|
||||||
_overlay_bubble_chase_cb, ovl);
|
|
||||||
evas_object_event_callback_add(ovl->pobj, EVAS_CALLBACK_MOVE,
|
|
||||||
_overlay_bubble_chase_cb, ovl);
|
|
||||||
|
|
||||||
_overlay_bubble_chase(ovl);
|
|
||||||
evas_object_smart_changed(bubble->wd->pan_smart);
|
evas_object_smart_changed(bubble->wd->pan_smart);
|
||||||
#else
|
#else
|
||||||
(void) bubble;
|
(void) bubble;
|
||||||
|
|
|
@ -178,7 +178,7 @@ typedef enum _Elm_Map_Overlay_Type
|
||||||
typedef struct _Elm_Map_Marker Elm_Map_Marker; /**< A marker to be shown in a specific point of the map. Can be created with elm_map_marker_add() and deleted with elm_map_marker_remove(). */
|
typedef struct _Elm_Map_Marker Elm_Map_Marker; /**< A marker to be shown in a specific point of the map. Can be created with elm_map_marker_add() and deleted with elm_map_marker_remove(). */
|
||||||
typedef struct _Elm_Map_Marker_Class Elm_Map_Marker_Class; /**< Each marker must be associated to a class. It's required to add a mark. The class defines the style of the marker when a marker is displayed alone (not grouped). A new class can be created with elm_map_marker_class_new(). */
|
typedef struct _Elm_Map_Marker_Class Elm_Map_Marker_Class; /**< Each marker must be associated to a class. It's required to add a mark. The class defines the style of the marker when a marker is displayed alone (not grouped). A new class can be created with elm_map_marker_class_new(). */
|
||||||
typedef struct _Elm_Map_Group_Class Elm_Map_Group_Class; /**< Each marker must be associated to a group class. It's required to add a mark. The group class defines the style of the marker when a marker is grouped to other markers. Markers with the same group are grouped if they are close. A new group class can be created with elm_map_marker_group_class_new(). */
|
typedef struct _Elm_Map_Group_Class Elm_Map_Group_Class; /**< Each marker must be associated to a group class. It's required to add a mark. The group class defines the style of the marker when a marker is grouped to other markers. Markers with the same group are grouped if they are close. A new group class can be created with elm_map_marker_group_class_new(). */
|
||||||
typedef struct _Elm_Map_Route Elm_Map_Route; /**< A route to be shown in the map. Can be created with elm_map_route_add() and deleted with elm_map_route_remove(). */
|
typedef struct _Elm_Map_Route Elm_Map_Route; /**< A route to be shown in the map. Can be created with elm_map_route_add() and deleted with elm_map_route_del(). */
|
||||||
typedef struct _Elm_Map_Name Elm_Map_Name; /**< A handle for specific coordinates. */
|
typedef struct _Elm_Map_Name Elm_Map_Name; /**< A handle for specific coordinates. */
|
||||||
typedef struct _Elm_Map_Overlay Elm_Map_Overlay; /**< A overlay to be shown in a specific point of the map. This can be created by elm_map_overlay_add() and similar functions and deleted by elm_map_overlay_del(). */
|
typedef struct _Elm_Map_Overlay Elm_Map_Overlay; /**< A overlay to be shown in a specific point of the map. This can be created by elm_map_overlay_add() and similar functions and deleted by elm_map_overlay_del(). */
|
||||||
|
|
||||||
|
@ -587,6 +587,19 @@ EAPI const char *elm_map_user_agent_get(const Evas_Object *obj);
|
||||||
*/
|
*/
|
||||||
EAPI Elm_Map_Overlay * elm_map_overlay_add(Evas_Object *obj, double lon, double lat);
|
EAPI Elm_Map_Overlay * elm_map_overlay_add(Evas_Object *obj, double lon, double lat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all overlays in the map object.
|
||||||
|
*
|
||||||
|
* @param obj The map object to return overlays.
|
||||||
|
* @return The list of all overlays or @c NULL upon failure.
|
||||||
|
*
|
||||||
|
* This list includes group overlays also.
|
||||||
|
* So this can be changed dynamically while zooming and panning.
|
||||||
|
*
|
||||||
|
* @ingroup Map
|
||||||
|
*/
|
||||||
|
EAPI EAPI Eina_List * elm_map_overlays_get(Evas_Object *obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a overlay from the map. This function can delete all types
|
* Delete a overlay from the map. This function can delete all types
|
||||||
* of overlays.
|
* of overlays.
|
||||||
|
@ -732,6 +745,20 @@ EAPI void elm_map_overlay_paused_set(Elm_Map_Overlay *overlay,
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool elm_map_overlay_paused_get(const Elm_Map_Overlay *overlay);
|
EAPI Eina_Bool elm_map_overlay_paused_get(const Elm_Map_Overlay *overlay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a value whether the overlay is visible or not.
|
||||||
|
*
|
||||||
|
* @param overlay The overlay to return visible state.
|
||||||
|
* @return @c EINA_TRUE means overlay is visible. @c EINA_FALSE indicates
|
||||||
|
* it is not.
|
||||||
|
*
|
||||||
|
* The visible of the overlay can not be set.
|
||||||
|
* This value can be changed dynamically while zooming and panning
|
||||||
|
*
|
||||||
|
* @ingroup Map
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool elm_map_overlay_visible_get(const Elm_Map_Overlay *overlay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the content object of the overlay.
|
* Set the content object of the overlay.
|
||||||
*
|
*
|
||||||
|
@ -1354,10 +1381,10 @@ EAPI const char *elm_map_source_get(const Evas_Object *obj, Elm_Map_So
|
||||||
* of #ELM_MAP_ROUTE_METHOD_SHORTEST or #ELM_MAP_ROUTE_METHOD_FASTEST.
|
* of #ELM_MAP_ROUTE_METHOD_SHORTEST or #ELM_MAP_ROUTE_METHOD_FASTEST.
|
||||||
*
|
*
|
||||||
* Routes created with this method can be deleted with
|
* Routes created with this method can be deleted with
|
||||||
* elm_map_route_remove(),
|
* elm_map_route_del(),
|
||||||
* and distance can be get with elm_map_route_distance_get().
|
* and distance can be get with elm_map_route_distance_get().
|
||||||
*
|
*
|
||||||
* @see elm_map_route_remove()
|
* @see elm_map_route_del()
|
||||||
* @see elm_map_route_distance_get()
|
* @see elm_map_route_distance_get()
|
||||||
* @see elm_map_source_set()
|
* @see elm_map_source_set()
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue