changed attributes of header files
[platform/core/location/maps-plugin-here.git] / inc / engine / common / TileKey.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 TILEKEY_H_
19 #define TILEKEY_H_
20
21 #include "common/HereMaps_global.h"
22 #include "maps/GeoTiledMap.h"
23
24 HERE_MAPS_BEGIN_NAMESPACE
25
26 /**
27  * This class encapsulates information that identifies a map tile in a grid
28  * reflecting the normalized Mercator projection. The projection represents the
29  * surface of the globe as a set of squares. The size of the grid depends on the
30  * map zoom level.  At the lowest zoom level, the entire globe is
31  * shown in one square, which means that the tile grid consists of one row and
32  * one column. At the next higher zoom level, the tile grid contains two rows
33  * and two columns per row, at the next, four rows and four columns per row, and
34  * so on -- in other words, the number of rows and columns doubles at each
35  * higher zoom level.
36  */
37 class TileKey
38 {
39 public:
40     /**
41      * This is a constructor. It initializes a new instance of the tile key with
42      * the zoom level and the x and y coordinates of the tile at that zoom level.
43      * 
44      * @param aLevel A value indicating the zoom level.
45      * 
46      * @param aX A value indicating the x coordinate in the map tile grid.
47      * 
48      * @param aY A value indicating the y coordinate in the map tile grid.
49      *
50      * @param aMapLanguage A value indicating the map language.
51      *
52      * @param aMapLanguage A value indicating the map type.
53      */ 
54     TileKey(int aLevel,
55             int aX,
56             int aY,
57             String sMapLanguage = String("eng"),
58             GeoTiledMap::MapType aMapType = GeoTiledMap::MT_Normal_Day)
59     {
60         m_aLevel = aLevel;
61         m_aX = aX;
62         m_aY = aY;
63         m_sMapLanguage = sMapLanguage;
64         m_aMapType = aMapType;
65     }
66
67     /** 
68      * This method is a copy constructor.
69      * 
70      * @param rRhs A constant reference to an object whose contents are to be
71      *        copied into the present instance.
72      */
73     TileKey(const TileKey& rRhs)
74     {
75         operator = (rRhs);
76     }
77
78     /**
79      * This method retrieves a tile hash value based on the tile key properties.
80      * 
81      * @return An integer value representing the tile hash.
82      */
83     int GetHash() const
84     {
85         int hashValue = (((int)m_aMapType) << 25) +
86                 (m_aLevel << 16) +
87                 (m_aY << 8) +
88                 m_aX;
89         return hashValue;
90     }
91
92     /** 
93      * This is an equality operator.
94      * 
95      * @param rRhs A constant reference to an object that is to be compared to
96      *       the present instance.
97      * 
98      * @return <code>true</code> if the given instance and the right-hand object
99      *       are identical, otherwise <code>false</code>.
100      */
101     bool operator == (const TileKey& rRhs) const
102     {
103         return m_aLevel == rRhs.m_aLevel &&
104                 m_aX == rRhs.m_aX &&
105                 m_aY == rRhs.m_aY &&
106                 m_sMapLanguage == rRhs.m_sMapLanguage &&
107                 m_aMapType == rRhs.m_aMapType;
108     }
109
110     /** 
111      * This is an assignment operator.
112      * 
113      * @param rRhs A constant reference to an object whose contents are to be
114      *        copied into the present instance.
115      * 
116      * @return A reference to the given instance of the class after the assignment.
117      */
118     TileKey& operator = (const TileKey& rRhs)
119     {
120         if (&rRhs != this)
121         {
122             m_aLevel = rRhs.m_aLevel;
123             m_aX = rRhs.m_aX;
124             m_aY = rRhs.m_aY;
125             m_sMapLanguage = rRhs.m_sMapLanguage;
126             m_aMapType = rRhs.m_aMapType;
127         }
128         return *this;
129     }
130
131     /**
132      * This member variable holds a value indicating the tile zoom level.
133      */ 
134     int m_aLevel;
135
136     /**
137      * This member variable holds a value indicating the x coordinate of the tile.
138      */ 
139     int m_aX;
140
141     /**
142      * This member variable holds a value indicating the y coordinate of the tile.
143      */ 
144     int m_aY;
145
146     /**
147      * This member variable holds a value indicating the map language.
148      */
149     String m_sMapLanguage;
150
151     /**
152      * This member variable holds a value indicating the map type.
153      */
154     GeoTiledMap::MapType m_aMapType;
155 };
156
157 HERE_MAPS_END_NAMESPACE
158
159 #endif // TILEKEY_H_