aah we'll take bluz' patch then instead of my fixing

SVN revision: 68206
This commit is contained in:
Carsten Haitzler 2012-02-21 07:59:19 +00:00
parent a3ae956f8f
commit 6636c616bf
4 changed files with 2809 additions and 2080 deletions

View File

@ -20,9 +20,10 @@ typedef struct Map_Source
} Map_Source;
static Elm_Map_Marker_Class *itc1, *itc2, *itc_parking;
static Elm_Map_Group_Class *itc_group1, *itc_group2, *itc_group_parking, *route_group;
static Elm_Map_Group_Class *itc_group1, *itc_group2, *itc_group_parking;
static Evas_Object *menu, *fs_win;
static Evas_Object *rect, *menu, *fs_win;
static int nb_elts;
/*static Elm_Map_Marker *markers[MARKER_MAX];*/
static Elm_Map_Marker *route_from, *route_to;
static Elm_Map_Route *route;
@ -87,14 +88,14 @@ my_map_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf
static void
my_map_longpressed(void *data __UNUSED__, Evas_Object *obj, void *event_info)
{
if (!event_info) return;
printf("longpressed\n");
double lon, lat;
Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info;
elm_map_canvas_to_geo_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat);
printf("longpressed, x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat);
if (!down) return;
if (elm_map_zoom_get(obj) < 5) return;
if (name) elm_map_name_remove(name);
elm_map_canvas_to_geo_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat);
printf("x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat);
name = elm_map_utils_convert_coord_into_name(obj, lon, lat);
}
@ -110,18 +111,15 @@ my_map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info)
elm_map_canvas_to_geo_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat);
printf("x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat);
if (!itc1) itc1 = elm_map_marker_class_new(obj);
itc1 = elm_map_marker_class_new(obj);
elm_map_marker_class_del_cb_set(itc1, NULL);
if (!route_group)
{
route_group = elm_map_group_class_new(obj);
elm_map_group_class_icon_cb_set(route_group, _group_icon_get);
elm_map_group_class_data_set(route_group, (void *)PACKAGE_DATA_DIR"/images/bubble.png");
elm_map_group_class_style_set(route_group, "empty");
elm_map_group_class_zoom_displayed_set(route_group, 5);
}
itc_group1 = elm_map_group_class_new(obj);
elm_map_group_class_icon_cb_set(itc_group1, _group_icon_get);
elm_map_group_class_data_set(itc_group1, (void *)PACKAGE_DATA_DIR"/images/bubble.png");
elm_map_group_class_style_set(itc_group1, "empty");
elm_map_group_class_zoom_displayed_set(itc_group1, 5);
if (route_from && route_to)
{
@ -132,8 +130,8 @@ my_map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info)
elm_map_route_remove(route);
}
if (!route_from) route_from = elm_map_marker_add(obj, lon, lat, itc1, route_group, NULL);
else route_to = elm_map_marker_add(obj, lon, lat, itc1, route_group, NULL);
if (!route_from) route_from = elm_map_marker_add(obj, lon, lat, itc1, itc_group1, NULL);
else route_to = elm_map_marker_add(obj, lon, lat, itc1, itc_group1, NULL);
if (route_from && route_to)
{
@ -203,9 +201,10 @@ my_map_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU
static void
my_map_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
printf("scroll\n");
double lon, lat;
elm_map_geo_region_get(obj, &lon, &lat);
printf("scroll, longitude: %f latitude: %f\n", lon, lat);
printf("scroll longitude : %f latitude : %f\n", lon, lat);
}
static void
@ -582,6 +581,16 @@ _group_icon_get(Evas_Object *obj, void *data)
return icon;
}
static void
_map_move_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
int x,y,w,h;
evas_object_geometry_get(data,&x,&y,&w,&h);
evas_object_resize(rect,w,h);
evas_object_move(rect,x,y);
}
static void
_populate(void *data, Elm_Object_Item *menu_it)
{
@ -720,6 +729,7 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
elm_win_resize_object_add(win, map);
evas_object_data_set(map, "window", win);
//
itc1 = elm_map_marker_class_new(map);
elm_map_marker_class_get_cb_set(itc1, _marker_get);
elm_map_marker_class_del_cb_set(itc1, NULL);
@ -734,7 +744,9 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
elm_map_marker_class_del_cb_set(itc_parking, NULL);
elm_map_marker_class_icon_cb_set(itc_parking, _icon_get);
elm_map_marker_class_style_set(itc_parking, "empty");
//
//
itc_group1 = elm_map_group_class_new(map);
elm_map_group_class_data_set(itc_group1, (void *)PACKAGE_DATA_DIR"/images/plant_01.jpg");
@ -747,7 +759,18 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
elm_map_group_class_data_set(itc_group_parking, (void *)PACKAGE_DATA_DIR"/images/parking.png");
elm_map_group_class_style_set(itc_group_parking, "empty");
elm_map_group_class_zoom_displayed_set(itc_group_parking, 5);
//
rect = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_color_set(rect, 0, 0, 0, 0);
evas_object_repeat_events_set(rect,1);
evas_object_show(rect);
evas_object_raise(rect);
evas_object_event_callback_add(map, EVAS_CALLBACK_RESIZE,
_map_move_resize_cb, map);
evas_object_event_callback_add(map, EVAS_CALLBACK_MOVE,
_map_move_resize_cb, map);
evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_DOWN,
_map_mouse_down, map);
evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_MOVE,
@ -770,6 +793,8 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
elm_map_marker_add(map, 7.3165409990833, 48.856078, itc2, itc_group1, &data11);
elm_map_marker_add(map, 7.319812, 48.856561, itc2, itc_group2, &data10);
nb_elts = 13;
evas_object_smart_callback_add(map, "clicked", my_map_clicked, map);
evas_object_smart_callback_add(map, "press", my_map_press, map);
evas_object_smart_callback_add(map, "longpressed", my_map_longpressed, map);

View File

@ -93,6 +93,13 @@ _group_country_content_get(Evas_Object *obj, void *data __UNUSED__)
return icon;
}
static void
_map_downloaded(void *data __UNUSED__, Evas_Object *obj, void *ev __UNUSED__)
{
elm_map_zoom_set(obj, 3);
evas_object_smart_callback_del(obj, "downloaded", _map_downloaded);
}
static void
_bt_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
{
@ -234,6 +241,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
markers = eina_list_append(markers, m);
elm_map_markers_list_show(markers);
evas_object_smart_callback_add(map, "downloaded", _map_downloaded, NULL);
evas_object_resize(win, 512, 512);
evas_object_show(win);

File diff suppressed because it is too large Load Diff

View File

@ -153,20 +153,20 @@ typedef struct _Elm_Map_Route Elm_Map_Route; /**< A route to be shown in
typedef struct _Elm_Map_Name Elm_Map_Name; /**< A handle for specific coordinates. */
typedef struct _Elm_Map_Track Elm_Map_Track;
typedef Evas_Object *(*Elm_Map_Marker_Get_Func)(Evas_Object *obj, Elm_Map_Marker *marker, void *data); /**< Bubble content fetching class function for marker classes. When the user click on a marker, a bubble is displayed with a content. */
typedef void (*Elm_Map_Marker_Del_Func)(Evas_Object *obj, Elm_Map_Marker *marker, void *data, Evas_Object *o); /**< Function to delete bubble content for marker classes. */
typedef Evas_Object *(*Elm_Map_Marker_Icon_Get_Func)(Evas_Object *obj, Elm_Map_Marker *marker, void *data); /**< Icon fetching class function for marker classes. */
typedef Evas_Object *(*Elm_Map_Group_Icon_Get_Func)(Evas_Object *obj, void *data); /**< Icon fetching class function for markers group classes. */
typedef Evas_Object *(*ElmMapMarkerGetFunc)(Evas_Object *obj, Elm_Map_Marker *marker, void *data); /**< Bubble content fetching class function for marker classes. When the user click on a marker, a bubble is displayed with a content. */
typedef void (*ElmMapMarkerDelFunc)(Evas_Object *obj, Elm_Map_Marker *marker, void *data, Evas_Object *o); /**< Function to delete bubble content for marker classes. */
typedef Evas_Object *(*ElmMapMarkerIconGetFunc)(Evas_Object *obj, Elm_Map_Marker *marker, void *data); /**< Icon fetching class function for marker classes. */
typedef Evas_Object *(*ElmMapGroupIconGetFunc)(Evas_Object *obj, void *data); /**< Icon fetching class function for markers group classes. */
typedef char *(*Elm_Map_Module_Source_Func)(void);
typedef int (*Elm_Map_Module_Zoom_Min_Func)(void);
typedef int (*Elm_Map_Module_Zoom_Max_Func)(void);
typedef char *(*Elm_Map_Module_Url_Func)(Evas_Object *obj, int x, int y, int zoom);
typedef int (*Elm_Map_Module_Route_Source_Func)(void);
typedef char *(*Elm_Map_Module_Route_Url_Func)(Evas_Object *obj, char *type_name, int method, double flon, double flat, double tlon, double tlat);
typedef char *(*Elm_Map_Module_Name_Url_Func)(Evas_Object *obj, int method, char *name, double lon, double lat);
typedef Eina_Bool (*Elm_Map_Module_Geo_Into_Coord_Func)(const Evas_Object *obj, int zoom, double lon, double lat, int size, int *x, int *y);
typedef Eina_Bool (*Elm_Map_Module_Coord_Into_Geo_Func)(const Evas_Object *obj, int zoom, int x, int y, int size, double *lon, double *lat);
typedef char *(*ElmMapModuleSourceFunc)(void);
typedef int (*ElmMapModuleZoomMinFunc)(void);
typedef int (*ElmMapModuleZoomMaxFunc)(void);
typedef char *(*ElmMapModuleUrlFunc)(Evas_Object *obj, int x, int y, int zoom);
typedef int (*ElmMapModuleRouteSourceFunc)(void);
typedef char *(*ElmMapModuleRouteUrlFunc)(Evas_Object *obj, char *type_name, int method, double flon, double flat, double tlon, double tlat);
typedef char *(*ElmMapModuleNameUrlFunc)(Evas_Object *obj, int method, char *name, double lon, double lat);
typedef Eina_Bool (*ElmMapModuleGeoIntoCoordFunc)(const Evas_Object *obj, int zoom, double lon, double lat, int size, int *x, int *y);
typedef Eina_Bool (*ElmMapModuleCoordIntoGeoFunc)(const Evas_Object *obj, int zoom, int x, int y, int size, double *lon, double *lat);
/**
* Add a new map widget to the given parent Elementary (container) object.
@ -661,12 +661,12 @@ EAPI void elm_map_marker_show(Elm_Map_Marker *marker);
EAPI void elm_map_markers_list_show(Eina_List *markers);
/**
* Get the Evas object returned by the Elm_Map_Marker_Get_Func callback
* Get the Evas object returned by the ElmMapMarkerGetFunc callback
*
* @param marker The marker which content should be returned.
* @return Return the evas object if it exists, else @c NULL.
*
* To set callback function #Elm_Map_Marker_Get_Func for the marker class,
* To set callback function #ElmMapMarkerGetFunc for the marker class,
* elm_map_marker_class_get_cb_set() should be used.
*
* This content is what will be inside the bubble that will be displayed
@ -691,8 +691,8 @@ EAPI Evas_Object *elm_map_marker_object_get(const Elm_Map_Marker *marke
* @param marker The marker to be updated.
*
* If a content is set to this marker, it will call function to delete it,
* #Elm_Map_Marker_Del_Func, and then will fetch the content again with
* #Elm_Map_Marker_Get_Func.
* #ElmMapMarkerDelFunc, and then will fetch the content again with
* #ElmMapMarkerGetFunc.
*
* These functions are set for the marker class with
* elm_map_marker_class_get_cb_set() and elm_map_marker_class_del_cb_set().
@ -706,7 +706,7 @@ EAPI void elm_map_marker_update(Elm_Map_Marker *marker);
*
* @param obj The map object.
*
* A bubble is displayed with a content fetched with #Elm_Map_Marker_Get_Func
* A bubble is displayed with a content fetched with #ElmMapMarkerGetFunc
* when the user clicks on a marker.
*
* This functions is set for the marker class with
@ -741,7 +741,7 @@ EAPI void elm_map_bubbles_close(Evas_Object *obj);
* elm_map_group_class_zoom_grouped_set().
* - visibility - set if markers will be visible or not, set with
* elm_map_group_class_hide_set().
* - #Elm_Map_Group_Icon_Get_Func - used to fetch icon for markers group classes.
* - #ElmMapGroupIconGetFunc - used to fetch icon for markers group classes.
* It can be set using elm_map_group_class_icon_cb_set().
*
* @see elm_map_marker_add()
@ -791,7 +791,7 @@ EAPI void elm_map_group_class_style_set(Elm_Map_Group_Class *cl
*
* @ingroup Map
*/
EAPI void elm_map_group_class_icon_cb_set(Elm_Map_Group_Class *clas, Elm_Map_Group_Icon_Get_Func icon_get);
EAPI void elm_map_group_class_icon_cb_set(Elm_Map_Group_Class *clas, ElmMapGroupIconGetFunc icon_get);
/**
* Set the data associated to the group class.
@ -877,11 +877,11 @@ EAPI void elm_map_group_class_hide_set(Evas_Object *obj, Elm_Ma
*
* Some properties and functions can be set by class, as:
* - style, with elm_map_marker_class_style_set()
* - #Elm_Map_Marker_Icon_Get_Func - used to fetch icon for markers classes.
* - #ElmMapMarkerIconGetFunc - used to fetch icon for markers classes.
* It can be set using elm_map_marker_class_icon_cb_set().
* - #Elm_Map_Marker_Get_Func - used to fetch bubble content for marker classes.
* - #ElmMapMarkerGetFunc - used to fetch bubble content for marker classes.
* Set using elm_map_marker_class_get_cb_set().
* - #Elm_Map_Marker_Del_Func - used to delete bubble content for marker classes.
* - #ElmMapMarkerDelFunc - used to delete bubble content for marker classes.
* Set using elm_map_marker_class_del_cb_set().
*
* @see elm_map_marker_add()
@ -929,7 +929,7 @@ EAPI void elm_map_marker_class_style_set(Elm_Map_Marker_Class *
*
* @ingroup Map
*/
EAPI void elm_map_marker_class_icon_cb_set(Elm_Map_Marker_Class *clas, Elm_Map_Marker_Icon_Get_Func icon_get);
EAPI void elm_map_marker_class_icon_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerIconGetFunc icon_get);
/**
* Set the bubble content callback function of a marker class.
@ -950,7 +950,7 @@ EAPI void elm_map_marker_class_icon_cb_set(Elm_Map_Marker_Class
*
* @ingroup Map
*/
EAPI void elm_map_marker_class_get_cb_set(Elm_Map_Marker_Class *clas, Elm_Map_Marker_Get_Func get);
EAPI void elm_map_marker_class_get_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerGetFunc get);
/**
* Set the callback function used to delete bubble content of a marker class.
@ -976,7 +976,7 @@ EAPI void elm_map_marker_class_get_cb_set(Elm_Map_Marker_Class
*
* @ingroup Map
*/
EAPI void elm_map_marker_class_del_cb_set(Elm_Map_Marker_Class *clas, Elm_Map_Marker_Del_Func del);
EAPI void elm_map_marker_class_del_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerDelFunc del);
/**
* Get the list of available sources.