2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: CPosLmDisplayItem class
19 #ifndef CPOSLMDISPLAYITEM_H
20 #define CPOSLMDISPLAYITEM_H
25 class CPosLandmarkCategory;
31 * A displayable item consists of a landmark or category and its database
32 * index. Database index is 0 if running single database search, and it is
33 * in the range [0, @ref CPosLmMultiDbSearch::NumOfDatabasesInSearch - 1] in
34 * case of multiple database search. Thus, this class is a link between a
35 * landmark or a category and its database.
37 * The class is usually not instantiated by client applications.
39 * @lib eposlmsearchlib.lib
42 class CPosLmDisplayItem : public CBase
52 ELandmarkItem = 0 /**< Landmark display item. This indicates
53 * that the item contains a landmark and the
54 * @ref Landmark function can be called to
57 ECategoryItem /**< Category display item. This indicates
58 * that the item contains a category and the
59 * @ref Category function can be called to
67 * Two-phased constructor.
69 * @param[in] aLandmark A landmark.
70 * @param[in] aDatabaseIndex A database index.
72 * @returns A new instance of this class.
74 IMPORT_C static CPosLmDisplayItem* NewL(
75 CPosLandmark* aLandmark,
76 TUint aDatabaseIndex = 0
80 * Two-phased constructor.
82 * @param[in] aCategory A category.
83 * @param[in] aDatabaseIndex A database index.
85 * @returns A new instance of this class.
87 IMPORT_C static CPosLmDisplayItem* NewL(
88 CPosLandmarkCategory* aCategory,
89 TUint aDatabaseIndex = 0
95 virtual ~CPosLmDisplayItem();
100 * Returns the type of the display item.
102 * @return The display item type.
104 IMPORT_C TDisplayItemType DisplayItemType() const;
107 * Returns the index of the database, which contained item belongs to.
109 * The database index is associated with a database URI from the list
110 * of databases specified in @ref CPosLmMultiDbSearch.
112 * If display data is used in @ref CPosLandmarkSearch, this
113 * function always returns 0.
115 * @return The database index of this displayable item.
117 IMPORT_C TUint DatabaseIndex() const;
120 * Returns the category contained in the displayable item.
122 * @return The category.
124 * @panic "Landmarks Client"-EPosInvalidItemType
125 * The item type is not a category displayable item. See @ref DisplayItemType.
127 IMPORT_C const CPosLandmarkCategory& Category() const;
130 * Returns the landmark contained in the displayable item.
132 * @return The landmark.
134 * @panic "Landmarks Client"-EPosInvalidItemType
135 * The item type is not a landmark displayable item. See @ref DisplayItemType.
137 IMPORT_C const CPosLandmark& Landmark() const;
140 * Returns the distance to a position specified in the
141 * @ref CPosLmNearestCriteria. The distance data is only used when
142 * searching with this criteria.
144 * @param[out] aDistance Distance to the position specified in a
145 * @ref CPosLmNearestCriteria.
146 * @return KErrNone if distance is available. KErrNotFound otherwise.
148 IMPORT_C TInt GetDistance( TReal32& aDistance ) const;
152 * Sets the database index of this displayable item.
154 * @param aDatabaseIndex The database index.
156 void SetDatabaseIndex( TUint aDatabaseIndex );
160 * Sets the distance to the position specified in the nearest criterion.
162 * @param aDistance Distance to the position.
164 void SetDistance( TReal32 aDistance );
171 * @param[in] aLandmark A landmark.
172 * @param[in] aDatabaseIndex Database index.
175 CPosLandmark* aLandmark,
182 * @param[in] aCategory A category.
183 * @param[in] aDatabaseIndex Database index.
186 CPosLandmarkCategory* aCategory,
192 TDisplayItemType iDisplayItemType;
194 CPosLandmark* iLandmark;
196 CPosLandmarkCategory* iCategory;
198 TUint iDatabaseIndex;
206 #endif // CPOSLMDISPLAYITEM_H