summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--configure.ac1
-rw-r--r--src/bin/test_map.c14
-rw-r--r--src/lib/Elementary.h.in8
-rw-r--r--src/lib/elm_map.c112
-rw-r--r--src/modules/Makefile.am3
-rw-r--r--src/modules/test_map/Makefile.am32
-rw-r--r--src/modules/test_map/mod.c50
8 files changed, 192 insertions, 29 deletions
diff --git a/AUTHORS b/AUTHORS
index 5c4ee86cb..9357d10c6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -28,3 +28,4 @@ Tiago Falc√£o <tiago@profusion.mobi>
28Otavio Pontes <otavio@profusion.mobi> 28Otavio Pontes <otavio@profusion.mobi>
29Viktor Kojouharov <vkojouharov@gmail.com> 29Viktor Kojouharov <vkojouharov@gmail.com>
30Daniel Juyung Seo (SeoZ) <juyung.seo@samsung.com> <seojuyung2@gmail.com> 30Daniel Juyung Seo (SeoZ) <juyung.seo@samsung.com> <seojuyung2@gmail.com>
31Sangho Park <sangho.g.park@samsung.com> <gouache95@gmail.com>
diff --git a/configure.ac b/configure.ac
index e56f0aacc..d49cc23fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -479,6 +479,7 @@ src/lib/Elementary.h
479src/bin/Makefile 479src/bin/Makefile
480src/modules/Makefile 480src/modules/Makefile
481src/modules/test_entry/Makefile 481src/modules/test_entry/Makefile
482src/modules/test_map/Makefile
482src/edje_externals/Makefile 483src/edje_externals/Makefile
483data/Makefile 484data/Makefile
484data/themes/Makefile 485data/themes/Makefile
diff --git a/src/bin/test_map.c b/src/bin/test_map.c
index 155f18666..1d3e00686 100644
--- a/src/bin/test_map.c
+++ b/src/bin/test_map.c
@@ -216,6 +216,12 @@ my_bt_source_maplint(void *data, Evas_Object *obj __UNUSED__, void *event_info _
216} 216}
217 217
218static void 218static void
219my_bt_source_module(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
220{
221 elm_map_source_set(data, ELM_MAP_SOURCE_MODULE);
222}
223
224static void
219my_bt_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 225my_bt_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
220{ 226{
221 int i; 227 int i;
@@ -584,6 +590,14 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
584 evas_object_size_hint_align_set(bt, 1.0, 0.9); 590 evas_object_size_hint_align_set(bt, 1.0, 0.9);
585 evas_object_show(bt); 591 evas_object_show(bt);
586 elm_box_pack_end(bx, bt); 592 elm_box_pack_end(bx, bt);
593
594 bt = elm_button_add(win);
595 elm_button_label_set(bt, "Module");
596 evas_object_smart_callback_add(bt, "clicked", my_bt_source_module, map);
597 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
598 evas_object_size_hint_align_set(bt, 1.0, 0.9);
599 evas_object_show(bt);
600 elm_box_pack_end(bx, bt);
587 // 601 //
588 602
589 evas_object_show(tb2); 603 evas_object_show(tb2);
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index a536be1ed..c1e7208b7 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -2041,7 +2041,7 @@ extern "C" {
2041 ELM_MAP_SOURCE_CUSTOM_4, 2041 ELM_MAP_SOURCE_CUSTOM_4,
2042 ELM_MAP_SOURCE_CUSTOM_5, 2042 ELM_MAP_SOURCE_CUSTOM_5,
2043 ELM_MAP_SOURCE_CUSTOM_6, 2043 ELM_MAP_SOURCE_CUSTOM_6,
2044 ELM_MAP_SOURCE_CUSTOM_7, 2044 ELM_MAP_SOURCE_MODULE,
2045 ELM_MAP_SOURCE_LAST 2045 ELM_MAP_SOURCE_LAST
2046 } Elm_Map_Sources; 2046 } Elm_Map_Sources;
2047 2047
@@ -2052,7 +2052,7 @@ extern "C" {
2052 typedef void (*ElmMapMarkerDelFunc) (Evas_Object *obj, Elm_Map_Marker *marker, void *data, Evas_Object *o); 2052 typedef void (*ElmMapMarkerDelFunc) (Evas_Object *obj, Elm_Map_Marker *marker, void *data, Evas_Object *o);
2053 typedef Evas_Object *(*ElmMapMarkerIconGetFunc) (Evas_Object *obj, Elm_Map_Marker *marker, void *data); 2053 typedef Evas_Object *(*ElmMapMarkerIconGetFunc) (Evas_Object *obj, Elm_Map_Marker *marker, void *data);
2054 typedef Evas_Object *(*ElmMapGroupIconGetFunc) (Evas_Object *obj, void *data); 2054 typedef Evas_Object *(*ElmMapGroupIconGetFunc) (Evas_Object *obj, void *data);
2055 typedef char *(*ElmMapSourceURLFunc) (int x, int y, int zoom); 2055 typedef char *(*ElmMapSourceURLFunc) (Evas_Object *obj, int x, int y, int zoom);
2056 2056
2057 EAPI Evas_Object *elm_map_add(Evas_Object *parent) EINA_ARG_NONNULL(1); 2057 EAPI Evas_Object *elm_map_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
2058 EAPI void elm_map_zoom_set(Evas_Object *obj, int zoom) EINA_ARG_NONNULL(1); 2058 EAPI void elm_map_zoom_set(Evas_Object *obj, int zoom) EINA_ARG_NONNULL(1);
@@ -2066,8 +2066,8 @@ extern "C" {
2066 EAPI Eina_Bool elm_map_paused_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 2066 EAPI Eina_Bool elm_map_paused_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
2067 EAPI void elm_map_paused_markers_set(Evas_Object *obj, Eina_Bool paused) EINA_ARG_NONNULL(1); 2067 EAPI void elm_map_paused_markers_set(Evas_Object *obj, Eina_Bool paused) EINA_ARG_NONNULL(1);
2068 EAPI Eina_Bool elm_map_paused_markers_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 2068 EAPI Eina_Bool elm_map_paused_markers_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
2069 EAPI void elm_map_utils_convert_coord_into_geo(int x, int y, int size, double *lon, double *lat); 2069 EAPI void elm_map_utils_convert_coord_into_geo(const Evas_Object *obj, int x, int y, int size, double *lon, double *lat);
2070 EAPI void elm_map_utils_convert_geo_into_coord(double lon, double lat, int size, int *x, int *y); 2070 EAPI void elm_map_utils_convert_geo_into_coord(const Evas_Object *obj, double lon, double lat, int size, int *x, int *y);
2071 EAPI Elm_Map_Marker *elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Class *clas, Elm_Map_Group_Class *clas_group, void *data) EINA_ARG_NONNULL(1, 4, 5); 2071 EAPI Elm_Map_Marker *elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Class *clas, Elm_Map_Group_Class *clas_group, void *data) EINA_ARG_NONNULL(1, 4, 5);
2072 EAPI void elm_map_max_marker_per_group_set(Evas_Object *obj, int max) EINA_ARG_NONNULL(1); 2072 EAPI void elm_map_max_marker_per_group_set(Evas_Object *obj, int max) EINA_ARG_NONNULL(1);
2073 EAPI void elm_map_marker_remove(Elm_Map_Marker *marker) EINA_ARG_NONNULL(1); 2073 EAPI void elm_map_marker_remove(Elm_Map_Marker *marker) EINA_ARG_NONNULL(1);
diff --git a/src/lib/elm_map.c b/src/lib/elm_map.c
index 981c4b070..80872cce2 100644
--- a/src/lib/elm_map.c
+++ b/src/lib/elm_map.c
@@ -3,6 +3,7 @@
3 3
4/** 4/**
5 * @defgroup Map Map 5 * @defgroup Map Map
6 * @ingroup Elementary
6 * 7 *
7 * This is a widget specifically for displaying the free map OpenStreetMap. 8 * This is a widget specifically for displaying the free map OpenStreetMap.
8 * 9 *
@@ -47,6 +48,7 @@ typedef struct _Pan Pan;
47typedef struct _Grid Grid; 48typedef struct _Grid Grid;
48typedef struct _Grid_Item Grid_Item; 49typedef struct _Grid_Item Grid_Item;
49typedef struct _Marker_Group Marker_Group; 50typedef struct _Marker_Group Marker_Group;
51typedef struct _Mod_Api Mod_Api;
50 52
51#define DEST_DIR_ZOOM_PATH "/tmp/elm_map/%d/%d/" 53#define DEST_DIR_ZOOM_PATH "/tmp/elm_map/%d/%d/"
52#define DEST_DIR_PATH DEST_DIR_ZOOM_PATH"%d/" 54#define DEST_DIR_PATH DEST_DIR_ZOOM_PATH"%d/"
@@ -66,10 +68,11 @@ typedef struct _Map_Sources_Tab
66 68
67#define ZOOM_MAX 18 69#define ZOOM_MAX 18
68//Zemm min is supposed to be 0 70//Zemm min is supposed to be 0
69static char * _mapnik_url_cb(int x, int y, int zoom); 71static char * _mapnik_url_cb(void *data ,int x, int y, int zoom);
70static char * _osmarender_url_cb(int x, int y, int zoom); 72static char * _osmarender_url_cb(void *data ,int x, int y, int zoom);
71static char * _cyclemap_url_cb(int x, int y, int zoom); 73static char * _cyclemap_url_cb(void *data ,int x, int y, int zoom);
72static char * _maplint_url_cb(int x, int y, int zoom); 74static char * _maplint_url_cb(void *data ,int x, int y, int zoom);
75static char * _module_url_cb(void *data ,int x, int y, int zoom);
73static Map_Sources_Tab map_sources_tab[] = 76static Map_Sources_Tab map_sources_tab[] =
74{ 77{
75 {ELM_MAP_SOURCE_MAPNIK, "Mapnik", 0, 18, _mapnik_url_cb}, 78 {ELM_MAP_SOURCE_MAPNIK, "Mapnik", 0, 18, _mapnik_url_cb},
@@ -82,7 +85,7 @@ static Map_Sources_Tab map_sources_tab[] =
82 {ELM_MAP_SOURCE_CUSTOM_4, "Custom 4", 0, 18, NULL}, 85 {ELM_MAP_SOURCE_CUSTOM_4, "Custom 4", 0, 18, NULL},
83 {ELM_MAP_SOURCE_CUSTOM_5, "Custom 5", 0, 18, NULL}, 86 {ELM_MAP_SOURCE_CUSTOM_5, "Custom 5", 0, 18, NULL},
84 {ELM_MAP_SOURCE_CUSTOM_6, "Custom 6", 0, 18, NULL}, 87 {ELM_MAP_SOURCE_CUSTOM_6, "Custom 6", 0, 18, NULL},
85 {ELM_MAP_SOURCE_CUSTOM_7, "Custom 7", 0, 18, NULL} 88 {ELM_MAP_SOURCE_MODULE, "Module", 0, 18, _module_url_cb}
86}; 89};
87 90
88struct _Elm_Map_Marker_Class 91struct _Elm_Map_Marker_Class
@@ -244,8 +247,17 @@ struct _Widget_Data
244 Eina_List *markers_clas; // list of Elm_Map_Markers_Class* 247 Eina_List *markers_clas; // list of Elm_Map_Markers_Class*
245 248
246 Elm_Map_Sources source; 249 Elm_Map_Sources source;
250 Mod_Api *api;
247}; 251};
248 252
253struct _Mod_Api
254{
255 Eina_Bool (*obj_hook) (Evas_Object *obj);
256 Eina_Bool (*obj_unhook) (Evas_Object *obj);
257 char * (*obj_url_request) (Evas_Object *obj, int x, int y, int zoom);
258 Eina_Bool (*obj_convert_coord_into_geo) (const Evas_Object *obj, int zoom, int x, int y, int size, double *lon, double *lat);
259 Eina_Bool (*obj_convert_geo_into_coord) (const Evas_Object *obj, int zoom, double lon, double lat, int size, int *x, int *y);
260};
249struct _Pan 261struct _Pan
250{ 262{
251 Evas_Object_Smart_Clipped_Data __clipped_data; 263 Evas_Object_Smart_Clipped_Data __clipped_data;
@@ -310,6 +322,29 @@ static void _group_bubble_content_free(Marker_Group *group);
310static 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); 322static 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);
311static void _bubble_sc_hits_changed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); 323static void _bubble_sc_hits_changed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
312 324
325static Mod_Api *
326module(Evas_Object *obj __UNUSED__)
327{
328 static Elm_Module *m = NULL;
329 if (m) goto ok;
330 if (!(m = _elm_module_find_as("map/api"))) return NULL;
331
332 m->api = malloc(sizeof(Mod_Api));
333 if (!m->api) return NULL;
334 ((Mod_Api *)(m->api) )->obj_hook =
335 _elm_module_symbol_get(m, "obj_hook");
336 ((Mod_Api *)(m->api) )->obj_unhook =
337 _elm_module_symbol_get(m, "obj_unhook");
338 ((Mod_Api *)(m->api) )->obj_url_request =
339 _elm_module_symbol_get(m, "obj_url_request");
340 ((Mod_Api *)(m->api) )->obj_convert_coord_into_geo =
341 _elm_module_symbol_get(m, "obj_convert_coord_into_geo");
342 ((Mod_Api *)(m->api) )->obj_convert_geo_into_coord =
343 _elm_module_symbol_get(m, "obj_convert_geo_into_coord");
344 ok:
345 return m->api;
346}
347
313static void 348static void
314rect_place(Evas_Object *obj, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) 349rect_place(Evas_Object *obj, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh)
315{ 350{
@@ -823,7 +858,7 @@ grid_load(Evas_Object *obj, Grid *g)
823 858
824 snprintf(buf2, sizeof(buf2), DEST_FILE_PATH, buf, y); 859 snprintf(buf2, sizeof(buf2), DEST_FILE_PATH, buf, y);
825 860
826 source = map_sources_tab[wd->source].url_cb(x, y, g->zoom); 861 source = map_sources_tab[wd->source].url_cb(obj, x, y, g->zoom);
827 862
828 eina_stringshare_replace(&gi->file, buf2); 863 eina_stringshare_replace(&gi->file, buf2);
829 864
@@ -953,7 +988,7 @@ zoom_do(Evas_Object *obj, double t)
953 988
954 if (wd->center_on.enabled) 989 if (wd->center_on.enabled)
955 { 990 {
956 elm_map_utils_convert_geo_into_coord(wd->center_on.lon, wd->center_on.lat, wd->size.w, &xx, &yy); 991 elm_map_utils_convert_geo_into_coord(obj, wd->center_on.lon, wd->center_on.lat, wd->size.w, &xx, &yy);
957 xx -= ow / 2; 992 xx -= ow / 2;
958 yy -= oh / 2; 993 yy -= oh / 2;
959 } 994 }
@@ -1089,6 +1124,7 @@ _del_hook(Evas_Object *obj)
1089 if (wd->scr_timer) ecore_timer_del(wd->scr_timer); 1124 if (wd->scr_timer) ecore_timer_del(wd->scr_timer);
1090 if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator); 1125 if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator);
1091 if (wd->long_timer) ecore_timer_del(wd->long_timer); 1126 if (wd->long_timer) ecore_timer_del(wd->long_timer);
1127 if ((wd->api) && (wd->api->obj_unhook)) wd->api->obj_unhook(obj);
1092 1128
1093 free(wd); 1129 free(wd);
1094} 1130}
@@ -1363,7 +1399,6 @@ _scr_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSE
1363static void 1399static void
1364_scr_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 1400_scr_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1365{ 1401{
1366
1367 Widget_Data *wd = elm_widget_data_get(data); 1402 Widget_Data *wd = elm_widget_data_get(data);
1368 wd->center_on.enabled = EINA_FALSE; 1403 wd->center_on.enabled = EINA_FALSE;
1369 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL); 1404 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
@@ -1528,9 +1563,7 @@ _group_bubble_content_update(Marker_Group *group)
1528 group->sc = elm_scroller_add(group->bubble); 1563 group->sc = elm_scroller_add(group->bubble);
1529 elm_scroller_content_min_limit(group->sc, EINA_FALSE, EINA_TRUE); 1564 elm_scroller_content_min_limit(group->sc, EINA_FALSE, EINA_TRUE);
1530 elm_scroller_policy_set(group->sc, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF); 1565 elm_scroller_policy_set(group->sc, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
1531 elm_scroller_bounce_set(group->sc, 1566 elm_scroller_bounce_set(group->sc, _elm_config->thumbscroll_bounce_enable, EINA_FALSE);
1532 _elm_config->thumbscroll_bounce_enable,
1533 EINA_FALSE);
1534 edje_object_part_swallow(group->bubble, "elm.swallow.content", group->sc); 1567 edje_object_part_swallow(group->bubble, "elm.swallow.content", group->sc);
1535 evas_object_show(group->sc); 1568 evas_object_show(group->sc);
1536 evas_object_smart_member_add(group->sc, 1569 evas_object_smart_member_add(group->sc,
@@ -1711,6 +1744,9 @@ elm_map_add(Evas_Object *parent)
1711 1744
1712 elm_smart_scroller_bounce_allow_set(wd->scr, bounce, bounce); 1745 elm_smart_scroller_bounce_allow_set(wd->scr, bounce, bounce);
1713 1746
1747 wd->api = module(obj);
1748 if ((wd->api) && (wd->api->obj_hook)) wd->api->obj_hook(obj);
1749
1714 wd->obj = obj; 1750 wd->obj = obj;
1715 1751
1716 wd->markers_max_num = 30; 1752 wd->markers_max_num = 30;
@@ -2065,7 +2101,7 @@ elm_map_geo_region_bring_in(Evas_Object *obj, double lon, double lat)
2065 int rx, ry, rw, rh; 2101 int rx, ry, rw, rh;
2066 2102
2067 if (!wd) return; 2103 if (!wd) return;
2068 elm_map_utils_convert_geo_into_coord(lon, lat, wd->size.w, &rx, &ry); 2104 elm_map_utils_convert_geo_into_coord(obj, lon, lat, wd->size.w, &rx, &ry);
2069 elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); 2105 elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh);
2070 2106
2071 rx = rx - rw / 2; 2107 rx = rx - rw / 2;
@@ -2106,7 +2142,7 @@ elm_map_geo_region_show(Evas_Object *obj, double lon, double lat)
2106 int rx, ry, rw, rh; 2142 int rx, ry, rw, rh;
2107 2143
2108 if (!wd) return; 2144 if (!wd) return;
2109 elm_map_utils_convert_geo_into_coord(lon, lat, wd->size.w, &rx, &ry); 2145 elm_map_utils_convert_geo_into_coord(obj, lon, lat, wd->size.w, &rx, &ry);
2110 elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); 2146 elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh);
2111 2147
2112 rx = rx - rw / 2; 2148 rx = rx - rw / 2;
@@ -2128,9 +2164,9 @@ elm_map_geo_region_show(Evas_Object *obj, double lon, double lat)
2128} 2164}
2129 2165
2130/** 2166/**
2131 * Move the map to the current coordinates. 2167 * Get the current coordinates of the map.
2132 * 2168 *
2133 * This move the map to the current coordinates. The map will be centered on these coordinates. 2169 * This gets the current coordinates of the map object.
2134 * 2170 *
2135 * @param obj The map object 2171 * @param obj The map object
2136 * @param lat The latitude. 2172 * @param lat The latitude.
@@ -2151,7 +2187,7 @@ elm_map_geo_region_get(const Evas_Object *obj, double *lon, double *lat)
2151 sx += sw / 2; 2187 sx += sw / 2;
2152 sy += sh / 2; 2188 sy += sh / 2;
2153 2189
2154 elm_map_utils_convert_coord_into_geo(sx, sy, wd->size.w, lon, lat); 2190 elm_map_utils_convert_coord_into_geo(obj, sx, sy, wd->size.w, lon, lat);
2155} 2191}
2156 2192
2157/** 2193/**
@@ -2259,8 +2295,15 @@ elm_map_paused_markers_get(const Evas_Object *obj)
2259 * @ingroup Map 2295 * @ingroup Map
2260 */ 2296 */
2261EAPI void 2297EAPI void
2262elm_map_utils_convert_coord_into_geo(int x, int y, int size, double *lon, double *lat) 2298elm_map_utils_convert_coord_into_geo(const Evas_Object *obj, int x, int y, int size, double *lon, double *lat)
2263{ 2299{
2300 Widget_Data *wd = elm_widget_data_get(obj);
2301 int zoom = floor(log2(size/256));
2302
2303 if (elm_map_source_get(obj) == ELM_MAP_SOURCE_MODULE)
2304 if ((wd->api) && (wd->api->obj_convert_coord_into_geo))
2305 if (wd->api->obj_convert_coord_into_geo(obj, zoom, x, y, size, lon, lat)) return;
2306
2264 if (lon) 2307 if (lon)
2265 { 2308 {
2266 *lon = x / (double)size * 360.0 - 180; 2309 *lon = x / (double)size * 360.0 - 180;
@@ -2285,8 +2328,15 @@ elm_map_utils_convert_coord_into_geo(int x, int y, int size, double *lon, double
2285 * @ingroup Map 2328 * @ingroup Map
2286 */ 2329 */
2287EAPI void 2330EAPI void
2288elm_map_utils_convert_geo_into_coord(double lon, double lat, int size, int *x, int *y) 2331elm_map_utils_convert_geo_into_coord(const Evas_Object *obj, double lon, double lat, int size, int *x, int *y)
2289{ 2332{
2333 Widget_Data *wd = elm_widget_data_get(obj);
2334 int zoom = floor(log2(size/256));
2335
2336 if (elm_map_source_get(obj) == ELM_MAP_SOURCE_MODULE)
2337 if ((wd->api) && (wd->api->obj_convert_geo_into_coord))
2338 if (wd->api->obj_convert_geo_into_coord(obj, zoom, lon, lat, size, x, y)) return;
2339
2290 if (x) 2340 if (x)
2291 *x = floor((lon + 180.0) / 360.0 * size); 2341 *x = floor((lon + 180.0) / 360.0 * size);
2292 if (y) 2342 if (y)
@@ -2384,7 +2434,7 @@ elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Clas
2384 2434
2385 for (i = clas_group->zoom_displayed; i <= ZOOM_MAX; i++) 2435 for (i = clas_group->zoom_displayed; i <= ZOOM_MAX; i++)
2386 { 2436 {
2387 elm_map_utils_convert_geo_into_coord(lon, lat, pow(2.0, i)*wd->tsize, 2437 elm_map_utils_convert_geo_into_coord(obj, lon, lat, pow(2.0, i)*wd->tsize,
2388 &(marker->x[i]), &(marker->y[i])); 2438 &(marker->x[i]), &(marker->y[i]));
2389 2439
2390 //search in the matrixsparse the region where the marker will be 2440 //search in the matrixsparse the region where the marker will be
@@ -2628,7 +2678,7 @@ elm_map_markers_list_show(Eina_List *markers)
2628 for (zoom = map_sources_tab[wd->source].zoom_max; zoom>map_sources_tab[wd->source].zoom_min; zoom--) 2678 for (zoom = map_sources_tab[wd->source].zoom_max; zoom>map_sources_tab[wd->source].zoom_min; zoom--)
2629 { 2679 {
2630 Evas_Coord size = pow(2.0, zoom)*wd->tsize; 2680 Evas_Coord size = pow(2.0, zoom)*wd->tsize;
2631 elm_map_utils_convert_geo_into_coord(lon, lat, size, &xc, &yc); 2681 elm_map_utils_convert_geo_into_coord(wd->obj, lon, lat, size, &xc, &yc);
2632 2682
2633 if ((m_min_lon->x[zoom] - wd->marker_max_w >= xc-rw/2) 2683 if ((m_min_lon->x[zoom] - wd->marker_max_w >= xc-rw/2)
2634 && (m_min_lat->y[zoom] - wd->marker_max_h >= yc-rh/2) 2684 && (m_min_lat->y[zoom] - wd->marker_max_h >= yc-rh/2)
@@ -3061,7 +3111,7 @@ elm_map_source_name_get(Elm_Map_Sources source)
3061 3111
3062 3112
3063static char * 3113static char *
3064_mapnik_url_cb(int x, int y, int zoom) 3114_mapnik_url_cb(void *data, int x, int y, int zoom)
3065{ 3115{
3066 char buf[PATH_MAX]; 3116 char buf[PATH_MAX];
3067 snprintf(buf, sizeof(buf), "http://tile.openstreetmap.org/%d/%d/%d.png", 3117 snprintf(buf, sizeof(buf), "http://tile.openstreetmap.org/%d/%d/%d.png",
@@ -3070,7 +3120,7 @@ _mapnik_url_cb(int x, int y, int zoom)
3070} 3120}
3071 3121
3072static char * 3122static char *
3073_osmarender_url_cb(int x, int y, int zoom) 3123_osmarender_url_cb(void * data, int x, int y, int zoom)
3074{ 3124{
3075 char buf[PATH_MAX]; 3125 char buf[PATH_MAX];
3076 snprintf(buf, sizeof(buf), "http://tah.openstreetmap.org/Tiles/tile/%d/%d/%d.png", 3126 snprintf(buf, sizeof(buf), "http://tah.openstreetmap.org/Tiles/tile/%d/%d/%d.png",
@@ -3079,7 +3129,7 @@ _osmarender_url_cb(int x, int y, int zoom)
3079} 3129}
3080 3130
3081static char * 3131static char *
3082_cyclemap_url_cb(int x, int y, int zoom) 3132_cyclemap_url_cb(void *data, int x, int y, int zoom)
3083{ 3133{
3084 char buf[PATH_MAX]; 3134 char buf[PATH_MAX];
3085 snprintf(buf, sizeof(buf), "http://andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png", 3135 snprintf(buf, sizeof(buf), "http://andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png",
@@ -3088,7 +3138,7 @@ _cyclemap_url_cb(int x, int y, int zoom)
3088} 3138}
3089 3139
3090static char * 3140static char *
3091_maplint_url_cb(int x, int y, int zoom) 3141_maplint_url_cb(void *data, int x, int y, int zoom)
3092{ 3142{
3093 char buf[PATH_MAX]; 3143 char buf[PATH_MAX];
3094 snprintf(buf, sizeof(buf), "http://tah.openstreetmap.org/Tiles/maplint/%d/%d/%d.png", 3144 snprintf(buf, sizeof(buf), "http://tah.openstreetmap.org/Tiles/maplint/%d/%d/%d.png",
@@ -3096,3 +3146,17 @@ _maplint_url_cb(int x, int y, int zoom)
3096 return strdup(buf); 3146 return strdup(buf);
3097} 3147}
3098 3148
3149static char *
3150_module_url_cb(void *data, int x, int y, int zoom)
3151{
3152 char *buf = NULL;
3153 Widget_Data *wd = elm_widget_data_get(data);
3154 if(elm_map_source_get(data) == ELM_MAP_SOURCE_MODULE)
3155 if ((wd->api) && (wd->api->obj_url_request))
3156 buf = wd->api->obj_url_request(data, x, y, zoom);
3157
3158 if(!buf) buf = strdup("");
3159
3160 return buf;
3161}
3162
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index d48924515..b00ad7ef7 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -2,4 +2,5 @@ AUTOMAKE_OPTIONS = 1.4 foreign
2MAINTAINERCLEANFILES = Makefile.in 2MAINTAINERCLEANFILES = Makefile.in
3 3
4SUBDIRS = \ 4SUBDIRS = \
5test_entry 5test_entry \
6test_map
diff --git a/src/modules/test_map/Makefile.am b/src/modules/test_map/Makefile.am
new file mode 100644
index 000000000..d789ce998
--- /dev/null
+++ b/src/modules/test_map/Makefile.am
@@ -0,0 +1,32 @@
1
2MAINTAINERCLEANFILES = Makefile.in
3
4AM_CPPFLAGS = \
5-I. \
6-I$(top_builddir) \
7-I$(top_srcdir) \
8-I$(top_srcdir)/src/lib \
9-I$(top_builddir)/src/lib \
10-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
11-DPACKAGE_LIB_DIR=\"$(libdir)\" \
12@ELEMENTARY_CFLAGS@ \
13@ELEMENTARY_X_CFLAGS@ \
14@ELEMENTARY_FB_CFLAGS@ \
15@ELEMENTARY_WIN32_CFLAGS@ \
16@ELEMENTARY_WINCE_CFLAGS@ \
17@ELEMENTARY_EDBUS_CFLAGS@ \
18@ELEMENTARY_EFREET_CFLAGS@ \
19@ELEMENTARY_ETHUMB_CFLAGS@
20
21if ELEMENTARY_WINDOWS_BUILD
22AM_CPPFLAGS += -DELEMENTARY_BUILD
23endif
24
25pkgdir = $(libdir)/elementary/modules/test_map/$(MODULE_ARCH)
26pkg_LTLIBRARIES = module.la
27
28module_la_SOURCES = mod.c
29
30module_la_LIBADD = $(top_builddir)/src/lib/libelementary.la
31module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
32module_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/src/modules/test_map/mod.c b/src/modules/test_map/mod.c
new file mode 100644
index 000000000..8b94996f1
--- /dev/null
+++ b/src/modules/test_map/mod.c
@@ -0,0 +1,50 @@
1#include <Elementary.h>
2#ifdef HAVE_CONFIG_H
3# include "elementary_config.h"
4#endif
5
6EAPI int
7elm_modapi_init(void *m)
8{
9 return 1; // succeed always
10}
11
12EAPI int
13elm_modapi_shutdown(void *m)
14{
15 return 1; // succeed always
16}
17
18EAPI Eina_Bool
19obj_hook(Evas_Object *obj)
20{
21 return EINA_TRUE;
22}
23
24EAPI Eina_Bool
25obj_unhook(Evas_Object *obj)
26{
27 return EINA_TRUE;
28}
29
30EAPI Eina_Bool
31obj_convert_geo_into_coord(const Evas_Object *obj, int zoom, double lon, double lat, int size, int *x, int *y)
32{
33 return EINA_FALSE;
34}
35
36EAPI Eina_Bool
37obj_convert_coord_into_geo(const Evas_Object *obj, int zoom, int x, int y, int size, double *lon, double *lat)
38{
39 return EINA_FALSE;
40}
41
42EAPI char*
43obj_url_request(Evas_Object *obj, int x, int y, int zoom)
44{
45 char buf[PATH_MAX];
46 snprintf(buf, sizeof(buf), "http://tile.openstreetmap.org/%d/%d/%d.png",
47 zoom, x, y);
48 return strdup(buf);
49}
50