changed attributes of header files
[platform/core/location/maps-plugin-here.git] / inc / engine / maps / GeoTile.h
1 /*
2  * Copyright (C) 2013 HERE Global B.V. All rights reserved.
3  * This software, including documentation, is protected by copyright controlled by
4  * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
5  * storing, adapting or translating, any or all of this material requires the prior
6  * written consent of HERE Global B.V. You may use this
7  * Software in accordance with the terms and conditions defined in the
8  * HERE Location Platform Services Terms and Conditions, available at
9  * http://developer.here.com/terms-conditions-base
10  *
11  * As an additional permission to the above, you may distribute Software,
12  * in object code format as part of an Application, according to, and subject to, terms and
13  * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
14  * You may distribute such object code format Application under terms of your choice,
15  * provided that the header and source files of the Software have not been modified.
16  */
17
18 #ifndef GEOTILE_H
19 #define GEOTILE_H
20
21 #include <tr1/memory>
22 #include "common/HereMaps_global.h"
23
24 #ifndef TIZEN_MIGRATION
25 #include <FGraphics.h>
26 #include <FGraphicsOpengl2.h>
27 #endif
28
29 #include "common/RestItemHandle.h"
30 #include "maps/DrawableBitmap.h"
31
32 HERE_MAPS_BEGIN_NAMESPACE
33
34 class GeoProviderManager;
35
36 #if 0 //note: this class has been moved to a separate file
37 /**
38  * This class encapsulates a bitmap that can be drawn in a graphics context (on
39  * the map, whether the bitmap can represent a tile). 
40  *
41  * A map tile supports two layers, the map tile layer and a map objects layer,
42  * (which overlays the map tile layer). The latter may be
43  * <code>NULL</code> if no objects have been added to the map. 
44  * 
45  * \ingroup maps
46  */
47 class DrawableBitmap
48 {
49 public:
50     /**
51      * This typedef defines a render handle as a type.
52      */
53     typedef UInt RenderHandle;
54
55     
56     /**
57      * This method is a constructor. It initiates a new instance using the
58      * bitmap pointer supplied by the caller.
59      * 
60      * @param bitmap A pointer to a bitmap object.
61      */
62     DrawableBitmap(std::auto_ptr<Tizen::Graphics::Bitmap>& bitmap)
63     : m_bitmap(bitmap)
64     , m_renderHandle(0)
65     {
66     }
67
68     /**
69      * This method is the destructor. It destroys the given instance and rests
70      * the render handle.
71      */
72     ~DrawableBitmap()
73     {
74         ResetRenderHandle();
75     }
76
77     /**
78      * This method resets the render handle for the given bitmap instance. 
79      */
80     void ResetRenderHandle()
81     {
82         if (m_renderHandle)
83         {
84             Tizen::Graphics::Opengl::glDeleteTextures(1, &m_renderHandle);
85         }
86         m_renderHandle = 0;
87     }
88
89     /**
90      * This method obtains a pointer to the bitmap.
91      * 
92      * @return A pointer to the bitmap.
93      */
94     Tizen::Graphics::Bitmap* GetBitmap() const
95     {
96         return m_bitmap.get();
97     }
98
99     /**
100      * This method sets the render handle for the given bitmap instance to the
101      * value provided by the caller.
102      * 
103      * @param aRenderHandle A new value for the render handle.
104      */
105     void SetRenderHandle(RenderHandle aRenderHandle)
106     {
107         m_renderHandle = aRenderHandle;
108     }
109
110     /**
111      * This method retrieves the current render handle.
112      * 
113      * @return A unsigned integer representing the render handle.
114      */
115     RenderHandle GetRenderHandle() const
116     {
117         return m_renderHandle;
118     }
119
120 private:
121     std::auto_ptr<Tizen::Graphics::Bitmap> m_bitmap;
122     RenderHandle m_renderHandle;
123 };
124
125 //-----------------------------------------------------------------------------
126
127 typedef std::tr1::shared_ptr<DrawableBitmap> DrawableBitmapPtr;
128
129 #endif
130
131 class TileKey;
132
133
134 /**
135  * This class encapsulates a map tile. A map tile is a square bitmap that is
136  * fetched from a grid representing the normalized Mercator projection. The
137  * position of the tile in this grid depends on the map zoom level and is
138  * defined by the x and y coordinates. At the lowest zoom level, there is only
139  * one tile. At the next higher zoom level, the grid is 2 x 2. With each zoom
140  * level above that, the x-size and the y-size of the grid increase by a power
141  * of two.
142  * 
143  * \ingroup maps
144  */
145 class GeoTile
146 {
147 public:
148
149     /**
150      * This enumeration defines identifiers for event types.
151      */
152     enum EventType
153     {
154         ET_OnTileFetcherReply = 0, ///< Indicates an event fired when a reply to
155                                    ///  a tile fetch request arrives.
156         ET_OnFailure               ///< Indicates an event fired on failure.
157     };
158
159     
160     /**
161      * This property holds a value representing the tile size. 
162      */
163     static int size;
164
165     /**
166      * This method is a contructor. It initializes a new instance of the class
167      * using the manager reference and the tile key provided by the caller.
168      * 
169      * @param rKey A constant reference to a key object that identifies the tile.
170      */
171     GeoTile(const TileKey& rKey);
172
173     /**
174      * This method is the (virtual) destructor.
175      */
176     virtual ~GeoTile();
177
178     /**
179      * This method retrieves the tile key.
180      * 
181      * @return A constant reference to the tile key object for the given tile.
182      */
183     const TileKey& GetKey() const;
184
185     /**
186      * This method sets a flag to indicate whether the given map tile has been
187      * requested for display.
188      * 
189      * @param b A Boolean indcating if the given map tile has been requested
190      *(       <code>true</code>) or not (<code>false</code>).
191      */
192     void SetMarked(bool b);
193
194     /**
195      * This method checks whether the given map tile has been
196      * requested for display.
197      * 
198      * @return A Boolean indcating if the given map tile has been requested
199      *(       <code>true</code>) or not (<code>false</code>).
200      */
201     bool IsMarked() const;
202
203     /**
204      * This method retrieves a point to the tile image.
205      * 
206      * @return A pointer to the tile image.
207      */
208     DrawableBitmapPtr GetImage() const;
209
210     /**
211      * This method sets the tile image.
212      * 
213      * @param image A pointer to the tile image.
214      */
215     void SetImage(DrawableBitmapPtr image);
216
217     /**
218      * This method retrieves an object that represents a pending tile request to
219      * the REST server.
220      * 
221      * @return A value representing the identifier of the issued request.
222      */
223     const RestItemHandle::RequestId GetPendingRequest() const;
224
225     /**
226      * This method marks a tile request to the REST server as pending.
227      * 
228      * @aRequestId An identifier representing a tile request.
229      */
230     void SetPendingRequest(RestItemHandle::RequestId aRequestId);
231
232     /**
233      * This method sets/creates the map object layer. 
234      * 
235      * A tile supports two layers, the map tile layer on which the tile is
236      * drawn, and a layer superimposed on top of the map tile layer, which
237      * contains the map objects that may have been added/created. If no objects
238      * have been added/created, the map object layer is <code>NULL</code>.
239      * 
240      * @param layer A pointer to an instance of <code>DrawableBitmap</code> that
241      *        constitutes the object layer.
242      */
243     void SetMapObjectLayer(DrawableBitmapPtr layer);
244
245     /**
246      * This method retrieves a pointer to the map object layer. 
247      * 
248      * A tile supports two layers, the map tile layer on which the tile is
249      * drawn, and a layer superimposed on top of the map tile layer, which
250      * contains the map objects that may have been added/created. If no objects
251      * have been added/created, the map object layer is <code>NULL</code>.
252      * 
253      * @return A pointer to an instance of <code>DrawableBitmap</code> that
254      *        constitutes the object layer.
255      */
256     DrawableBitmapPtr GetMapObjectLayer() const;
257
258     /**
259      * This method removes the map object layer. 
260      * 
261      * A tile supports two layers, the map tile layer on which the tile is
262      * drawn, and a layer superimposed on top of the map tile layer, which
263      * contains the map objects that may have been added/created. If no objects
264      * have been added/created, the map object layer is <code>NULL</code>.
265      */
266     void RemoveMapObjectLayer();
267
268     /**
269      * This methods aborts loading of the given tile.
270      */
271     void AbortLoading();
272
273 #ifdef TIZEN_SUPPORT_LIMIT_RETRYING_FETCHING_TILES
274     int GetTryCount() const;
275
276     int SetTryCount(int count);
277 #endif
278
279 private:
280     HERE_MAPS_NO_COPY_NO_ASSIGN(GeoTile);
281
282     class GeoTileImpl;
283     GeoTileImpl* m_pImpl;
284 };
285
286 typedef std::tr1::shared_ptr<GeoTile> TilePtr;
287
288 HERE_MAPS_END_NAMESPACE
289
290 #endif