587fa1ce9975bd476da9e134dfcc72a7016008df
[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 hView, maps_plugin_map_view_ready_cb pCbFunc);
53         here_error_e Close(maps_view_h hView);
54         here_error_e RenderMap(maps_view_h hView, const maps_coordinates_h mapsCoord, double dZoom, double dAngle);
55         here_error_e RenderMapByArea(maps_view_h hView, const maps_area_h hArea, double dZoom, double dAngle);
56         here_error_e DrawMap(maps_view_h hView, Evas* pCanvas, int x, int y, int nWidth, int nHeight);
57         here_error_e MoveCenter(maps_view_h hView, int delta_x, int delta_y);
58         here_error_e GetCenter(maps_view_h hView, maps_coordinates_h *center);
59         here_error_e SetScalebar(maps_view_h hView, bool enable);
60         here_error_e GetScalebar(maps_view_h hView, bool *enabled);
61         here_error_e ScreenToGeolocation(maps_view_h hView, int x, int y, maps_coordinates_h *mapsCoord);
62         here_error_e GeolocationToScreen(maps_view_h hView, const maps_coordinates_h mapsCoord, int *x, int *y);
63
64         here_error_e GetMinZoomLevel(maps_view_h hView, int *nMinZoomLevel);
65         here_error_e GetMaxZoomLevel(maps_view_h hView, int *nMaxZoomLevel);
66         here_error_e OnViewObject(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation);
67
68 private:
69         here_error_e __initOpenGL();
70         here_error_e __initOpenGLSurface(maps_view_h hView);
71         here_error_e __initMap(maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc);
72         static void __readyMapCb(maps_view_h hView);
73         static Eina_Bool __idlerCb(void *data);
74         static void __renderingCb(void *data);
75         static void __pixelGetCb(void *data, Evas_Object *obj);
76         static void __processViewObject(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation);
77         void __setMapType(maps_view_h hView);
78
79 private:
80         Here::Maps::GeoTiledMap *__map;
81
82         Evas_Object     *__img;
83         Evas_GL_Context *__ctx;
84         Evas_GL_Surface *__sfc;
85         Evas_GL_Config  *__cfg;
86         Evas_GL         *__gl;
87         Evas_GL_API     *__api;
88
89         bool __isInitialized;
90
91         int __x, __y, __w, __h;
92         double __lat, __lng, __zoom, __angle;
93
94         HereViewObjects __visualObjects;
95         PendingObjects __pendingObjects;
96         Ecore_Idler *__idler;
97         bool __redraw;
98
99         maps_plugin_map_view_ready_cb __readyCb;
100 };
101
102 HERE_PLUGIN_END_NAMESPACE
103
104 #endif