Tizen C++ Coding Rules
[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, const maps_coordinates_h coord, int *x, int *y);
61
62         here_error_e getMinZoomLevel(maps_view_h view, int *zoom);
63         here_error_e getMaxZoomLevel(maps_view_h view, int *zoom);
64         here_error_e onViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation);
65
66 private:
67         here_error_e initOpenGL();
68         here_error_e initOpenGLSurface(maps_view_h view);
69         here_error_e initMap(maps_view_h view, maps_plugin_map_view_ready_cb callback);
70         void setMapType(maps_view_h view);
71         static void __readyMapCb(maps_view_h view);
72         static Eina_Bool __idlerCb(void *data);
73         static void __renderingCb(void *data);
74         static void __pixelGetCb(void *data, Evas_Object *obj);
75         static void __processViewObject(maps_view_h view, const maps_view_object_h object, maps_view_object_operation_e operation);
76
77 private:
78         Here::Maps::GeoTiledMap *__map;
79
80         Evas_Object     *__img;
81         Evas_GL_Context *__ctx;
82         Evas_GL_Surface *__sfc;
83         Evas_GL_Config  *__cfg;
84         Evas_GL         *__gl;
85         Evas_GL_API     *__api;
86
87         bool __isInitialized;
88
89         int __x, __y, __w, __h;
90         double __lat, __lng, __zoom, __angle;
91
92         HereViewObjects __visualObjects;
93         PendingObjects __pendingObjects;
94         Ecore_Idler *__idler;
95         bool __redraw;
96
97         maps_plugin_map_view_ready_cb __readyCb;
98 };
99
100 HERE_PLUGIN_END_NAMESPACE
101
102 #endif