williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
3 |
* All rights reserved.
|
williamr@4
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
8 |
*
|
williamr@4
|
9 |
* Initial Contributors:
|
williamr@4
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@4
|
11 |
*
|
williamr@4
|
12 |
* Contributors:
|
williamr@4
|
13 |
*
|
williamr@4
|
14 |
* Description: CPosLmDisplayItem class
|
williamr@4
|
15 |
*
|
williamr@4
|
16 |
*/
|
williamr@4
|
17 |
|
williamr@4
|
18 |
|
williamr@4
|
19 |
#ifndef CPOSLMDISPLAYITEM_H
|
williamr@4
|
20 |
#define CPOSLMDISPLAYITEM_H
|
williamr@4
|
21 |
|
williamr@4
|
22 |
#include <e32base.h>
|
williamr@4
|
23 |
|
williamr@4
|
24 |
class CPosLandmark;
|
williamr@4
|
25 |
class CPosLandmarkCategory;
|
williamr@4
|
26 |
|
williamr@4
|
27 |
|
williamr@4
|
28 |
/**
|
williamr@4
|
29 |
* Displayable item.
|
williamr@4
|
30 |
*
|
williamr@4
|
31 |
* A displayable item consists of a landmark or category and its database
|
williamr@4
|
32 |
* index. Database index is 0 if running single database search, and it is
|
williamr@4
|
33 |
* in the range [0, @ref CPosLmMultiDbSearch::NumOfDatabasesInSearch - 1] in
|
williamr@4
|
34 |
* case of multiple database search. Thus, this class is a link between a
|
williamr@4
|
35 |
* landmark or a category and its database.
|
williamr@4
|
36 |
*
|
williamr@4
|
37 |
* The class is usually not instantiated by client applications.
|
williamr@4
|
38 |
*
|
williamr@4
|
39 |
* @lib eposlmsearchlib.lib
|
williamr@4
|
40 |
* @since S60 3.0
|
williamr@4
|
41 |
*/
|
williamr@4
|
42 |
class CPosLmDisplayItem : public CBase
|
williamr@4
|
43 |
{
|
williamr@4
|
44 |
|
williamr@4
|
45 |
public:
|
williamr@4
|
46 |
|
williamr@4
|
47 |
/**
|
williamr@4
|
48 |
* Display item type.
|
williamr@4
|
49 |
*/
|
williamr@4
|
50 |
enum TDisplayItemType
|
williamr@4
|
51 |
{
|
williamr@4
|
52 |
ELandmarkItem = 0 /**< Landmark display item. This indicates
|
williamr@4
|
53 |
* that the item contains a landmark and the
|
williamr@4
|
54 |
* @ref Landmark function can be called to
|
williamr@4
|
55 |
* access it.
|
williamr@4
|
56 |
*/,
|
williamr@4
|
57 |
ECategoryItem /**< Category display item. This indicates
|
williamr@4
|
58 |
* that the item contains a category and the
|
williamr@4
|
59 |
* @ref Category function can be called to
|
williamr@4
|
60 |
* access it.
|
williamr@4
|
61 |
*/
|
williamr@4
|
62 |
};
|
williamr@4
|
63 |
|
williamr@4
|
64 |
public:
|
williamr@4
|
65 |
|
williamr@4
|
66 |
/**
|
williamr@4
|
67 |
* Two-phased constructor.
|
williamr@4
|
68 |
*
|
williamr@4
|
69 |
* @param[in] aLandmark A landmark.
|
williamr@4
|
70 |
* @param[in] aDatabaseIndex A database index.
|
williamr@4
|
71 |
*
|
williamr@4
|
72 |
* @returns A new instance of this class.
|
williamr@4
|
73 |
*/
|
williamr@4
|
74 |
IMPORT_C static CPosLmDisplayItem* NewL(
|
williamr@4
|
75 |
CPosLandmark* aLandmark,
|
williamr@4
|
76 |
TUint aDatabaseIndex = 0
|
williamr@4
|
77 |
);
|
williamr@4
|
78 |
|
williamr@4
|
79 |
/**
|
williamr@4
|
80 |
* Two-phased constructor.
|
williamr@4
|
81 |
*
|
williamr@4
|
82 |
* @param[in] aCategory A category.
|
williamr@4
|
83 |
* @param[in] aDatabaseIndex A database index.
|
williamr@4
|
84 |
*
|
williamr@4
|
85 |
* @returns A new instance of this class.
|
williamr@4
|
86 |
*/
|
williamr@4
|
87 |
IMPORT_C static CPosLmDisplayItem* NewL(
|
williamr@4
|
88 |
CPosLandmarkCategory* aCategory,
|
williamr@4
|
89 |
TUint aDatabaseIndex = 0
|
williamr@4
|
90 |
);
|
williamr@4
|
91 |
|
williamr@4
|
92 |
/**
|
williamr@4
|
93 |
* Destructor.
|
williamr@4
|
94 |
*/
|
williamr@4
|
95 |
virtual ~CPosLmDisplayItem();
|
williamr@4
|
96 |
|
williamr@4
|
97 |
public:
|
williamr@4
|
98 |
|
williamr@4
|
99 |
/**
|
williamr@4
|
100 |
* Returns the type of the display item.
|
williamr@4
|
101 |
*
|
williamr@4
|
102 |
* @return The display item type.
|
williamr@4
|
103 |
*/
|
williamr@4
|
104 |
IMPORT_C TDisplayItemType DisplayItemType() const;
|
williamr@4
|
105 |
|
williamr@4
|
106 |
/**
|
williamr@4
|
107 |
* Returns the index of the database, which contained item belongs to.
|
williamr@4
|
108 |
*
|
williamr@4
|
109 |
* The database index is associated with a database URI from the list
|
williamr@4
|
110 |
* of databases specified in @ref CPosLmMultiDbSearch.
|
williamr@4
|
111 |
*
|
williamr@4
|
112 |
* If display data is used in @ref CPosLandmarkSearch, this
|
williamr@4
|
113 |
* function always returns 0.
|
williamr@4
|
114 |
*
|
williamr@4
|
115 |
* @return The database index of this displayable item.
|
williamr@4
|
116 |
*/
|
williamr@4
|
117 |
IMPORT_C TUint DatabaseIndex() const;
|
williamr@4
|
118 |
|
williamr@4
|
119 |
/**
|
williamr@4
|
120 |
* Returns the category contained in the displayable item.
|
williamr@4
|
121 |
*
|
williamr@4
|
122 |
* @return The category.
|
williamr@4
|
123 |
*
|
williamr@4
|
124 |
* @panic "Landmarks Client"-EPosInvalidItemType
|
williamr@4
|
125 |
* The item type is not a category displayable item. See @ref DisplayItemType.
|
williamr@4
|
126 |
*/
|
williamr@4
|
127 |
IMPORT_C const CPosLandmarkCategory& Category() const;
|
williamr@4
|
128 |
|
williamr@4
|
129 |
/**
|
williamr@4
|
130 |
* Returns the landmark contained in the displayable item.
|
williamr@4
|
131 |
*
|
williamr@4
|
132 |
* @return The landmark.
|
williamr@4
|
133 |
*
|
williamr@4
|
134 |
* @panic "Landmarks Client"-EPosInvalidItemType
|
williamr@4
|
135 |
* The item type is not a landmark displayable item. See @ref DisplayItemType.
|
williamr@4
|
136 |
*/
|
williamr@4
|
137 |
IMPORT_C const CPosLandmark& Landmark() const;
|
williamr@4
|
138 |
|
williamr@4
|
139 |
/**
|
williamr@4
|
140 |
* Returns the distance to a position specified in the
|
williamr@4
|
141 |
* @ref CPosLmNearestCriteria. The distance data is only used when
|
williamr@4
|
142 |
* searching with this criteria.
|
williamr@4
|
143 |
*
|
williamr@4
|
144 |
* @param[out] aDistance Distance to the position specified in a
|
williamr@4
|
145 |
* @ref CPosLmNearestCriteria.
|
williamr@4
|
146 |
* @return KErrNone if distance is available. KErrNotFound otherwise.
|
williamr@4
|
147 |
*/
|
williamr@4
|
148 |
IMPORT_C TInt GetDistance( TReal32& aDistance ) const;
|
williamr@4
|
149 |
|
williamr@4
|
150 |
/** @internal */
|
williamr@4
|
151 |
/*
|
williamr@4
|
152 |
* Sets the database index of this displayable item.
|
williamr@4
|
153 |
*
|
williamr@4
|
154 |
* @param aDatabaseIndex The database index.
|
williamr@4
|
155 |
*/
|
williamr@4
|
156 |
void SetDatabaseIndex( TUint aDatabaseIndex );
|
williamr@4
|
157 |
|
williamr@4
|
158 |
/** @internal */
|
williamr@4
|
159 |
/*
|
williamr@4
|
160 |
* Sets the distance to the position specified in the nearest criterion.
|
williamr@4
|
161 |
*
|
williamr@4
|
162 |
* @param aDistance Distance to the position.
|
williamr@4
|
163 |
*/
|
williamr@4
|
164 |
void SetDistance( TReal32 aDistance );
|
williamr@4
|
165 |
|
williamr@4
|
166 |
private:
|
williamr@4
|
167 |
|
williamr@4
|
168 |
/**
|
williamr@4
|
169 |
* C++ constructor.
|
williamr@4
|
170 |
*
|
williamr@4
|
171 |
* @param[in] aLandmark A landmark.
|
williamr@4
|
172 |
* @param[in] aDatabaseIndex Database index.
|
williamr@4
|
173 |
*/
|
williamr@4
|
174 |
CPosLmDisplayItem(
|
williamr@4
|
175 |
CPosLandmark* aLandmark,
|
williamr@4
|
176 |
TUint aDatabaseIndex
|
williamr@4
|
177 |
);
|
williamr@4
|
178 |
|
williamr@4
|
179 |
/**
|
williamr@4
|
180 |
* C++ constructor.
|
williamr@4
|
181 |
*
|
williamr@4
|
182 |
* @param[in] aCategory A category.
|
williamr@4
|
183 |
* @param[in] aDatabaseIndex Database index.
|
williamr@4
|
184 |
*/
|
williamr@4
|
185 |
CPosLmDisplayItem(
|
williamr@4
|
186 |
CPosLandmarkCategory* aCategory,
|
williamr@4
|
187 |
TUint aDatabaseIndex
|
williamr@4
|
188 |
);
|
williamr@4
|
189 |
|
williamr@4
|
190 |
private:
|
williamr@4
|
191 |
|
williamr@4
|
192 |
TDisplayItemType iDisplayItemType;
|
williamr@4
|
193 |
|
williamr@4
|
194 |
CPosLandmark* iLandmark;
|
williamr@4
|
195 |
|
williamr@4
|
196 |
CPosLandmarkCategory* iCategory;
|
williamr@4
|
197 |
|
williamr@4
|
198 |
TUint iDatabaseIndex;
|
williamr@4
|
199 |
|
williamr@4
|
200 |
TReal32 iDistance;
|
williamr@4
|
201 |
|
williamr@4
|
202 |
TBool iHasDistance;
|
williamr@4
|
203 |
|
williamr@4
|
204 |
};
|
williamr@4
|
205 |
|
williamr@4
|
206 |
#endif // CPOSLMDISPLAYITEM_H
|
williamr@4
|
207 |
|
williamr@4
|
208 |
|