From d23707ec4bf3f1c5c94176ed977cc7aa9832ff72 Mon Sep 17 00:00:00 2001 From: sanjeev Date: Fri, 24 Feb 2012 05:48:27 +0000 Subject: [PATCH] Fix up elm_route have min_max API consistent with the rest of elm. Signed-off-by: Sanjeev BA git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68379 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_deprecated.h | 11 ++++++++++ src/lib/elm_map.c | 8 +++++-- src/lib/elm_route.c | 47 ++++++++++++++++++++++++++++------------- src/lib/elm_route.h | 54 ++++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 100 insertions(+), 20 deletions(-) diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h index c11147f..87f8b89 100644 --- a/src/lib/elm_deprecated.h +++ b/src/lib/elm_deprecated.h @@ -4563,6 +4563,17 @@ EINA_DEPRECATED EAPI void elm_video_uri_set(Evas_Object *video, */ EINA_DEPRECATED EAPI void elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h); +/* No documentation for these API before. + * + * @deprecated Use elm_route_latitude_min_max_get() + * elm_route_longitude_min_max_get() + * instead. + */ +EINA_DEPRECATED EAPI double elm_route_lon_min_get(Evas_Object *obj); +EINA_DEPRECATED EAPI double elm_route_lat_min_get(Evas_Object *obj); +EINA_DEPRECATED EAPI double elm_route_lon_max_get(Evas_Object *obj); +EINA_DEPRECATED EAPI double elm_route_lat_max_get(Evas_Object *obj); + /** * @} */ diff --git a/src/lib/elm_map.c b/src/lib/elm_map.c index b5a5acd..8214301 100644 --- a/src/lib/elm_map.c +++ b/src/lib/elm_map.c @@ -1466,8 +1466,12 @@ _track_place(Widget_Data *wd) EINA_LIST_FOREACH(wd->track, l, route) { - elm_map_utils_convert_geo_into_coord(wd->obj, elm_route_lon_min_get(route), elm_route_lat_max_get(route), size, &xmin, &ymin); - elm_map_utils_convert_geo_into_coord(wd->obj, elm_route_lon_max_get(route), elm_route_lat_min_get(route), size, &xmax, &ymax); + double lon_min, lon_max; + double lat_min, lat_max; + elm_route_longitude_min_max_get(route, &lon_min, &lon_max); + elm_route_latitude_min_max_get(route, &lat_min, &lat_max); + elm_map_utils_convert_geo_into_coord(wd->obj, lon_min, lat_max, size, &xmin, &ymin); + elm_map_utils_convert_geo_into_coord(wd->obj, lon_max, lat_min, size, &xmax, &ymax); if( !(xmin < px && xmax < px) && !(xmin > px+ow && xmax > px+ow)) { diff --git a/src/lib/elm_route.c b/src/lib/elm_route.c index 7ca2dad..74a9152 100644 --- a/src/lib/elm_route.c +++ b/src/lib/elm_route.c @@ -265,36 +265,55 @@ elm_route_emap_set(Evas_Object *obj, EMap_Route *emap) } #endif -EAPI double +EINA_DEPRECATED EAPI double elm_route_lon_min_get(Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - return wd->lon_min; + double val; + elm_route_longitude_min_max_get(obj, &val, NULL); + return val; } -EAPI double +EINA_DEPRECATED EAPI double elm_route_lat_min_get(Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - return wd->lat_min; + double val; + elm_route_latitude_min_max_get(obj, &val, NULL); + return val; } -EAPI double +EINA_DEPRECATED EAPI double elm_route_lon_max_get(Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - return wd->lon_max; + double val; + elm_route_longitude_min_max_get(obj, NULL, &val); + return val; } -EAPI double +EINA_DEPRECATED EAPI double elm_route_lat_max_get(Evas_Object *obj) { + double val; + elm_route_latitude_min_max_get(obj, NULL, &val); + return val; +} + +EAPI void +elm_route_longitude_min_max_get(const Evas_Object *obj, double *min, double *max) +{ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); - return wd->lat_max; + if (!wd) return; + if (min) *min = wd->lon_min; + if (max) *max = wd->lon_max; } +EAPI void +elm_route_latitude_min_max_get(const Evas_Object *obj, double *min, double *max) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (min) *min = wd->lat_min; + if (max) *max = wd->lat_max; +} /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/ diff --git a/src/lib/elm_route.h b/src/lib/elm_route.h index 51a42c8..24fb981 100644 --- a/src/lib/elm_route.h +++ b/src/lib/elm_route.h @@ -1,8 +1,54 @@ +/** + * @defgroup Route Route + * + * For displaying a route on the map widget. + * + * @{ + */ + +/** + * Add a new route object to the parent's canvas + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + */ EAPI Evas_Object *elm_route_add(Evas_Object *parent); + #ifdef ELM_EMAP EAPI void elm_route_emap_set(Evas_Object *obj, EMap_Route *emap); #endif -EAPI double elm_route_lon_min_get(Evas_Object *obj); -EAPI double elm_route_lat_min_get(Evas_Object *obj); -EAPI double elm_route_lon_max_get(Evas_Object *obj); -EAPI double elm_route_lat_max_get(Evas_Object *obj); + + +EINA_DEPRECATED EAPI double elm_route_lon_min_get(Evas_Object *obj); +EINA_DEPRECATED EAPI double elm_route_lat_min_get(Evas_Object *obj); +EINA_DEPRECATED EAPI double elm_route_lon_max_get(Evas_Object *obj); +EINA_DEPRECATED EAPI double elm_route_lat_max_get(Evas_Object *obj); + +/** + * Get the minimum and maximum values along the longitude. + * + * @param obj The route object. + * @param min Pointer to store the minimum value. + * @param max Pointer to store the maximum value. + * + * @note If only one value is needed, the other pointer can be passed + * as @c NULL. + * + * @ingroup Route + */ +EAPI void elm_route_longitude_min_max_get(const Evas_Object *obj, double *min, double *max); + +/** + * Get the minimum and maximum values along the latitude. + * + * @param obj The route object. + * @param min Pointer to store the minimum value. + * @param max Pointer to store the maximum value. + * + * @note If only one value is needed, the other pointer can be passed + * as @c NULL. + * + * @ingroup Route + */ +EAPI void elm_route_latitude_min_max_get(const Evas_Object *obj, double *min, double *max); -- 2.7.4