cb6dc915290be6f39d2d59e595378cbb058d9c1a
[platform/core/location/maps-plugin-here.git] / inc / here_view.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef HERE_VIEW_H
18 #define HERE_VIEW_H
19
20 #include <deque>
21
22 //plug-in header
23 #include "here_manager.h"
24 #include "here_base.h"
25 #include "here_view_objects.h"
26
27 //maps-service header
28 #include <maps_service.h>
29 #include <maps_view.h>
30 #include <maps_view_plugin.h>
31
32 //map engine header
33 #include <maps/GeoTiledMap.h>
34 #include <Ecore.h>
35 #include <Ecore_Evas.h>
36 #include <graphic/Grp_Util.h>
37 #include <maps/GeoMapObjectMarker.h>
38 #include <maps/GeoMapObjectPolygon.h>
39 #include <maps/GeoMapObjectPolyline.h>
40
41 HERE_PLUGIN_BEGIN_NAMESPACE
42
43 using namespace HERE_MAPS_NAMESPACE_PREFIX;
44
45 class HereView
46 : public HereBase
47 {
48 public:
49         HereView();
50         ~HereView();
51
52         here_error_e init(maps_view_h view, maps_plugin_map_view_ready_cb callback);
53         here_error_e close(maps_view_h view);
54         here_error_e renderMap(maps_view_h view, const maps_coordinates_h coord, double zoom, double angle);
55         here_error_e moveCenter(maps_view_h view, int delta_x, int delta_y);
56         here_error_e getCenter(maps_view_h view, maps_coordinates_h *center);
57         here_error_e setScalebarEnabled(maps_view_h view, bool enable);
58         here_error_e getScalebarEnabled(maps_view_h view, bool *enabled);
59         here_error_e convertScreenToGeolocation(maps_view_h view, int x, int y, maps_coordinates_h *coord);
60         here_error_e convertGeolocationToScreen(maps_view_h view,
61                                                                 const maps_coordinates_h coord, int *x, int *y);
62         here_error_e captureSnapshot(maps_view_h view, void **data, int *width, int *height,
63                                                                 maps_view_colorspace_type_e *cs);
64
65         here_error_e getMinZoomLevel(maps_view_h view, int *zoom);
66         here_error_e getMaxZoomLevel(maps_view_h view, int *zoom);
67         here_error_e onViewObject(maps_view_h view, const maps_view_object_h object,
68                                                                 maps_view_object_operation_e operation);
69         here_error_e getViewScale(maps_view_h view, double *scale);
70         here_error_e setViewScale(maps_view_h view, double scale);
71
72 private:
73         here_error_e initOpenGL();
74         here_error_e initOpenGLSurface(maps_view_h view);
75         here_error_e initMap(maps_view_h view, maps_plugin_map_view_ready_cb callback);
76         void setMapType(maps_view_h view);
77         static void __readyMapCb(maps_view_h view);
78         static Eina_Bool __idlerCb(void *data);
79         static void __renderingCb(void *data);
80         static void __pixelGetCb(void *data, Evas_Object *obj);
81         static void __processViewObject(maps_view_h view, const maps_view_object_h object,
82                                                                 maps_view_object_operation_e operation);
83
84 private:
85         Here::Maps::GeoTiledMap *__map;
86
87         Evas_Object     *__img;
88         Evas_GL_Context *__ctx;
89         Evas_GL_Surface *__sfc;
90         Evas_GL_Config  *__cfg;
91         Evas_GL         *__gl;
92         Evas_GL_API     *__api;
93
94         bool __isInitialized;
95
96         int __x, __y, __w, __h;
97
98         HereViewObjects __visualObjects;
99         PendingObjects __pendingObjects;
100         Ecore_Idler *__idler;
101         bool __redraw;
102
103         maps_plugin_map_view_ready_cb __readyCb;
104 };
105
106 HERE_PLUGIN_END_NAMESPACE
107
108 #endif