1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CMnMapViewServiceBase class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MN_MAPSERVICEBASE_H |
|
20 #define MN_MAPSERVICEBASE_H |
|
21 |
|
22 #include "mnservicebase.h" |
|
23 #include "mnmapview.h" |
|
24 |
|
25 class TMnMapOptions; |
|
26 class CPosLandmark; |
|
27 |
|
28 /** @brief Base class for MapView service implementations (KMnAppMapViewService). |
|
29 * |
|
30 * Provider Application |
|
31 * must derive its MapView service class from this one. This base implementation |
|
32 * hides IPC communication details and provides native methods for accessing |
|
33 * various map parameters, specified by client. |
|
34 * |
|
35 * Provider Application must return pointer to instance of its class, derived |
|
36 * from this class, in response to CAknAppService::CreateServiceL() call, |
|
37 * if given parameter is KMnAppMapViewService. |
|
38 * |
|
39 * This class defines handlers of particular requests from client as pure |
|
40 * virtual methods, which derived class must implement. The parameters, which |
|
41 * client application may specify in CMnMapView are accessible via other methods |
|
42 * of this class. Provider Application must obey these parameters and use them |
|
43 * as specified in @ref CMnMapView. |
|
44 * |
|
45 * See parent @ref CMnServiceBase class documentation for |
|
46 * other details. |
|
47 * |
|
48 * @since 3.1 |
|
49 * @lib mnservicelib.lib |
|
50 * @ingroup MnProviderAPI |
|
51 */ |
|
52 class CMnMapViewServiceBase : public CMnServiceBase |
|
53 { |
|
54 public : |
|
55 |
|
56 /** @brief Returns map displaying options specified by client application. |
|
57 * |
|
58 * These options must be utilized in request handlers as specified in |
|
59 * @ref CMnMapView. |
|
60 * |
|
61 * @return Options specified by client. |
|
62 */ |
|
63 IMPORT_C CMnMapView::TOptions Options(); |
|
64 |
|
65 /** @brief Returns Current Location option specified by client application. |
|
66 * |
|
67 * This option must be utilized in request handlers as specified in |
|
68 * @ref CMnMapView. |
|
69 * |
|
70 * @return Current Location options specified by client. |
|
71 */ |
|
72 IMPORT_C CMnMapView::TCurrentLocationOption CurrentLocationOption(); |
|
73 |
|
74 /** @brief Returns array of landmarks as set by client to be shown on map. |
|
75 * |
|
76 * All these landmarks shall be shown on map. |
|
77 * |
|
78 * @return Reference to array of landmarks. |
|
79 */ |
|
80 IMPORT_C TArray<const CPosLandmark*> LandmarksToShow(); |
|
81 |
|
82 /** @brief Returns array of linked landmarks from specified database. |
|
83 * |
|
84 * All these landmarks shall be shown on map. |
|
85 * |
|
86 * @param[in] aDbIndex Index of landmark database, which contains returned |
|
87 * landmarks. Must be valid for array returned from |
|
88 * @ref LandmarksToShowDatabases(). |
|
89 * @return Array of IDs of landmarks from database, specified by |
|
90 * aDbIndex. |
|
91 * |
|
92 * @panic "MnPanicServer"-KMnPanicArrayIndexOutOfBounds |
|
93 * aDbIndex not valid for the list of databases. |
|
94 */ |
|
95 IMPORT_C TArray<TPosLmItemId> LinkedLandmarksToShow( TInt aDbIndex ); |
|
96 |
|
97 /** @brief Returns databases, where linked landmarks belong to. |
|
98 * @return Array of landmark database URIs. |
|
99 */ |
|
100 IMPORT_C TArray<const HBufC*> LandmarksToShowDatabases(); |
|
101 |
|
102 /** @brief Returns text, which shall be shown in Select From Map |
|
103 * request. |
|
104 * |
|
105 * This text is used in HandleSelectFromMapL(). |
|
106 * |
|
107 * @return Selection request text to be shown to user in |
|
108 * HandleSelectFromMapL(). |
|
109 */ |
|
110 IMPORT_C TPtrC SelectionRequestText(); |
|
111 |
|
112 /** @brief Determines whether central point is specified by client. |
|
113 * |
|
114 * If central point is not set, @ref GetAreaCentralPoint returns |
|
115 * coordinate with latitude and longitude set to NaN. |
|
116 * |
|
117 * @return ETrue - if central point is set, EFalse - otherwise, |
|
118 * and during Show Current Location request. |
|
119 */ |
|
120 IMPORT_C TBool IsAreaCentralPointSet(); |
|
121 |
|
122 /** @brief Returns central point specified by client. |
|
123 * |
|
124 * If central point is not set, this |
|
125 * coordinate has latitude and longitude set to NaN. |
|
126 * |
|
127 * @param[out] aCentralPoint Central point of map view area, |
|
128 * specified by client. |
|
129 */ |
|
130 IMPORT_C void GetAreaCentralPoint( TCoordinate& aCentralPoint ); |
|
131 |
|
132 /** @brief Returns radius, in meters, of map view area, specified by client. |
|
133 * |
|
134 * Implementation has to obey this setting as long as this is within |
|
135 * allowed range. If it is too low and cannot be used, the implementation |
|
136 * must select lowest possible radius. If this value is KAutomaticRadius, |
|
137 * it is considered not set. |
|
138 */ |
|
139 IMPORT_C TReal AreaRadius(); |
|
140 |
|
141 /** @brief Completes selection request. |
|
142 * |
|
143 * Implementation must call this method to signal completion |
|
144 * of Select From Map request. |
|
145 * This override is used if free location from map has been selected by user. |
|
146 * |
|
147 * @param[in] aLandmark Landmark containing information about |
|
148 * user-selected location. As much information as possible |
|
149 * shall be set. |
|
150 * |
|
151 * @leave KErrArgument CMnMapView::EOptionRestrictSelection was specified |
|
152 * by client. |
|
153 * @see Options(). |
|
154 */ |
|
155 IMPORT_C void CompleteSelectionRequestL( const CPosLandmark& aLandmark ); |
|
156 |
|
157 /** @brief Completes selection request. |
|
158 * |
|
159 * Implementation must call this method to signal completion |
|
160 * of Select From Map request. |
|
161 * This override is used if one of not linked landmarks has been selected by user. |
|
162 * |
|
163 * @param[in] aLandmarkIndex Index of not linked landmark containing information about |
|
164 * user-selected location. As much information as possible |
|
165 * shall be set. |
|
166 * |
|
167 * @panic "MnPanicServer"-KMnPanicArrayIndexOutOfBounds |
|
168 * aLandmarkIndex is negative or greater than LandmarksToShow().Count(). |
|
169 */ |
|
170 IMPORT_C void CompleteSelectionRequest( TInt aLandmarkIndex ); |
|
171 |
|
172 /** @brief Completes selection request. |
|
173 * |
|
174 * Implementation must call this method to signal completion |
|
175 * of Select From Map request. |
|
176 * This override is used if one of linked landmarks, passed by client |
|
177 * has been selected by user. |
|
178 * |
|
179 * @param aLandmarkId ID of landmark selected by user. |
|
180 * @param aDbIndex Index of database where landmark specified by |
|
181 * aLandmarkId belongs to. |
|
182 * |
|
183 * @panic "MnPanicServer"-KMnPanicArrayIndexOutOfBounds |
|
184 * aDbIndex is negative or greater than LandmarksToShowDatabases().Count(). |
|
185 */ |
|
186 IMPORT_C void CompleteSelectionRequest( TPosLmItemId aLandmarkId, TInt aDbIndex ); |
|
187 |
|
188 protected : |
|
189 |
|
190 /** C++ constructor */ |
|
191 IMPORT_C CMnMapViewServiceBase(); |
|
192 /** Destructor */ |
|
193 IMPORT_C virtual ~CMnMapViewServiceBase(); |
|
194 |
|
195 /** This method must be called from derived class' ConstructL to |
|
196 * allow internal initialization of this class. */ |
|
197 IMPORT_C void BaseConstructL(); |
|
198 |
|
199 /** @brief Handles client's request for showing map. |
|
200 * |
|
201 * Derived class must implement this method obeying |
|
202 * specification of @ref CMnMapView::ShowMapL and if @ref KMnSvcFeatureShowMap |
|
203 * feature is specified in its SERVICE_INFO. |
|
204 * |
|
205 * Landmarks returned by LandmarksToShow and LinkedLandmarksToShow shall be |
|
206 * shown on map. |
|
207 * |
|
208 * This is synchronous request. |
|
209 * Client's request will be completed when this method exits, therefore |
|
210 * it should exit immediately after map view is shown. |
|
211 * |
|
212 * @leave KErrNotSupported Should leave if this feature is not supported. |
|
213 */ |
|
214 virtual void HandleShowMapL() =0; |
|
215 |
|
216 /** @brief Handles client's request for showing map from current location. |
|
217 * |
|
218 * Derived class must implement this method obeying specification of |
|
219 * @ref CMnMapView::ShowCurrentLocationL and if @ref KMnSvcFeatureShowMap |
|
220 * feature is specified in its SERVICE_INFO. |
|
221 * |
|
222 * Landmarks returned by LandmarksToShow and LinkedLandmarksToShow shall be |
|
223 * shown on map. |
|
224 * |
|
225 * This is synchronous request. |
|
226 * Client's request will be completed when this method exits, therefore |
|
227 * it should exit immediately after map view is shown. |
|
228 * |
|
229 * @leave KErrNotSupported Should leave if this feature is not supported. |
|
230 */ |
|
231 virtual void HandleShowCurrentLocationL() =0; |
|
232 |
|
233 /** @brief Handles client's request for selecting a location from map. |
|
234 * |
|
235 * Derived class must implement this method obeying specification of |
|
236 * @ref CMnMapView::SelectFromMapL and if KMnSvcFeatureSelectFromMap |
|
237 * feature is specified in its SERVICE_INFO. |
|
238 * |
|
239 * Landmarks returned by LandmarksToShow and LinkedLandmarksToShow shall be |
|
240 * shown on map. |
|
241 * |
|
242 * This is asynchronous request. |
|
243 * It must be completed (in successful case) with one of |
|
244 * CompleteSelectionRequest overloads. |
|
245 * |
|
246 * @leave KErrNotSupported Should leave if this feature is not supported. |
|
247 */ |
|
248 virtual void HandleSelectFromMapL() =0; |
|
249 |
|
250 protected: // From CAknAppServiceBase |
|
251 |
|
252 /** \internal */ |
|
253 IMPORT_C void ServiceL( const RMessage2& aMessage ); |
|
254 |
|
255 private: // Internal methods |
|
256 |
|
257 void CleanSelectionResult(); |
|
258 |
|
259 void HandleAddLandmarkIdsToShowL( const RMessage2& aMessage ); |
|
260 void HandleAddLandmarksToShowL( const RMessage2& aMessage ); |
|
261 void HandleGetSelectionResultLandmarkL( const RMessage2& aMessage ); |
|
262 void HandleGetSelectionResultDbUriL( const RMessage2& aMessage ); |
|
263 |
|
264 void ResetLandmarks(); |
|
265 TInt FindDatabase( const TDesC& aUri ); |
|
266 |
|
267 void UnpackOptionsL( const RMessage2& aMsg ); |
|
268 void UnpackSelectionRequestTextL( const RMessage2& aMsg ); |
|
269 |
|
270 void VerifySelectionRequestL(); |
|
271 |
|
272 private: |
|
273 class CLinkedLandmarksList : public CBase |
|
274 { |
|
275 public: |
|
276 ~CLinkedLandmarksList(); |
|
277 |
|
278 HBufC* iDatabaseUri; |
|
279 RArray< TPosLmItemId > iLandmarkIds; |
|
280 }; |
|
281 |
|
282 private: |
|
283 |
|
284 CMnMapView::TOptions iOptions; |
|
285 CMnMapView::TCurrentLocationOption iCurrentLocationOption; |
|
286 |
|
287 TCoordinate iCentralPoint; |
|
288 TReal iRadius; |
|
289 HBufC* iSelectionRequestText; |
|
290 |
|
291 RPointerArray< const CPosLandmark > iLandmarks; |
|
292 RPointerArray< CLinkedLandmarksList > iLinkedLandmarksLists; |
|
293 |
|
294 RPointerArray< const HBufC > iTempDatabaseList; |
|
295 |
|
296 HBufC8* iResultLandmark; |
|
297 TInt iResultDbIndex; |
|
298 }; |
|
299 |
|
300 #endif // MN_MAPSERVICEBASE_H |
|
301 |
|
302 |
|