williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Geographical circular area class definition.
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef LBTGEOCIRCLE_H
|
williamr@2
|
20 |
#define LBTGEOCIRCLE_H
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#include <lbtgeoareabase.h>
|
williamr@2
|
23 |
#include <lbsposition.h>
|
williamr@2
|
24 |
|
williamr@2
|
25 |
/**
|
williamr@2
|
26 |
* Geographical circular area.
|
williamr@2
|
27 |
*
|
williamr@2
|
28 |
* A geographical circular area is defined by the center of the
|
williamr@2
|
29 |
* circle and the radius. The radius is in meters. The altitude in
|
williamr@2
|
30 |
* the center's coordinate is always ignored. It is optionally also possible
|
williamr@2
|
31 |
* to provide additional geographical area information of CLbtGeoCell
|
williamr@2
|
32 |
* type. Providing additional cell information would enable further
|
williamr@2
|
33 |
* optimization by reducing the number of GPS fixes required to
|
williamr@2
|
34 |
* supervise the trigger, there by, reducing the impact on battery
|
williamr@2
|
35 |
* consumption. Triggers would, initially, be monitored using the cell
|
williamr@2
|
36 |
* information provided. GPS would be used to check the coordinates
|
williamr@2
|
37 |
* only when the mobile terminal reaches the cell / cells specified.
|
williamr@2
|
38 |
* If a particular location is served by multiple cells, then it is
|
williamr@2
|
39 |
* important to mention all available cell information. If not, there
|
williamr@2
|
40 |
* is a possibility of missing triggers even when the mobile terminal
|
williamr@2
|
41 |
* reaches the location specified by the coordinates.
|
williamr@2
|
42 |
*
|
williamr@2
|
43 |
* @lib lbt.lib
|
williamr@2
|
44 |
*
|
williamr@2
|
45 |
* @since S60 5.1
|
williamr@2
|
46 |
*/
|
williamr@2
|
47 |
class CLbtGeoCircle : public CLbtGeoAreaBase
|
williamr@2
|
48 |
{
|
williamr@2
|
49 |
public:
|
williamr@2
|
50 |
/**
|
williamr@2
|
51 |
* Allocates and constructs a new geographical circular area object.
|
williamr@2
|
52 |
* In the returned object, the latitude, longitude and altitude
|
williamr@2
|
53 |
* are set to NaN, and the radius is set to NaN.
|
williamr@2
|
54 |
*
|
williamr@2
|
55 |
* @return Pointer to the new geographical circular area object.
|
williamr@2
|
56 |
*/
|
williamr@2
|
57 |
IMPORT_C static CLbtGeoCircle* NewL();
|
williamr@2
|
58 |
|
williamr@2
|
59 |
/**
|
williamr@2
|
60 |
* Constructs a new geographical circular area object and pushes
|
williamr@2
|
61 |
* it onto cleanup stack.
|
williamr@2
|
62 |
* In the returned object, the latitude, longitude and altitude
|
williamr@2
|
63 |
* are set to NaN, and the radius is set to NaN.
|
williamr@2
|
64 |
*
|
williamr@2
|
65 |
* @return Pointer to the new geographical circular area object.
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
IMPORT_C static CLbtGeoCircle* NewLC();
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/**
|
williamr@2
|
70 |
* Allocates and constructs a new geographical circular area object
|
williamr@2
|
71 |
* with specified center coordinate and radius.
|
williamr@2
|
72 |
*
|
williamr@2
|
73 |
* @panic ELbtErrArgument If the input radius is negative.
|
williamr@2
|
74 |
*
|
williamr@2
|
75 |
* @param[in] aCenter The coordinate of the center.
|
williamr@2
|
76 |
* @param[in] aRadiusInMeters The radius of the circle in meters.
|
williamr@2
|
77 |
* @return Pointer to the new geographical circle area object.
|
williamr@2
|
78 |
*/
|
williamr@2
|
79 |
IMPORT_C static CLbtGeoCircle* NewL(
|
williamr@2
|
80 |
const TCoordinate& aCenter,
|
williamr@2
|
81 |
TReal aRadiusInMeters );
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/**
|
williamr@2
|
84 |
* Allocates and constructs a new geographical circular area object
|
williamr@2
|
85 |
* with specified center coordinate and radius. The constructed
|
williamr@2
|
86 |
* object is pushed onto cleanup stack.
|
williamr@2
|
87 |
*
|
williamr@2
|
88 |
* @panic ELbtErrArgument If the input radius is negative.
|
williamr@2
|
89 |
*
|
williamr@2
|
90 |
* @param[in] aCenter The coordinate of the center.
|
williamr@2
|
91 |
* @param[in] aRadiusInMeters The radius of the circle in meters.
|
williamr@2
|
92 |
* @return Pointer to the new geographical circle area object.
|
williamr@2
|
93 |
*/
|
williamr@2
|
94 |
IMPORT_C static CLbtGeoCircle* NewLC(
|
williamr@2
|
95 |
const TCoordinate& aCenter,
|
williamr@2
|
96 |
TReal aRadiusInMeters );
|
williamr@2
|
97 |
|
williamr@2
|
98 |
/**
|
williamr@2
|
99 |
* Destructor.
|
williamr@2
|
100 |
*/
|
williamr@2
|
101 |
IMPORT_C ~CLbtGeoCircle();
|
williamr@2
|
102 |
|
williamr@2
|
103 |
/**
|
williamr@2
|
104 |
* Returns the type of geographical area, CLbtGeoAreaBase::ECircle
|
williamr@2
|
105 |
*
|
williamr@2
|
106 |
* @return CLbtGeoAreaBase::ECircle.
|
williamr@2
|
107 |
*/
|
williamr@2
|
108 |
virtual TGeoAreaType Type() const;
|
williamr@2
|
109 |
|
williamr@2
|
110 |
/**
|
williamr@2
|
111 |
* Gets the center of the area. If the center has not been set
|
williamr@2
|
112 |
* before, the returned coordinate has latitude, longitude and
|
williamr@2
|
113 |
* altitude set to NaN,
|
williamr@2
|
114 |
*
|
williamr@2
|
115 |
* @return The center of the area.
|
williamr@2
|
116 |
*/
|
williamr@2
|
117 |
virtual TCoordinate Center() const;
|
williamr@2
|
118 |
|
williamr@2
|
119 |
/**
|
williamr@2
|
120 |
* Sets the center of the circle.
|
williamr@2
|
121 |
*
|
williamr@2
|
122 |
* @param[in] aCenter The coordinate of the center.
|
williamr@2
|
123 |
*/
|
williamr@2
|
124 |
IMPORT_C void SetCenter(const TCoordinate& aCenter);
|
williamr@2
|
125 |
|
williamr@2
|
126 |
/**
|
williamr@2
|
127 |
* Gets the radius of the circle. If the radius has not been
|
williamr@2
|
128 |
* set before, the returned value is NaN.
|
williamr@2
|
129 |
*
|
williamr@2
|
130 |
* @return The radius of the circle in meters.
|
williamr@2
|
131 |
*/
|
williamr@2
|
132 |
IMPORT_C TReal Radius() const;
|
williamr@2
|
133 |
|
williamr@2
|
134 |
/**
|
williamr@2
|
135 |
* Sets the radius of the circle.
|
williamr@2
|
136 |
*
|
williamr@2
|
137 |
* @panic ELbtErrArgument If the input radius is negative.
|
williamr@2
|
138 |
*
|
williamr@2
|
139 |
* @param[in] aRadiusInMeters The radius of the circle in meters.
|
williamr@2
|
140 |
*/
|
williamr@2
|
141 |
IMPORT_C void SetRadius(TReal aRadiusInMeters);
|
williamr@2
|
142 |
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
* Gets geographical area information. The following method is currently not
|
williamr@2
|
145 |
* supported. This method will only return empty array when invoked.
|
williamr@2
|
146 |
*
|
williamr@2
|
147 |
* @return An array of geographical area instances
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
IMPORT_C RPointerArray< CLbtGeoAreaBase >& GetAdditionalGeoAreaInfo();
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/**
|
williamr@2
|
152 |
* Sets additional geographical area information. The geographical
|
williamr@2
|
153 |
* information provided can only be of CLbtGeoCell type. This is optional
|
williamr@2
|
154 |
* and clients may specify this information when available.The following method
|
williamr@2
|
155 |
* is currently not supported.
|
williamr@2
|
156 |
*
|
williamr@2
|
157 |
* @panic ELbtErrArgument if argument passed is NULL or if the argument
|
williamr@2
|
158 |
* passed is of any other type other than CLbtGeoCell.
|
williamr@2
|
159 |
*
|
williamr@2
|
160 |
* @param[in] aGeoArea A pointer representing a geographical area.
|
williamr@2
|
161 |
*/
|
williamr@2
|
162 |
IMPORT_C void SetAdditionalGeoAreaInfo(CLbtGeoAreaBase* aGeoArea);
|
williamr@2
|
163 |
|
williamr@2
|
164 |
/**
|
williamr@2
|
165 |
* Validates cell information.
|
williamr@2
|
166 |
*
|
williamr@2
|
167 |
* @leave KErrArgument if any of the mandatory parameters have not
|
williamr@2
|
168 |
* been specified.
|
williamr@2
|
169 |
*/
|
williamr@2
|
170 |
void ValidateCircleInformationL();
|
williamr@2
|
171 |
|
williamr@2
|
172 |
protected:
|
williamr@2
|
173 |
|
williamr@2
|
174 |
/**
|
williamr@2
|
175 |
* Externalize method that subclass must implement.
|
williamr@2
|
176 |
* @param[in] aStream Stream to which the object should be externalized.
|
williamr@2
|
177 |
*/
|
williamr@2
|
178 |
virtual void DoExternalizeL(RWriteStream& aStream) const ;
|
williamr@2
|
179 |
|
williamr@2
|
180 |
/**
|
williamr@2
|
181 |
* Internalize method that subclass must implement.
|
williamr@2
|
182 |
* @param[in] aStream Stream from which the object should be internalized.
|
williamr@2
|
183 |
*/
|
williamr@2
|
184 |
virtual void DoInternalizeL(RReadStream& aStream) ;
|
williamr@2
|
185 |
|
williamr@2
|
186 |
private:
|
williamr@2
|
187 |
/**
|
williamr@2
|
188 |
* Default constructor
|
williamr@2
|
189 |
*/
|
williamr@2
|
190 |
CLbtGeoCircle();
|
williamr@2
|
191 |
|
williamr@2
|
192 |
/**
|
williamr@2
|
193 |
* By default, prohibit copy constructor
|
williamr@2
|
194 |
*/
|
williamr@2
|
195 |
CLbtGeoCircle(const CLbtGeoCircle&);
|
williamr@2
|
196 |
|
williamr@2
|
197 |
/**
|
williamr@2
|
198 |
* Prohibit assigment operator
|
williamr@2
|
199 |
*/
|
williamr@2
|
200 |
CLbtGeoCircle& operator= (const CLbtGeoCircle&);
|
williamr@2
|
201 |
|
williamr@2
|
202 |
/**
|
williamr@2
|
203 |
* Symbian 2nd phase constructor
|
williamr@2
|
204 |
*/
|
williamr@2
|
205 |
void ConstructL();
|
williamr@2
|
206 |
|
williamr@2
|
207 |
/**
|
williamr@2
|
208 |
* Symbian 2nd phase constructor
|
williamr@2
|
209 |
*/
|
williamr@2
|
210 |
void ConstructL(TCoordinate aCenter,TReal aRadius);
|
williamr@2
|
211 |
|
williamr@2
|
212 |
|
williamr@2
|
213 |
private:
|
williamr@2
|
214 |
/**
|
williamr@2
|
215 |
* The center of the circle.
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
TCoordinate iCenter;
|
williamr@2
|
218 |
|
williamr@2
|
219 |
/**
|
williamr@2
|
220 |
* Radius of the circle in meters.
|
williamr@2
|
221 |
*/
|
williamr@2
|
222 |
TReal iRadius;
|
williamr@2
|
223 |
|
williamr@2
|
224 |
/**
|
williamr@2
|
225 |
* An array of instances representing additional geographical area
|
williamr@2
|
226 |
* information
|
williamr@2
|
227 |
*/
|
williamr@2
|
228 |
RPointerArray< CLbtGeoAreaBase > iAdditionalGeoAreaInfo;
|
williamr@2
|
229 |
};
|
williamr@2
|
230 |
|
williamr@2
|
231 |
#endif // LBTGEOCIRCLE_H
|