summaryrefslogtreecommitdiff
path: root/src/location/maps
diff options
context:
space:
mode:
Diffstat (limited to 'src/location/maps')
-rw-r--r--src/location/maps/qgeosearchmanager.cpp121
-rw-r--r--src/location/maps/qgeosearchmanagerengine.cpp53
-rw-r--r--src/location/maps/qgeosearchreply.cpp26
-rw-r--r--src/location/maps/qgeosearchreply.h8
-rw-r--r--src/location/maps/qgeosearchreply_p.h4
-rw-r--r--src/location/maps/qgeoserviceproviderfactory.cpp9
6 files changed, 38 insertions, 183 deletions
diff --git a/src/location/maps/qgeosearchmanager.cpp b/src/location/maps/qgeosearchmanager.cpp
index 3e48d4a4..7f84a476 100644
--- a/src/location/maps/qgeosearchmanager.cpp
+++ b/src/location/maps/qgeosearchmanager.cpp
@@ -70,95 +70,11 @@ QTM_BEGIN_NAMESPACE
QGeoAddress instances to QGeoCoordinate instances and vice-versa.
The search() function allows a user to perform a free text search
- for place information. If the string provided can be interpreted as
- an address it can be geocoded to coordinate information, and the string
- can also be used to search a landmarks database, depending on the level
- of support supplied by the service provider.
-
- The defaultLandmarkManager() function will return a QLandmarkManager
- instance if access to the service providers landmark database is
- available outside of the search() method.
-
- A user can supply other QLandmarkManager instances to be searched during
- the execution of search() with setAdditionalLandmarkManagers(). This
- means that a personal database store can be combined with a public source
- of database information with very little effort.
-
- \note At present the additional landmark managers only search for the
- search string in the name of the landmarks.
+ for location information. If the string provided can be interpreted as
+ an address it can be geocoded to coordinate information.
Instances of QGeoSearchManager can be accessed with
QGeoServiceProvider::searchManager().
-
- A small example of the usage of QGeoSearchManager and the handling of
- QLandmark results follows:
-
- \code
-class MySearchHandler : public QObject
-{
- Q_OBJECT
-public:
- MySearchHandler(QGeoSearchManager *searchManager, QString searchString)
- {
- QGeoSearchReply *reply = searchManager->search(searchString);
-
- if (reply->isFinished()) {
- if (reply->error() == QGeoSearchReply::NoError) {
- searchResults(reply);
- else
- searchError(reply, reply->error(), reply->errorString());
- return;
- }
-
- connect(searchManager,
- SIGNAL(finished(QGeoSearchReply*)),
- this,
- SLOT(searchResults(QGeoSearchReply*)));
-
- connect(searchManager,
- SIGNAL(error(QGeoSearchReply*,QGeoSearchReply::Error,QString)),
- this
- SLOT(searchError(QGeoSearchReply*,QGeoSearchReply::Error,QString)));
- }
-
-private slots:
- void searchResults(QGeoSearchReply *reply)
- {
- // The QLandmark results can be created from the simpler
- // QGeoPlace results if that is required.
- QList<QLandmark> landmarks;
- for (int i = 0; i < reply->places().size(); ++i) {
- if (reply->places().at(i).isLandmark())
- landmarks.append(QLandmark(reply->places().at(i)));
- }
-
- // ... now we have to make use of the places and landmarks ...
- reply->deleteLater();
- }
-
- void searchError(QGeoSearchReply *reply, QGeoSearchReply::Error error, const QString &errorString)
- {
- // ... inform the user that an error has occurred ...
- reply->deleteLater();
- }
-};
- \endcode
-*/
-
-/*!
-\enum QGeoSearchManager::SearchType
-
-Describes the type of search that should be performed by search().
-
-\value SearchNone
- Do not use the search string.
-\value SearchGeocode
- Use the search string as a textual address in a geocoding operation.
-\value SearchLandmarks
- Use the search string for free-text search against the available landmark
- information sources.
-\value SearchAll
- All available information sources should be used as part of the search.
*/
/*!
@@ -242,8 +158,8 @@ int QGeoSearchManager::managerVersion() const
If supportsGeocoding() returns false an
QGeoSearchReply::UnsupportedOptionError will occur.
- Once the operation has completed, QGeoSearchReply::places() can be used to
- retrieve the results, which will consist of a list of QGeoPlace objects.
+ Once the operation has completed, QGeoSearchReply::locations() can be used to
+ retrieve the results, which will consist of a list of QGeoLocation objects.
These object represent a combination of coordinate and address data.
The address data returned in the results may be different from \a address.
@@ -282,8 +198,8 @@ QGeoSearchReply* QGeoSearchManager::geocode(const QGeoAddress &address, QGeoBoun
If supportsReverseGeocoding() returns false an
QGeoSearchReply::UnsupportedOptionError will occur.
- At that point QGeoSearchReply::places() can be used to retrieve the
- results, which will consist of a list of QGeoPlace objects. These object
+ At that point QGeoSearchReply::locations() can be used to retrieve the
+ results, which will consist of a list of QGeoLocation objects. These object
represent a combination of coordinate and address data.
The coordinate data returned in the results may be different from \a
@@ -314,7 +230,7 @@ QGeoSearchReply* QGeoSearchManager::reverseGeocode(const QGeoCoordinate &coordin
}
/*!
- Begins searching for a place matching \a searchString. The value of
+ Begins searching for a location matching \a searchString. The value of
\a searchTypes will determine whether the search is for addresses only,
for landmarks only or for both.
@@ -328,24 +244,10 @@ QGeoSearchReply* QGeoSearchManager::reverseGeocode(const QGeoCoordinate &coordin
QGeoSearchManager::SearchGeocode an
QGeoSearchReply::UnsupportedOptionError will occur.
- Once the operation has completed, QGeoSearchReply::places() can be used to
- retrieve the results, which will consist of a list of QGeoPlace objects.
+ Once the operation has completed, QGeoSearchReply::locations() can be used to
+ retrieve the results, which will consist of a list of QGeoLocation objects.
These object represent a combination of coordinate and address data.
- If any of the QGeoPlace instances in the results have landmark associated
- data, QGeoPlace::isLandmark() will return true and
- QLandmark::QLandmark(const QGeoPlace &place) can be used to convert the
- QGeoPlace instance into a QLandmark instance.
-
- If \a searchTypes is QGeoSearchManager::SearchLandmarks or
- QGeoSearchManager::SearchAll, a free text landmark search will be
- performed. The results will be a combination of the backend specific
- landmark search and the same free text search applied to each of the
- QLandmarkManager instances in additionalLandmarkManagers().
-
- \note At present the additional landmark managers only search for the
- search string in the name of the landmarks.
-
If \a limit is -1 the entire result set will be returned, otherwise at most
\a limit results will be returned.
@@ -354,11 +256,6 @@ QGeoSearchReply* QGeoSearchManager::reverseGeocode(const QGeoCoordinate &coordin
The \a limit and \a offset results are used together to implement paging.
- If additional landmark managers have been setup the number of results
- returned will be at most (1 + number of additional landmark managers) *
- \a limit. This happens because the results are requested from all sources, combined, and returned once
- all sources have responded.
-
If \a bounds is non-null and a valid QGeoBoundingArea it will be used to
limit the results to thos that are contained within \a bounds.
diff --git a/src/location/maps/qgeosearchmanagerengine.cpp b/src/location/maps/qgeosearchmanagerengine.cpp
index c5ad5557..93327901 100644
--- a/src/location/maps/qgeosearchmanagerengine.cpp
+++ b/src/location/maps/qgeosearchmanagerengine.cpp
@@ -72,19 +72,6 @@ QTM_BEGIN_NAMESPACE
setSupportsReverseGeocoding(true) at some point in time before
reverseGeoocode() is called.
- The search() function will make use of the QLandmarkManager instances
- returned by additionalLandmarkManagers(). If a QLandmarkManager is used
- internally to query the service providers landmark data the
- QLandmarkManager can be made available to the users with
- setDefaultLandmarkManager().
-
- The subclass should call setSupportedSearchTypes() at some point in time
- before search() is called.
-
- If the service supports searching for places the subclass should provide
- an implementetation of search() and call setSupportedSearchTypes() at
- some point in time before search() is called.
-
A subclass of QGeoSearchManagerEngine will often make use of a subclass
fo QGeoSearchReply internally, in order to add any engine-specific
data (such as a QNetworkReply object for network-based services) to the
@@ -171,8 +158,8 @@ int QGeoSearchManagerEngine::managerVersion() const
If supportsGeocoding() returns false an
QGeoSearchReply::UnsupportedOptionError will occur.
- Once the operation has completed, QGeoSearchReply::places() can be used to
- retrieve the results, which will consist of a list of QGeoPlace objects.
+ Once the operation has completed, QGeoSearchReply::locations() can be used to
+ retrieve the results, which will consist of a list of QGeoLocation objects.
These object represent a combination of coordinate and address data.
The address data returned in the results may be different from \a address.
@@ -211,8 +198,8 @@ QGeoSearchReply* QGeoSearchManagerEngine::geocode(const QGeoAddress &address,
If supportsReverseGeocoding() returns false an
QGeoSearchReply::UnsupportedOptionError will occur.
- At that point QGeoSearchReply::places() can be used to retrieve the
- results, which will consist of a list of QGeoPlace objects. These object
+ At that point QGeoSearchReply::locations() can be used to retrieve the
+ results, which will consist of a list of QGeoLocation objects. These object
represent a combination of coordinate and address data.
The coordinate data returned in the results may be different from \a
@@ -244,9 +231,7 @@ QGeoSearchReply* QGeoSearchManagerEngine::reverseGeocode(const QGeoCoordinate &c
}
/*!
- Begins searching for a place matching \a searchString. The value of
- \a searchTypes will determine whether the search is for addresses only,
- for landmarks only or for both.
+ Begins searching for a location matching \a searchString.
A QGeoSearchReply object will be returned, which can be used to manage the
geocoding operation and to return the results of the operation.
@@ -254,28 +239,10 @@ QGeoSearchReply* QGeoSearchManagerEngine::reverseGeocode(const QGeoCoordinate &c
This engine and the returned QGeoSearchReply object will emit signals
indicating if the operation completes or if errors occur.
- If supportsGeocoding() returns false and \a searchTypes is
- QGeoSearchManagerEngine::SearchGeocode an
- QGeoSearchReply::UnsupportedOptionError will occur.
-
- Once the operation has completed, QGeoSearchReply::places() can be used to
- retrieve the results, which will consist of a list of QGeoPlace objects.
+ Once the operation has completed, QGeoSearchReply::locations() can be used to
+ retrieve the results, which will consist of a list of QGeoLocation objects.
These object represent a combination of coordinate and address data.
- If any of the QGeoPlace instances in the results have landmark associated
- data, QGeoPlace::isLandmark() will return true and
- QLandmark::QLandmark(const QGeoPlace &place) can be used to convert the
- QGeoPlace instance into a QLandmark instance.
-
- If \a searchTypes is QGeoSearchManagerEngine::SearchLandmarks or
- QGeoSearchManagerEngine::SearchAll, a free text landmark search will be
- performed. The results will be a combination of the backend specific
- landmark search and the same free text search applied to each of the
- QLandmarkManager instances in additionalLandmarkManagers().
-
- \note At present the additional landmark managers only search for the
- search string in the name of the landmarks.
-
If \a limit is -1 the entire result set will be returned, otherwise at most
\a limit results will be returned.
@@ -284,12 +251,6 @@ QGeoSearchReply* QGeoSearchManagerEngine::reverseGeocode(const QGeoCoordinate &c
The \a limit and \a offset results are used together to implement paging.
- If additional landmark managers have been setup the number of results
- returned will be at most (1 + number of additional landmark managers) *
- \a limit. This happens because the results are requested from all sources, combined, and returned once
- all sources have responded.
-
-
If \a bounds is non-null and a valid QGeoBoundingArea it will be used to
limit the results to those that are contained by \a bounds.
diff --git a/src/location/maps/qgeosearchreply.cpp b/src/location/maps/qgeosearchreply.cpp
index 371123b1..c2f5146b 100644
--- a/src/location/maps/qgeosearchreply.cpp
+++ b/src/location/maps/qgeosearchreply.cpp
@@ -73,7 +73,7 @@ QTM_BEGIN_NAMESPACE
this might be carried out.
If the operation completes successfully the results will be able to be
- accessed with places().
+ accessed with locations().
*/
/*!
@@ -126,7 +126,7 @@ QGeoSearchReply::~QGeoSearchReply()
If \a finished is true, this will cause the finished() signal to be
emitted.
- If the operation completed successfully, QGeoSearchReply::setPlaces()
+ If the operation completed successfully, QGeoSearchReply::setLocations()
should be called before this function. If an error occurred,
QGeoSearchReply::setError() should be used instead.
*/
@@ -206,30 +206,30 @@ QGeoBoundingArea* QGeoSearchReply::viewport() const
}
/*!
- Returns a list of places.
+ Returns a list of locations.
- The places are the results of the operation corresponding to the
+ The locations are the results of the operation corresponding to the
QGeoSearchManager function which created this reply.
*/
-QList<QGeoPlace> QGeoSearchReply::places() const
+QList<QGeoLocation> QGeoSearchReply::locations() const
{
- return d_ptr->places;
+ return d_ptr->locations;
}
/*!
- Adds \a place to the list of places in this reply.
+ Adds \a location to the list of locations in this reply.
*/
-void QGeoSearchReply::addPlace(const QGeoPlace &place)
+void QGeoSearchReply::addLocation(const QGeoLocation &location)
{
- d_ptr->places.append(place);
+ d_ptr->locations.append(location);
}
/*!
- Sets the list of \a places in the reply.
+ Sets the list of \a locations in the reply.
*/
-void QGeoSearchReply::setPlaces(const QList<QGeoPlace> &places)
+void QGeoSearchReply::setLocations(const QList<QGeoLocation> &locations)
{
- d_ptr->places = places;
+ d_ptr->locations = locations;
}
/*!
@@ -248,7 +248,7 @@ void QGeoSearchReply::abort()
If no limit was set this function will return -1.
- This may be more than places().length() if the number of responses
+ This may be more than locations().length() if the number of responses
was less than the number requested.
If QGeoSearchManager::search() is used along with
diff --git a/src/location/maps/qgeosearchreply.h b/src/location/maps/qgeosearchreply.h
index 0bf53864..536f6a4c 100644
--- a/src/location/maps/qgeosearchreply.h
+++ b/src/location/maps/qgeosearchreply.h
@@ -42,7 +42,7 @@
#ifndef QGEOSEARCHREPLY_H
#define QGEOSEARCHREPLY_H
-#include "qgeoplace.h"
+#include "qgeolocation.h"
#include <QObject>
#include <QList>
@@ -74,7 +74,7 @@ public:
QString errorString() const;
QGeoBoundingArea* viewport() const;
- QList<QGeoPlace> places() const;
+ QList<QGeoLocation>locations() const;
int limit() const;
int offset() const;
@@ -92,8 +92,8 @@ protected:
void setFinished(bool finished);
void setViewport(QGeoBoundingArea *viewport);
- void addPlace(const QGeoPlace &place);
- void setPlaces(const QList<QGeoPlace> &places);
+ void addLocation(const QGeoLocation &location);
+ void setLocations(const QList<QGeoLocation> &locations);
void setLimit(int limit);
void setOffset(int offset);
diff --git a/src/location/maps/qgeosearchreply_p.h b/src/location/maps/qgeosearchreply_p.h
index 50bf9d6d..fc2072fe 100644
--- a/src/location/maps/qgeosearchreply_p.h
+++ b/src/location/maps/qgeosearchreply_p.h
@@ -61,7 +61,7 @@
QTM_BEGIN_NAMESPACE
-class QGeoPlace;
+class QGeoLocation;
class QGeoSearchReplyPrivate
{
@@ -75,7 +75,7 @@ public:
bool isFinished;
QGeoBoundingArea* viewport;
- QList<QGeoPlace> places;
+ QList<QGeoLocation> locations;
int limit;
int offset;
diff --git a/src/location/maps/qgeoserviceproviderfactory.cpp b/src/location/maps/qgeoserviceproviderfactory.cpp
index 83827517..a2e7f03b 100644
--- a/src/location/maps/qgeoserviceproviderfactory.cpp
+++ b/src/location/maps/qgeoserviceproviderfactory.cpp
@@ -89,8 +89,7 @@ amongst the plugins.
/*!
Returns a new QGeoSearchManagerEngine instance, initialized with \a
- parameters, which implements as much of the places searching functionality
- as the service provider supports.
+ parameters, which implements the location searching functionality.
If \a error is not 0 it should be set to QGeoServiceProvider::NoError on
success or an appropriate QGeoServiceProvider::Error on failure.
@@ -114,8 +113,7 @@ QGeoSearchManagerEngine* QGeoServiceProviderFactory::createSearchManagerEngine(c
/*!
Returns a new QGeoMappingManagerEngine instance, initialized with \a
- parameters, which implements as much of the places searching functionality
- as the service provider supports.
+ parameters, which implements the location searching functionality.
If \a error is not 0 it should be set to QGeoServiceProvider::NoError on
success or an appropriate QGeoServiceProvider::Error on failure.
@@ -139,8 +137,7 @@ QGeoMappingManagerEngine* QGeoServiceProviderFactory::createMappingManagerEngine
/*!
Returns a new QGeoRoutingManagerEngine instance, initialized with \a
- parameters, which implements as much of the places searching functionality
- as the service provider supports.
+ parameters, which implements the location searching functionality.
If \a error is not 0 it should be set to QGeoServiceProvider::NoError on
success or an appropriate QGeoServiceProvider::Error on failure.