From: Enlightenment S. <no-...@en...> - 2009-11-15 15:53:49
|
Log: Elm map : add the markers Author: watchwolf Date: 2009-11-15 07:53:37 -0800 (Sun, 15 Nov 2009) New Revision: 43710 Added: trunk/TMP/st/elementary/data/themes/bubble.png Modified: trunk/TMP/st/elementary/data/themes/default.edc trunk/TMP/st/elementary/src/bin/test_map.c trunk/TMP/st/elementary/src/lib/Elementary.h.in trunk/TMP/st/elementary/src/lib/elm_map.c Property changes on: trunk/TMP/st/elementary/data/themes/bubble.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/TMP/st/elementary/data/themes/default.edc =================================================================== --- trunk/TMP/st/elementary/data/themes/default.edc 2009-11-15 14:24:55 UTC (rev 43709) +++ trunk/TMP/st/elementary/data/themes/default.edc 2009-11-15 15:53:37 UTC (rev 43710) @@ -18687,7 +18687,648 @@ } } } + + /////////////////////////////////////////////////////////////////////////////// + group { name: "elm/map/base/default"; + script { + public sbvis_v, sbvis_h, sbalways_v, sbalways_h, sbvis_timer; + public timer0(val) { + new v; + v = get_int(sbvis_v); + if (v) { + v = get_int(sbalways_v); + if (!v) { + emit("do-hide-vbar", ""); + set_int(sbvis_v, 0); + } + } + v = get_int(sbvis_h); + if (v) { + v = get_int(sbalways_h); + if (!v) { + emit("do-hide-hbar", ""); + set_int(sbvis_h, 0); + } + } + set_int(sbvis_timer, 0); + return 0; + } + } + images { + image: "shelf_inset.png" COMP; + image: "bt_sm_base2.png" COMP; + image: "bt_sm_shine.png" COMP; + image: "bt_sm_hilight.png" COMP; + image: "sb_runnerh.png" COMP; + image: "sb_runnerv.png" COMP; + image: "busy-1.png" COMP; + image: "busy-2.png" COMP; + image: "busy-3.png" COMP; + image: "busy-4.png" COMP; + image: "busy-5.png" COMP; + image: "busy-6.png" COMP; + image: "busy-7.png" COMP; + image: "busy-8.png" COMP; + image: "busy-9.png" COMP; + } + parts { + part { name: "bg"; + type: RECT; + description { state: "default" 0.0; + rel1.offset: 1 1; + rel2.offset: -2 -2; + color: 255 255 255 0; + } + } + part { name: "clipper"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + } + } + part { name: "elm.swallow.content"; + clip_to: "clipper"; + type: SWALLOW; + description { state: "default" 0.0; + rel1.offset: 1 1; + rel2.offset: -2 -2; + } + } + part { name: "busy_clip"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + } + description { state: "active" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { name: "busy"; + clip_to: "busy_clip"; + mouse_events: 0; + description { state: "default" 0.0; + fixed: 1 1; + min: 32 32; + aspect: 1.0 1.0; + align: 1.0 1.0; + aspect_preference: BOTH; + rel1 { + relative: 0.9 0.9; + offset: -9 -9; + } + rel2 { + relative: 0.9 0.9; + offset: -9 -9; + } + image { + normal: "busy-9.png"; + tween: "busy-1.png"; + tween: "busy-2.png"; + tween: "busy-3.png"; + tween: "busy-4.png"; + tween: "busy-5.png"; + tween: "busy-6.png"; + tween: "busy-7.png"; + tween: "busy-8.png"; + } + } + } + part { name: "conf_over"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.offset: 0 0; + rel2.offset: -1 -1; + image { + normal: "shelf_inset.png"; + border: 7 7 7 7; + middle: 0; + } + fill.smooth : 0; + } + } + part { name: "sb_vbar_clip_master"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + } + description { state: "hidden" 0.0; + visible: 0; + color: 255 255 255 0; + } + } + part { name: "sb_vbar_clip"; + clip_to: "sb_vbar_clip_master"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + } + description { state: "hidden" 0.0; + visible: 0; + color: 255 255 255 0; + } + } + part { name: "sb_vbar"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + fixed: 1 1; + visible: 0; + min: 17 17; + align: 1.0 0.0; + rel1 { + relative: 1.0 0.0; + offset: -2 0; + } + rel2 { + relative: 1.0 0.0; + offset: -2 -1; + to_y: "sb_hbar"; + } + } + } + part { name: "sb_vbar_runner"; + clip_to: "sb_vbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + min: 3 3; + max: 3 99999; + rel1.to: "sb_vbar"; + rel2.to: "sb_vbar"; + image { + normal: "sb_runnerv.png"; + border: 0 0 4 4; + } + fill.smooth: 0; + } + } + part { name: "elm.dragable.vbar"; + clip_to: "sb_vbar_clip"; + mouse_events: 0; + dragable { + x: 0 0 0; + y: 1 1 0; + confine: "sb_vbar"; + } + description { state: "default" 0.0; + fixed: 1 1; + min: 17 17; + rel1 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_vbar"; + } + rel2 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_vbar"; + } + image { + normal: "bt_sm_base2.png"; + border: 6 6 6 6; + } + image.middle: SOLID; + } + } + part { name: "sb_vbar_over1"; + clip_to: "sb_vbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.dragable.vbar"; + rel2.relative: 1.0 0.5; + rel2.to: "elm.dragable.vbar"; + image { + normal: "bt_sm_hilight.png"; + border: 6 6 6 0; + } + } + } + part { name: "sb_vbar_over2"; + clip_to: "sb_vbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.dragable.vbar"; + rel2.to: "elm.dragable.vbar"; + image { + normal: "bt_sm_shine.png"; + border: 6 6 6 0; + } + } + } + part { name: "sb_hbar_clip_master"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + } + description { state: "hidden" 0.0; + visible: 0; + color: 255 255 255 0; + } + } + part { name: "sb_hbar_clip"; + clip_to: "sb_hbar_clip_master"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + } + description { state: "hidden" 0.0; + visible: 0; + color: 255 255 255 0; + } + } + part { name: "sb_hbar"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + fixed: 1 1; + visible: 0; + min: 17 17; + align: 0.0 1.0; + rel1 { + relative: 0.0 1.0; + offset: 0 -2; + } + rel2 { + relative: 0.0 1.0; + offset: -1 -2; + to_x: "sb_vbar"; + } + } + } + part { name: "sb_hbar_runner"; + clip_to: "sb_hbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + min: 3 3; + max: 99999 3; + rel1.to: "sb_hbar"; + rel2.to: "sb_hbar"; + image { + normal: "sb_runnerh.png"; + border: 4 4 0 0; + } + fill.smooth: 0; + } + } + part { name: "elm.dragable.hbar"; + clip_to: "sb_hbar_clip"; + mouse_events: 0; + dragable { + x: 1 1 0; + y: 0 0 0; + confine: "sb_hbar"; + } + description { state: "default" 0.0; + fixed: 1 1; + min: 17 17; + rel1 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_hbar"; + } + rel2 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_hbar"; + } + image { + normal: "bt_sm_base2.png"; + border: 6 6 6 6; + } + image.middle: SOLID; + } + } + part { name: "sb_hbar_over1"; + clip_to: "sb_hbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.dragable.hbar"; + rel2.relative: 1.0 0.5; + rel2.to: "elm.dragable.hbar"; + image { + normal: "bt_sm_hilight.png"; + border: 6 6 6 0; + } + } + } + part { name: "sb_hbar_over2"; + clip_to: "sb_hbar_clip"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "elm.dragable.hbar"; + rel2.to: "elm.dragable.hbar"; + image { + normal: "bt_sm_shine.png"; + border: 6 6 6 0; + } + } + } + } + programs { + program { name: "load"; + signal: "load"; + source: ""; + script { + set_state(PART:"sb_hbar_clip", "hidden", 0.0); + set_state(PART:"sb_vbar_clip", "hidden", 0.0); + set_int(sbvis_h, 0); + set_int(sbvis_v, 0); + set_int(sbalways_v, 0); + set_int(sbalways_h, 0); + set_int(sbvis_timer, 0); + } + } + + program { name: "vbar_show"; + signal: "elm,action,show,vbar"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "sb_vbar_clip_master"; + } + program { name: "vbar_hide"; + signal: "elm,action,hide,vbar"; + source: "elm"; + action: STATE_SET "hidden" 0.0; + target: "sb_vbar_clip_master"; + } + program { name: "vbar_show_always"; + signal: "elm,action,show_always,vbar"; + source: "elm"; + script { + new v; + v = get_int(sbvis_v); + v |= get_int(sbalways_v); + if (!v) { + set_int(sbalways_v, 1); + emit("do-show-vbar", ""); + set_int(sbvis_v, 1); + } + } + } + program { name: "vbar_show_notalways"; + signal: "elm,action,show_notalways,vbar"; + source: "elm"; + script { + new v; + v = get_int(sbalways_v); + if (v) { + set_int(sbalways_v, 0); + v = get_int(sbvis_v); + if (!v) { + emit("do-hide-vbar", ""); + set_int(sbvis_v, 0); + } + } + } + } + program { name: "sb_vbar_show"; + signal: "do-show-vbar"; + source: ""; + action: STATE_SET "default" 0.0; + transition: LINEAR 1.0; + target: "sb_vbar_clip"; + } + program { name: "sb_vbar_hide"; + signal: "do-hide-vbar"; + source: ""; + action: STATE_SET "hidden" 0.0; + transition: LINEAR 1.0; + target: "sb_vbar_clip"; + } + + program { name: "hbar_show"; + signal: "elm,action,show,hbar"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "sb_hbar_clip_master"; + } + program { name: "hbar_hide"; + signal: "elm,action,hide,hbar"; + source: "elm"; + action: STATE_SET "hidden" 0.0; + target: "sb_hbar_clip_master"; + } + program { name: "hbar_show_always"; + signal: "elm,action,show_always,hbar"; + source: "elm"; + script { + new v; + v = get_int(sbvis_h); + v |= get_int(sbalways_h); + if (!v) { + set_int(sbalways_h, 1); + emit("do-show-hbar", ""); + set_int(sbvis_h, 1); + } + } + } + program { name: "hbar_show_notalways"; + signal: "elm,action,show_notalways,hbar"; + source: "elm"; + script { + new v; + v = get_int(sbalways_h); + if (v) { + set_int(sbalways_h, 0); + v = get_int(sbvis_h); + if (!v) { + emit("do-hide-hbar", ""); + set_int(sbvis_h, 0); + } + } + } + } + program { name: "sb_hbar_show"; + signal: "do-show-hbar"; + source: ""; + action: STATE_SET "default" 0.0; + transition: LINEAR 1.0; + target: "sb_hbar_clip"; + } + program { name: "sb_hbar_hide"; + signal: "do-hide-hbar"; + source: ""; + action: STATE_SET "hidden" 0.0; + transition: LINEAR 1.0; + target: "sb_hbar_clip"; + } + + program { name: "scroll"; + signal: "elm,action,scroll"; + source: "elm"; + script { + new v; + v = get_int(sbvis_v); + v |= get_int(sbalways_v); + if (!v) { + emit("do-show-vbar", ""); + set_int(sbvis_v, 1); + } + v = get_int(sbvis_h); + v |= get_int(sbalways_h); + if (!v) { + emit("do-show-hbar", ""); + set_int(sbvis_h, 1); + } + v = get_int(sbvis_timer); + if (v > 0) cancel_timer(v); + v = timer(2.0, "timer0", 0); + set_int(sbvis_timer, v); + } + } + program { name: "go1"; + signal: "elm,state,busy,start"; + source: "elm"; + action: STATE_SET "active" 0.0; + transition: SINUSOIDAL 1.0; + target: "busy_clip"; + } + program { name: "go2"; + signal: "elm,state,busy,start"; + source: "elm"; + action: STATE_SET "default" 0.0; + transition: LINEAR 0.5; + target: "busy"; + after: "go2"; + } + program { name: "stop1"; + signal: "elm,state,busy,stop"; + source: "elm"; + action: STATE_SET "default" 0.0; + transition: SINUSOIDAL 1.0; + target: "busy_clip"; + after: "stop2"; + } + program { name: "stop2"; + action: ACTION_STOP; + target: "go2"; + } + } + } + group { name: "elm/map/marker/default"; + data { + item: size_w 30; + item: size_h 30; + item: size_max_w 70; + item: size_max_h 70; + } + parts { + part { name: "base"; + ignore_flags: ON_HOLD; + description { state: "default" 0.0; + image.normal: "radio.png"; + } + } + part { name: "elm.text"; + type: TEXT; + effect: SOFT_SHADOW; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + align: 0.5 0.5; + color: 224 224 224 255; + color3: 0 0 0 64; + text { + font: "Sans,Edje-Vera"; + size: 10; + min: 0 0; + align: 0.5 0.5; + } + } + } + } + programs { + program { name: "open"; + signal: "mouse,up,1"; + source: "base"; + action: SIGNAL_EMIT "open" "elm"; + } + } + } + group { name: "elm/map/marker_bubble/default"; + images { + image: "bubble.png" COMP; + image: "bubble_shine.png" COMP; + } + data { + item: size_w 200; + item: size_h 100; + } + parts { + part { name: "clipper"; + mouse_events: 0; + description { state: "default" 0.0; + color: 255 255 255 0; + } + description { state: "show" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + part { name: "base0"; + mouse_events: 0; + clip_to: "clipper"; + description { state: "default" 0.0; + image { + normal: "bubble.png"; + border: 11 36 10 19; + } + image.middle: SOLID; + fill.smooth: 0; + } + } + part { name: "elm.swallow.content"; + type: SWALLOW; + clip_to: "clipper"; + description { state: "default" 0.0; + rel1 { + to: "base0"; + offset: 9 8; + } + rel2 { + to: "base0"; + offset: -10 -17; + } + } + } + part { name: "shine"; + mouse_events: 0; + clip_to: "clipper"; + description { state: "default" 0.0; + rel1 { + to: "base0"; + offset: 5 4; + } + rel2 { + to: "base0"; + relative: 1.0 0.5; + offset: -6 -16; + } + image { + normal: "bubble_shine.png"; + border: 5 5 5 0; + } + fill.smooth: 0; + } + } + } + programs { + program { name: "show"; + signal: "show"; + action: STATE_SET "show" 0.0; + target: "clipper"; + transition: ACCELERATE 0.5; + } + } + } + + + ///////////////////////////////////////////////////////////////////////////// // PANEL ///////////////////////////////////////////////////////////////////////////// Modified: trunk/TMP/st/elementary/src/bin/test_map.c =================================================================== --- trunk/TMP/st/elementary/src/bin/test_map.c 2009-11-15 14:24:55 UTC (rev 43709) +++ trunk/TMP/st/elementary/src/bin/test_map.c 2009-11-15 15:53:37 UTC (rev 43710) @@ -1,6 +1,26 @@ #include <Elementary.h> #ifndef ELM_LIB_QUICKLAUNCH +typedef struct Marker_Data +{ + const char *file; +} Marker_Data; + + +Elm_Map_Marker_Class itc; + +Marker_Data data1 = {PACKAGE_DATA_DIR"/images/logo.png"}; +Marker_Data data2 = {PACKAGE_DATA_DIR"/images/logo_small.png"}; +Marker_Data data3 = {PACKAGE_DATA_DIR"/images/panel_01.jpg"}; +Marker_Data data4 = {PACKAGE_DATA_DIR"/images/plant_01.jpg"}; +Marker_Data data5 = {PACKAGE_DATA_DIR"/images/rock_01.jpg"}; +Marker_Data data6 = {PACKAGE_DATA_DIR"/images/rock_02.jpg"}; +Marker_Data data7 = {PACKAGE_DATA_DIR"/images/sky_01.jpg"}; +Marker_Data data8 = {PACKAGE_DATA_DIR"/images/sky_02.jpg"}; +Marker_Data data9 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"}; +Marker_Data data10 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"}; +Marker_Data data11= {PACKAGE_DATA_DIR"/images/wood_01.jpg"}; + static void my_map_clicked(void *data, Evas_Object *obj, void *event_info) { @@ -111,8 +131,8 @@ { Evas_Object *win = data; double lon, lat; - elm_map_geo_region_get(obj, &lat, &lon); - printf("scroll latitude : %f longitude : %f\n", lat, lon); + elm_map_geo_region_get(obj, &lon, &lat); + printf("scroll longitude : %f latitude : %f\n", lon, lat); } static void @@ -131,13 +151,13 @@ elm_map_paused_set(data, EINA_TRUE); elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); //elm_map_zoom_set(data, 18); - elm_map_geo_region_show(data, 48.857, 2.352); + elm_map_geo_region_show(data, 2.352, 48.857); } static void my_bt_bring_reg(void *data, Evas_Object *obj, void *event_info) { - elm_map_geo_region_bring_in(data, 48.857, 2.352); + elm_map_geo_region_bring_in(data, 2.352, 48.857); } static void @@ -180,6 +200,19 @@ elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL); } +static Evas_Object *_marker_get(Evas_Object *obj, Elm_Map_Marker *marker, void *data) +{ + Marker_Data *d = data; + + Evas_Object *o = evas_object_image_add(evas_object_evas_get(obj)); + evas_object_image_file_set(o, d->file, NULL); + evas_object_image_filled_set(o, EINA_TRUE); + evas_object_size_hint_min_set(o, 64, 64); + evas_object_show(o); + + return o; +} + void test_map(void *data, Evas_Object *obj, void *event_info) { @@ -200,6 +233,25 @@ elm_win_resize_object_add(win, map); evas_object_data_set(map, "window", win); + itc.func.get = _marker_get; + itc.func.del = NULL; + + Elm_Map_Marker *marker = elm_map_marker_add(map, 2.352, 48.857, &itc, &data1); + marker = elm_map_marker_add(map, 2.355, 48.857, &itc, &data3); + marker = elm_map_marker_add(map, 3, 48.857, &itc, &data2); + marker = elm_map_marker_add(map, 2.352, 49, &itc, &data1); + + marker = elm_map_marker_add(map, 7.31451, 48.857127, &itc, &data10); + marker = elm_map_marker_add(map, 7.314704, 48.857119, &itc, &data4); + marker = elm_map_marker_add(map, 7.314704, 48.857119, &itc, &data5); + marker = elm_map_marker_add(map, 7.31432, 48.856785, &itc, &data6); + marker = elm_map_marker_add(map, 7.3148, 48.85725, &itc, &data7); + marker = elm_map_marker_add(map, 7.316445, 48.8572210000694, &itc, &data8); + marker = elm_map_marker_add(map, 7.316527000125, 48.85609, &itc, &data9); + marker = elm_map_marker_add(map, 7.3165409990833, 48.856078, &itc, &data11); + marker = elm_map_marker_add(map, 7.319812, 48.856561, &itc, &data10); + + evas_object_smart_callback_add(map, "clicked", my_map_clicked, win); evas_object_smart_callback_add(map, "press", my_map_press, win); evas_object_smart_callback_add(map, "longpressed", my_map_longpressed, win); Modified: trunk/TMP/st/elementary/src/lib/Elementary.h.in =================================================================== --- trunk/TMP/st/elementary/src/lib/Elementary.h.in 2009-11-15 14:24:55 UTC (rev 43709) +++ trunk/TMP/st/elementary/src/lib/Elementary.h.in 2009-11-15 15:53:37 UTC (rev 43710) @@ -1003,17 +1003,32 @@ ELM_MAP_ZOOM_MODE_AUTO_FIT, ELM_MAP_ZOOM_MODE_AUTO_FILL } Elm_Map_Zoom_Mode; + typedef struct _Elm_Map_Marker Elm_Map_Marker; + typedef struct _Elm_Map_Marker_Class Elm_Map_Marker_Class; + typedef Evas_Object *(*ElmMapMarkerGetFunc) (Evas_Object *obj, Elm_Map_Marker *marker, void *data); + typedef void (*ElmMapMarkerDelFunc) (Evas_Object *obj, Elm_Map_Marker *marker, void *data, Evas_Object *o); + struct _Elm_Map_Marker_Class + { + struct _Elm_Map_Marker_Class_Func + { + ElmMapMarkerGetFunc get; + ElmMapMarkerDelFunc del; //if NULL the object will be destroyed with evas_object_del() + } func; + }; EAPI Evas_Object *elm_map_add(Evas_Object *parent); EAPI void elm_map_zoom_set(Evas_Object *obj, int zoom); EAPI double elm_map_zoom_get(Evas_Object *obj); EAPI void elm_map_zoom_mode_set(Evas_Object *obj, Elm_Map_Zoom_Mode mode); EAPI Elm_Map_Zoom_Mode elm_map_zoom_mode_get(Evas_Object *obj); EAPI void elm_map_image_size_get(Evas_Object *obj, int *w, int *h); - EAPI void elm_map_geo_region_get(Evas_Object *obj, double *lat, double *lon); - EAPI void elm_map_geo_region_bring_in(Evas_Object *obj, double lat, double lon); - EAPI void elm_map_geo_region_show(Evas_Object *obj, double lat, double lon); + EAPI void elm_map_geo_region_get(Evas_Object *obj, double *lon, double *lat); + EAPI void elm_map_geo_region_bring_in(Evas_Object *obj, double lon, double lat); + EAPI void elm_map_geo_region_show(Evas_Object *obj, double lon, double lat); EAPI void elm_map_paused_set(Evas_Object *obj, Eina_Bool paused); EAPI Eina_Bool elm_map_paused_get(Evas_Object *obj); + EAPI void elm_map_utils_convert_coord_into_geo(int x, int y, int size, double *lon, double *lat); + EAPI void elm_map_utils_convert_geo_into_coord(double lon, double lat, int size, int *x, int *y); + EAPI Elm_Map_Marker *elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Class *class, void *data); /* smart callbacks called: * "clicked" - when image clicked * "press" - when mouse/finger held down initially on image Modified: trunk/TMP/st/elementary/src/lib/elm_map.c =================================================================== --- trunk/TMP/st/elementary/src/lib/elm_map.c 2009-11-15 14:24:55 UTC (rev 43709) +++ trunk/TMP/st/elementary/src/lib/elm_map.c 2009-11-15 15:53:37 UTC (rev 43710) @@ -42,8 +42,6 @@ * * scroll,drag,stop - dragging the contents around has stopped * - * --- - * */ @@ -51,17 +49,42 @@ typedef struct _Pan Pan; typedef struct _Grid Grid; typedef struct _Grid_Item Grid_Item; +typedef struct _Marker_Group Marker_Group; + #define SOURCE_PATH "http://tile.openstreetmap.org/%d/%d/%d.png" #define DEST_DIR_ZOOM_PATH "/tmp/elm_map/%d/" #define DEST_DIR_PATH DEST_DIR_ZOOM_PATH"%d/" #define DEST_FILE_PATH "%s%d.png" +struct _Elm_Map_Marker +{ + Widget_Data *wd; + Elm_Map_Marker_Class *class; + double longitude, latitude; + Evas_Coord map_size; + Evas_Coord x[19], y[19]; + void *data; + + Evas_Object *content; +}; + +struct _Marker_Group +{ + Widget_Data *wd; + Eina_List *markers; + Evas_Coord x, y; + Evas_Coord w, h; + Evas_Object *obj, *bubble, *sc, *bx; + Eina_Bool open : 1; +}; + struct _Grid_Item { Widget_Data *wd; - Evas_Object *img, *txt; + Evas_Object *img; + //Evas_Object *txt; const char *file; struct { @@ -83,7 +106,6 @@ int w, h; // size of grid image in pixels (represented by grid) int gw, gh; // size of grid in tiles Eina_Matrixsparse *grid; - Eina_Bool dead : 1; // old grid. will die as soon as anim is over }; struct _Widget_Data @@ -120,6 +142,11 @@ Eina_Bool longpressed : 1; Eina_Bool on_hold : 1; Eina_Bool paused : 1; + + Eina_List *markers[19]; + Evas_Coord marker_w, marker_h; + Evas_Coord marker_max_w, marker_max_h; + int marker_zoom; }; struct _Pan @@ -138,6 +165,16 @@ static Grid *grid_create(Evas_Object *obj); static void grid_load(Evas_Object *obj, Grid *g); + +static void _group_open_cb(void *data, Evas_Object *obj, const char *emission, const char *soure); +static void _group_bubble_create(Marker_Group *group); +static void _group_bubble_free(Marker_Group *group); +static void _group_bubble_place(Marker_Group *group); + +static void _group_bubble_content_update(Marker_Group *group); +static void _group_bubble_content_free(Marker_Group *group); +static void marker_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh); + static void rect_place(Evas_Object *obj, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) { @@ -158,12 +195,18 @@ } static void -grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +marker_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) { Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord ax, ay, gw, gh, tx, ty; + Eina_List *l, *l2; + Marker_Group *group; int x, y; + int xx, yy, ww, hh; + char buf[PATH_MAX]; + if(g != eina_list_data_get(wd->grids)) return ; + ax = 0; ay = 0; gw = wd->size.w; @@ -171,12 +214,107 @@ if (ow > gw) ax = (ow - gw) / 2; if (oh > gh) ay = (oh - gh) / 2; + if(wd->zoom != wd->marker_zoom) + { + EINA_LIST_FOREACH(wd->markers[wd->marker_zoom], l, group) + { + if(group->obj) + { + evas_object_del(group->obj); + group->obj = NULL; + group->open = EINA_FALSE; + _group_bubble_free(group); + } + } + } + wd->marker_zoom = wd->zoom; + + EINA_LIST_FOREACH(wd->markers[wd->zoom], l, group) + { + if(!group->markers) continue ; + + xx = group->x; + yy = group->y; + ww = group->w; + hh = group->h; + + if(ww<=0) ww = 1; + if(hh<=0) hh = 1; + + if ((gw != g->w) && (g->w > 0)) + { + tx = xx; + xx = ((long long )gw * xx) / g->w; + ww = (((long long)gw * (tx + ww)) / g->w) - xx; + } + if ((gh != g->h) && (g->h > 0)) + { + ty = yy; + yy = ((long long)gh * yy) / g->h; + hh = (((long long)gh * (ty + hh)) / g->h) - yy; + } + + if(xx-px+ax >= ox && xx-px+ax<= ox+ow + && yy-py+ay >= oy && yy-py+ay<= oy+oh) + { + if(!group->obj) + { + group->obj = edje_object_add(evas_object_evas_get(obj)); + _elm_theme_set(group->obj, "map", "marker", elm_widget_style_get(obj)); + + evas_object_smart_member_add(group->obj, + wd->pan_smart); + elm_widget_sub_object_add(obj, group->obj); + + edje_object_signal_callback_add(group->obj, "open", "elm", _group_open_cb, group); + + if(group->open) + _group_bubble_create(group); + } + + if(eina_list_count(group->markers) > 1) + { + snprintf(buf, PATH_MAX, "%d", eina_list_count(group->markers)); + edje_object_part_text_set(group->obj, "elm.text", buf); + } + evas_object_move(group->obj, + xx - px + ax + ox - ww/2, + yy - py + ay + oy - hh/2); + evas_object_resize(group->obj, ww, hh); + evas_object_raise(group->obj); + evas_object_show(group->obj); + + if(group->bubble) + _group_bubble_place(group); + } + else if(group->obj) + { + evas_object_del(group->obj); + group->obj = NULL; + _group_bubble_free(group); + } + } +} + + static void +grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord ax, ay, gw, gh, tx, ty; + int xx, yy, ww, hh; + + ax = 0; + ay = 0; + gw = wd->size.w; + gh = wd->size.h; + if (ow > gw) ax = (ow - gw) / 2; + if (oh > gh) ay = (oh - gh) / 2; + Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); Eina_Matrixsparse_Cell *cell; EINA_ITERATOR_FOREACH(it, cell) { - int xx, yy, ww, hh; Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); xx = gi->out.x; @@ -201,12 +339,14 @@ evas_object_resize(gi->img, ww, hh); - evas_object_move(gi->txt, - xx - px + ax + ox, - yy - py + ay + oy); + /*evas_object_move(gi->txt, + xx - px + ax + ox, + yy - py + ay + oy); - evas_object_resize(gi->txt, ww, hh); + evas_object_resize(gi->txt, ww, hh); + */ } + eina_iterator_free(it); } static void @@ -227,7 +367,7 @@ { Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); evas_object_del(gi->img); - evas_object_del(gi->txt); + //evas_object_del(gi->txt); if (gi->want) { @@ -254,6 +394,7 @@ free(gi); } eina_matrixsparse_free(g->grid); + eina_iterator_free(it); g->grid = NULL; g->gw = 0; g->gh = 0; @@ -263,12 +404,12 @@ _tile_update(Grid_Item *gi) { gi->want = EINA_FALSE; - gi->download = EINA_FALSE; + gi->download = EINA_FALSE; evas_object_image_file_set(gi->img, gi->file, NULL); evas_object_show(gi->img); - evas_object_text_text_set(gi->txt, gi->file); - evas_object_show(gi->txt); + //evas_object_text_text_set(gi->txt, gi->file); + //evas_object_show(gi->txt); gi->have = EINA_TRUE; gi->wd->preload_num--; @@ -291,10 +432,10 @@ DBG("DOWNLOAD done %s", gi->file); if (gi->want && !status) - _tile_update(gi); + _tile_update(gi); if(status) - DBG("Download failed (%d) %s", status, gi->file); + DBG("Download failed (%d) %s", status, gi->file); } static Grid * @@ -410,11 +551,12 @@ } } } + eina_iterator_free(it); - xx = wd->pan_x / size; + xx = wd->pan_x / size - 1; if(xx < 0) xx = 0; - yy = wd->pan_y / size; + yy = wd->pan_y / size - 1; if(yy < 0) yy = 0; ww = ow / size + 2; @@ -457,14 +599,14 @@ elm_widget_sub_object_add(obj, gi->img); evas_object_pass_events_set(gi->img, 1); - gi->txt = evas_object_text_add(evas_object_evas_get(obj)); - evas_object_text_font_set(gi->txt, "Vera", 12); - evas_object_color_set(gi->txt, 100, 100, 100, 255); - evas_object_smart_member_add(gi->txt, - wd->pan_smart); - elm_widget_sub_object_add(obj, gi->txt); - evas_object_pass_events_set(gi->txt, 1); - + /*gi->txt = evas_object_text_add(evas_object_evas_get(obj)); + evas_object_text_font_set(gi->txt, "Vera", 12); + evas_object_color_set(gi->txt, 100, 100, 100, 255); + evas_object_smart_member_add(gi->txt, + wd->pan_smart); + elm_widget_sub_object_add(obj, gi->txt); + evas_object_pass_events_set(gi->txt, 1); + */ eina_matrixsparse_data_idx_set(g->grid, y, x, gi); } @@ -502,7 +644,7 @@ _tile_update(gi); else { - DBG("DOWNLOAD %s \t in %s", buf, buf2); + DBG("DOWNLOAD %s \t in %s", buf, buf2); ecore_file_download(buf, buf2, _tile_downloaded, NULL, gi, &(gi->job)); if(!gi->job) DBG("Can't start to download %s", buf); @@ -545,6 +687,7 @@ Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); evas_object_image_smooth_scale_set(gi->img, (wd->nosmooth == 0)); } + eina_iterator_free(it); } } @@ -561,8 +704,9 @@ { Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); evas_object_raise(gi->img); - evas_object_raise(gi->txt); + //evas_object_raise(gi->txt); } + eina_iterator_free(it); } static int @@ -697,22 +841,45 @@ static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_NULL; -static void + static void _del_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); + if (wd->calc_job) ecore_job_del(wd->calc_job); if (wd->scr_timer) ecore_timer_del(wd->scr_timer); if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator); if (wd->long_timer) ecore_timer_del(wd->long_timer); + free(wd); } -static void + static void _del_pre_hook(Evas_Object *obj) { + Marker_Group *group; + Elm_Map_Marker *marker; + int i; + Eina_Bool free_marker = EINA_TRUE; + Widget_Data *wd = elm_widget_data_get(obj); grid_clearall(obj); + + for(i=0; i<19; i++) + { + EINA_LIST_FREE(wd->markers[i], group) + { + EINA_LIST_FREE(group->markers, marker) + { + if(free_marker) + free(marker); + } + free(group); + } + free_marker = EINA_FALSE; + } + + evas_object_del(wd->pan_smart); wd->pan_smart = NULL; } @@ -721,7 +888,7 @@ _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); - elm_smart_scroller_theme_set(wd->scr, "photocam", "base", elm_widget_style_get(obj)); + elm_smart_scroller_theme_set(wd->scr, "map", "base", elm_widget_style_get(obj)); edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } @@ -869,6 +1036,7 @@ { grid_load(sd->wd->obj, g); grid_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh); + marker_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh); } } @@ -934,6 +1102,143 @@ evas_object_smart_callback_call(data, "scroll", NULL); } + static void +_group_bubble_create(Marker_Group *group) +{ + if(group->bubble) return ; + + group->bubble = edje_object_add(evas_object_evas_get(group->obj)); + _elm_theme_set(group->bubble, "map", "marker_bubble", + elm_widget_style_get(group->wd->obj)); + evas_object_smart_member_add(group->bubble, + group->wd->obj); + elm_widget_sub_object_add(group->wd->obj, group->bubble); + + _group_bubble_content_update(group); + + _group_bubble_place(group); +} + + static void +_group_bubble_mouse_in_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Marker_Group *group = data; + evas_object_raise(group->bubble); + evas_object_raise(group->sc); +} + + static void +_group_bubble_content_update(Marker_Group *group) +{ + Eina_List *l; + Elm_Map_Marker *marker; + + if(!group->bubble) return ; + + _group_bubble_content_free(group); + + if(!group->sc) + { + group->sc = elm_scroller_add(group->bubble); + elm_scroller_content_min_limit(group->sc, EINA_FALSE, EINA_TRUE); + elm_scroller_policy_set(group->sc, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF); + elm_scroller_bounce_set(group->sc, EINA_TRUE, EINA_FALSE); + edje_object_part_swallow(group->bubble, "elm.swallow.content", group->sc); + evas_object_show(group->sc); + evas_object_smart_member_add(group->sc, + group->wd->obj); + elm_widget_sub_object_add(group->wd->obj, group->sc); + + group->bx = elm_box_add(group->bubble); + evas_object_size_hint_align_set(group->bx, -1, -1); + evas_object_size_hint_weight_set(group->bx, 0.5, 0.5); + elm_box_horizontal_set(group->bx, EINA_TRUE); + evas_object_show(group->bx); + + evas_object_event_callback_add(group->bx, EVAS_CALLBACK_MOUSE_IN, _group_bubble_mouse_in_cb, group); + evas_object_event_callback_add(group->bx, EVAS_CALLBACK_MOUSE_DOWN, _group_bubble_mouse_in_cb, group); + + elm_scroller_content_set(group->sc, group->bx); + } + + EINA_LIST_FOREACH(group->markers, l, marker) + { + if(marker->class->func.get) + marker->content = marker->class->func.get(group->wd->obj, marker, marker->data); + + if(marker->content) + elm_box_pack_end(group->bx, marker->content); + } +} + + static void +_group_bubble_content_free(Marker_Group *group) +{ + Eina_List *l; + Elm_Map_Marker *marker; + + if(!group->sc) return ; + + EINA_LIST_FOREACH(group->markers, l, marker) + { + if(marker->content && marker->class->func.del) + marker->class->func.del(group->wd->obj, marker, marker->data, marker->content); + else if(marker->content) + evas_object_del(marker->content); + } + + evas_object_del(group->sc); + group->sc = NULL; +} + + static void +_group_bubble_free(Marker_Group *group) +{ + if(!group->bubble) return ; + evas_object_del(group->bubble); + group->bubble = NULL; + _group_bubble_content_free(group); +} + + static void +_group_bubble_place(Marker_Group *group) +{ + Evas_Coord x, y, w, h; + Evas_Coord xx, yy, ww, hh; + const char *s; + + if(!group->bubble) return ; + + evas_object_geometry_get(group->obj, &x, &y, &w, &h); + s = edje_object_data_get(group->bubble, "size_w"); + ww = atoi(s); + s = edje_object_data_get(group->bubble, "size_h"); + hh = atoi(s); + xx = x+w/2-ww/2; + yy = y-hh; + + evas_object_move(group->bubble, xx, yy); + evas_object_resize(group->bubble, ww, hh); + evas_object_show(group->bubble); +} + + +static void +_group_open_cb(void *data, Evas_Object *obj, const char *emission, const char *soure) +{ + Marker_Group *group = data; + + if(group->bubble) + { + group->open = EINA_FALSE; + _group_bubble_free(group); + return ; + } + group->open = EINA_TRUE; + _group_bubble_create(group); +} + + /** * Add a new Map object * @@ -945,20 +1250,21 @@ EAPI Evas_Object * elm_map_add(Evas_Object *parent) { - Evas_Object *obj; + Evas_Object *obj, *o; Evas *e; Widget_Data *wd; Evas_Coord minw, minh; static Evas_Smart *smart = NULL; int i; + const char *s; Grid *g; - + if(!ecore_file_download_protocol_available("http://")) - { - ERR("Ecore must be built with the support of HTTP for the widget map !"); - return NULL; - } + { + ERR("Ecore must be built with the support of HTTP for the widget map !"); + return NULL; + } wd = ELM_NEW(Widget_Data); e = evas_object_evas_get(parent); @@ -971,7 +1277,7 @@ elm_widget_theme_hook_set(obj, _theme_hook); wd->scr = elm_smart_scroller_add(e); - elm_smart_scroller_theme_set(wd->scr, "photocam", "base", "default"); + elm_smart_scroller_theme_set(wd->scr, "map", "base", "default"); evas_object_smart_callback_add(wd->scr, "scroll", _scr, obj); evas_object_smart_callback_add(wd->scr, "drag", _scr, obj); elm_widget_resize_object_set(obj, wd->scr); @@ -986,6 +1292,19 @@ wd->obj = obj; + //load the minimum size of the marker group + o = edje_object_add(e); + _elm_theme_set(o, "map", "marker", elm_widget_style_get(obj)); + s = edje_object_data_get(o, "size_w"); + wd->marker_w = atoi(s); + s = edje_object_data_get(o, "size_h"); + wd->marker_h = atoi(s); + s = edje_object_data_get(o, "size_max_w"); + wd->marker_max_w = atoi(s); + s = edje_object_data_get(o, "size_max_h"); + wd->marker_max_h = atoi(s); + evas_object_del(o); + evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj); evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj); evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); @@ -1053,7 +1372,7 @@ /** * Set the zoom level of the map * - * This sets the zoom level. 0 is the world map and 18 is the maximum zoom. + * This sets the zoom level. 0 is the world map and 18 is the maximum zoom. * * @param obj The map object * @param zoom The zoom level to set @@ -1305,14 +1624,12 @@ } EAPI void -elm_map_geo_region_bring_in(Evas_Object *obj, double lat, double lon) +elm_map_geo_region_bring_in(Evas_Object *obj, double lon, double lat) { Widget_Data *wd = elm_widget_data_get(obj); int rx, ry, rw, rh; - rx = floor((lon + 180.0) / 360.0 * wd->size.w); - ry = floor((1.0 - log( tan(lat * ELM_PI/180.0) + 1.0 / cos(lat * ELM_PI/180.0)) / ELM_PI) / 2.0 * wd->size.h); - + elm_map_utils_convert_geo_into_coord(lon, lat, wd->size.w, &rx, &ry); elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); rx = rx - rw/2; @@ -1331,7 +1648,7 @@ } /** - * Move the map to the current coordinates. + * Move the map to the current coordinates. * * This move the map to the current coordinates. The map will be centred on these coordinates. * @@ -1342,14 +1659,12 @@ * @ingroup Map */ EAPI void -elm_map_geo_region_show(Evas_Object *obj, double lat, double lon) +elm_map_geo_region_show(Evas_Object *obj, double lon, double lat) { Widget_Data *wd = elm_widget_data_get(obj); int rx, ry, rw, rh; - rx = floor((lon + 180.0) / 360.0 * wd->size.w); - ry = floor((1.0 - log( tan(lat * ELM_PI/180.0) + 1.0 / cos(lat * ELM_PI/180.0)) / ELM_PI) / 2.0 * wd->size.h); - + elm_map_utils_convert_geo_into_coord(lon, lat, wd->size.w, &rx, &ry); elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); rx = rx - rw/2; @@ -1367,7 +1682,7 @@ } /** - * Move the map to the current coordinates. + * Move the map to the current coordinates. * * This move the map to the current coordinates. The map will be centred on these coordinates. * @@ -1378,7 +1693,7 @@ * @ingroup Map */ EAPI void -elm_map_geo_region_get(Evas_Object *obj, double *lat, double *lon) +elm_map_geo_region_get(Evas_Object *obj, double *lon, double *lat) { Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord sx, sy, sw, sh; @@ -1389,21 +1704,7 @@ sx += sw/2; sy += sh/2; - if (wd->size.w > 0) - { - if (lon) - { - *lon = sx / (double)wd->size.w * 360.0 - 180; - } - } - if (wd->size.h > 0) - { - if (lat) - { - double n = ELM_PI - 2.0 * ELM_PI * sy / wd->size.h; - *lat = 180.0 / ELM_PI * atan(0.5 * (exp(n) - exp(-n))); - } - } + elm_map_utils_convert_coord_into_geo(sx, sy, wd->size.w, lon, lat); } /** @@ -1448,3 +1749,140 @@ Widget_Data *wd = elm_widget_data_get(obj); return wd->paused; } + + +/** + * Convert a pixel coordinate into a geographic coordinate. + * + * Convert a pixel coordinate (x,y) into a geographic coordinate (longitude, latitude). + * + * @param obj The map object + * @param x the coordinate + * @param y the coordinate + * @param size the size in pixels of the map. The map is a square and generally his size is : pow(2.0, zoom)*256. + * @param lon the longitude correspond to x + * @param lat the latitude correspond to y + */ + EAPI void +elm_map_utils_convert_coord_into_geo(int x, int y, int size, double *lon, double *lat) +{ + if (lon) + { + *lon = x / (double)size * 360.0 - 180; + } + if (lat) + { + double n = ELM_PI - 2.0 * ELM_PI * y / size; + *lat = 180.0 / ELM_PI * atan(0.5 * (exp(n) - exp(-n))); + } +} + +/** + * Convert a geographic coordinate into a pixel coordinate. + * + * Convert a geographic coordinate (longitude, latitude) into a pixel coordinate (x, y). + * + * @param obj The map object + * @param lon the longitude + * @param lat the latitude + * @param size the size in pixels of the map. The map is a square and generally his size is : pow(2.0, zoom)*256. + * @param x the coordinate correspond to the longitude + * @param y the coordinate correspond to the latitude + */ + EAPI void +elm_map_utils_convert_geo_into_coord(double lon, double lat, int size, int *x, int *y) +{ + if(x) + *x = floor((lon + 180.0) / 360.0 * size); + if(y) + *y = floor((1.0 - log( tan(lat * ELM_PI/180.0) + 1.0 / cos(lat * ELM_PI/180.0)) / ELM_PI) / 2.0 * size); +} + + + +/** + * Add a marker on the map + * + * Add a marker on the map + * + * @param obj The map object + * @param lon the longitude + * @param lat the latitude + * @param class the class to use + * @param data the data passed to the callbacks + */ + EAPI Elm_Map_Marker * +elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Class *class, void *data) +{ + int i; + Eina_List *l, *l2; + Marker_Group *group; + Elm_Map_Marker *_marker; + Widget_Data *wd = elm_widget_data_get(obj); + + Elm_Map_Marker *marker = calloc(1, sizeof(Elm_Map_Marker)); + + marker->wd = wd; + marker->class = class; + marker->longitude = lon; + marker->latitude = lat; + marker->data = data; + + for(i=0; i<=18; i++) + { + int sizew = wd->marker_w;; + int sizeh = wd->marker_h;; + if(sizew<=0) sizew = 2; + if(sizeh<=0) sizeh = 2; + if(sizew > wd->marker_max_w) sizew = wd->marker_max_w; + if(sizeh > wd->marker_max_h) sizeh = wd->marker_max_h; + + elm_map_utils_convert_geo_into_coord(lon, lat, pow(2.0, i)*wd->tsize, + &(marker->x[i]), &(marker->y[i])); + + EINA_LIST_FOREACH(wd->markers[i], l, group) + { + if(ELM_RECTS_INTERSECT( marker->x[i]-sizew/4, marker->y[i]-sizeh/4, sizew, sizeh, + group->x-group->w/4, group->y-group->h/4, group->w, group->h)) + { + group->x = marker->x[i]; + group->y = marker->y[i]; + EINA_LIST_FOREACH(group->markers, l2, _marker) + { + group->x+=_marker->x[i]; + group->y+=_marker->y[i]; + } + group->markers = eina_list_append(group->markers, marker); + group->x = group->x / eina_list_count(group->markers); + group->y = group->y / eina_list_count(group->markers); + group->w = sizew + sizew/8. * eina_list_count(group->markers); + group->h = sizeh + sizew/8. * eina_list_count(group->markers); + if(group->w > wd->marker_max_w) group->w = wd->marker_max_w; + if(group->h > wd->marker_max_h) group->h = wd->marker_max_h; + + break; + } + } + if(!group) + { + group = calloc(1, sizeof(Marker_Group)); + group->wd = wd; + group->x = marker->x[i]; + group->y = marker->y[i]; + group->w = sizew; + group->h = sizeh; + group->markers = eina_list_append(group->markers, marker); + wd->markers[i] = eina_list_append(wd->markers[i], group); + } + } + + if(wd->grids) + { + Evas_Coord ox, oy, ow, oh; + evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); + marker_place(obj, eina_list_data_get(wd->grids), wd->pan_x, wd->pan_y, ox, oy, ow, oh); + } + + return marker; +} + |