forked from enlightenment/efl
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Add line, polygon, circle, scale overlay This patch adds new overlay APIs (line, polygon, circle, scale) for elm_map. These overlays are adhered to map even though zooming, panning. You can test these by doing "elementary_test --> click mouse right --> overlay" SVN revision: 69562
This commit is contained in:
parent
047fcff3c3
commit
9e3b73137b
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
After Width: | Height: | Size: 244 B |
|
@ -742,4 +742,59 @@ group { name: "elm/map/marker_bubble/default";
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
group { name: "elm/map/circle/base/default";
|
||||
images {
|
||||
image: "map_circle.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "base";
|
||||
ignore_flags: ON_HOLD;
|
||||
description { state: "default" 0.0;
|
||||
image.normal: "map_circle.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
group { name: "elm/map/scale/base/default";
|
||||
data {
|
||||
item: size_w 100;
|
||||
item: size_h 25;
|
||||
}
|
||||
images {
|
||||
image: "map_scale.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "base";
|
||||
ignore_flags: ON_HOLD;
|
||||
description { state: "default" 0.0;
|
||||
image.normal: "map_scale.png";
|
||||
image.border: 10 10 10 10;
|
||||
}
|
||||
}
|
||||
part { name: "elm.text";
|
||||
type: TEXT;
|
||||
ignore_flags: ON_HOLD;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
color: 224 224 224 255;
|
||||
color3: 0 0 0 64;
|
||||
rel1 {
|
||||
relative: 0 0;
|
||||
offset: 1 1;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1 1;
|
||||
offset: -1 -1;
|
||||
}
|
||||
text {
|
||||
font: "Sans,Edje-Vera";
|
||||
size: 10;
|
||||
min: 0 0;
|
||||
align: 0.1 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,11 @@ static Elm_Map_Overlay *route_start, *route_end, *route_clas;
|
|||
static Elm_Map_Overlay *bubble_img;
|
||||
static Elm_Map_Overlay *bubble_parking;
|
||||
static Elm_Map_Overlay *route_ovl;
|
||||
static Elm_Map_Overlay *line_start, *line_end, *line;
|
||||
static Elm_Map_Overlay *poly;
|
||||
static Elm_Map_Overlay *circle;
|
||||
static Elm_Map_Overlay *scale;
|
||||
static Eina_List *poly_points;
|
||||
|
||||
static Evas_Object *menu, *fs_win;
|
||||
static Elm_Map_Route *route;
|
||||
|
@ -81,6 +86,109 @@ _route_icon_get(Evas_Object *obj)
|
|||
return icon;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_box_get(Evas_Object *obj, Overlay_Data *data, Elm_Map_Overlay *ovl)
|
||||
{
|
||||
Evas_Object *bx, *img, *label;
|
||||
double lon, lat;
|
||||
char buf[256];
|
||||
bx = elm_box_add(obj);
|
||||
evas_object_show(bx);
|
||||
|
||||
img = evas_object_image_add(evas_object_evas_get(obj));
|
||||
evas_object_image_file_set(img, data->file, NULL);
|
||||
evas_object_image_filled_set(img, EINA_TRUE);
|
||||
evas_object_size_hint_min_set(img, 64, 64);
|
||||
evas_object_show(img);
|
||||
elm_box_pack_end(bx, img);
|
||||
|
||||
label = elm_label_add(bx);
|
||||
elm_map_overlay_region_get(ovl, &lon, &lat);
|
||||
snprintf(buf, sizeof(buf), "%0.4lf %0.4lf", lon, lat);
|
||||
elm_object_text_set(label, buf);
|
||||
evas_object_show(label);
|
||||
elm_box_pack_end(bx, label);
|
||||
return bx;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_label_get(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object *label;
|
||||
label = elm_label_add(obj);
|
||||
elm_object_text_set(label, "Here is a parking lot.");
|
||||
return label;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_icon_get(Evas_Object *obj, Overlay_Data *data)
|
||||
{
|
||||
Evas_Object *icon = elm_icon_add(obj);
|
||||
elm_icon_file_set(icon, data->file, NULL);
|
||||
evas_object_show(icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_hide(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||
{
|
||||
elm_map_overlay_hide_set(data, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_pause(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||
{
|
||||
elm_map_overlay_paused_set(data, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_unpause(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||
{
|
||||
elm_map_overlay_paused_set(data, EINA_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_show(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||
{
|
||||
elm_map_overlay_show(data);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_btn_box_get(Evas_Object *obj, Elm_Map_Overlay *ovl)
|
||||
{
|
||||
Evas_Object *bx, *btn, *btn2, *btn3, *btn4;
|
||||
bx = elm_box_add(obj);
|
||||
elm_box_horizontal_set(bx, EINA_TRUE);
|
||||
evas_object_show(bx);
|
||||
|
||||
btn = elm_button_add(bx);
|
||||
elm_object_text_set(btn, "Hide");
|
||||
evas_object_smart_callback_add(btn, "clicked", _overlay_hide, ovl);
|
||||
evas_object_show(btn);
|
||||
elm_box_pack_end(bx, btn);
|
||||
|
||||
btn2 = elm_button_add(bx);
|
||||
elm_object_text_set(btn2, "Pause");
|
||||
evas_object_smart_callback_add(btn2, "clicked", _overlay_pause, ovl);
|
||||
evas_object_show(btn2);
|
||||
elm_box_pack_end(bx, btn2);
|
||||
|
||||
btn3 = elm_button_add(bx);
|
||||
elm_object_text_set(btn3, "Unpause");
|
||||
evas_object_smart_callback_add(btn3, "clicked", _overlay_unpause, ovl);
|
||||
evas_object_show(btn3);
|
||||
elm_box_pack_end(bx, btn3);
|
||||
|
||||
btn4 = elm_button_add(bx);
|
||||
elm_object_text_set(btn4, "Show");
|
||||
evas_object_smart_callback_add(btn4, "clicked", _overlay_show, ovl);
|
||||
evas_object_show(btn4);
|
||||
elm_box_pack_end(bx, btn4);
|
||||
|
||||
return bx;
|
||||
}
|
||||
|
||||
static void
|
||||
_bubble_parking_follow(Evas_Object *map)
|
||||
{
|
||||
|
@ -316,7 +424,16 @@ _map_name_loaded_fail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *
|
|||
}
|
||||
|
||||
static void
|
||||
map_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
_src_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Map_Source *s = data;
|
||||
|
||||
if (!s) return;
|
||||
elm_map_source_set(s->map, s->type, s->source_name);
|
||||
}
|
||||
|
||||
static void
|
||||
_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
|
||||
if (elm_map_zoom_get(data) < 12) elm_map_zoom_set(data, 12);
|
||||
|
@ -324,7 +441,7 @@ map_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUS
|
|||
}
|
||||
|
||||
static void
|
||||
map_bring_seoul(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
_bring_seoul(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
|
||||
if (elm_map_zoom_get(data) < 12) elm_map_zoom_set(data, 12);
|
||||
|
@ -504,115 +621,74 @@ _zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED
|
|||
}
|
||||
|
||||
static void
|
||||
src_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
_line_add(void *data, Evas_Object *obj __UNUSED__, void *ei __UNUSED__)
|
||||
{
|
||||
Map_Source *s = data;
|
||||
|
||||
if (!s) return;
|
||||
elm_map_source_set(s->map, s->type, s->source_name);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_box_get(Evas_Object *obj, Overlay_Data *data, Elm_Map_Overlay *ovl)
|
||||
{
|
||||
Evas_Object *bx, *img, *label;
|
||||
double lon, lat;
|
||||
char buf[256];
|
||||
bx = elm_box_add(obj);
|
||||
evas_object_show(bx);
|
||||
|
||||
img = evas_object_image_add(evas_object_evas_get(obj));
|
||||
evas_object_image_file_set(img, data->file, NULL);
|
||||
evas_object_image_filled_set(img, EINA_TRUE);
|
||||
evas_object_size_hint_min_set(img, 64, 64);
|
||||
evas_object_show(img);
|
||||
elm_box_pack_end(bx, img);
|
||||
elm_map_canvas_to_region_convert(data, down_x, down_y, &lon, &lat);
|
||||
printf("line marker: %d %d %lf %lf\n", down_x, down_y, lon, lat);
|
||||
if (line_start && line_end)
|
||||
{
|
||||
elm_map_overlay_del(line_start);
|
||||
elm_map_overlay_del(line_end);
|
||||
elm_map_overlay_del(line);
|
||||
line_start = NULL;
|
||||
line_end = NULL;
|
||||
line = NULL;
|
||||
}
|
||||
if (!line_start) line_start = elm_map_overlay_add(data, lon, lat);
|
||||
else if (!line_end) line_end = elm_map_overlay_add(data, lon, lat);
|
||||
|
||||
label = elm_label_add(bx);
|
||||
elm_map_overlay_region_get(ovl, &lon, &lat);
|
||||
snprintf(buf, sizeof(buf), "%0.4lf %0.4lf", lon, lat);
|
||||
elm_object_text_set(label, buf);
|
||||
evas_object_show(label);
|
||||
elm_box_pack_end(bx, label);
|
||||
return bx;
|
||||
if (line_start && line_end)
|
||||
{
|
||||
double flon, flat, tlon, tlat;
|
||||
elm_map_overlay_region_get(line_start, &flon, &flat);
|
||||
elm_map_overlay_region_get(line_end, &tlon, &tlat);
|
||||
line = elm_map_overlay_line_add(data, flon, flat, tlon, tlat);
|
||||
printf("line add: (%lf, %lf) --> (%lf, %lf)\n", flon, flat, tlon, tlat);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_hide(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||
_poly_add(void *data, Evas_Object *obj __UNUSED__, void *ei __UNUSED__)
|
||||
{
|
||||
elm_map_overlay_hide_set(data, EINA_TRUE);
|
||||
double lon, lat;
|
||||
|
||||
elm_map_canvas_to_region_convert(data, down_x, down_y, &lon, &lat);
|
||||
printf("%d %d %lf %lf\n", down_x, down_y, lon, lat);
|
||||
|
||||
if (!poly) poly = elm_map_overlay_polygon_add(data);
|
||||
poly_points = eina_list_append(poly_points,
|
||||
elm_map_overlay_add(data, lon, lat));
|
||||
elm_map_overlay_polygon_region_add(poly, lon, lat);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_pause(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||
_poly_clear(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *ei __UNUSED__)
|
||||
{
|
||||
elm_map_overlay_paused_set(data, EINA_TRUE);
|
||||
Elm_Map_Overlay *ovl;
|
||||
if (poly) elm_map_overlay_del(poly);
|
||||
EINA_LIST_FREE(poly_points, ovl) elm_map_overlay_del(ovl);
|
||||
poly = NULL;
|
||||
poly_points = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_unpause(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||
_circle_add(void *data, Evas_Object *obj __UNUSED__, void *ei __UNUSED__)
|
||||
{
|
||||
elm_map_overlay_paused_set(data, EINA_FALSE);
|
||||
double radius = 100;
|
||||
double lon, lat;
|
||||
|
||||
if (circle) elm_map_overlay_del(circle);
|
||||
elm_map_canvas_to_region_convert(data, down_x, down_y, &lon, &lat);
|
||||
circle = elm_map_overlay_circle_add(data, lon, lat, radius);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_show(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
|
||||
_scale_add(void *data, Evas_Object *obj __UNUSED__, void *ei __UNUSED__)
|
||||
{
|
||||
elm_map_overlay_show(data);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_btn_box_get(Evas_Object *obj, Elm_Map_Overlay *ovl)
|
||||
{
|
||||
Evas_Object *bx, *btn, *btn2, *btn3, *btn4;
|
||||
bx = elm_box_add(obj);
|
||||
elm_box_horizontal_set(bx, EINA_TRUE);
|
||||
evas_object_show(bx);
|
||||
|
||||
btn = elm_button_add(bx);
|
||||
elm_object_text_set(btn, "Hide");
|
||||
evas_object_smart_callback_add(btn, "clicked", _overlay_hide, ovl);
|
||||
evas_object_show(btn);
|
||||
elm_box_pack_end(bx, btn);
|
||||
|
||||
btn2 = elm_button_add(bx);
|
||||
elm_object_text_set(btn2, "Pause");
|
||||
evas_object_smart_callback_add(btn2, "clicked", _overlay_pause, ovl);
|
||||
evas_object_show(btn2);
|
||||
elm_box_pack_end(bx, btn2);
|
||||
|
||||
btn3 = elm_button_add(bx);
|
||||
elm_object_text_set(btn3, "Unpause");
|
||||
evas_object_smart_callback_add(btn3, "clicked", _overlay_unpause, ovl);
|
||||
evas_object_show(btn3);
|
||||
elm_box_pack_end(bx, btn3);
|
||||
|
||||
btn4 = elm_button_add(bx);
|
||||
elm_object_text_set(btn4, "Show");
|
||||
evas_object_smart_callback_add(btn4, "clicked", _overlay_show, ovl);
|
||||
evas_object_show(btn4);
|
||||
elm_box_pack_end(bx, btn4);
|
||||
|
||||
return bx;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_label_get(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object *label;
|
||||
label = elm_label_add(obj);
|
||||
elm_object_text_set(label, "Here is a parking lot.");
|
||||
return label;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_icon_get(Evas_Object *obj, Overlay_Data *data)
|
||||
{
|
||||
Evas_Object *icon = elm_icon_add(obj);
|
||||
elm_icon_file_set(icon, data->file, NULL);
|
||||
evas_object_show(icon);
|
||||
|
||||
return icon;
|
||||
if (scale) elm_map_overlay_del(scale);
|
||||
scale = elm_map_overlay_scale_add(data, down_x, down_y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -635,7 +711,7 @@ _submenu_src_add(void *data, Elm_Object_Item *parent)
|
|||
ts[idx].map = data;
|
||||
ts[idx].type = ELM_MAP_SOURCE_TYPE_TILE;
|
||||
ts[idx].source_name = strdup(tile_srcs[idx]);
|
||||
elm_menu_item_add(menu, parent, "", tile_srcs[idx], src_set, &ts[idx]);
|
||||
elm_menu_item_add(menu, parent, "", tile_srcs[idx], _src_set, &ts[idx]);
|
||||
}
|
||||
for (idx = 0; route_srcs[idx]; idx++)
|
||||
{
|
||||
|
@ -643,7 +719,7 @@ _submenu_src_add(void *data, Elm_Object_Item *parent)
|
|||
rs[idx].map = data;
|
||||
rs[idx].type = ELM_MAP_SOURCE_TYPE_ROUTE;
|
||||
rs[idx].source_name = strdup(route_srcs[idx]);
|
||||
elm_menu_item_add(menu, parent, "", route_srcs[idx], src_set, &rs[idx]);
|
||||
elm_menu_item_add(menu, parent, "", route_srcs[idx], _src_set, &rs[idx]);
|
||||
}
|
||||
for (idx = 0; name_srcs[idx]; idx++)
|
||||
{
|
||||
|
@ -651,7 +727,7 @@ _submenu_src_add(void *data, Elm_Object_Item *parent)
|
|||
ns[idx].map = data;
|
||||
ns[idx].type = ELM_MAP_SOURCE_TYPE_NAME;
|
||||
ns[idx].source_name = strdup(name_srcs[idx]);
|
||||
elm_menu_item_add(menu, parent, "", name_srcs[idx], src_set, &ns[idx]);
|
||||
elm_menu_item_add(menu, parent, "", name_srcs[idx], _src_set, &ns[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -659,8 +735,8 @@ static void
|
|||
_submenu_move_add(void *data, Elm_Object_Item *parent)
|
||||
{
|
||||
if ((!data) || (!parent)) return;
|
||||
elm_menu_item_add(menu, parent, NULL, "Show Urmatt", map_show_urmatt, data);
|
||||
elm_menu_item_add(menu, parent, NULL, "Bring Seoul", map_bring_seoul, data);
|
||||
elm_menu_item_add(menu, parent, NULL, "Show Urmatt", _show_urmatt, data);
|
||||
elm_menu_item_add(menu, parent, NULL, "Bring Seoul", _bring_seoul, data);
|
||||
|
||||
}
|
||||
|
||||
|
@ -698,6 +774,17 @@ _submenu_track_add(void *data, Elm_Object_Item *parent)
|
|||
elm_menu_item_add(menu, parent, NULL, "Remove Track", _track_remove, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_submenu_ovl_add(void *data, Elm_Object_Item *parent)
|
||||
{
|
||||
if ((!data) || (!parent)) return;
|
||||
elm_menu_item_add(menu, parent, NULL, "Add line", _line_add, data);
|
||||
elm_menu_item_add(menu, parent, NULL, "Add polygon", _poly_add, data);
|
||||
elm_menu_item_add(menu, parent, NULL, "Clear polygon", _poly_clear, data);
|
||||
elm_menu_item_add(menu, parent, NULL, "Add circle", _circle_add, data);
|
||||
elm_menu_item_add(menu, parent, NULL, "Add scale", _scale_add, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_map_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -726,6 +813,8 @@ _map_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event
|
|||
_submenu_prop_add(data, menu_it);
|
||||
menu_it = elm_menu_item_add(menu, NULL, "", "Track", NULL, NULL);
|
||||
_submenu_track_add(data, menu_it);
|
||||
menu_it = elm_menu_item_add(menu, NULL, "", "Overlay", NULL, NULL);
|
||||
_submenu_ovl_add(data, menu_it);
|
||||
|
||||
elm_menu_move(menu, down->canvas.x, down->canvas.y);
|
||||
evas_object_show(menu);
|
||||
|
@ -791,12 +880,29 @@ _overlay_cb(void *data __UNUSED__, Evas_Object *map, void *ev)
|
|||
Overlay_Data *od;
|
||||
Elm_Map_Overlay_Type type = elm_map_overlay_type_get(overlay);
|
||||
|
||||
if (type != ELM_MAP_OVERLAY_TYPE_DEFAULT) return;
|
||||
if (type != ELM_MAP_OVERLAY_TYPE_GROUP &&
|
||||
type != ELM_MAP_OVERLAY_TYPE_DEFAULT) return;
|
||||
|
||||
if (!bubble_img) bubble_img = elm_map_overlay_bubble_add(map);
|
||||
elm_map_overlay_bubble_follow(bubble_img, overlay);
|
||||
elm_map_overlay_bubble_content_clear(bubble_img);
|
||||
|
||||
if (type == ELM_MAP_OVERLAY_TYPE_GROUP)
|
||||
{
|
||||
Eina_List *l;
|
||||
Elm_Map_Overlay *memb;
|
||||
Eina_List *members = elm_map_overlay_group_members_get(overlay);
|
||||
printf("Group Members Num: %d\n", eina_list_count(members));
|
||||
EINA_LIST_FOREACH(members, l, memb)
|
||||
{
|
||||
od = elm_map_overlay_data_get(memb);
|
||||
if (od)
|
||||
elm_map_overlay_bubble_content_append(bubble_img,
|
||||
_box_get(map, od, memb));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
od = elm_map_overlay_data_get(overlay);
|
||||
if (od)
|
||||
elm_map_overlay_bubble_content_append(bubble_img,
|
||||
|
@ -804,12 +910,11 @@ _overlay_cb(void *data __UNUSED__, Evas_Object *map, void *ev)
|
|||
elm_map_overlay_bubble_content_append(bubble_img,
|
||||
_btn_box_get(map, overlay));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_parking_cb(void *data __UNUSED__, Evas_Object *map, Elm_Map_Overlay *ovl)
|
||||
{
|
||||
if (elm_map_overlay_type_get(ovl) != ELM_MAP_OVERLAY_TYPE_DEFAULT) return;
|
||||
|
||||
double lon, lat;
|
||||
Evas_Coord x, y;
|
||||
elm_map_overlay_region_get(ovl, &lon, &lat);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
typedef struct _Widget_Data Widget_Data;
|
||||
typedef struct _Path Path;
|
||||
typedef struct _Color Color;
|
||||
typedef struct _Region Region;
|
||||
typedef struct _Pan Pan;
|
||||
typedef struct _Grid Grid;
|
||||
typedef struct _Grid_Item Grid_Item;
|
||||
|
@ -21,6 +22,10 @@ typedef struct _Overlay_Class Overlay_Class;
|
|||
typedef struct _Overlay_Group Overlay_Group;
|
||||
typedef struct _Overlay_Bubble Overlay_Bubble;
|
||||
typedef struct _Overlay_Route Overlay_Route;
|
||||
typedef struct _Overlay_Line Overlay_Line;
|
||||
typedef struct _Overlay_Polygon Overlay_Polygon;
|
||||
typedef struct _Overlay_Circle Overlay_Circle;
|
||||
typedef struct _Overlay_Scale Overlay_Scale;
|
||||
typedef struct _Marker_Group Marker_Group;
|
||||
typedef struct _Marker_Bubble Marker_Bubble;
|
||||
typedef struct _Path_Node Path_Node;
|
||||
|
@ -38,6 +43,7 @@ typedef int (*Elm_Map_Module_Tile_Zoom_Max_Func)(void);
|
|||
typedef char *(*Elm_Map_Module_Tile_Url_Func)(const Evas_Object *obj, int x, int y, int zoom);
|
||||
typedef Eina_Bool (*Elm_Map_Module_Tile_Geo_to_Coord_Func)(const Evas_Object *obj, int zoom, double lon, double lat, int size, int *x, int *y);
|
||||
typedef Eina_Bool (*Elm_Map_Module_Tile_Coord_to_Geo_Func)(const Evas_Object *obj, int zoom, int x, int y, int size, double *lon, double *lat);
|
||||
typedef double (*Elm_Map_Module_Tile_Scale_Func)(const Evas_Object *obj, double lon, double lat, int zoom);
|
||||
typedef char *(*Elm_Map_Module_Route_Url_Func)(const Evas_Object *obj, const char *type_name, int method, double flon, double flat, double tlon, double tlat);
|
||||
typedef char *(*Elm_Map_Module_Name_Url_Func)(const Evas_Object *obj, int method, const char *name, double lon, double lat);
|
||||
|
||||
|
@ -98,6 +104,11 @@ struct _Path
|
|||
Evas_Coord x, y;
|
||||
};
|
||||
|
||||
struct _Region
|
||||
{
|
||||
double lon, lat;
|
||||
};
|
||||
|
||||
struct _Delayed_Data
|
||||
{
|
||||
void (*func)(void *data);
|
||||
|
@ -120,6 +131,7 @@ struct _Source_Tile
|
|||
Elm_Map_Module_Tile_Url_Func url_cb;
|
||||
Elm_Map_Module_Tile_Geo_to_Coord_Func geo_to_coord;
|
||||
Elm_Map_Module_Tile_Coord_to_Geo_Func coord_to_geo;
|
||||
Elm_Map_Module_Tile_Scale_Func scale_cb;
|
||||
};
|
||||
|
||||
// Map Route Source
|
||||
|
@ -198,6 +210,37 @@ struct _Overlay_Route
|
|||
Eina_List *nodes;
|
||||
};
|
||||
|
||||
struct _Overlay_Line
|
||||
{
|
||||
Widget_Data *wd;
|
||||
double flon, flat, tlon, tlat;
|
||||
Evas_Object *obj;
|
||||
};
|
||||
|
||||
struct _Overlay_Polygon
|
||||
{
|
||||
Widget_Data *wd;
|
||||
Eina_List *regions; // list of Regions
|
||||
Evas_Object *obj;
|
||||
};
|
||||
|
||||
struct _Overlay_Circle
|
||||
{
|
||||
Widget_Data *wd;
|
||||
double lon, lat;
|
||||
double radius; // Intial pixel in intial view
|
||||
double ratio; // initial-radius/map-size
|
||||
Evas_Object *obj;
|
||||
};
|
||||
|
||||
struct _Overlay_Scale
|
||||
{
|
||||
Widget_Data *wd;
|
||||
Evas_Coord x, y;
|
||||
Evas_Coord w, h;
|
||||
Evas_Object *obj;
|
||||
};
|
||||
|
||||
struct _Elm_Map_Overlay
|
||||
{
|
||||
Widget_Data *wd;
|
||||
|
@ -490,14 +533,15 @@ static char *_nominatim_url_cb(const Evas_Object *obj, int method, const char *n
|
|||
static char *_monav_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat)
|
||||
static char *_ors_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat);
|
||||
*/
|
||||
static double _scale_cb(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat, int zoom);
|
||||
|
||||
const Source_Tile src_tiles[] =
|
||||
{
|
||||
{"Mapnik", 0, 18, _mapnik_url_cb, NULL, NULL},
|
||||
{"Osmarender", 0, 17, _osmarender_url_cb, NULL, NULL},
|
||||
{"CycleMap", 0, 16, _cyclemap_url_cb, NULL, NULL},
|
||||
{"MapQuest", 0, 18, _mapquest_url_cb, NULL, NULL},
|
||||
{"MapQuest Open Aerial", 0, 11, _mapquest_aerial_url_cb, NULL, NULL},
|
||||
{"Mapnik", 0, 18, _mapnik_url_cb, NULL, NULL, _scale_cb},
|
||||
{"Osmarender", 0, 17, _osmarender_url_cb, NULL, NULL, _scale_cb},
|
||||
{"CycleMap", 0, 16, _cyclemap_url_cb, NULL, NULL, _scale_cb},
|
||||
{"MapQuest", 0, 18, _mapquest_url_cb, NULL, NULL, _scale_cb},
|
||||
{"MapQuest Open Aerial", 0, 11, _mapquest_aerial_url_cb, NULL, NULL, _scale_cb}
|
||||
};
|
||||
|
||||
// FIXME: Fix more open sources
|
||||
|
@ -508,6 +552,20 @@ const Source_Route src_routes[] =
|
|||
//{"ORS", _ors_url_cb}, // http://www.openrouteservice.org
|
||||
};
|
||||
|
||||
// Refer : http://wiki.openstreetmap.org/wiki/FAQ
|
||||
// meters per pixel when latitude is 0 (equator)
|
||||
// meters per pixel = _osm_scale_meter[zoom] * cos (latitude)
|
||||
const double _osm_scale_meter[] =
|
||||
{78206, 39135.758482, 19567.879241, 9783.939621, 4891.969810,
|
||||
2445.984905, 1222.992453, 611.496226, 305.748113, 152.874057, 76.437028,
|
||||
38.218514, 19.109257, 9.554629, 4.777314, 2.388657, 1.194329, 0.597164,
|
||||
0.29858};
|
||||
|
||||
// Scale in meters
|
||||
const double _scale_tb[] =
|
||||
{10000000, 5000000, 2000000, 1000000, 500000, 200000, 100000, 50000,
|
||||
20000, 10000, 5000, 2000, 1000, 500, 500, 200, 100, 50, 20, 10, 5, 2, 1};
|
||||
|
||||
// FIXME: Add more open sources
|
||||
const Source_Name src_names[] =
|
||||
{
|
||||
|
@ -2504,6 +2562,251 @@ _overlay_route_new(Widget_Data *wd, const Elm_Map_Route *route, Color c)
|
|||
return ovl;
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_line_color_update(Overlay_Line *ovl, Color c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
evas_object_color_set(ovl->obj, c.r, c.g, c.b, c.a);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_line_hide(Overlay_Line *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
if (ovl->obj) evas_object_hide(ovl->obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_line_show(Overlay_Line *ovl)
|
||||
{
|
||||
Evas_Coord fx, fy, tx, ty;
|
||||
Widget_Data *wd = ovl->wd;
|
||||
|
||||
_region_to_coord_convert(wd, ovl->flon, ovl->flat, wd->size.w, &fx, &fy);
|
||||
_region_to_coord_convert(wd, ovl->tlon, ovl->tlat, wd->size.w, &tx, &ty);
|
||||
_coord_to_canvas(wd, fx, fy, &fx, &fy);
|
||||
_coord_to_canvas(wd, tx, ty, &tx, &ty);
|
||||
evas_object_line_xy_set(ovl->obj, fx, fy, tx, ty);
|
||||
evas_object_show(ovl->obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_line_free(Overlay_Line *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
evas_object_del(ovl->obj);
|
||||
free(ovl);
|
||||
}
|
||||
|
||||
static Overlay_Line *
|
||||
_overlay_line_new(Widget_Data *wd, double flon, double flat, double tlon, double tlat, Color c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
|
||||
|
||||
Overlay_Line *ovl = ELM_NEW(Overlay_Line);
|
||||
ovl->wd = wd;
|
||||
ovl->flon = flon;
|
||||
ovl->flat = flat;
|
||||
ovl->tlon = tlon;
|
||||
ovl->tlat = tlat;
|
||||
ovl->obj = evas_object_line_add(evas_object_evas_get(wd->obj));
|
||||
evas_object_smart_member_add(ovl->obj, wd->pan_smart);
|
||||
_overlay_line_color_update(ovl, c);
|
||||
return ovl;
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_polygon_color_update(Overlay_Polygon *ovl, Color c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
evas_object_color_set(ovl->obj, c.r, c.g, c.b, c.a);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_polygon_hide(Overlay_Polygon *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
if (ovl->obj) evas_object_hide(ovl->obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_polygon_show(Overlay_Polygon *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
Eina_List *l;
|
||||
Region *r;
|
||||
Widget_Data *wd = ovl->wd;
|
||||
|
||||
evas_object_polygon_points_clear(ovl->obj);
|
||||
EINA_LIST_FOREACH(ovl->regions, l, r)
|
||||
{
|
||||
Evas_Coord x, y;
|
||||
_region_to_coord_convert(wd, r->lon, r->lat, wd->size.w, &x, &y);
|
||||
_coord_to_canvas(wd, x, y, &x, &y);
|
||||
evas_object_polygon_point_add(ovl->obj, x, y);
|
||||
}
|
||||
evas_object_show(ovl->obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_polygon_free(Overlay_Polygon *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
Region *r;
|
||||
evas_object_del(ovl->obj);
|
||||
EINA_LIST_FREE(ovl->regions, r) free(r);
|
||||
free(ovl);
|
||||
}
|
||||
|
||||
static Overlay_Polygon *
|
||||
_overlay_polygon_new(Widget_Data *wd, Color c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
|
||||
|
||||
Overlay_Polygon *ovl = ELM_NEW(Overlay_Polygon);
|
||||
ovl->wd = wd;
|
||||
ovl->obj = evas_object_polygon_add(evas_object_evas_get(wd->obj));
|
||||
evas_object_smart_member_add(ovl->obj, wd->pan_smart);
|
||||
_overlay_polygon_color_update(ovl, c);
|
||||
return ovl;
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_circle_color_update(Overlay_Circle *ovl, Color c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
Evas_Object *obj = elm_layout_edje_get(ovl->obj);
|
||||
evas_object_color_set(obj, c.r, c.g, c.b, c.a);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_circle_hide(Overlay_Circle *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
if (ovl->obj) evas_object_hide(ovl->obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_circle_show(Overlay_Circle *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
double r;
|
||||
Evas_Coord x, y;
|
||||
Widget_Data *wd = ovl->wd;
|
||||
|
||||
r = (ovl->ratio) * wd->size.w;
|
||||
_region_to_coord_convert(wd, ovl->lon, ovl->lat, wd->size.w, &x, &y);
|
||||
_coord_to_canvas(wd, x, y, &x, &y);
|
||||
_obj_place(ovl->obj, x - r, y - r, r * 2, r * 2);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_circle_free(Overlay_Circle *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
evas_object_del(ovl->obj);
|
||||
free(ovl);
|
||||
}
|
||||
|
||||
static Overlay_Circle *
|
||||
_overlay_circle_new(Widget_Data *wd, double lon, double lat, double radius, Color c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
|
||||
|
||||
Overlay_Circle *ovl = ELM_NEW(Overlay_Circle);
|
||||
ovl->wd = wd;
|
||||
ovl->lon = lon;
|
||||
ovl->lat = lat;
|
||||
ovl->radius = radius;
|
||||
ovl->ratio = radius / wd->size.w;
|
||||
|
||||
ovl->obj = elm_layout_add(wd->obj);
|
||||
evas_object_smart_member_add(ovl->obj, wd->pan_smart);
|
||||
evas_object_stack_above(ovl->obj, wd->sep_maps_markers);
|
||||
elm_layout_theme_set(ovl->obj, "map/circle", "base",
|
||||
elm_widget_style_get(wd->obj));
|
||||
_overlay_circle_color_update(ovl, c);
|
||||
return ovl;
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_scale_color_update(Overlay_Scale *ovl, Color c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
evas_object_color_set(ovl->obj, c.r, c.g, c.b, c.a);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_scale_hide(Overlay_Scale *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
if (ovl->obj) evas_object_hide(ovl->obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_scale_show(Overlay_Scale *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
Evas_Coord w;
|
||||
double lon, lat;
|
||||
double text;
|
||||
char buf[32];
|
||||
double meter;
|
||||
Widget_Data *wd = ovl->wd;
|
||||
|
||||
if ((int)sizeof(_scale_tb) <= wd->zoom)
|
||||
{
|
||||
ERR("Zoom level is too high");
|
||||
return;
|
||||
}
|
||||
|
||||
elm_map_region_get(wd->obj, &lon, &lat);
|
||||
meter = wd->src_tile->scale_cb(wd->obj, lon, lat, wd->zoom);
|
||||
|
||||
w = (_scale_tb[wd->zoom] / meter) * (wd->zoom_detail - wd->zoom + 1);
|
||||
|
||||
text = _scale_tb[wd->zoom]/1000;
|
||||
if (text < 1) snprintf(buf, sizeof(buf), "%d m", (int)(text * 1000));
|
||||
else snprintf(buf, sizeof(buf), "%d km", (int)text);
|
||||
|
||||
edje_object_part_text_set(elm_layout_edje_get(ovl->obj), "elm.text", buf);
|
||||
_obj_place(ovl->obj, ovl->x, ovl->y, w, ovl->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_scale_free(Overlay_Scale *ovl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(ovl);
|
||||
evas_object_del(ovl->obj);
|
||||
free(ovl);
|
||||
}
|
||||
|
||||
static Overlay_Scale *
|
||||
_overlay_scale_new(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Color c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL);
|
||||
const char *s;
|
||||
|
||||
Overlay_Scale *ovl = ELM_NEW(Overlay_Scale);
|
||||
ovl->wd = wd;
|
||||
ovl->x = x;
|
||||
ovl->y = y;
|
||||
|
||||
ovl->obj = elm_layout_add(wd->obj);
|
||||
evas_object_smart_member_add(ovl->obj, wd->pan_smart);
|
||||
evas_object_stack_above(ovl->obj, wd->sep_maps_markers);
|
||||
elm_layout_theme_set(ovl->obj, "map/scale", "base",
|
||||
elm_widget_style_get(wd->obj));
|
||||
s = edje_object_data_get(elm_layout_edje_get(ovl->obj), "size_w");
|
||||
if (s) ovl->w = atoi(s);
|
||||
else ovl->w = 100;
|
||||
s = edje_object_data_get(elm_layout_edje_get(ovl->obj), "size_h");
|
||||
if (s) ovl->h = atoi(s);
|
||||
else ovl->h = 60;
|
||||
_overlay_scale_color_update(ovl, c);
|
||||
return ovl;
|
||||
}
|
||||
|
||||
static void
|
||||
_overlay_grouping(Eina_List *clas_membs, Elm_Map_Overlay *boss)
|
||||
{
|
||||
|
@ -2594,6 +2897,26 @@ _overlay_show(Elm_Map_Overlay *overlay)
|
|||
if (hide) _overlay_route_hide(overlay->ovl);
|
||||
else _overlay_route_show(overlay->ovl);
|
||||
}
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_LINE)
|
||||
{
|
||||
if (hide) _overlay_line_hide(overlay->ovl);
|
||||
else _overlay_line_show(overlay->ovl);
|
||||
}
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_POLYGON)
|
||||
{
|
||||
if (hide) _overlay_polygon_hide(overlay->ovl);
|
||||
else _overlay_polygon_show(overlay->ovl);
|
||||
}
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CIRCLE)
|
||||
{
|
||||
if (hide) _overlay_circle_hide(overlay->ovl);
|
||||
else _overlay_circle_show(overlay->ovl);
|
||||
}
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_SCALE)
|
||||
{
|
||||
if (hide) _overlay_scale_hide(overlay->ovl);
|
||||
else _overlay_scale_show(overlay->ovl);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3291,6 +3614,7 @@ _source_tile_mod_cb(Eina_Module *m, void *data)
|
|||
Elm_Map_Module_Tile_Url_Func url_cb;
|
||||
Elm_Map_Module_Tile_Geo_to_Coord_Func geo_to_coord;
|
||||
Elm_Map_Module_Tile_Coord_to_Geo_Func coord_to_geo;
|
||||
Elm_Map_Module_Tile_Scale_Func scale_cb;
|
||||
const char *file;
|
||||
|
||||
file = eina_module_file_get(m);
|
||||
|
@ -3307,9 +3631,9 @@ _source_tile_mod_cb(Eina_Module *m, void *data)
|
|||
url_cb = eina_module_symbol_get(m, "map_module_tile_url_get");
|
||||
geo_to_coord = eina_module_symbol_get(m, "map_module_tile_geo_to_coord");
|
||||
coord_to_geo = eina_module_symbol_get(m, "map_module_tile_coord_to_geo");
|
||||
|
||||
scale_cb = eina_module_symbol_get(m, "map_module_tile_scale_get");
|
||||
if ((!name_cb) || (!zoom_min) || (!zoom_max) || (!url_cb) ||
|
||||
(!geo_to_coord) || (!coord_to_geo))
|
||||
(!geo_to_coord) || (!coord_to_geo) || (!scale_cb))
|
||||
{
|
||||
WRN("Could not find map module functions from module \"%s\": %s",
|
||||
file, eina_error_msg_get(eina_error_get()));
|
||||
|
@ -3323,6 +3647,7 @@ _source_tile_mod_cb(Eina_Module *m, void *data)
|
|||
s->url_cb = url_cb;
|
||||
s->geo_to_coord = geo_to_coord;
|
||||
s->coord_to_geo = coord_to_geo;
|
||||
s->scale_cb = scale_cb;
|
||||
wd->src_tiles = eina_list_append(wd->src_tiles, s);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
@ -3345,6 +3670,7 @@ _source_tile_load(Widget_Data *wd)
|
|||
s->url_cb = src_tiles[idx].url_cb;
|
||||
s->geo_to_coord = src_tiles[idx].geo_to_coord;
|
||||
s->coord_to_geo = src_tiles[idx].coord_to_geo;
|
||||
s->scale_cb = src_tiles[idx].scale_cb;
|
||||
wd->src_tiles = eina_list_append(wd->src_tiles, s);
|
||||
}
|
||||
|
||||
|
@ -3880,6 +4206,13 @@ _nominatim_url_cb(const Evas_Object *obj, int method, const char *name, double l
|
|||
return strdup(buf);
|
||||
}
|
||||
|
||||
static double
|
||||
_scale_cb(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat, int zoom)
|
||||
{
|
||||
if (zoom < 0 || zoom >= (int)sizeof(_osm_scale_meter)) return 0;
|
||||
return _osm_scale_meter[zoom] / cos(lat * ELM_PI / 180.0);
|
||||
}
|
||||
|
||||
static void
|
||||
_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
|
||||
{
|
||||
|
@ -4952,6 +5285,14 @@ elm_map_overlay_del(Elm_Map_Overlay *overlay)
|
|||
_overlay_class_free(overlay->ovl);
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_ROUTE)
|
||||
_overlay_route_free(overlay->ovl);
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_LINE)
|
||||
_overlay_line_free(overlay->ovl);
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_POLYGON)
|
||||
_overlay_polygon_free(overlay->ovl);
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CIRCLE)
|
||||
_overlay_circle_free(overlay->ovl);
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_SCALE)
|
||||
_overlay_scale_free(overlay->ovl);
|
||||
else ERR("Invalid overlay type: %d", overlay->type);
|
||||
|
||||
overlay->wd->overlays = eina_list_remove(overlay->wd->overlays, overlay);
|
||||
|
@ -5308,12 +5649,12 @@ elm_map_overlay_content_get(const Elm_Map_Overlay *overlay)
|
|||
if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT)
|
||||
{
|
||||
const Overlay_Default *ovl = overlay->ovl;
|
||||
return elm_object_part_content_get(ovl->layout, "elm.icon");
|
||||
return ovl->content;
|
||||
}
|
||||
else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS)
|
||||
{
|
||||
const Overlay_Class *ovl = overlay->ovl;
|
||||
return ovl->icon;
|
||||
return ovl->content;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5533,6 +5874,23 @@ elm_map_overlay_class_zoom_max_get(const Elm_Map_Overlay *clas)
|
|||
#endif
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
elm_map_overlay_group_members_get(const Elm_Map_Overlay *grp)
|
||||
{
|
||||
#ifdef HAVE_ELEMENTARY_ECORE_CON
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(grp, NULL);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(grp->wd, NULL);
|
||||
ELM_CHECK_WIDTYPE(grp->wd->obj, widtype) NULL;
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(grp->type == ELM_MAP_OVERLAY_TYPE_GROUP, NULL);
|
||||
|
||||
Overlay_Group *ovl = grp->ovl;
|
||||
return ovl->members;
|
||||
#else
|
||||
(void) clas;
|
||||
return OVERLAY_CLASS_ZOOM_MAX;
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI Elm_Map_Overlay *
|
||||
elm_map_overlay_bubble_add(Evas_Object *obj)
|
||||
{
|
||||
|
@ -5666,6 +6024,139 @@ elm_map_overlay_route_add(Evas_Object *obj, const Elm_Map_Route *route)
|
|||
#endif
|
||||
}
|
||||
|
||||
EAPI Elm_Map_Overlay *
|
||||
elm_map_overlay_line_add(Evas_Object *obj, double flon, double flat, double tlon, double tlat)
|
||||
{
|
||||
#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);
|
||||
|
||||
Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay);
|
||||
overlay->wd = wd;
|
||||
overlay->type = ELM_MAP_OVERLAY_TYPE_LINE;
|
||||
overlay->c.r = 0xff;
|
||||
overlay->c.g = 0x00;
|
||||
overlay->c.b = 0x00;
|
||||
overlay->c.a = 0xff;
|
||||
overlay->ovl = _overlay_line_new(wd, flon, flat, tlon, tlat, overlay->c);
|
||||
overlay->grp = _overlay_group_new(wd);
|
||||
wd->overlays = eina_list_append(wd->overlays, overlay);
|
||||
|
||||
evas_object_smart_changed(wd->pan_smart);
|
||||
return overlay;
|
||||
#else
|
||||
(void) obj;
|
||||
(void) flon;
|
||||
(void) flat
|
||||
(void) tlon;
|
||||
(void) tlat;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI Elm_Map_Overlay *
|
||||
elm_map_overlay_polygon_add(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);
|
||||
|
||||
Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay);
|
||||
overlay->wd = wd;
|
||||
overlay->type = ELM_MAP_OVERLAY_TYPE_POLYGON;
|
||||
overlay->c.r = 0xdc;
|
||||
overlay->c.g = 0x14;
|
||||
overlay->c.b = 0x3c;
|
||||
overlay->c.a = 200;
|
||||
overlay->ovl = _overlay_polygon_new(wd, overlay->c);
|
||||
overlay->grp = _overlay_group_new(wd);
|
||||
wd->overlays = eina_list_append(wd->overlays, overlay);
|
||||
evas_object_smart_changed(wd->pan_smart);
|
||||
return overlay;
|
||||
#else
|
||||
(void) obj;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_map_overlay_polygon_region_add(Elm_Map_Overlay *overlay, double lon, double lat)
|
||||
{
|
||||
#ifdef HAVE_ELEMENTARY_ECORE_CON
|
||||
EINA_SAFETY_ON_NULL_RETURN(overlay);
|
||||
ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype);
|
||||
EINA_SAFETY_ON_FALSE_RETURN(overlay->type == ELM_MAP_OVERLAY_TYPE_POLYGON);
|
||||
|
||||
Overlay_Polygon *ovl = overlay->ovl;
|
||||
Region *r = ELM_NEW(Region);
|
||||
r->lon = lon;
|
||||
r->lat = lat;
|
||||
ovl->regions = eina_list_append(ovl->regions, r);
|
||||
|
||||
evas_object_smart_changed(ovl->wd->pan_smart);
|
||||
#else
|
||||
(void) overlay;
|
||||
(void) lon;
|
||||
(void) lat
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI Elm_Map_Overlay *
|
||||
elm_map_overlay_circle_add(Evas_Object *obj, double lon, double lat, double radius)
|
||||
{
|
||||
#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);
|
||||
|
||||
Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay);
|
||||
overlay->wd = wd;
|
||||
overlay->type = ELM_MAP_OVERLAY_TYPE_CIRCLE;
|
||||
overlay->c.r = 0xdc;
|
||||
overlay->c.g = 0x14;
|
||||
overlay->c.b = 0x3c;
|
||||
overlay->c.a = 200;
|
||||
overlay->ovl = _overlay_circle_new(wd, lon, lat, radius, overlay->c);
|
||||
overlay->grp = _overlay_group_new(wd);
|
||||
wd->overlays = eina_list_append(wd->overlays, overlay);
|
||||
|
||||
evas_object_smart_changed(wd->pan_smart);
|
||||
return overlay;
|
||||
#else
|
||||
(void) obj;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI Elm_Map_Overlay *
|
||||
elm_map_overlay_scale_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||
{
|
||||
#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);
|
||||
|
||||
Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay);
|
||||
overlay->wd = wd;
|
||||
overlay->type = ELM_MAP_OVERLAY_TYPE_SCALE;
|
||||
overlay->c.r = 0;
|
||||
overlay->c.g = 0;
|
||||
overlay->c.b = 0;
|
||||
overlay->c.a = 255;
|
||||
overlay->ovl = _overlay_scale_new(wd, x, y, overlay->c);
|
||||
overlay->grp = _overlay_group_new(wd);
|
||||
wd->overlays = eina_list_append(wd->overlays, overlay);
|
||||
|
||||
evas_object_smart_changed(wd->pan_smart);
|
||||
return overlay;
|
||||
#else
|
||||
(void) obj;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ELM_EMAP
|
||||
EAPI Evas_Object *
|
||||
elm_map_track_add(Evas_Object *obj, void *emap)
|
||||
|
|
|
@ -165,9 +165,14 @@ typedef enum _Elm_Map_Overlay_Type
|
|||
ELM_MAP_OVERLAY_TYPE_NONE = 0,
|
||||
ELM_MAP_OVERLAY_TYPE_DEFAULT,
|
||||
ELM_MAP_OVERLAY_TYPE_CLASS,
|
||||
ELM_MAP_OVERLAY_TYPE_GROUP,
|
||||
ELM_MAP_OVERLAY_TYPE_BUBBLE,
|
||||
ELM_MAP_OVERLAY_TYPE_ROUTE,
|
||||
ELM_MAP_OVERLAY_TYPE_GROUP
|
||||
ELM_MAP_OVERLAY_TYPE_LINE,
|
||||
ELM_MAP_OVERLAY_TYPE_POLYGON,
|
||||
ELM_MAP_OVERLAY_TYPE_CIRCLE,
|
||||
ELM_MAP_OVERLAY_TYPE_SCALE
|
||||
|
||||
} 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(). */
|
||||
|
@ -935,6 +940,10 @@ EAPI void elm_map_overlays_show(Eina_List *overlays);
|
|||
*
|
||||
* If the overlay is clicked, the callback wll be called.
|
||||
* The clicked overlay is returned by callback.
|
||||
*
|
||||
* You can add callback to the class overlay. If one of the group overlays in this class
|
||||
* is clicked, callback will be called and return a virtual group overlays.
|
||||
*
|
||||
* You can delete this callback function by setting @c NULL.
|
||||
*
|
||||
* @ingroup Map
|
||||
|
@ -956,7 +965,7 @@ EAPI void elm_map_overlay_get_cb_set(Elm_Map_Overlay *overlay, Elm_Map_Overlay_G
|
|||
*
|
||||
* You can change the state (hidden, paused, etc.) or set the content
|
||||
* or icon of the group overlays by chaning the state of the class overlay.
|
||||
* Do not control the group overlay itself.
|
||||
* Do not modifty the group overlay itself.
|
||||
*
|
||||
* Also these changes have a influence on the overlays in the same class
|
||||
* even if each overlay is alone and is not grouped.
|
||||
|
@ -1023,6 +1032,27 @@ EAPI void elm_map_overlay_class_zoom_max_set(Elm_Map_Overlay *c
|
|||
*/
|
||||
EAPI int elm_map_overlay_class_zoom_max_get(const Elm_Map_Overlay *clas);
|
||||
|
||||
/**
|
||||
* Get the overlay members of the group overlay.
|
||||
*
|
||||
* @param clas The group overlay has overlay members.
|
||||
*
|
||||
* @return The list of group overlay memebers.
|
||||
*
|
||||
* The group overlays are virtualy overlays. Those are shown and hidden dynamically.
|
||||
* You can add callback to the class overlay. If one of the group overlays in this class
|
||||
* is clicked, callback will be called and return a virtual group overlays.
|
||||
*
|
||||
* You can change the state (hidden, paused, etc.) or set the content
|
||||
* or icon of the group overlays by chaning the state of the class overlay.
|
||||
* Do not modifty the group overlay itself.
|
||||
*
|
||||
* @see elm_map_overlay_class_add()
|
||||
*
|
||||
* @ingroup Map
|
||||
*/
|
||||
EAPI Eina_List * elm_map_overlay_group_members_get(const Elm_Map_Overlay *grp);
|
||||
|
||||
/**
|
||||
* Add a new bubble overlay to the map object.
|
||||
* This overlay has a bubble type.
|
||||
|
@ -1113,6 +1143,98 @@ EAPI void elm_map_overlay_bubble_content_clear(Elm_Map_Overlay
|
|||
*/
|
||||
EAPI Elm_Map_Overlay * elm_map_overlay_route_add(Evas_Object *obj, const Elm_Map_Route *route);
|
||||
|
||||
/**
|
||||
* Add a new line overlay to the map object.
|
||||
* This overlay has a line type.
|
||||
*
|
||||
* @param obj The map object to add a new overlay.
|
||||
* @param flon The start longitude.
|
||||
* @param flat The start latitude.
|
||||
* @param tlon The destination longitude.
|
||||
* @param tlat The destination latitude.
|
||||
* @return The created overlay or @c NULL upon failure.
|
||||
*
|
||||
* Overlay created with this method can be deleted with elm_map_overlay_del().
|
||||
*
|
||||
* @see elm_map_overlay_del()
|
||||
*
|
||||
* @ingroup Map
|
||||
*/
|
||||
EAPI Elm_Map_Overlay * elm_map_overlay_line_add(Evas_Object *obj, double flon, double flat, double tlon, double tlat);
|
||||
|
||||
/**
|
||||
* Add a new polygon overlay to the map object.
|
||||
* This overlay has a polygon type.
|
||||
*
|
||||
* @param obj The map object to add a new overlay.
|
||||
* @return The created overlay or @c NULL upon failure.
|
||||
*
|
||||
* At least 3 regions should be added to show the polygon overlay.
|
||||
*
|
||||
* Overlay created with this method can be deleted with elm_map_overlay_del().
|
||||
*
|
||||
* @see elm_map_overlay_polygon_region_add()
|
||||
* @see elm_map_overlay_del()
|
||||
*
|
||||
* @ingroup Map
|
||||
*/
|
||||
EAPI Elm_Map_Overlay * elm_map_overlay_polygon_add(Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Add a geographic coordinates to the polygon overlay.
|
||||
*
|
||||
* @param overlay The polygon overlay to get a region.
|
||||
* @param lon The longitude.
|
||||
* @param lat The latitude.
|
||||
*
|
||||
* At least 3 regions should be added to show the polygon overlay.
|
||||
*
|
||||
* Overlay created with this method can be deleted with elm_map_overlay_del().
|
||||
*
|
||||
* @see elm_map_overlay_polygon_add()
|
||||
* @see elm_map_overlay_del()
|
||||
*
|
||||
* @ingroup Map
|
||||
*/
|
||||
EAPI void elm_map_overlay_polygon_region_add(Elm_Map_Overlay *overlay, double lon, double lat);
|
||||
|
||||
/**
|
||||
* Add a new circle overlay to the map object.
|
||||
* This overlay has a circle type.
|
||||
*
|
||||
* @param obj The map object to add a new overlay.
|
||||
* @param lon The center longitude.
|
||||
* @param lat The center latitude.
|
||||
* @param radius The pixel length of radius.
|
||||
* @return The created overlay or @c NULL upon failure.
|
||||
*
|
||||
* Overlay created with this method can be deleted with elm_map_overlay_del().
|
||||
*
|
||||
* @see elm_map_overlay_del()
|
||||
*
|
||||
* @ingroup Map
|
||||
*/
|
||||
EAPI Elm_Map_Overlay * elm_map_overlay_circle_add(Evas_Object *obj, double lon, double lat, double radius);
|
||||
|
||||
/**
|
||||
* Add a new scale overlay to the map object.
|
||||
* This overlay has a scale type.
|
||||
*
|
||||
* @param obj The map object to add a new overlay.
|
||||
* @param x horizontal pixel coordinate.
|
||||
* @param y vertical pixel coordinate
|
||||
* @return The created overlay or @c NULL upon failure.
|
||||
*
|
||||
* The scale overlay shows the ratio of a distance on the map to the corresponding distance.
|
||||
*
|
||||
* Overlay created with this method can be deleted with elm_map_overlay_del().
|
||||
*
|
||||
* @see elm_map_overlay_del()
|
||||
*
|
||||
* @ingroup Map
|
||||
*/
|
||||
EAPI Elm_Map_Overlay * elm_map_overlay_scale_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
|
||||
/**
|
||||
* Get the information of tile load status.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue