2009-11-13 07:22:23 -08:00
|
|
|
#include <Elementary.h>
|
2010-10-19 11:25:22 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
2009-11-13 07:22:23 -08:00
|
|
|
#ifndef ELM_LIB_QUICKLAUNCH
|
|
|
|
|
2011-05-04 08:01:07 -07:00
|
|
|
#define SOURCE_MAX 10
|
2011-02-15 02:28:39 -08:00
|
|
|
#define MARKER_MAX 1000
|
2011-04-17 23:42:47 -07:00
|
|
|
#define NAME_ENTRY_TEXT "Enter freeform address"
|
2011-02-15 02:28:39 -08:00
|
|
|
|
2009-11-15 07:53:37 -08:00
|
|
|
typedef struct Marker_Data
|
|
|
|
{
|
2011-04-26 09:19:58 -07:00
|
|
|
const char *file;
|
2009-11-15 07:53:37 -08:00
|
|
|
} Marker_Data;
|
|
|
|
|
2011-05-04 08:01:07 -07:00
|
|
|
typedef struct Map_Source
|
|
|
|
{
|
|
|
|
Evas_Object *map;
|
|
|
|
char *source_name;
|
|
|
|
} Map_Source;
|
2009-11-15 07:53:37 -08:00
|
|
|
|
2009-12-20 08:34:45 -08:00
|
|
|
static Elm_Map_Marker_Class *itc1, *itc2, *itc_parking;
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
static Elm_Map_Group_Class *itc_group1, *itc_group2, *itc_group_parking, *route_group;
|
2009-11-15 07:53:37 -08:00
|
|
|
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
static Evas_Object *menu, *fs_win;
|
2011-05-05 00:42:12 -07:00
|
|
|
/*static Elm_Map_Marker *markers[MARKER_MAX];*/
|
2011-04-07 23:14:10 -07:00
|
|
|
static Elm_Map_Marker *route_from, *route_to;
|
|
|
|
static Elm_Map_Route *route;
|
2011-04-17 23:42:47 -07:00
|
|
|
static Elm_Map_Name *name;
|
2011-06-26 10:36:18 -07:00
|
|
|
static Evas_Object *track;
|
2011-05-04 02:44:53 -07:00
|
|
|
static const char **source_names = NULL;
|
2011-05-04 08:01:07 -07:00
|
|
|
static Evas_Coord old_x, old_y;
|
|
|
|
static Evas_Coord old_d;
|
|
|
|
static Map_Source ms[SOURCE_MAX];
|
2009-11-17 11:05:59 -08:00
|
|
|
|
2009-11-15 07:53:37 -08:00
|
|
|
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"};
|
|
|
|
|
2009-12-20 08:34:45 -08:00
|
|
|
Marker_Data data_parking= {PACKAGE_DATA_DIR"/images/parking.png"};
|
|
|
|
|
2011-04-07 23:14:10 -07:00
|
|
|
static Evas_Object * _marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data);
|
|
|
|
static Evas_Object * _group_icon_get(Evas_Object *obj, void *data);
|
|
|
|
|
2011-05-19 22:55:15 -07:00
|
|
|
static void
|
2011-06-28 00:02:37 -07:00
|
|
|
#ifdef ELM_EMAP
|
2011-05-19 22:55:15 -07:00
|
|
|
my_map_gpx_fileselector_done(void *data, Evas_Object *obj __UNUSED__, void *event_info)
|
2011-06-28 00:02:37 -07:00
|
|
|
#else
|
|
|
|
my_map_gpx_fileselector_done(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
#endif
|
2011-05-19 22:55:15 -07:00
|
|
|
{
|
|
|
|
const char *selected = event_info;
|
|
|
|
|
|
|
|
if (selected)
|
|
|
|
{
|
|
|
|
printf("Selected file: %s\n", selected);
|
2011-06-25 10:48:55 -07:00
|
|
|
#ifdef ELM_EMAP
|
2011-06-25 07:30:10 -07:00
|
|
|
EMap_Route *emap = emap_route_gpx_new(selected);
|
|
|
|
track = elm_map_track_add(data, emap);
|
|
|
|
#else
|
|
|
|
printf("libEMap is required !\n");
|
|
|
|
#endif
|
2011-05-19 22:55:15 -07:00
|
|
|
}
|
|
|
|
evas_object_del(fs_win);
|
|
|
|
}
|
|
|
|
|
2009-11-13 07:22:23 -08:00
|
|
|
static void
|
2010-10-19 11:25:22 -07:00
|
|
|
my_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
|
|
|
printf("clicked\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-19 11:25:22 -07:00
|
|
|
my_map_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
|
|
|
printf("press\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Fix zoom & rotated coordinates bug
In my point of view, elm_map did not consider zooming & rotation by
using Evas_Map initially.
There are no problems if you use only elm_map_zoom_set(). But if you
use pinch gesture or wheel to do subtle zooming & rotating, the
calculations of coordinates are not correct currently.
I have fixed these problem and also made some utility APIs for user
convenience.
I made following 3 APIs.
1. elm_map_utils_size_get()
Currently users can only get integer zoom level by using
elm_map_zoom_get().
So if user want to calculate full map size, user should calculate
pow(2.0, zoom level) * tile size. Furthermore, user assumes tile size
as 256. (tile size can be changed!!)
Also it's not correct sometimes because Evas_map is used for subtle
zooming between zoom levels.
Above APIs return correct full map size.
2. elm_map_utils_region_get()
It can used for getting left top coordinates, center coordinates and
width, height of currently shown map area.
3. elm_map_utils_convert_canvas_into_geo()
Currently it is hard to converting x, y coordinates to geographical
longitude, latitude because of subtle zooming & rotating.
If use wants to get it, user uses combination of above functions and
more. It is harsh job.
This function is used for getting longitude, latitude from x, y
coordinates of current viewport.
SVN revision: 67286
2012-01-17 19:55:40 -08:00
|
|
|
my_map_longpressed(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
if (!event_info) return;
|
2011-04-17 23:42:47 -07:00
|
|
|
double lon, lat;
|
|
|
|
Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info;
|
2012-02-20 23:59:19 -08:00
|
|
|
elm_map_canvas_to_geo_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat);
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
printf("longpressed, x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat);
|
|
|
|
|
|
|
|
if (elm_map_zoom_get(obj) < 5) return;
|
|
|
|
if (name) elm_map_name_remove(name);
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Fix zoom & rotated coordinates bug
In my point of view, elm_map did not consider zooming & rotation by
using Evas_Map initially.
There are no problems if you use only elm_map_zoom_set(). But if you
use pinch gesture or wheel to do subtle zooming & rotating, the
calculations of coordinates are not correct currently.
I have fixed these problem and also made some utility APIs for user
convenience.
I made following 3 APIs.
1. elm_map_utils_size_get()
Currently users can only get integer zoom level by using
elm_map_zoom_get().
So if user want to calculate full map size, user should calculate
pow(2.0, zoom level) * tile size. Furthermore, user assumes tile size
as 256. (tile size can be changed!!)
Also it's not correct sometimes because Evas_map is used for subtle
zooming between zoom levels.
Above APIs return correct full map size.
2. elm_map_utils_region_get()
It can used for getting left top coordinates, center coordinates and
width, height of currently shown map area.
3. elm_map_utils_convert_canvas_into_geo()
Currently it is hard to converting x, y coordinates to geographical
longitude, latitude because of subtle zooming & rotating.
If use wants to get it, user uses combination of above functions and
more. It is harsh job.
This function is used for getting longitude, latitude from x, y
coordinates of current viewport.
SVN revision: 67286
2012-01-17 19:55:40 -08:00
|
|
|
name = elm_map_utils_convert_coord_into_name(obj, lon, lat);
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Fix zoom & rotated coordinates bug
In my point of view, elm_map did not consider zooming & rotation by
using Evas_Map initially.
There are no problems if you use only elm_map_zoom_set(). But if you
use pinch gesture or wheel to do subtle zooming & rotating, the
calculations of coordinates are not correct currently.
I have fixed these problem and also made some utility APIs for user
convenience.
I made following 3 APIs.
1. elm_map_utils_size_get()
Currently users can only get integer zoom level by using
elm_map_zoom_get().
So if user want to calculate full map size, user should calculate
pow(2.0, zoom level) * tile size. Furthermore, user assumes tile size
as 256. (tile size can be changed!!)
Also it's not correct sometimes because Evas_map is used for subtle
zooming between zoom levels.
Above APIs return correct full map size.
2. elm_map_utils_region_get()
It can used for getting left top coordinates, center coordinates and
width, height of currently shown map area.
3. elm_map_utils_convert_canvas_into_geo()
Currently it is hard to converting x, y coordinates to geographical
longitude, latitude because of subtle zooming & rotating.
If use wants to get it, user uses combination of above functions and
more. It is harsh job.
This function is used for getting longitude, latitude from x, y
coordinates of current viewport.
SVN revision: 67286
2012-01-17 19:55:40 -08:00
|
|
|
my_map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("clicked,double\n");
|
2011-04-07 23:14:10 -07:00
|
|
|
double lon, lat;
|
|
|
|
double flon, flat, tlon, tlat;
|
2011-04-17 23:42:47 -07:00
|
|
|
Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info;
|
2011-04-07 23:14:10 -07:00
|
|
|
if (!down) return;
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Fix zoom & rotated coordinates bug
In my point of view, elm_map did not consider zooming & rotation by
using Evas_Map initially.
There are no problems if you use only elm_map_zoom_set(). But if you
use pinch gesture or wheel to do subtle zooming & rotating, the
calculations of coordinates are not correct currently.
I have fixed these problem and also made some utility APIs for user
convenience.
I made following 3 APIs.
1. elm_map_utils_size_get()
Currently users can only get integer zoom level by using
elm_map_zoom_get().
So if user want to calculate full map size, user should calculate
pow(2.0, zoom level) * tile size. Furthermore, user assumes tile size
as 256. (tile size can be changed!!)
Also it's not correct sometimes because Evas_map is used for subtle
zooming between zoom levels.
Above APIs return correct full map size.
2. elm_map_utils_region_get()
It can used for getting left top coordinates, center coordinates and
width, height of currently shown map area.
3. elm_map_utils_convert_canvas_into_geo()
Currently it is hard to converting x, y coordinates to geographical
longitude, latitude because of subtle zooming & rotating.
If use wants to get it, user uses combination of above functions and
more. It is harsh job.
This function is used for getting longitude, latitude from x, y
coordinates of current viewport.
SVN revision: 67286
2012-01-17 19:55:40 -08:00
|
|
|
if (elm_map_zoom_get(obj) < 5) return;
|
2011-04-07 23:14:10 -07:00
|
|
|
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Fix zoom & rotated coordinates bug
In my point of view, elm_map did not consider zooming & rotation by
using Evas_Map initially.
There are no problems if you use only elm_map_zoom_set(). But if you
use pinch gesture or wheel to do subtle zooming & rotating, the
calculations of coordinates are not correct currently.
I have fixed these problem and also made some utility APIs for user
convenience.
I made following 3 APIs.
1. elm_map_utils_size_get()
Currently users can only get integer zoom level by using
elm_map_zoom_get().
So if user want to calculate full map size, user should calculate
pow(2.0, zoom level) * tile size. Furthermore, user assumes tile size
as 256. (tile size can be changed!!)
Also it's not correct sometimes because Evas_map is used for subtle
zooming between zoom levels.
Above APIs return correct full map size.
2. elm_map_utils_region_get()
It can used for getting left top coordinates, center coordinates and
width, height of currently shown map area.
3. elm_map_utils_convert_canvas_into_geo()
Currently it is hard to converting x, y coordinates to geographical
longitude, latitude because of subtle zooming & rotating.
If use wants to get it, user uses combination of above functions and
more. It is harsh job.
This function is used for getting longitude, latitude from x, y
coordinates of current viewport.
SVN revision: 67286
2012-01-17 19:55:40 -08:00
|
|
|
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);
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
if (!itc1) itc1 = elm_map_marker_class_new(obj);
|
2011-04-07 23:14:10 -07:00
|
|
|
|
|
|
|
elm_map_marker_class_del_cb_set(itc1, NULL);
|
|
|
|
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
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);
|
|
|
|
}
|
2011-04-07 23:14:10 -07:00
|
|
|
|
|
|
|
if (route_from && route_to)
|
|
|
|
{
|
|
|
|
elm_map_marker_remove(route_from);
|
2011-04-21 01:55:02 -07:00
|
|
|
route_from = NULL;
|
2011-04-07 23:14:10 -07:00
|
|
|
elm_map_marker_remove(route_to);
|
2011-04-21 01:55:02 -07:00
|
|
|
route_to = NULL;
|
2011-04-07 23:14:10 -07:00
|
|
|
elm_map_route_remove(route);
|
|
|
|
}
|
|
|
|
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
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);
|
2011-04-07 23:14:10 -07:00
|
|
|
|
|
|
|
if (route_from && route_to)
|
|
|
|
{
|
|
|
|
elm_map_marker_region_get(route_from, &flon, &flat);
|
|
|
|
elm_map_marker_region_get(route_to, &tlon, &tlat);
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Fix zoom & rotated coordinates bug
In my point of view, elm_map did not consider zooming & rotation by
using Evas_Map initially.
There are no problems if you use only elm_map_zoom_set(). But if you
use pinch gesture or wheel to do subtle zooming & rotating, the
calculations of coordinates are not correct currently.
I have fixed these problem and also made some utility APIs for user
convenience.
I made following 3 APIs.
1. elm_map_utils_size_get()
Currently users can only get integer zoom level by using
elm_map_zoom_get().
So if user want to calculate full map size, user should calculate
pow(2.0, zoom level) * tile size. Furthermore, user assumes tile size
as 256. (tile size can be changed!!)
Also it's not correct sometimes because Evas_map is used for subtle
zooming between zoom levels.
Above APIs return correct full map size.
2. elm_map_utils_region_get()
It can used for getting left top coordinates, center coordinates and
width, height of currently shown map area.
3. elm_map_utils_convert_canvas_into_geo()
Currently it is hard to converting x, y coordinates to geographical
longitude, latitude because of subtle zooming & rotating.
If use wants to get it, user uses combination of above functions and
more. It is harsh job.
This function is used for getting longitude, latitude from x, y
coordinates of current viewport.
SVN revision: 67286
2012-01-17 19:55:40 -08:00
|
|
|
route = elm_map_route_add(obj, ELM_MAP_ROUTE_TYPE_MOTOCAR, ELM_MAP_ROUTE_METHOD_FASTEST, flon, flat, tlon, tlat);
|
2011-04-07 23:14:10 -07:00
|
|
|
elm_map_route_color_set(route, 255, 0, 0, 255);
|
|
|
|
}
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-01-11 01:58:34 -08:00
|
|
|
my_map_load_detail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-01-10 21:48:28 -08:00
|
|
|
printf("load,detail\n");
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-01-11 01:58:34 -08:00
|
|
|
my_map_loaded_detail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-01-10 21:48:28 -08:00
|
|
|
printf("loaded,detail\n");
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-19 11:25:22 -07:00
|
|
|
my_map_zoom_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
|
|
|
printf("zoom,start\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-19 11:25:22 -07:00
|
|
|
my_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
|
|
|
printf("zoom,stop\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-19 11:25:22 -07:00
|
|
|
my_map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
|
|
|
printf("zoom,change\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-19 11:25:22 -07:00
|
|
|
my_map_anim_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("scroll,anim,start\n");
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-19 11:25:22 -07:00
|
|
|
my_map_anim_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("scroll,anim,stop\n");
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-28 09:52:52 -07:00
|
|
|
my_map_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("scroll,drag,start\n");
|
2011-04-28 09:52:52 -07:00
|
|
|
evas_object_smart_callback_del(data, "longpressed", my_map_longpressed);
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-28 09:52:52 -07:00
|
|
|
my_map_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("scroll,drag,stop\n");
|
2011-04-28 09:52:52 -07:00
|
|
|
evas_object_smart_callback_add(data, "longpressed", my_map_longpressed, data);
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-19 11:25:22 -07:00
|
|
|
my_map_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
|
|
|
double lon, lat;
|
2009-11-15 07:53:37 -08:00
|
|
|
elm_map_geo_region_get(obj, &lon, &lat);
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
printf("scroll, longitude: %f latitude: %f\n", lon, lat);
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
2011-01-10 21:48:28 -08:00
|
|
|
static void
|
|
|
|
my_map_downloaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
int try_num, finish_num;
|
|
|
|
elm_map_utils_downloading_status_get(data, &try_num, &finish_num);
|
|
|
|
printf("downloaded : %d / %d\n", finish_num, try_num);
|
|
|
|
}
|
|
|
|
|
2011-04-07 23:14:10 -07:00
|
|
|
static void
|
2011-04-08 01:42:32 -07:00
|
|
|
my_map_route_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2011-04-07 23:14:10 -07:00
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("route,load\n");
|
2011-04-26 09:19:58 -07:00
|
|
|
}
|
2011-04-07 23:14:10 -07:00
|
|
|
|
|
|
|
static void
|
2011-04-08 01:42:32 -07:00
|
|
|
my_map_route_loaded(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2011-04-07 23:14:10 -07:00
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("route,loaded\n");
|
2011-04-07 23:14:10 -07:00
|
|
|
double d;
|
|
|
|
const char *w, *n;
|
|
|
|
d = elm_map_route_distance_get(route);
|
|
|
|
printf("route distance = %lf km\n", d);
|
|
|
|
|
|
|
|
w = elm_map_route_waypoint_get(route);
|
|
|
|
if (w) printf("[waypoints]\n%s\n", w);
|
|
|
|
|
|
|
|
n = elm_map_route_node_get(route);
|
|
|
|
if (n) printf("[nodes]\n%s\n", n);
|
|
|
|
}
|
|
|
|
|
2011-04-17 23:42:47 -07:00
|
|
|
static void
|
|
|
|
my_map_name_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("name,load\n");
|
2011-04-26 09:19:58 -07:00
|
|
|
}
|
2011-04-17 23:42:47 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
my_map_name_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
2011-12-04 21:04:24 -08:00
|
|
|
printf("name,loaded\n");
|
2011-04-17 23:42:47 -07:00
|
|
|
if (!name) return;
|
|
|
|
double lon, lat;
|
|
|
|
const char *addr = elm_map_name_address_get(name);
|
|
|
|
elm_map_name_region_get(name, &lon, &lat);
|
|
|
|
if (addr)
|
|
|
|
{
|
|
|
|
printf("name of [lon = %lf, lat = %lf] is %s\n", lon, lat, addr);
|
|
|
|
if ((lon != 0.0) && (lat !=0.0))
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
elm_map_geo_region_show(data, lon, lat);
|
2011-12-13 02:39:53 -08:00
|
|
|
elm_map_zoom_set(data, elm_map_source_zoom_max_get(data));
|
2011-04-17 23:42:47 -07:00
|
|
|
elm_map_paused_set(data, b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elm_map_name_remove(name);
|
|
|
|
}
|
|
|
|
|
2011-05-06 23:32:34 -07:00
|
|
|
static void
|
2011-06-26 10:36:18 -07:00
|
|
|
map_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2011-05-06 23:32:34 -07:00
|
|
|
{
|
|
|
|
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);
|
2011-06-26 10:36:18 -07:00
|
|
|
elm_map_geo_region_show(data,7.325201, 48.526813);
|
|
|
|
elm_map_zoom_set(data, 12);
|
2011-05-06 23:32:34 -07:00
|
|
|
elm_map_paused_set(data, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
map_bring_seoul(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
elm_map_geo_region_bring_in(data, 126.977969, 37.566535);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
map_paused_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
elm_map_paused_set(data, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
map_paused_unset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
elm_map_paused_set(data, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2009-11-13 07:22:23 -08:00
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-05-05 08:15:43 -07:00
|
|
|
int zoom;
|
2011-05-04 08:01:07 -07:00
|
|
|
|
2011-05-05 08:15:43 -07:00
|
|
|
zoom = elm_map_zoom_get(data) + 1;
|
2009-11-14 07:30:03 -08:00
|
|
|
elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
|
2011-05-05 08:15:43 -07:00
|
|
|
elm_map_zoom_set(data, zoom);
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-05-05 08:15:43 -07:00
|
|
|
int zoom;
|
2011-05-04 08:01:07 -07:00
|
|
|
|
2011-05-05 08:15:43 -07:00
|
|
|
zoom = elm_map_zoom_get(data) - 1;
|
2011-05-04 08:01:07 -07:00
|
|
|
elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
|
2011-05-05 08:15:43 -07:00
|
|
|
elm_map_zoom_set(data, zoom);
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-05-04 08:01:07 -07:00
|
|
|
elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT);
|
|
|
|
}
|
2009-11-13 07:22:23 -08:00
|
|
|
|
2011-05-04 08:01:07 -07:00
|
|
|
static void
|
|
|
|
map_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL);
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
2011-05-19 22:55:15 -07:00
|
|
|
static void
|
|
|
|
map_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
Evas_Object *fs, *bg, *vbox, *hbox, *sep;
|
2011-12-13 02:39:53 -08:00
|
|
|
char *path = NULL;
|
2011-05-19 22:55:15 -07:00
|
|
|
|
|
|
|
fs_win = elm_win_add(NULL, "fileselector", ELM_WIN_BASIC);
|
|
|
|
elm_win_title_set(fs_win, "File Selector");
|
|
|
|
elm_win_autodel_set(fs_win, 1);
|
|
|
|
|
|
|
|
bg = elm_bg_add(fs_win);
|
|
|
|
elm_win_resize_object_add(fs_win, bg);
|
|
|
|
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_show(bg);
|
|
|
|
|
|
|
|
vbox = elm_box_add(fs_win);
|
|
|
|
elm_win_resize_object_add(fs_win, vbox);
|
|
|
|
evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_show(vbox);
|
|
|
|
|
|
|
|
fs = elm_fileselector_add(fs_win);
|
|
|
|
elm_fileselector_is_save_set(fs, EINA_TRUE);
|
|
|
|
elm_fileselector_expandable_set(fs, EINA_FALSE);
|
2011-12-13 02:39:53 -08:00
|
|
|
path = getenv("HOME");
|
|
|
|
//if "HOME" is not available, set current dir. path
|
|
|
|
if (!path)
|
|
|
|
path = ".";
|
|
|
|
elm_fileselector_path_set(fs, path);
|
2011-05-19 22:55:15 -07:00
|
|
|
evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_box_pack_end(vbox, fs);
|
|
|
|
evas_object_show(fs);
|
|
|
|
|
|
|
|
evas_object_smart_callback_add(fs, "done", my_map_gpx_fileselector_done, data);
|
|
|
|
|
|
|
|
sep = elm_separator_add(fs_win);
|
|
|
|
elm_separator_horizontal_set(sep, EINA_TRUE);
|
|
|
|
elm_box_pack_end(vbox, sep);
|
|
|
|
evas_object_show(sep);
|
|
|
|
|
|
|
|
hbox = elm_box_add(fs_win);
|
|
|
|
elm_box_horizontal_set(hbox, EINA_TRUE);
|
|
|
|
elm_box_pack_end(vbox, hbox);
|
|
|
|
evas_object_show(hbox);
|
|
|
|
|
|
|
|
evas_object_resize(fs_win, 240, 350);
|
|
|
|
evas_object_show(fs_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
map_track_remove(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
2011-06-26 10:36:18 -07:00
|
|
|
elm_map_track_remove(data, track);
|
2011-05-19 22:55:15 -07:00
|
|
|
}
|
|
|
|
|
2011-04-21 01:55:02 -07:00
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_rotate_cw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2011-04-21 01:55:02 -07:00
|
|
|
{
|
|
|
|
double d;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
float half_w, half_h;
|
|
|
|
evas_object_geometry_get(data, &x, &y, &w, &h);
|
|
|
|
half_w = (float)w * 0.5;
|
|
|
|
half_h = (float)h * 0.5;
|
|
|
|
|
|
|
|
elm_map_rotate_get(data, &d, NULL, NULL);
|
|
|
|
d += 15.0;
|
|
|
|
elm_map_rotate_set(data, d, x + half_w, y + half_h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_rotate_ccw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2011-04-21 01:55:02 -07:00
|
|
|
{
|
|
|
|
double d;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
float half_w, half_h;
|
|
|
|
evas_object_geometry_get(data, &x, &y, &w, &h);
|
|
|
|
half_w = (float)w * 0.5;
|
|
|
|
half_h = (float)h * 0.5;
|
|
|
|
|
|
|
|
elm_map_rotate_get(data, &d, NULL, NULL);
|
|
|
|
d -= 15.0;
|
|
|
|
elm_map_rotate_set(data, d, x + half_w, y + half_h);
|
|
|
|
}
|
|
|
|
|
2009-11-13 07:22:23 -08:00
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-05-04 08:01:07 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
float half_w, half_h;
|
|
|
|
evas_object_geometry_get(data, &x, &y, &w, &h);
|
|
|
|
half_w = (float)w * 0.5;
|
|
|
|
half_h = (float)h * 0.5;
|
2009-11-13 07:22:23 -08:00
|
|
|
|
2011-05-04 08:01:07 -07:00
|
|
|
elm_map_rotate_set(data, 0.0, x + half_w, y + half_h);
|
2009-11-13 07:22:23 -08:00
|
|
|
}
|
|
|
|
|
2011-05-26 05:40:29 -07:00
|
|
|
static void
|
|
|
|
map_zoom_min_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
elm_map_source_zoom_min_set(data, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
map_zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
elm_map_source_zoom_max_set(data, 10);
|
|
|
|
}
|
|
|
|
|
2009-12-22 14:47:17 -08:00
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_source(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-12-22 14:47:17 -08:00
|
|
|
{
|
2011-05-21 01:59:19 -07:00
|
|
|
Map_Source *s = data;
|
2009-12-22 14:47:17 -08:00
|
|
|
|
2011-05-21 01:59:19 -07:00
|
|
|
if (!s) return;
|
|
|
|
elm_map_source_name_set(s->map, s->source_name);
|
2010-12-21 01:14:47 -08:00
|
|
|
}
|
|
|
|
|
2011-05-05 00:42:12 -07:00
|
|
|
/*
|
2009-12-18 06:28:36 -08:00
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_marker_add(void *data)
|
2009-12-18 06:28:36 -08:00
|
|
|
{
|
2011-02-15 02:28:39 -08:00
|
|
|
int i;
|
|
|
|
Elm_Map_Group_Class *g_clas;
|
|
|
|
Elm_Map_Marker_Class *m_clas;
|
|
|
|
Marker_Data *d = &data7;
|
2009-12-18 06:28:36 -08:00
|
|
|
|
2011-02-15 02:28:39 -08:00
|
|
|
if (*markers) return;
|
2011-04-26 09:19:58 -07:00
|
|
|
for (i =0; i<MARKER_MAX; i++)
|
2011-02-15 02:28:39 -08:00
|
|
|
{
|
2009-12-20 08:34:45 -08:00
|
|
|
d = &data7;
|
|
|
|
|
2009-12-18 06:28:36 -08:00
|
|
|
int r1 = rand() % (180*2*100);
|
2011-04-26 09:19:58 -07:00
|
|
|
if (r1<=180) r1 = -r1;
|
2009-12-18 06:28:36 -08:00
|
|
|
else r1 = r1 - 180*100;
|
|
|
|
|
|
|
|
int r2 = rand() % (85*2*100);
|
2011-04-26 09:19:58 -07:00
|
|
|
if (r2<=85) r2 = -r2;
|
2009-12-18 06:28:36 -08:00
|
|
|
else r2 = r2 - 85*100;
|
|
|
|
|
2009-12-20 08:34:45 -08:00
|
|
|
int style = rand() % 3;
|
2011-02-15 02:28:39 -08:00
|
|
|
if (!style) m_clas = itc1;
|
|
|
|
else if (style == 1) m_clas = itc2;
|
2009-12-20 08:34:45 -08:00
|
|
|
else
|
2011-02-15 02:28:39 -08:00
|
|
|
{
|
|
|
|
m_clas = itc_parking;
|
|
|
|
d = &data_parking;
|
|
|
|
}
|
|
|
|
|
|
|
|
style = rand() % 2;
|
|
|
|
if (!style) g_clas = itc_group1;
|
2011-04-21 01:55:02 -07:00
|
|
|
else g_clas = itc_group2;
|
2011-02-15 02:28:39 -08:00
|
|
|
|
2011-04-26 09:19:58 -07:00
|
|
|
markers[i] = elm_map_marker_add(data, r1/100., r2/100., m_clas, g_clas, d);
|
|
|
|
}
|
|
|
|
nb_elts += 1000;
|
|
|
|
printf("nb elements: %d\n", nb_elts);
|
2009-12-18 06:28:36 -08:00
|
|
|
}
|
|
|
|
|
2011-02-15 02:28:39 -08:00
|
|
|
static void
|
2011-05-04 08:01:07 -07:00
|
|
|
map_marker_remove(void *data __UNUSED__)
|
2011-02-15 02:28:39 -08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i<MARKER_MAX; i++)
|
2011-04-08 07:30:48 -07:00
|
|
|
{
|
2011-02-15 02:28:39 -08:00
|
|
|
if (markers[i])
|
|
|
|
{
|
|
|
|
elm_map_marker_remove(markers[i]);
|
|
|
|
markers[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-17 23:42:47 -07:00
|
|
|
static void
|
|
|
|
my_map_entry_focused(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
const char *s = elm_scrolled_entry_entry_get(obj);
|
|
|
|
if (!strcmp(s, NAME_ENTRY_TEXT)) elm_scrolled_entry_entry_set(obj, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
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_utils_convert_name_into_coord(data, addr);
|
|
|
|
if (addr) free (addr);
|
|
|
|
}
|
2011-05-05 00:42:12 -07:00
|
|
|
*/
|
2011-04-17 23:42:47 -07:00
|
|
|
|
2009-12-07 10:05:04 -08:00
|
|
|
static Evas_Object *
|
2010-10-19 11:25:22 -07:00
|
|
|
_marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data)
|
2009-11-15 07:53:37 -08:00
|
|
|
{
|
2011-04-26 09:19:58 -07:00
|
|
|
Marker_Data *d = data;
|
2009-11-15 07:53:37 -08:00
|
|
|
|
2011-04-26 09:19:58 -07:00
|
|
|
Evas_Object *bx = elm_box_add(obj);
|
|
|
|
evas_object_show(bx);
|
2009-11-16 13:32:33 -08:00
|
|
|
|
2011-04-26 09:19:58 -07:00
|
|
|
if (d == &data3)
|
|
|
|
{
|
2009-11-16 13:32:33 -08:00
|
|
|
Evas_Object *icon = elm_icon_add(obj);
|
|
|
|
elm_icon_file_set(icon, d->file, NULL);
|
|
|
|
evas_object_show(icon);
|
|
|
|
|
|
|
|
Evas_Object *o = elm_button_add(obj);
|
2011-11-17 13:02:31 -08:00
|
|
|
elm_object_part_content_set(o, "icon", icon);
|
2009-11-16 13:32:33 -08:00
|
|
|
evas_object_show(o);
|
|
|
|
elm_box_pack_end(bx, o);
|
2011-04-26 09:19:58 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-16 13:32:33 -08:00
|
|
|
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);
|
|
|
|
elm_box_pack_end(bx, o);
|
|
|
|
|
|
|
|
Evas_Object *lbl = elm_label_add(obj);
|
2011-06-28 23:41:31 -07:00
|
|
|
elm_object_text_set(lbl, "Wolves Go !");
|
2009-11-16 13:32:33 -08:00
|
|
|
evas_object_show(lbl);
|
|
|
|
elm_box_pack_end(bx, lbl);
|
2011-04-26 09:19:58 -07:00
|
|
|
}
|
2009-11-16 13:32:33 -08:00
|
|
|
|
2011-04-26 09:19:58 -07:00
|
|
|
return bx;
|
2009-11-15 07:53:37 -08:00
|
|
|
}
|
|
|
|
|
2009-12-20 08:34:45 -08:00
|
|
|
static Evas_Object *
|
2010-10-19 11:25:22 -07:00
|
|
|
_icon_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data)
|
2009-12-20 08:34:45 -08:00
|
|
|
{
|
2011-04-26 09:19:58 -07:00
|
|
|
Marker_Data *d = data;
|
2009-12-20 08:34:45 -08:00
|
|
|
|
2011-04-26 09:19:58 -07:00
|
|
|
Evas_Object *icon = elm_icon_add(obj);
|
|
|
|
elm_icon_file_set(icon, d->file, NULL);
|
|
|
|
evas_object_show(icon);
|
2009-12-20 08:34:45 -08:00
|
|
|
|
2011-04-26 09:19:58 -07:00
|
|
|
return icon;
|
2009-12-20 08:34:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_group_icon_get(Evas_Object *obj, void *data)
|
|
|
|
{
|
2011-04-26 09:19:58 -07:00
|
|
|
char *file = data;
|
2009-12-20 08:34:45 -08:00
|
|
|
|
2011-04-26 09:19:58 -07:00
|
|
|
Evas_Object *icon = elm_icon_add(obj);
|
|
|
|
elm_icon_file_set(icon, file, NULL);
|
|
|
|
evas_object_show(icon);
|
2009-12-20 08:34:45 -08:00
|
|
|
|
2011-04-26 09:19:58 -07:00
|
|
|
return icon;
|
2009-12-20 08:34:45 -08:00
|
|
|
}
|
|
|
|
|
2011-05-04 08:01:07 -07:00
|
|
|
static void
|
2011-11-25 02:57:39 -08:00
|
|
|
_populate(void *data, Elm_Object_Item *menu_it)
|
2011-05-04 08:01:07 -07:00
|
|
|
{
|
|
|
|
int idx;
|
|
|
|
|
2011-11-25 02:57:39 -08:00
|
|
|
if ((!data) || (!menu_it) || (!source_names)) return;
|
2011-05-04 08:01:07 -07:00
|
|
|
for (idx = 0; source_names[idx]; idx++)
|
|
|
|
{
|
|
|
|
if (idx >= SOURCE_MAX) break;
|
|
|
|
ms[idx].map = data;
|
|
|
|
ms[idx].source_name = strdup(source_names[idx]);
|
2011-11-25 02:57:39 -08:00
|
|
|
elm_menu_item_add(menu, menu_it, "", source_names[idx], map_source,
|
|
|
|
&ms[idx]);
|
2011-05-04 08:01:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_map_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Down *down = event_info;
|
2011-11-25 02:57:39 -08:00
|
|
|
Elm_Object_Item *menu_it;
|
2011-05-04 08:01:07 -07:00
|
|
|
if (!down) return;
|
|
|
|
|
|
|
|
if (down->button == 2)
|
|
|
|
{
|
2011-06-13 04:26:08 -07:00
|
|
|
old_x = down->canvas.x;
|
|
|
|
old_y = down->canvas.y;
|
2011-05-04 08:01:07 -07:00
|
|
|
old_d = 0.0;
|
|
|
|
}
|
|
|
|
else if (down->button == 3)
|
|
|
|
{
|
|
|
|
menu = elm_menu_add(obj);
|
2011-11-25 02:57:39 -08:00
|
|
|
menu_it = elm_menu_item_add(menu, NULL, NULL, "Source", NULL, NULL);
|
|
|
|
_populate(data, menu_it);
|
2011-06-26 10:36:18 -07:00
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Show Urmatt", map_show_urmatt, data);
|
2011-05-06 23:32:34 -07:00
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Bring Seoul", map_bring_seoul, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Paused Set", map_paused_set, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Paused Unset", map_paused_unset, data);
|
2011-05-04 08:01:07 -07:00
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Zoom +", map_zoom_in, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Zoom -", map_zoom_out, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Zoom Fit", map_zoom_fit, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Zoom Fill", map_zoom_fill, data);
|
2011-05-19 22:55:15 -07:00
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Add Track", map_track_add, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Remove Track", map_track_remove, data);
|
2011-05-04 08:01:07 -07:00
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Add Marker", NULL, NULL);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Rotate CW", map_rotate_cw, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Rotate CCW", map_rotate_ccw, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Reset Rotate", map_rotate_reset, data);
|
2011-05-26 05:40:29 -07:00
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Set Zoom Min to 1", map_zoom_min_set, data);
|
|
|
|
elm_menu_item_add(menu, NULL, NULL, "Set Zoom Max to 10", map_zoom_max_set, data);
|
2011-05-04 08:01:07 -07:00
|
|
|
|
|
|
|
elm_menu_move(menu, down->canvas.x, down->canvas.y);
|
|
|
|
evas_object_show(menu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_map_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Move *move = event_info;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
float half_w, half_h;
|
|
|
|
int d, d_diff;
|
|
|
|
double cur_d;
|
|
|
|
if (!move) return;
|
|
|
|
|
|
|
|
if (move->buttons == 2)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(data, &x, &y, &w, &h);
|
|
|
|
half_w = (float)w * 0.5;
|
|
|
|
half_h = (float)h * 0.5;
|
|
|
|
elm_map_rotate_get(data, &cur_d, NULL, NULL);
|
|
|
|
|
2011-06-13 04:26:08 -07:00
|
|
|
d = move->cur.canvas.x - old_x;
|
2011-05-04 08:01:07 -07:00
|
|
|
if (!old_d) old_d = d;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
d_diff = old_d - d;
|
|
|
|
if (d_diff > 0)
|
|
|
|
{
|
|
|
|
old_d --;
|
|
|
|
cur_d += 1.0;
|
|
|
|
}
|
|
|
|
else if (d_diff < 0)
|
|
|
|
{
|
|
|
|
old_d ++;
|
|
|
|
cur_d -= 1.0;
|
|
|
|
}
|
|
|
|
old_d = d;
|
|
|
|
elm_map_rotate_set(data, cur_d, x + half_w, y + half_h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-05-05 00:42:12 -07:00
|
|
|
_map_mouse_up(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
2011-05-04 08:01:07 -07:00
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Up *up = event_info;
|
|
|
|
if (!up) return;
|
|
|
|
|
|
|
|
if (up->button == 2)
|
|
|
|
{
|
|
|
|
old_x = 0;
|
|
|
|
old_y = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-13 07:22:23 -08:00
|
|
|
void
|
2010-10-19 11:25:22 -07:00
|
|
|
test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-11-13 07:22:23 -08:00
|
|
|
{
|
2011-11-11 08:47:05 -08:00
|
|
|
Evas_Object *win, *bg, *map;
|
2011-05-04 02:44:53 -07:00
|
|
|
int idx = 0;
|
2009-11-13 07:22:23 -08:00
|
|
|
|
|
|
|
win = elm_win_add(NULL, "map", ELM_WIN_BASIC);
|
|
|
|
elm_win_title_set(win, "Map");
|
2011-07-25 07:22:19 -07:00
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
2009-11-13 07:22:23 -08:00
|
|
|
|
|
|
|
bg = elm_bg_add(win);
|
|
|
|
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
elm_win_resize_object_add(win, bg);
|
|
|
|
evas_object_show(bg);
|
|
|
|
|
|
|
|
map = elm_map_add(win);
|
2011-04-08 07:30:48 -07:00
|
|
|
if (map)
|
2009-12-07 10:05:04 -08:00
|
|
|
{
|
2011-05-04 02:44:53 -07:00
|
|
|
srand(time(NULL));
|
|
|
|
|
|
|
|
source_names = elm_map_source_names_get(map);
|
|
|
|
|
|
|
|
if (!source_names) return;
|
|
|
|
printf("map sources [ ");
|
|
|
|
for (idx = 0; source_names[idx] ; idx++) printf("%s ", source_names[idx]);
|
|
|
|
printf("]\n");
|
2009-12-18 06:28:36 -08:00
|
|
|
|
2009-12-07 10:05:04 -08:00
|
|
|
evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2011-11-11 08:47:05 -08:00
|
|
|
elm_win_resize_object_add(win, map);
|
2009-12-07 10:05:04 -08:00
|
|
|
evas_object_data_set(map, "window", win);
|
|
|
|
|
2009-12-20 08:34:45 -08:00
|
|
|
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);
|
2011-04-08 07:30:48 -07:00
|
|
|
|
2009-12-20 08:34:45 -08:00
|
|
|
itc2 = elm_map_marker_class_new(map);
|
|
|
|
elm_map_marker_class_get_cb_set(itc2, _marker_get);
|
|
|
|
elm_map_marker_class_del_cb_set(itc2, NULL);
|
|
|
|
elm_map_marker_class_style_set(itc2, "radio2");
|
|
|
|
|
|
|
|
itc_parking = elm_map_marker_class_new(map);
|
|
|
|
elm_map_marker_class_get_cb_set(itc_parking, _marker_get);
|
|
|
|
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);
|
2010-10-20 10:15:14 -07:00
|
|
|
elm_map_group_class_data_set(itc_group1, (void *)PACKAGE_DATA_DIR"/images/plant_01.jpg");
|
2009-12-20 08:34:45 -08:00
|
|
|
|
|
|
|
itc_group2 = elm_map_group_class_new(map);
|
|
|
|
elm_map_group_class_style_set(itc_group2, "radio2");
|
|
|
|
elm_map_group_class_zoom_displayed_set(itc_group1, 3);
|
|
|
|
|
|
|
|
itc_group_parking = elm_map_group_class_new(map);
|
|
|
|
elm_map_group_class_icon_cb_set(itc_group_parking, _group_icon_get);
|
2010-10-20 10:15:14 -07:00
|
|
|
elm_map_group_class_data_set(itc_group_parking, (void *)PACKAGE_DATA_DIR"/images/parking.png");
|
2009-12-20 08:34:45 -08:00
|
|
|
elm_map_group_class_style_set(itc_group_parking, "empty");
|
|
|
|
elm_map_group_class_zoom_displayed_set(itc_group_parking, 5);
|
From: Bluezery <ohpowel@gmail.com>
Subject: [E-devel] [Patch][elm_map] Refactoring Elementary Map
I have done refactoring & code clean-up in elm_map. Event if this
patch have much changes, refactoring & code clean-up jobs almost
always do.
Anyway, code is shortened and optimized I think.
I have done following jobs in my patch.
(1) Always change child size
Scroller Child size is changed when integer zoom level is changed
before. This makes bugs which mouse pointer is not correct on the map
when map is dragging.
Now, scroller child size is always changed when double zoom level is
changed.
(2) Evas map
Evas map is used for rotation & zooming before. But now it is used for
only rotation. evas_object_resize() can do zooming because (1) makes
child size always changed.
(3) Grid & Marker & Route, etc.
Because of (1), all coordinate calculations are all changed. So grid &
marker & route should be changed.
When I have fixed these, I have these split into small function
(create, free, update, place, etc.)
So these can be easily reused for other purpose ( I will add overlay
later.)
Also marker size is not changed and is not rotated anymore because
marker's coordinate is just rotated and evas_map is not used for
marker.
And grouping algorithm is somewhat changed. Each marker can be group
leader and if other markers (followers) are closed to leader, markers
are grouped.
Actually _marker_place() function do almost everything. (place marker,
bubble, group & make group, etc.)
Bubbles go along with parent object. (show, hide, move) and this is
created when marker & group are opened.
At now, bubble display bugs are all fixed.
As before, grid is created when elm_map_add() or tile source is
changed. And I add _grid_item_* functions for each 256x256 tile
management. So grid_place() function can be simple now.
(4) Download idler
Before download is not a job or idler and is integrated with grid
calculation.
I have separated this into independent idler. So now, download idler
do download jobs when idler time.
(5) Zoom
I have made one zoom_do() function. This does all zoom jobs. At now,
pinch_zoom & wheel_zoom & animated zoom do not much jobs. just call
zoom_do().
(6) Delayed jobs
As I know, evas is based on a retained mode and calculation can be do
later. So sometimes elm_map APIs can not do the jobs correctly.
For example, elm_map_marker_list_show() or elm_map_zoom_set() can not
be used right after elm_map_add() because window size and pan size
can be 0. (refer map_example_02.c)
So when APIs related such calculation are called. These are deferred
and calculated later when _pan_calculate() is called.
5) Code clean-up
I have removed unused variables & functions. and rearranged struct &
functions & declaration & static variables, etc.
Instead of "if (!wd) return; ", I changed this by macro,
"EINA_SAFETY_ON_NULL_RETURN(wd);". This is better for function
entrance check. Also ELM_NEW is used instead of calloc or malloc.
Aboves are all related each other. So it can be hard to split this
file. If these should be splitted, I'm going to freak ;D.
This patch does no harm!!!! :D.
After this patch, I will add overlay APIs based on this patch. I
doubt whether I will add this before elementary 1.0 release. :(
SVN revision: 68207
2012-02-21 00:01:22 -08:00
|
|
|
|
2011-05-04 08:01:07 -07:00
|
|
|
evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_DOWN,
|
|
|
|
_map_mouse_down, map);
|
|
|
|
evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_MOVE,
|
|
|
|
_map_mouse_move, map);
|
|
|
|
evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_UP,
|
|
|
|
_map_mouse_up, map);
|
2009-12-07 10:05:04 -08:00
|
|
|
|
2010-10-14 07:10:33 -07:00
|
|
|
elm_map_marker_add(map, 2.352, 48.857, itc1, itc_group1, &data1);
|
|
|
|
elm_map_marker_add(map, 2.355, 48.857, itc1, itc_group1, &data3);
|
|
|
|
elm_map_marker_add(map, 3, 48.857, itc2, itc_group1, &data2);
|
|
|
|
elm_map_marker_add(map, 2.352, 49, itc2, itc_group1, &data1);
|
|
|
|
|
|
|
|
elm_map_marker_add(map, 7.31451, 48.857127, itc1, itc_group1, &data10);
|
|
|
|
elm_map_marker_add(map, 7.314704, 48.857119, itc1, itc_group1, &data4);
|
|
|
|
elm_map_marker_add(map, 7.314704, 48.857119, itc2, itc_group1, &data5);
|
|
|
|
elm_map_marker_add(map, 7.31432, 48.856785, itc2, itc_group1, &data6);
|
|
|
|
elm_map_marker_add(map, 7.3148, 48.85725, itc1, itc_group2, &data7);
|
|
|
|
elm_map_marker_add(map, 7.316445, 48.8572210000694, itc1, itc_group1, &data8);
|
|
|
|
elm_map_marker_add(map, 7.316527000125, 48.85609, itc2, itc_group2, &data9);
|
|
|
|
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);
|
2009-12-07 10:05:04 -08:00
|
|
|
|
2011-12-04 21:04:24 -08:00
|
|
|
evas_object_smart_callback_add(map, "clicked", my_map_clicked, map);
|
|
|
|
evas_object_smart_callback_add(map, "press", my_map_press, map);
|
2011-04-17 23:42:47 -07:00
|
|
|
evas_object_smart_callback_add(map, "longpressed", my_map_longpressed, map);
|
2011-04-07 23:14:10 -07:00
|
|
|
evas_object_smart_callback_add(map, "clicked,double", my_map_clicked_double, map);
|
2011-12-04 21:04:24 -08:00
|
|
|
evas_object_smart_callback_add(map, "load,detail", my_map_load_detail, map);
|
|
|
|
evas_object_smart_callback_add(map, "loaded,detail", my_map_loaded_detail, map);
|
|
|
|
evas_object_smart_callback_add(map, "zoom,start", my_map_zoom_start, map);
|
|
|
|
evas_object_smart_callback_add(map, "zoom,stop", my_map_zoom_stop, map);
|
|
|
|
evas_object_smart_callback_add(map, "zoom,change", my_map_zoom_change, map);
|
|
|
|
evas_object_smart_callback_add(map, "scroll,anim,start", my_map_anim_start, map);
|
|
|
|
evas_object_smart_callback_add(map, "scroll,anim,stop", my_map_anim_stop, map);
|
2011-04-28 09:52:52 -07:00
|
|
|
evas_object_smart_callback_add(map, "scroll,drag,start", my_map_drag_start, map);
|
|
|
|
evas_object_smart_callback_add(map, "scroll,drag,stop", my_map_drag_stop, map);
|
2011-12-04 21:04:24 -08:00
|
|
|
evas_object_smart_callback_add(map, "scroll", my_map_scroll, map);
|
2011-01-10 21:48:28 -08:00
|
|
|
evas_object_smart_callback_add(map, "downloaded", my_map_downloaded, map);
|
2011-04-07 23:14:10 -07:00
|
|
|
evas_object_smart_callback_add(map, "route,load", my_map_route_load, map);
|
|
|
|
evas_object_smart_callback_add(map, "route,loaded", my_map_route_loaded, map);
|
2011-04-17 23:42:47 -07:00
|
|
|
evas_object_smart_callback_add(map, "name,load", my_map_name_load, map);
|
|
|
|
evas_object_smart_callback_add(map, "name,loaded", my_map_name_loaded, map);
|
2009-12-07 10:05:04 -08:00
|
|
|
|
|
|
|
evas_object_show(map);
|
|
|
|
}
|
2009-11-13 07:22:23 -08:00
|
|
|
|
|
|
|
evas_object_resize(win, 800, 800);
|
|
|
|
evas_object_show(win);
|
|
|
|
}
|
|
|
|
#endif
|