williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2005-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: CPosLmNearestCriteria class
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef CPOSLMNEARESTCRITERIA_H
|
williamr@2
|
20 |
#define CPOSLMNEARESTCRITERIA_H
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#include <e32base.h>
|
williamr@4
|
23 |
#include <lbsposition.h>
|
williamr@2
|
24 |
#include "EPos_CPosLmSearchCriteria.h"
|
williamr@2
|
25 |
|
williamr@2
|
26 |
|
williamr@2
|
27 |
/**
|
williamr@2
|
28 |
* Criterion for finding the landmarks which are closest to a certain
|
williamr@2
|
29 |
* coordinate, called "center coordinate".
|
williamr@2
|
30 |
*
|
williamr@2
|
31 |
* When using @ref CPosLmNearestCriteria, the matches returned in the search
|
williamr@2
|
32 |
* are sorted in ascending distance order if the client does not specify
|
williamr@2
|
33 |
* other sort preferences.
|
williamr@2
|
34 |
*
|
williamr@2
|
35 |
* By default, this search returns all landmarks in the database, except
|
williamr@2
|
36 |
* those which have no coordinates. It is recommended to specify a maximum
|
williamr@2
|
37 |
* distance to narrow down the search. This is done by @ref SetMaxDistance.
|
williamr@2
|
38 |
*
|
williamr@2
|
39 |
* The client can specify if the coverage radius should be used.
|
williamr@2
|
40 |
* If coverage radius is used, the distance to the landmark coverage area
|
williamr@2
|
41 |
* border is used instead of the distance to the landmark coverage area
|
williamr@2
|
42 |
* center. If the source coordinate is inside the landmark coverage area,
|
williamr@2
|
43 |
* the distance is considered zero. By default, the coverage radius is not
|
williamr@2
|
44 |
* used.
|
williamr@2
|
45 |
*
|
williamr@2
|
46 |
* This criterion is only valid when searching for landmarks, i.e. if it
|
williamr@2
|
47 |
* is passed to @p CPosLandmarkSearch::StartCategorySearchL, the function
|
williamr@2
|
48 |
* will fail with error code @p KErrArgument.
|
williamr@2
|
49 |
*
|
williamr@2
|
50 |
* @lib eposlmsearchlib.lib
|
williamr@2
|
51 |
* @since S60 3.0
|
williamr@2
|
52 |
*/
|
williamr@2
|
53 |
class CPosLmNearestCriteria : public CPosLmSearchCriteria
|
williamr@2
|
54 |
{
|
williamr@2
|
55 |
public:
|
williamr@2
|
56 |
|
williamr@2
|
57 |
/**
|
williamr@2
|
58 |
* Two-phased constructor.
|
williamr@2
|
59 |
*
|
williamr@2
|
60 |
* Latitude and longitude must be set in the coordinate (not NaN).
|
williamr@2
|
61 |
* Altitude is ignored.
|
williamr@2
|
62 |
*
|
williamr@2
|
63 |
* @param[in] aCoordinate The center coordinate of the landmark search.
|
williamr@2
|
64 |
* @param[in] aUseCoverageRadius @p ETrue if coverage radius should be
|
williamr@2
|
65 |
* considered in the search.
|
williamr@2
|
66 |
*
|
williamr@2
|
67 |
* @panic "Landmarks Client"-EPosNaNCoordinate Latitude and/or longitude is NaN.
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
IMPORT_C static CPosLmNearestCriteria* NewLC(
|
williamr@2
|
70 |
const TCoordinate& aCoordinate,
|
williamr@2
|
71 |
TBool aUseCoverageRadius = EFalse
|
williamr@2
|
72 |
);
|
williamr@2
|
73 |
|
williamr@2
|
74 |
/**
|
williamr@2
|
75 |
* Destructor.
|
williamr@2
|
76 |
*/
|
williamr@2
|
77 |
virtual ~CPosLmNearestCriteria();
|
williamr@2
|
78 |
|
williamr@2
|
79 |
public:
|
williamr@2
|
80 |
|
williamr@2
|
81 |
/**
|
williamr@2
|
82 |
* Returns the center coordinate of the search.
|
williamr@2
|
83 |
*
|
williamr@2
|
84 |
* @param[out] aCoordinate On return, contains the center coordinate.
|
williamr@2
|
85 |
*/
|
williamr@2
|
86 |
IMPORT_C void GetCoordinate( TCoordinate& aCoordinate ) const;
|
williamr@2
|
87 |
|
williamr@2
|
88 |
/**
|
williamr@2
|
89 |
* Set the center coordinate of the search.
|
williamr@2
|
90 |
*
|
williamr@2
|
91 |
* Latitude and longitude must be set in the coordinate (not NaN).
|
williamr@2
|
92 |
* Altitude is ignored.
|
williamr@2
|
93 |
*
|
williamr@2
|
94 |
* @param[in] aCoordinate The center coordinate of the landmarks search.
|
williamr@2
|
95 |
*
|
williamr@2
|
96 |
* @panic "Landmarks Client"-EPosNaNCoordinate Latitude and/or longitude is NaN.
|
williamr@2
|
97 |
*/
|
williamr@2
|
98 |
IMPORT_C void SetCoordinate( const TCoordinate& aCoordinate );
|
williamr@2
|
99 |
|
williamr@2
|
100 |
/**
|
williamr@2
|
101 |
* Returns if coverage radius is considered in the search.
|
williamr@2
|
102 |
*
|
williamr@2
|
103 |
* @return @p ETrue if coverage radius is considered in the search.
|
williamr@2
|
104 |
* @p EFalse otherwise.
|
williamr@2
|
105 |
*/
|
williamr@2
|
106 |
IMPORT_C TBool UseCoverageRadius() const;
|
williamr@2
|
107 |
|
williamr@2
|
108 |
/**
|
williamr@2
|
109 |
* Set if coverage radius should be considered in the search.
|
williamr@2
|
110 |
*
|
williamr@2
|
111 |
* @param aUseCoverageRadius @p ETrue if coverage radius should be
|
williamr@2
|
112 |
* considered in the search. @p EFalse otherwise.
|
williamr@2
|
113 |
*/
|
williamr@2
|
114 |
IMPORT_C void SetUseCoverageRadius( TBool aUseCoverageRadius );
|
williamr@2
|
115 |
|
williamr@2
|
116 |
/**
|
williamr@2
|
117 |
* Returns whether the search should be limited to landmarks which are
|
williamr@2
|
118 |
* closer than a maximum distance.
|
williamr@2
|
119 |
*
|
williamr@2
|
120 |
* By default the maximum distance is set to NaN which means that the
|
williamr@2
|
121 |
* distance is unlimited.
|
williamr@2
|
122 |
*
|
williamr@2
|
123 |
* @return The maximum distance or NaN if the distance is unlimited.
|
williamr@2
|
124 |
*/
|
williamr@2
|
125 |
IMPORT_C TReal32 MaxDistance() const;
|
williamr@2
|
126 |
|
williamr@2
|
127 |
/**
|
williamr@2
|
128 |
* Set a maximum distance for the search.
|
williamr@2
|
129 |
*
|
williamr@2
|
130 |
* Only landmarks, which are closer to the center coordinate than the
|
williamr@2
|
131 |
* maximum distance are considered matches.
|
williamr@2
|
132 |
*
|
williamr@2
|
133 |
* @param aMaxDistance The maximum distance or NaN if the distance
|
williamr@2
|
134 |
* should be unlimited.
|
williamr@2
|
135 |
*/
|
williamr@2
|
136 |
IMPORT_C void SetMaxDistance( TReal32 aMaxDistance );
|
williamr@2
|
137 |
|
williamr@2
|
138 |
private:
|
williamr@2
|
139 |
|
williamr@2
|
140 |
CPosLmNearestCriteria(TBool aUseCoverageRadius);
|
williamr@2
|
141 |
|
williamr@2
|
142 |
void ConstructL(const TCoordinate& aCoordinate);
|
williamr@2
|
143 |
|
williamr@2
|
144 |
// Prohibit copy constructor
|
williamr@2
|
145 |
CPosLmNearestCriteria( const CPosLmNearestCriteria& );
|
williamr@2
|
146 |
// Prohibit assigment operator
|
williamr@2
|
147 |
CPosLmNearestCriteria& operator= ( const CPosLmNearestCriteria& );
|
williamr@2
|
148 |
|
williamr@2
|
149 |
private:
|
williamr@2
|
150 |
|
williamr@2
|
151 |
TCoordinate iCenterCoordinate;
|
williamr@2
|
152 |
TBool iUseCoverageRadius;
|
williamr@2
|
153 |
TReal32 iMaxDistance;
|
williamr@2
|
154 |
|
williamr@2
|
155 |
};
|
williamr@2
|
156 |
|
williamr@2
|
157 |
#endif // CPOSLMNEARESTCRITERIA_H
|
williamr@2
|
158 |
|
williamr@2
|
159 |
|