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: CPosLmNearestCriteria class
19 #ifndef CPOSLMNEARESTCRITERIA_H
20 #define CPOSLMNEARESTCRITERIA_H
23 #include <lbsposition.h>
24 #include "EPos_CPosLmSearchCriteria.h"
28 * Criterion for finding the landmarks which are closest to a certain
29 * coordinate, called "center coordinate".
31 * When using @ref CPosLmNearestCriteria, the matches returned in the search
32 * are sorted in ascending distance order if the client does not specify
33 * other sort preferences.
35 * By default, this search returns all landmarks in the database, except
36 * those which have no coordinates. It is recommended to specify a maximum
37 * distance to narrow down the search. This is done by @ref SetMaxDistance.
39 * The client can specify if the coverage radius should be used.
40 * If coverage radius is used, the distance to the landmark coverage area
41 * border is used instead of the distance to the landmark coverage area
42 * center. If the source coordinate is inside the landmark coverage area,
43 * the distance is considered zero. By default, the coverage radius is not
46 * This criterion is only valid when searching for landmarks, i.e. if it
47 * is passed to @p CPosLandmarkSearch::StartCategorySearchL, the function
48 * will fail with error code @p KErrArgument.
50 * @lib eposlmsearchlib.lib
53 class CPosLmNearestCriteria : public CPosLmSearchCriteria
58 * Two-phased constructor.
60 * Latitude and longitude must be set in the coordinate (not NaN).
61 * Altitude is ignored.
63 * @param[in] aCoordinate The center coordinate of the landmark search.
64 * @param[in] aUseCoverageRadius @p ETrue if coverage radius should be
65 * considered in the search.
67 * @panic "Landmarks Client"-EPosNaNCoordinate Latitude and/or longitude is NaN.
69 IMPORT_C static CPosLmNearestCriteria* NewLC(
70 const TCoordinate& aCoordinate,
71 TBool aUseCoverageRadius = EFalse
77 virtual ~CPosLmNearestCriteria();
82 * Returns the center coordinate of the search.
84 * @param[out] aCoordinate On return, contains the center coordinate.
86 IMPORT_C void GetCoordinate( TCoordinate& aCoordinate ) const;
89 * Set the center coordinate of the search.
91 * Latitude and longitude must be set in the coordinate (not NaN).
92 * Altitude is ignored.
94 * @param[in] aCoordinate The center coordinate of the landmarks search.
96 * @panic "Landmarks Client"-EPosNaNCoordinate Latitude and/or longitude is NaN.
98 IMPORT_C void SetCoordinate( const TCoordinate& aCoordinate );
101 * Returns if coverage radius is considered in the search.
103 * @return @p ETrue if coverage radius is considered in the search.
104 * @p EFalse otherwise.
106 IMPORT_C TBool UseCoverageRadius() const;
109 * Set if coverage radius should be considered in the search.
111 * @param aUseCoverageRadius @p ETrue if coverage radius should be
112 * considered in the search. @p EFalse otherwise.
114 IMPORT_C void SetUseCoverageRadius( TBool aUseCoverageRadius );
117 * Returns whether the search should be limited to landmarks which are
118 * closer than a maximum distance.
120 * By default the maximum distance is set to NaN which means that the
121 * distance is unlimited.
123 * @return The maximum distance or NaN if the distance is unlimited.
125 IMPORT_C TReal32 MaxDistance() const;
128 * Set a maximum distance for the search.
130 * Only landmarks, which are closer to the center coordinate than the
131 * maximum distance are considered matches.
133 * @param aMaxDistance The maximum distance or NaN if the distance
134 * should be unlimited.
136 IMPORT_C void SetMaxDistance( TReal32 aMaxDistance );
140 CPosLmNearestCriteria(TBool aUseCoverageRadius);
142 void ConstructL(const TCoordinate& aCoordinate);
144 // Prohibit copy constructor
145 CPosLmNearestCriteria( const CPosLmNearestCriteria& );
146 // Prohibit assigment operator
147 CPosLmNearestCriteria& operator= ( const CPosLmNearestCriteria& );
151 TCoordinate iCenterCoordinate;
152 TBool iUseCoverageRadius;
153 TReal32 iMaxDistance;
157 #endif // CPOSLMNEARESTCRITERIA_H