fix segfault & merge upstream & fix zoom bug
[framework/uifw/elementary.git] / src / bin / test_map.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6
7 #define MARKER_MAX 1000
8
9 typedef struct Marker_Data
10 {
11     const char *file;
12 } Marker_Data;
13
14
15 static Elm_Map_Marker_Class *itc1, *itc2, *itc_parking;
16 static Elm_Map_Group_Class *itc_group1, *itc_group2, *itc_group_parking;
17
18 static Evas_Object *rect;
19 static int nb_elts;
20 static Elm_Map_Marker *markers[MARKER_MAX];
21 static Elm_Map_Marker *route_from, *route_to;
22 static Elm_Map_Route *route;
23
24 Marker_Data data1 = {PACKAGE_DATA_DIR"/images/logo.png"};
25 Marker_Data data2 = {PACKAGE_DATA_DIR"/images/logo_small.png"};
26 Marker_Data data3 = {PACKAGE_DATA_DIR"/images/panel_01.jpg"};
27 Marker_Data data4 = {PACKAGE_DATA_DIR"/images/plant_01.jpg"};
28 Marker_Data data5 = {PACKAGE_DATA_DIR"/images/rock_01.jpg"};
29 Marker_Data data6 = {PACKAGE_DATA_DIR"/images/rock_02.jpg"};
30 Marker_Data data7 = {PACKAGE_DATA_DIR"/images/sky_01.jpg"};
31 Marker_Data data8 = {PACKAGE_DATA_DIR"/images/sky_02.jpg"};
32 Marker_Data data9 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"};
33 Marker_Data data10 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"};
34 Marker_Data data11= {PACKAGE_DATA_DIR"/images/wood_01.jpg"};
35
36 Marker_Data data_parking= {PACKAGE_DATA_DIR"/images/parking.png"};
37
38 static Evas_Object * _marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data);
39 static Evas_Object * _group_icon_get(Evas_Object *obj, void *data);
40
41 static void
42 my_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
43 {
44    printf("clicked\n");
45 }
46
47 static void
48 my_map_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
49 {
50    printf("press\n");
51 }
52
53 static void
54 my_map_longpressed(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
55 {
56    printf("longpressed\n");
57 }
58
59 static void
60 my_map_clicked_double(void *data, Evas_Object *obj, void *event_info)
61 {
62    double lon, lat;
63    double flon, flat, tlon, tlat;
64    Evas_Coord ox, oy, x, y, w, h;
65    int zoom;
66    Evas_Event_Mouse_Up *down = (Evas_Event_Mouse_Up *)event_info;
67    if (!down) return;
68
69    evas_object_geometry_get(data, &ox, &oy, &w, &h);
70    zoom = elm_map_zoom_get(data);
71    if (zoom<5) return;
72    elm_map_geo_region_get(obj, &lon, &lat);
73    elm_map_utils_convert_geo_into_coord(obj, lon, lat, pow(2.0, zoom)*256, &x, &y);
74    x += down->output.x - (w / 2) - ox;
75    y += down->output.y - (h / 2) - oy;
76    elm_map_utils_convert_coord_into_geo(obj, x, y, pow(2.0, zoom)*256, &lon, &lat);
77
78    itc1 = elm_map_marker_class_new(data);
79
80    elm_map_marker_class_del_cb_set(itc1, NULL);
81
82    itc_group1 = elm_map_group_class_new(data);
83    elm_map_group_class_icon_cb_set(itc_group1, _group_icon_get);
84    elm_map_group_class_data_set(itc_group1, (void *)PACKAGE_DATA_DIR"/images/bubble.png");
85    elm_map_group_class_style_set(itc_group1, "empty");
86    elm_map_group_class_zoom_displayed_set(itc_group1, 5);
87
88    if (route_from && route_to)
89      {
90         elm_map_marker_remove(route_from);
91         route_from = NULL;
92         elm_map_marker_remove(route_to);
93         route_to = NULL;
94         elm_map_route_remove(route);
95      }
96
97    if (!route_from) route_from = elm_map_marker_add(data, lon, lat, itc1, itc_group1, NULL);
98    else route_to = elm_map_marker_add(data, lon, lat, itc1, itc_group1, NULL);
99
100    if (route_from && route_to)
101      {
102         elm_map_marker_region_get(route_from, &flon, &flat);
103         elm_map_marker_region_get(route_to, &tlon, &tlat);
104         route = elm_map_route_add(data, ELM_MAP_ROUTE_TYPE_MOTOCAR, ELM_MAP_ROUTE_METHOD_FASTEST, flon, flat, tlon, tlat);
105         if (route) elm_map_route_color_set(route, 255, 0, 0, 255);
106      }
107 }
108
109 static void
110 my_map_load_detail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
111 {
112    printf("load,detail\n");
113 }
114
115 static void
116 my_map_loaded_detail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
117 {
118    printf("loaded,detail\n");
119 }
120
121 static void
122 my_map_zoom_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
123 {
124    printf("zoom,start\n");
125 }
126
127 static void
128 my_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
129 {
130    printf("zoom,stop\n");
131 }
132
133 static void
134 my_map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
135 {
136    printf("zoom,change\n");
137 }
138
139 static void
140 my_map_anim_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
141 {
142    printf("anim,start\n");
143 }
144
145 static void
146 my_map_anim_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
147 {
148    printf("anim,stop\n");
149 }
150
151 static void
152 my_map_drag_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
153 {
154    printf("drag,start\n");
155 }
156
157 static void
158 my_map_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
159 {
160    printf("drag_stop\n");
161 }
162
163 static void
164 my_map_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
165 {
166    double lon, lat;
167    elm_map_geo_region_get(obj, &lon, &lat);
168    printf("scroll longitude : %f latitude : %f\n", lon, lat);
169 }
170
171 static void
172 my_map_downloaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
173 {
174    int try_num, finish_num;
175    elm_map_utils_downloading_status_get(data, &try_num, &finish_num);
176    printf("downloaded : %d / %d\n", finish_num, try_num);
177 }
178
179 static void
180 my_map_route_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
181 {
182    printf("route_load\n");
183  }
184
185 static void
186 my_map_route_loaded(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
187 {
188    double d;
189    const char *w, *n;
190    d = elm_map_route_distance_get(route);
191    printf("route distance = %lf km\n", d);
192
193    w = elm_map_route_waypoint_get(route);
194    if (w) printf("[waypoints]\n%s\n", w);
195
196    n = elm_map_route_node_get(route);
197    if (n) printf("[nodes]\n%s\n", n);
198 }
199
200 static void
201 my_bt_show_reg(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
202 {
203    Eina_Bool b = elm_map_paused_get(data);
204    elm_map_paused_set(data, EINA_TRUE);
205    elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
206    elm_map_geo_region_show(data, 126.977969, 37.566535);
207    elm_map_zoom_set(data, 18);
208    elm_map_paused_set(data, b);
209 }
210
211 static void
212 my_bt_bring_reg(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
213 {
214    elm_map_geo_region_bring_in(data, 126.977969, 37.566535);
215 }
216
217 static void
218 my_bt_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
219 {
220    double zoom;
221
222    zoom = elm_map_zoom_get(data);
223    zoom += 1;
224    elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
225    if (zoom >= (1.0 / 32.0)) elm_map_zoom_set(data, zoom);
226 }
227
228 static void
229 my_bt_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
230 {
231    double zoom;
232
233    zoom = elm_map_zoom_get(data);
234    zoom -= 1;
235    elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
236    if (zoom <= 256.0) elm_map_zoom_set(data, zoom);
237 }
238
239 static void
240 my_bt_pause(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
241 {
242    elm_map_paused_set(data, !elm_map_paused_get(data));
243 }
244
245 static void
246 my_bt_markers_pause(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
247 {
248    elm_map_paused_markers_set(data, !elm_map_paused_markers_get(data));
249 }
250
251 static void
252 my_bt_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
253 {
254    elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT);
255 }
256
257 static void
258 my_bt_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
259 {
260    elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL);
261 }
262
263 static void
264 my_bt_source_mapnik(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
265 {
266    elm_map_source_set(data, ELM_MAP_SOURCE_MAPNIK);
267 }
268
269 static void
270 my_bt_source_osmarender(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
271 {
272    elm_map_source_set(data, ELM_MAP_SOURCE_OSMARENDER);
273 }
274
275 static void
276 my_bt_source_cyclemap(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
277 {
278    elm_map_source_set(data, ELM_MAP_SOURCE_CYCLEMAP);
279 }
280
281 static void
282 my_bt_source_maplint(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
283 {
284    elm_map_source_set(data, ELM_MAP_SOURCE_MAPLINT);
285 }
286
287 static void
288 my_bt_source_module(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
289 {
290    elm_map_source_set(data, ELM_MAP_SOURCE_MODULE);
291 }
292
293 static void
294 my_bt_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
295 {
296    int i;
297    Elm_Map_Group_Class *g_clas;
298    Elm_Map_Marker_Class *m_clas;
299    Marker_Data *d = &data7;
300
301    if (*markers) return;
302    for(i =0; i<MARKER_MAX; i++)
303      {
304         d = &data7;
305
306         int r1 = rand() % (180*2*100);
307         if(r1<=180) r1 = -r1;
308         else r1 = r1 - 180*100;
309
310         int r2 = rand() % (85*2*100);
311         if(r2<=85) r2 = -r2;
312         else r2 = r2 - 85*100;
313
314         int style = rand() % 3;
315         if (!style) m_clas = itc1;
316         else if (style == 1) m_clas = itc2;
317         else
318           {
319              m_clas = itc_parking;
320              d = &data_parking;
321           }
322
323         style = rand() % 2;
324         if (!style) g_clas = itc_group1;
325         else g_clas = itc_group2;
326
327        markers[i] = elm_map_marker_add(data, r1/100., r2/100., m_clas, g_clas, d);
328     }
329     nb_elts += 1000;
330     printf("nb elements: %d\n", nb_elts);
331 }
332
333 static void
334 my_bt_remove(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
335 {
336    int i;
337
338    for (i = 0; i<MARKER_MAX; i++)
339      { 
340         if (markers[i])
341           {
342              elm_map_marker_remove(markers[i]);
343              markers[i] = NULL;
344           }
345      }
346 }
347
348 static Evas_Object *
349 _marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data)
350 {
351     Marker_Data *d = data;
352
353     Evas_Object *bx = elm_box_add(obj);
354     evas_object_show(bx);
355
356     if(d == &data3)
357     {
358         Evas_Object *icon = elm_icon_add(obj);
359         elm_icon_file_set(icon, d->file, NULL);
360         evas_object_show(icon);
361
362         Evas_Object *o = elm_button_add(obj);
363         elm_button_icon_set(o, icon);
364         evas_object_show(o);
365         elm_box_pack_end(bx, o);
366     }
367     else
368     {
369         Evas_Object *o = evas_object_image_add(evas_object_evas_get(obj));
370         evas_object_image_file_set(o, d->file, NULL);
371         evas_object_image_filled_set(o, EINA_TRUE);
372         evas_object_size_hint_min_set(o, 64, 64);
373         evas_object_show(o);
374         elm_box_pack_end(bx, o);
375
376         Evas_Object *lbl = elm_label_add(obj);
377         elm_label_label_set(lbl, "Wolves Go !");
378         evas_object_show(lbl);
379         elm_box_pack_end(bx, lbl);
380     }
381
382     return bx;
383 }
384
385 static Evas_Object *
386 _icon_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data)
387 {
388     Marker_Data *d = data;
389
390     Evas_Object *icon = elm_icon_add(obj);
391     elm_icon_file_set(icon, d->file, NULL);
392     evas_object_show(icon);
393
394     return icon;
395 }
396
397 static Evas_Object *
398 _group_icon_get(Evas_Object *obj, void *data)
399 {
400     char *file = data;
401
402     Evas_Object *icon = elm_icon_add(obj);
403     elm_icon_file_set(icon, file, NULL);
404     evas_object_show(icon);
405
406     return icon;
407 }
408
409 static void
410 _map_mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
411 {
412    Evas_Object *map = data;
413    Evas_Event_Mouse_Wheel *ev = (Evas_Event_Mouse_Wheel*) event_info;
414    int zoom;
415    //unset the mouse wheel
416    ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
417
418    zoom = elm_map_zoom_get(map);
419
420    if (ev->z > 0)
421      zoom--;
422    else
423      zoom++;
424
425    elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_MANUAL);
426    if ((zoom >= 0) && (zoom <= 18)) elm_map_zoom_set(map, zoom);
427 }
428
429 static void 
430 _map_move_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
431 {
432    int x,y,w,h;
433
434    evas_object_geometry_get(data,&x,&y,&w,&h);
435    evas_object_resize(rect,w,h);
436    evas_object_move(rect,x,y);
437 }
438
439 void
440 test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
441 {
442    Evas_Object *win, *bg, *map, *tb2, *bt, *bx;
443
444    win = elm_win_add(NULL, "map", ELM_WIN_BASIC);
445    elm_win_title_set(win, "Map");
446    elm_win_autodel_set(win, 1);
447
448    bg = elm_bg_add(win);
449    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
450    elm_win_resize_object_add(win, bg);
451    evas_object_show(bg);
452
453    map = elm_map_add(win);
454    if (map) 
455      {
456         srand( time(NULL) );
457
458         evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
459         elm_win_resize_object_add(win, map);
460         evas_object_data_set(map, "window", win);
461
462         //
463         itc1 = elm_map_marker_class_new(map);
464         elm_map_marker_class_get_cb_set(itc1, _marker_get);
465         elm_map_marker_class_del_cb_set(itc1, NULL);
466  
467         itc2 = elm_map_marker_class_new(map);
468         elm_map_marker_class_get_cb_set(itc2, _marker_get);
469         elm_map_marker_class_del_cb_set(itc2, NULL);
470         elm_map_marker_class_style_set(itc2, "radio2");
471
472         itc_parking = elm_map_marker_class_new(map);
473         elm_map_marker_class_get_cb_set(itc_parking, _marker_get);
474         elm_map_marker_class_del_cb_set(itc_parking, NULL);
475         elm_map_marker_class_icon_cb_set(itc_parking, _icon_get);
476         elm_map_marker_class_style_set(itc_parking, "empty");
477         //
478
479         //
480         itc_group1 = elm_map_group_class_new(map);
481         elm_map_group_class_data_set(itc_group1, (void *)PACKAGE_DATA_DIR"/images/plant_01.jpg");
482
483         itc_group2 = elm_map_group_class_new(map);
484         elm_map_group_class_style_set(itc_group2, "radio2");
485         elm_map_group_class_zoom_displayed_set(itc_group1, 3);
486
487         itc_group_parking = elm_map_group_class_new(map);
488         elm_map_group_class_icon_cb_set(itc_group_parking, _group_icon_get);
489         elm_map_group_class_data_set(itc_group_parking, (void *)PACKAGE_DATA_DIR"/images/parking.png");
490         elm_map_group_class_style_set(itc_group_parking, "empty");
491         elm_map_group_class_zoom_displayed_set(itc_group_parking, 5);
492         //
493
494
495         rect = evas_object_rectangle_add(evas_object_evas_get(win));
496         evas_object_color_set(rect, 0, 0, 0, 0);
497         evas_object_repeat_events_set(rect,1);
498         evas_object_show(rect);
499         evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_WHEEL, 
500                                        _map_mouse_wheel_cb, map);
501         evas_object_raise(rect);
502
503         evas_object_event_callback_add(map, EVAS_CALLBACK_RESIZE, 
504                                        _map_move_resize_cb, map);
505         evas_object_event_callback_add(map, EVAS_CALLBACK_MOVE, 
506                                        _map_move_resize_cb, map);
507
508         elm_map_marker_add(map, 2.352, 48.857, itc1, itc_group1, &data1);
509         elm_map_marker_add(map, 2.355, 48.857, itc1, itc_group1, &data3);
510         elm_map_marker_add(map, 3, 48.857, itc2, itc_group1, &data2);
511         elm_map_marker_add(map, 2.352, 49, itc2, itc_group1, &data1);
512
513         elm_map_marker_add(map, 7.31451, 48.857127, itc1, itc_group1, &data10);
514         elm_map_marker_add(map, 7.314704, 48.857119, itc1, itc_group1, &data4);
515         elm_map_marker_add(map, 7.314704, 48.857119, itc2, itc_group1, &data5);
516         elm_map_marker_add(map, 7.31432, 48.856785, itc2, itc_group1, &data6);
517         elm_map_marker_add(map, 7.3148, 48.85725, itc1, itc_group2, &data7);
518         elm_map_marker_add(map, 7.316445, 48.8572210000694, itc1, itc_group1, &data8);
519         elm_map_marker_add(map, 7.316527000125, 48.85609, itc2, itc_group2, &data9);
520         elm_map_marker_add(map, 7.3165409990833, 48.856078, itc2, itc_group1, &data11);
521         elm_map_marker_add(map, 7.319812, 48.856561, itc2, itc_group2, &data10);
522
523         nb_elts = 13;
524
525         evas_object_smart_callback_add(map, "clicked", my_map_clicked, win);
526         evas_object_smart_callback_add(map, "press", my_map_press, win);
527         evas_object_smart_callback_add(map, "longpressed", my_map_longpressed, win);
528         evas_object_smart_callback_add(map, "clicked,double", my_map_clicked_double, map);
529         evas_object_smart_callback_add(map, "load,detail", my_map_load_detail, win);
530         evas_object_smart_callback_add(map, "loaded,detail", my_map_loaded_detail, win);
531         evas_object_smart_callback_add(map, "zoom,start", my_map_zoom_start, win);
532         evas_object_smart_callback_add(map, "zoom,stop", my_map_zoom_stop, win);
533         evas_object_smart_callback_add(map, "zoom,change", my_map_zoom_change, win);
534         evas_object_smart_callback_add(map, "scroll,anim,start", my_map_anim_start, win);
535         evas_object_smart_callback_add(map, "scroll,anim,stop", my_map_anim_stop, win);
536         evas_object_smart_callback_add(map, "scroll,drag,start", my_map_drag_start, win);
537         evas_object_smart_callback_add(map, "scroll,drag,stop", my_map_drag_stop, win);
538         evas_object_smart_callback_add(map, "scroll", my_map_scroll, win);
539         evas_object_smart_callback_add(map, "downloaded", my_map_downloaded, map);
540         evas_object_smart_callback_add(map, "route,load", my_map_route_load, map);
541         evas_object_smart_callback_add(map, "route,loaded", my_map_route_loaded, map);
542
543         evas_object_show(map);
544
545         tb2 = elm_table_add(win);
546         evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
547         elm_win_resize_object_add(win, tb2);
548
549         bt = elm_button_add(win);
550         elm_button_label_set(bt, "Z -");
551         evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_out, map);
552         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
553         evas_object_size_hint_align_set(bt, 0.1, 0.1);
554         elm_table_pack(tb2, bt, 0, 0, 1, 1);
555         evas_object_show(bt);
556
557         bt = elm_button_add(win);
558         elm_button_label_set(bt, "Z +");
559         evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_in, map);
560         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
561         evas_object_size_hint_align_set(bt, 0.9, 0.1);
562         elm_table_pack(tb2, bt, 2, 0, 1, 1);
563         evas_object_show(bt);
564
565         bx = elm_box_add(win);
566         evas_object_show(bx);
567         evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
568         evas_object_size_hint_align_set(bx, 0.5, 0.1);
569         elm_table_pack(tb2, bx, 1, 0, 1, 1);
570
571         //
572         bt = elm_button_add(win);
573         elm_button_label_set(bt, "Add 1000 markers");
574         evas_object_smart_callback_add(bt, "clicked", my_bt_add, map);
575         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
576         evas_object_size_hint_align_set(bt, 0.5, 0.1);
577         evas_object_show(bt);
578         elm_box_pack_end(bx, bt);
579
580         bt = elm_button_add(win);
581         elm_button_label_set(bt, "remove 1000 markers");
582         evas_object_smart_callback_add(bt, "clicked", my_bt_remove, map);
583         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
584         evas_object_size_hint_align_set(bt, 0.5, 0.1);
585         evas_object_show(bt);
586         elm_box_pack_end(bx, bt);
587         //
588
589         bt = elm_button_add(win);
590         elm_button_label_set(bt, "Show Seoul");
591         evas_object_smart_callback_add(bt, "clicked", my_bt_show_reg, map);
592         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
593         evas_object_size_hint_align_set(bt, 0.1, 0.5);
594         elm_table_pack(tb2, bt, 0, 1, 1, 1);
595         evas_object_show(bt);
596
597         bt = elm_button_add(win);
598         elm_button_label_set(bt, "Bring Seoul");
599         evas_object_smart_callback_add(bt, "clicked", my_bt_bring_reg, map);
600         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
601         evas_object_size_hint_align_set(bt, 0.9, 0.5);
602         elm_table_pack(tb2, bt, 2, 1, 1, 1);
603         evas_object_show(bt);
604
605         //
606         bx = elm_box_add(win);
607         evas_object_show(bx);
608         evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
609         evas_object_size_hint_align_set(bx, 0.1, 0.9);
610         elm_table_pack(tb2, bx, 0, 2, 1, 1);
611
612         bt = elm_button_add(win);
613         elm_button_label_set(bt, "Pause On/Off");
614         evas_object_smart_callback_add(bt, "clicked", my_bt_pause, map);
615         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
616         evas_object_size_hint_align_set(bt, 0.1, 0.9);
617         evas_object_show(bt);
618         elm_box_pack_end(bx, bt);
619
620         bt = elm_button_add(win);
621         elm_button_label_set(bt, "Markers pause On/Off");
622         evas_object_smart_callback_add(bt, "clicked", my_bt_markers_pause, map);
623         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
624         evas_object_size_hint_align_set(bt, 0.1, 0.9);
625         evas_object_show(bt);
626         elm_box_pack_end(bx, bt);
627         //
628
629         //
630         bx = elm_box_add(win);
631         evas_object_show(bx);
632         evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
633         evas_object_size_hint_align_set(bx, 0.5, 0.9);
634         elm_table_pack(tb2, bx, 1, 2, 1, 1);
635
636         bt = elm_button_add(win);
637         elm_button_label_set(bt, "Fit");
638         evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_fit, map);
639         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
640         evas_object_size_hint_align_set(bt, 0.5, 0.9);
641         evas_object_show(bt);
642         elm_box_pack_end(bx, bt);
643
644         bt = elm_button_add(win);
645         elm_button_label_set(bt, "Fill");
646         evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_fill, map);
647         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
648         evas_object_size_hint_align_set(bt, 0.5, 0.9);
649         evas_object_show(bt);
650         elm_box_pack_end(bx, bt);
651         //
652
653         //
654         bx = elm_box_add(win);
655         evas_object_show(bx);
656         evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
657         evas_object_size_hint_align_set(bx, 1.0, 0.9);
658         elm_table_pack(tb2, bx, 2, 2, 1, 1);
659
660         bt = elm_button_add(win);
661         elm_button_label_set(bt, "Mapnik");
662         evas_object_smart_callback_add(bt, "clicked", my_bt_source_mapnik, map);
663         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
664         evas_object_size_hint_align_set(bt, 1.0, 0.9);
665         evas_object_show(bt);
666         elm_box_pack_end(bx, bt);
667
668         bt = elm_button_add(win);
669         elm_button_label_set(bt, "Osmarender");
670         evas_object_smart_callback_add(bt, "clicked", my_bt_source_osmarender, map);
671         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
672         evas_object_size_hint_align_set(bt, 1.0, 0.9);
673         evas_object_show(bt);
674         elm_box_pack_end(bx, bt);
675
676         bt = elm_button_add(win);
677         elm_button_label_set(bt, "Cycle Map");
678         evas_object_smart_callback_add(bt, "clicked", my_bt_source_cyclemap, map);
679         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
680         evas_object_size_hint_align_set(bt, 1.0, 0.9);
681         evas_object_show(bt);
682         elm_box_pack_end(bx, bt);
683
684         bt = elm_button_add(win);
685         elm_button_label_set(bt, "Maplint");
686         evas_object_smart_callback_add(bt, "clicked", my_bt_source_maplint, map);
687         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
688         evas_object_size_hint_align_set(bt, 1.0, 0.9);
689         evas_object_show(bt);
690         elm_box_pack_end(bx, bt);
691
692         bt = elm_button_add(win);
693         elm_button_label_set(bt, "Module");
694         evas_object_smart_callback_add(bt, "clicked", my_bt_source_module, map);
695         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
696         evas_object_size_hint_align_set(bt, 1.0, 0.9);
697         evas_object_show(bt);
698         elm_box_pack_end(bx, bt);
699         //
700
701         evas_object_show(tb2);
702      }
703
704    evas_object_resize(win, 800, 800);
705    evas_object_show(win);
706 }
707 #endif