elm_map - Bug fix and cleanup.
authorsanjeev <sanjeev@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 20 Mar 2012 07:37:59 +0000 (07:37 +0000)
committerTae-Hwan Kim <the81.kim@samsung.com>
Mon, 26 Mar 2012 05:28:34 +0000 (14:28 +0900)
Author : Bluezery <ohpowel@gmail.com>

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69519 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

Conflicts:

src/lib/elm_map.c

Change-Id: I0da07a7fb011a5a23543f7e59436e8766b7ee009

src/bin/test_map.c
src/lib/elm_map.c
src/lib/elm_map.h

index 9f4302b..5a9f967 100644 (file)
@@ -90,7 +90,7 @@ _map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info)
 {
    printf("clicked,double\n");
    double lon, lat;
-   Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info;
+   Evas_Event_Mouse_Down *down = event_info;
    if (!down) return;
    if (elm_map_zoom_get(obj) < 5) return;
 
@@ -108,6 +108,7 @@ _map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info)
      {
         elm_map_overlay_del(route_start);
         elm_map_overlay_del(route_end);
+        elm_map_route_del(route);
         route_start = NULL;
         route_end = NULL;
         route = NULL;
@@ -298,17 +299,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__)
 {
-   Eina_Bool b = elm_map_paused_get(data);
-   elm_map_paused_set(data, EINA_TRUE);
    elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
+   if (elm_map_zoom_get(data) < 12) elm_map_zoom_set(data, 12);
    elm_map_region_show(data,7.325201, 48.526813);
-   elm_map_zoom_set(data, 12);
-   elm_map_paused_set(data, b);
 }
 
 static void
 map_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);
    elm_map_region_bring_in(data, 126.977969, 37.566535);
 }
 
@@ -543,7 +543,7 @@ my_map_entry_activated(void *data, Evas_Object *obj, void *event_info __UNUSED__
 {
    const char *s = elm_scrolled_entry_entry_get(obj);
    char *addr = strdup(s);
-   name = elm_map_name_geo_request(data, addr);
+   name = elm_map_name_add(data, addr, 0, 0, NULL, NULL);
    if (addr) free (addr);
 }
 */
index afb5cde..983a6f2 100644 (file)
@@ -641,7 +641,6 @@ static void
 _coord_to_region_convert(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Evas_Coord size, double *lon, double *lat)
 {
    EINA_SAFETY_ON_NULL_RETURN(wd);
-
    int zoom = floor(log(size / wd->size.tile) / log(2));
    if ((wd->src_tile) && (wd->src_tile->coord_to_geo))
      {
@@ -1009,24 +1008,6 @@ _marker_group_create(Widget_Data *wd)
 }
 
 static void
-_marker_bringin_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__)
-{
-   Elm_Map_Marker *marker = data;
-   EINA_SAFETY_ON_NULL_RETURN(marker);
-   elm_map_region_bring_in(marker->wd->obj, marker->longitude, marker->latitude);
-}
-
-static void
-_marker_bubble_open_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__)
-{
-   EINA_SAFETY_ON_NULL_RETURN(data);
-   Elm_Map_Marker *marker = data;
-
-   if (!marker->bubble) marker->bubble = _bubble_create(marker->obj, marker->wd);
-   evas_object_smart_changed(marker->wd->pan_smart);
-}
-
-static void
 _marker_update(Elm_Map_Marker *marker)
 {
    EINA_SAFETY_ON_NULL_RETURN(marker);
@@ -1352,7 +1333,7 @@ _download_job(void *data)
 
    EINA_LIST_REVERSE_FOREACH_SAFE(wd->download_list, l, ll, gi)
      {
-        if (gi->g->zoom != wd->zoom || !_grid_item_in_viewport(gi))
+        if ((gi->g->zoom != wd->zoom) || !(_grid_item_in_viewport(gi)))
           {
              wd->download_list = eina_list_remove(wd->download_list, gi);
              continue;
@@ -1630,26 +1611,25 @@ zoom_do(Widget_Data *wd, double zoom)
    // Fix to zooming with (viewport center vx, vy) as the center to prevent
    // from zooming with (0,0) as the cetner. (scroller default behavior)
    _viewport_coord_get(wd, &vx, &vy, &vw, &vh);
-
    if ((vw > 0) && (vh > 0) && (ow > 0) && (oh > 0))
      {
-        Evas_Coord xx, yy;
+        Evas_Coord xy;
         double sx, sy;
         if (vw > ow) sx = 0.5;
-        else         sx = (double)(vx + (vw / 2)) / ow;
+        else         sx = (double)(vx + (double)(vw / 2)) / ow;
         if (vh > oh) sy = 0.5;
-        else         sy = (double)(vy + (vh / 2)) / oh;
+        else         sy = (double)(vy + (double)(vh / 2)) / oh;
 
         if (sx > 1.0) sx = 1.0;
         if (sy > 1.0) sy = 1.0;
 
-        xx = (sx * wd->size.w) - (vw / 2);
-        yy = (sy * wd->size.h) - (vh / 2);
-        if (xx < 0) xx = 0;
-        else if (xx > (wd->size.w - vw)) xx = wd->size.w - vw;
-        if (yy < 0) yy = 0;
-        else if (yy > (wd->size.h - vh)) yy = wd->size.h - vh;
-        elm_smart_scroller_child_region_show(wd->scr, xx, yy, vw, vh);
+        x = ceil((sx * wd->size.w) - (vw / 2));
+        y = ceil((sy * wd->size.h) - (vh / 2));
+        if (x < 0) x = 0;
+        else if (x > (wd->size.w - vw)) x = wd->size.w - vw;
+        if (y < 0) y = 0;
+        else if (y > (wd->size.h - vh)) y = wd->size.h - vh;
+        elm_smart_scroller_child_region_show(wd->scr, xy, vw, vh);
      }
    if (wd->zoom_timer) ecore_timer_del(wd->zoom_timer);
    else evas_object_smart_callback_call(wd->obj, SIG_ZOOM_START, NULL);
@@ -3709,45 +3689,6 @@ _region_bring_in(void *data)
    evas_object_smart_changed(dd->wd->pan_smart);
 }
 
-static void
-_marker_list_show(void *data)
-{
-   EINA_SAFETY_ON_NULL_RETURN(data);
-   Delayed_Data *dd = data;
-   int zoom;
-   double max_lon = -180, min_lon = 180;
-   double max_lat = -90, min_lat = 90;
-   Evas_Coord vw, vh;
-   Elm_Map_Marker *marker;
-
-   EINA_LIST_FREE(dd->markers, marker)
-     {
-        if (marker->longitude > max_lon) max_lon = marker->longitude;
-        if (marker->longitude < min_lon) min_lon = marker->longitude;
-        if (marker->latitude > max_lat) max_lat = marker->latitude;
-        if (marker->latitude < min_lat) min_lat = marker->latitude;
-     }
-   dd->lon = (max_lon + min_lon) / 2;
-   dd->lat = (max_lat + min_lat) / 2;
-
-   zoom = dd->wd->src_tile->zoom_min;
-   _viewport_coord_get(dd->wd, NULL, NULL, &vw, &vh);
-   while (zoom <= dd->wd->src_tile->zoom_max)
-     {
-        Evas_Coord size, max_x, max_y, min_x, min_y;
-        size = pow(2.0, zoom) * dd->wd->tsize;
-        _region_to_coord_convert(dd->wd, min_lon, max_lat, size, &min_x, &max_y);
-        _region_to_coord_convert(dd->wd, max_lon, min_lat, size, &max_x, &min_y);
-        if ((max_x - min_x) > vw || (max_y - min_y) > vh) break;
-        zoom++;
-     }
-   zoom--;
-
-   zoom_do(dd->wd, zoom);
-   _region_show(dd);
-   evas_object_smart_changed(dd->wd->pan_smart);
-}
-
 static char *
 _mapnik_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom)
 {
index 97fb96c..9eb1c4d 100644 (file)
@@ -1312,7 +1312,6 @@ EAPI Elm_Map_Name         *elm_map_name_add(const Evas_Object *obj, const char *
  * This gets the coordinates of the @p name, created with one of the
  * conversion functions.
  *
- * @see elm_map_name_geo_request()
  * @see elm_map_name_add()
  *
  * @ingroup Map
@@ -1329,7 +1328,6 @@ EAPI const char           *elm_map_name_address_get(const Elm_Map_Name *name);
  * This gets the coordinates of the @p name, created with one of the
  * conversion functions.
  *
- * @see elm_map_name_geo_request()
  * @see elm_map_name_add()
  *
  * @ingroup Map
@@ -1344,7 +1342,6 @@ EAPI void                  elm_map_name_region_get(const Elm_Map_Name *name, dou
  * Basically the struct handled by @p name will be freed, so conversions
  * between address and coordinates will be lost.
  *
- * @see elm_map_name_geo_request()
  * @see elm_map_name_add()
  *
  * @ingroup Map