diff options
-rw-r--r-- | Makefile | 25 | ||||
-rw-r--r-- | README | 28 | ||||
-rw-r--r-- | bing_aerial.c | 71 | ||||
-rw-r--r-- | bing_aerial_road.c | 71 | ||||
-rw-r--r-- | bing_road.c | 71 | ||||
-rw-r--r-- | util.c | 21 | ||||
-rw-r--r-- | util.h | 1 |
7 files changed, 288 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..78dcf40 --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,25 @@ | |||
1 | PREF = /usr/local/lib/elementary/modules | ||
2 | POST = v-1.11.0 | ||
3 | DIR = /usr/local/lib/elementary/modules/dir/linux-gnu-i686-1.0.0 | ||
4 | TARGET = module.so | ||
5 | SRCS = bing_aerial bing_aerial_road bing_road | ||
6 | |||
7 | all: | ||
8 | gcc -c util.c | ||
9 | for src in $(SRCS); do\ | ||
10 | gcc -c -fPIC $$src.c util.c `pkg-config --cflags elementary` && \ | ||
11 | gcc -shared -Wl,-z,defs -Wl,-soname,$$src.so -o $$src.so $$src.o util.o -Wl,--as-needed `pkg-config --libs elementary`;\ | ||
12 | done | ||
13 | |||
14 | install: | ||
15 | for src in $(SRCS); do\ | ||
16 | test -z $(PREF)/$$src/$(POST)/ || mkdir -p $(PREF)/$$src/$(POST)/ && install $$src.so $(PREF)/$$src/$(POST)/module.so;\ | ||
17 | done | ||
18 | |||
19 | uninstall: | ||
20 | for src in $(SRCS); do\ | ||
21 | rm -rf $(PREF)/$$src/$(POST)/module.so;\ | ||
22 | done | ||
23 | |||
24 | clean: | ||
25 | rm -rf *.o *.so | ||
@@ -0,0 +1,28 @@ | |||
1 | elm map bing plugin 0.0.1 | ||
2 | |||
3 | Elm Map Module for Bing map (http://www.bing.com/maps/) | ||
4 | |||
5 | ****************************************************************************** | ||
6 | |||
7 | FOR ANY ISSUES PLEASE EMAIL: | ||
8 | enlightenment-devel@lists.sourceforge.net | ||
9 | |||
10 | ****************************************************************************** | ||
11 | |||
12 | Requirements: | ||
13 | ------------- | ||
14 | |||
15 | * elementary (>= 1.9.0) | ||
16 | |||
17 | Supports: | ||
18 | --------- | ||
19 | Currently bing aerial, bing road, bing aerial road are supported | ||
20 | This is hacky :p | ||
21 | |||
22 | |||
23 | How to install: | ||
24 | --------------- | ||
25 | |||
26 | $make && sudo make install | ||
27 | |||
28 | Module will be installed into $PREFIX/lib/elementary/modules/ | ||
diff --git a/bing_aerial.c b/bing_aerial.c new file mode 100644 index 0000000..0061b3e --- /dev/null +++ b/bing_aerial.c | |||
@@ -0,0 +1,71 @@ | |||
1 | #include "Elementary.h" | ||
2 | #include <Eina.h> | ||
3 | #include "util.h" | ||
4 | |||
5 | #define __UNUSED__ __attribute__((unused)) | ||
6 | |||
7 | EAPI char * | ||
8 | map_module_source_name_get(void) | ||
9 | { | ||
10 | return strdup("bing_aerial"); | ||
11 | } | ||
12 | |||
13 | EAPI int | ||
14 | map_module_tile_zoom_min_get(void) | ||
15 | { | ||
16 | return 1; | ||
17 | } | ||
18 | |||
19 | EAPI int | ||
20 | map_module_tile_zoom_max_get(void) | ||
21 | { | ||
22 | return 21; | ||
23 | } | ||
24 | |||
25 | EAPI char * | ||
26 | map_module_tile_url_get(Evas_Object *obj __UNUSED__, int x, int y, int zoom) | ||
27 | { | ||
28 | char buf[PATH_MAX]; | ||
29 | snprintf(buf, sizeof(buf), "http://ecn.t3.tiles.virtualearth.net/tiles/a%s.png?g=471", | ||
30 | get_url(zoom, x, y)); | ||
31 | return strdup(buf); | ||
32 | } | ||
33 | |||
34 | EAPI char * | ||
35 | map_module_route_source_get(void) | ||
36 | { | ||
37 | return NULL; | ||
38 | } | ||
39 | |||
40 | EAPI Eina_Bool | ||
41 | map_module_tile_geo_to_coord(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int size __UNUSED__, int *x __UNUSED__, int *y __UNUSED__) | ||
42 | { | ||
43 | return EINA_FALSE; | ||
44 | } | ||
45 | |||
46 | EAPI Eina_Bool | ||
47 | map_module_tile_coord_to_geo(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, int x __UNUSED__, int y __UNUSED__, int size __UNUSED__, double *lon __UNUSED__, double *lat __UNUSED__) | ||
48 | { | ||
49 | return EINA_FALSE; | ||
50 | } | ||
51 | |||
52 | EAPI double | ||
53 | map_module_tile_scale_get(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int zoom __UNUSED__) | ||
54 | { | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static Eina_Bool | ||
59 | _module_init(void) | ||
60 | { | ||
61 | return EINA_TRUE; | ||
62 | } | ||
63 | |||
64 | static void | ||
65 | _module_shutdown(void) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | EINA_MODULE_INIT(_module_init); | ||
70 | EINA_MODULE_SHUTDOWN(_module_shutdown); | ||
71 | |||
diff --git a/bing_aerial_road.c b/bing_aerial_road.c new file mode 100644 index 0000000..f3f507a --- /dev/null +++ b/bing_aerial_road.c | |||
@@ -0,0 +1,71 @@ | |||
1 | #include "Elementary.h" | ||
2 | #include <Eina.h> | ||
3 | #include "util.h" | ||
4 | |||
5 | #define __UNUSED__ __attribute__((unused)) | ||
6 | |||
7 | EAPI char * | ||
8 | map_module_source_name_get(void) | ||
9 | { | ||
10 | return strdup("bing_aerial_road"); | ||
11 | } | ||
12 | |||
13 | EAPI int | ||
14 | map_module_tile_zoom_min_get(void) | ||
15 | { | ||
16 | return 1; | ||
17 | } | ||
18 | |||
19 | EAPI int | ||
20 | map_module_tile_zoom_max_get(void) | ||
21 | { | ||
22 | return 21; | ||
23 | } | ||
24 | |||
25 | EAPI char * | ||
26 | map_module_tile_url_get(Evas_Object *obj __UNUSED__, int x, int y, int zoom) | ||
27 | { | ||
28 | char buf[PATH_MAX]; | ||
29 | snprintf(buf, sizeof(buf), "http://ecn.t3.tiles.virtualearth.net/tiles/h%s.png?g=909", | ||
30 | get_url(zoom, x, y)); | ||
31 | return strdup(buf); | ||
32 | } | ||
33 | |||
34 | EAPI char * | ||
35 | map_module_route_source_get(void) | ||
36 | { | ||
37 | return NULL; | ||
38 | } | ||
39 | |||
40 | EAPI Eina_Bool | ||
41 | map_module_tile_geo_to_coord(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int size __UNUSED__, int *x __UNUSED__, int *y __UNUSED__) | ||
42 | { | ||
43 | return EINA_FALSE; | ||
44 | } | ||
45 | |||
46 | EAPI Eina_Bool | ||
47 | map_module_tile_coord_to_geo(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, int x __UNUSED__, int y __UNUSED__, int size __UNUSED__, double *lon __UNUSED__, double *lat __UNUSED__) | ||
48 | { | ||
49 | return EINA_FALSE; | ||
50 | } | ||
51 | |||
52 | EAPI double | ||
53 | map_module_tile_scale_get(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int zoom __UNUSED__) | ||
54 | { | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static Eina_Bool | ||
59 | _module_init(void) | ||
60 | { | ||
61 | return EINA_TRUE; | ||
62 | } | ||
63 | |||
64 | static void | ||
65 | _module_shutdown(void) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | EINA_MODULE_INIT(_module_init); | ||
70 | EINA_MODULE_SHUTDOWN(_module_shutdown); | ||
71 | |||
diff --git a/bing_road.c b/bing_road.c new file mode 100644 index 0000000..10fb7cd --- /dev/null +++ b/bing_road.c | |||
@@ -0,0 +1,71 @@ | |||
1 | #include "Elementary.h" | ||
2 | #include <Eina.h> | ||
3 | #include "util.h" | ||
4 | |||
5 | #define __UNUSED__ __attribute__((unused)) | ||
6 | |||
7 | EAPI char * | ||
8 | map_module_source_name_get(void) | ||
9 | { | ||
10 | return strdup("bing_road"); | ||
11 | } | ||
12 | |||
13 | EAPI int | ||
14 | map_module_tile_zoom_min_get(void) | ||
15 | { | ||
16 | return 1; | ||
17 | } | ||
18 | |||
19 | EAPI int | ||
20 | map_module_tile_zoom_max_get(void) | ||
21 | { | ||
22 | return 21; | ||
23 | } | ||
24 | |||
25 | EAPI char * | ||
26 | map_module_tile_url_get(Evas_Object *obj __UNUSED__, int x, int y, int zoom) | ||
27 | { | ||
28 | char buf[PATH_MAX]; | ||
29 | snprintf(buf, sizeof(buf), "http://ecn.t3.tiles.virtualearth.net/tiles/r%s.png?g=471", | ||
30 | get_url(zoom, x, y)); | ||
31 | return strdup(buf); | ||
32 | } | ||
33 | |||
34 | EAPI char * | ||
35 | map_module_route_source_get(void) | ||
36 | { | ||
37 | return NULL; | ||
38 | } | ||
39 | |||
40 | EAPI Eina_Bool | ||
41 | map_module_tile_geo_to_coord(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int size __UNUSED__, int *x __UNUSED__, int *y __UNUSED__) | ||
42 | { | ||
43 | return EINA_FALSE; | ||
44 | } | ||
45 | |||
46 | EAPI Eina_Bool | ||
47 | map_module_tile_coord_to_geo(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, int x __UNUSED__, int y __UNUSED__, int size __UNUSED__, double *lon __UNUSED__, double *lat __UNUSED__) | ||
48 | { | ||
49 | return EINA_FALSE; | ||
50 | } | ||
51 | |||
52 | EAPI double | ||
53 | map_module_tile_scale_get(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int zoom __UNUSED__) | ||
54 | { | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static Eina_Bool | ||
59 | _module_init(void) | ||
60 | { | ||
61 | return EINA_TRUE; | ||
62 | } | ||
63 | |||
64 | static void | ||
65 | _module_shutdown(void) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | EINA_MODULE_INIT(_module_init); | ||
70 | EINA_MODULE_SHUTDOWN(_module_shutdown); | ||
71 | |||
@@ -0,0 +1,21 @@ | |||
1 | #include "util.h" | ||
2 | |||
3 | static char buf[22]; | ||
4 | |||
5 | const char * | ||
6 | get_url(int zoom, int x, int y) | ||
7 | { | ||
8 | int xq, yq, val; | ||
9 | xq = x; | ||
10 | yq = y; | ||
11 | buf[zoom] = '\0'; | ||
12 | while (zoom > 0) | ||
13 | { | ||
14 | val = (xq % 2) + (yq % 2) * 2; | ||
15 | xq /= 2; | ||
16 | yq /= 2; | ||
17 | buf[zoom - 1] = val + 0x30; | ||
18 | zoom--; | ||
19 | } | ||
20 | return buf; | ||
21 | } | ||
@@ -0,0 +1 @@ | |||
const char *get_url(int zoom, int x, int y); | |||