summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile25
-rw-r--r--README28
-rw-r--r--bing_aerial.c71
-rw-r--r--bing_aerial_road.c71
-rw-r--r--bing_road.c71
-rw-r--r--util.c21
-rw-r--r--util.h1
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 @@
1PREF = /usr/local/lib/elementary/modules
2POST = v-1.11.0
3DIR = /usr/local/lib/elementary/modules/dir/linux-gnu-i686-1.0.0
4TARGET = module.so
5SRCS = bing_aerial bing_aerial_road bing_road
6
7all:
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
14install:
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
19uninstall:
20 for src in $(SRCS); do\
21 rm -rf $(PREF)/$$src/$(POST)/module.so;\
22 done
23
24clean:
25 rm -rf *.o *.so
diff --git a/README b/README
new file mode 100644
index 0000000..8027bbc
--- /dev/null
+++ b/README
@@ -0,0 +1,28 @@
1elm map bing plugin 0.0.1
2
3Elm 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
12Requirements:
13-------------
14
15 * elementary (>= 1.9.0)
16
17Supports:
18---------
19Currently bing aerial, bing road, bing aerial road are supported
20This is hacky :p
21
22
23How to install:
24---------------
25
26$make && sudo make install
27
28Module 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
7EAPI char *
8map_module_source_name_get(void)
9{
10 return strdup("bing_aerial");
11}
12
13EAPI int
14map_module_tile_zoom_min_get(void)
15{
16 return 1;
17}
18
19EAPI int
20map_module_tile_zoom_max_get(void)
21{
22 return 21;
23}
24
25EAPI char *
26map_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
34EAPI char *
35map_module_route_source_get(void)
36{
37 return NULL;
38}
39
40EAPI Eina_Bool
41map_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
46EAPI Eina_Bool
47map_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
52EAPI double
53map_module_tile_scale_get(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int zoom __UNUSED__)
54{
55 return 0;
56}
57
58static Eina_Bool
59_module_init(void)
60{
61 return EINA_TRUE;
62}
63
64static void
65_module_shutdown(void)
66{
67}
68
69EINA_MODULE_INIT(_module_init);
70EINA_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
7EAPI char *
8map_module_source_name_get(void)
9{
10 return strdup("bing_aerial_road");
11}
12
13EAPI int
14map_module_tile_zoom_min_get(void)
15{
16 return 1;
17}
18
19EAPI int
20map_module_tile_zoom_max_get(void)
21{
22 return 21;
23}
24
25EAPI char *
26map_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
34EAPI char *
35map_module_route_source_get(void)
36{
37 return NULL;
38}
39
40EAPI Eina_Bool
41map_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
46EAPI Eina_Bool
47map_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
52EAPI double
53map_module_tile_scale_get(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int zoom __UNUSED__)
54{
55 return 0;
56}
57
58static Eina_Bool
59_module_init(void)
60{
61 return EINA_TRUE;
62}
63
64static void
65_module_shutdown(void)
66{
67}
68
69EINA_MODULE_INIT(_module_init);
70EINA_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
7EAPI char *
8map_module_source_name_get(void)
9{
10 return strdup("bing_road");
11}
12
13EAPI int
14map_module_tile_zoom_min_get(void)
15{
16 return 1;
17}
18
19EAPI int
20map_module_tile_zoom_max_get(void)
21{
22 return 21;
23}
24
25EAPI char *
26map_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
34EAPI char *
35map_module_route_source_get(void)
36{
37 return NULL;
38}
39
40EAPI Eina_Bool
41map_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
46EAPI Eina_Bool
47map_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
52EAPI double
53map_module_tile_scale_get(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int zoom __UNUSED__)
54{
55 return 0;
56}
57
58static Eina_Bool
59_module_init(void)
60{
61 return EINA_TRUE;
62}
63
64static void
65_module_shutdown(void)
66{
67}
68
69EINA_MODULE_INIT(_module_init);
70EINA_MODULE_SHUTDOWN(_module_shutdown);
71
diff --git a/util.c b/util.c
new file mode 100644
index 0000000..4bb44e4
--- /dev/null
+++ b/util.c
@@ -0,0 +1,21 @@
1#include "util.h"
2
3static char buf[22];
4
5const char *
6get_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}
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..ecf885f
--- /dev/null
+++ b/util.h
@@ -0,0 +1 @@
const char *get_url(int zoom, int x, int y);