e7ac4005a4399079b023a77e8a8a1c3cb90b5d1f
[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
31 //map engine header
32 #include <maps/GeoTiledMap.h>
33 #include <Ecore.h>
34 #include <Ecore_Evas.h>
35 #include <graphic/Grp_Util.h>
36 #include <maps/GeoMapObjectMarker.h>
37 #include <maps/GeoMapObjectPolygon.h>
38 #include <maps/GeoMapObjectPolyline.h>
39
40 HERE_PLUGIN_BEGIN_NAMESPACE
41
42 using namespace HERE_MAPS_NAMESPACE_PREFIX;
43
44
45 typedef struct _GLData
46 {
47         Here::Maps::GeoTiledMap *map;
48
49         Evas_Object     *img;
50         Evas_GL_Context *ctx;
51         Evas_GL_Surface *sfc;
52         Evas_GL_Config  *cfg;
53         Evas_GL         *gl;
54         Evas_GL_API     *api;
55
56         bool isInitialized;
57
58         int x, y, w, h;
59         double lat, lng, zoom, angle;
60
61         maps_view_h hView;
62
63         // to remove // UpdatedObjects updatedObjects;
64         HereViewObjects visualObjects;
65         PendingObjects pendingObjects;
66         Ecore_Idler *idler;
67         bool redraw;
68
69         maps_plugin_map_view_ready_cb readyCb;
70 } GLData;
71
72 class HereView
73 : public HereBase
74 {
75 public:
76         HereView(void *pCbFunc, void *pUserData, int nReqId);
77         ~HereView();
78
79         here_error_e Init(const maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc);
80         static here_error_e Close();
81         here_error_e RenderMap(const maps_coordinates_h mapsCoord, double dZoom, double dAngle);
82         here_error_e RenderMapByArea(const maps_area_h hArea, double dZoom, double dAngle);
83         static here_error_e DrawMap(Evas* pCanvas, int x, int y, int nWidth, int nHeight);
84         here_error_e MoveCenter(int delta_x, int delta_y);
85         here_error_e SetScalebar(bool enable);
86         here_error_e GetScalebar(bool *enabled);
87         here_error_e GetCenter(maps_coordinates_h *center);
88         here_error_e ScreenToGeolocation(int x, int y, maps_coordinates_h *mapsCoord);
89         here_error_e GeolocationToScreen(const maps_coordinates_h mapsCoord, int *x, int *y);
90
91         static here_error_e GetMinZoomLevel(int *nMinZoomLevel);
92         static here_error_e GetMaxZoomLevel(int *nMaxZoomLevel);
93         static here_error_e OnViewObject(const maps_view_object_h object, maps_view_object_operation_e operation);
94
95         static void RenderingCb(void *data);
96         static bool foreachObject(int index, int total, maps_view_object_h object, void *user_data);
97         static GLData* GetImplHandler();
98
99 private:
100
101         here_error_e InitOpenGL(GLData *gld);
102         here_error_e InitOpenGLSurface(GLData *gld);
103         here_error_e InitMap(GLData *gld, maps_plugin_map_view_ready_cb pCbFunc);
104         static void __readyCb();
105         static Eina_Bool __idlerCb(void *data);
106         static void __renderingCb(void *data);
107         static void __pixelGetCb(void *data, Evas_Object *obj);
108         static void __processViewObject(const maps_view_object_h object, maps_view_object_operation_e operation);
109         void __setMapType();
110
111         static GLData *m_pImpl;
112
113 };
114
115 HERE_PLUGIN_END_NAMESPACE
116
117 #endif