summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/location/declarativemaps/qdeclarativegeocodemodel.cpp3
-rw-r--r--src/location/declarativeplaces/qdeclarativesearchmodelbase.cpp3
-rw-r--r--src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp4
-rw-r--r--src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp26
-rw-r--r--src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp4
-rw-r--r--src/plugins/geoservices/osm/qplacemanagerengineosm.cpp20
6 files changed, 24 insertions, 36 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeocodemodel.cpp b/src/location/declarativemaps/qdeclarativegeocodemodel.cpp
index 3e2a1aea..b64b2545 100644
--- a/src/location/declarativemaps/qdeclarativegeocodemodel.cpp
+++ b/src/location/declarativemaps/qdeclarativegeocodemodel.cpp
@@ -42,6 +42,7 @@
#include <QtPositioning/QGeoCircle>
#include <QtLocation/QGeoServiceProvider>
#include <QtLocation/QGeoCodingManager>
+#include <QtPositioning/QGeoPolygon>
QT_BEGIN_NAMESPACE
@@ -374,6 +375,8 @@ QVariant QDeclarativeGeocodeModel::bounds() const
return QVariant::fromValue(QGeoRectangle(boundingArea_));
else if (boundingArea_.type() == QGeoShape::CircleType)
return QVariant::fromValue(QGeoCircle(boundingArea_));
+ else if (boundingArea_.type() == QGeoShape::PolygonType)
+ return QVariant::fromValue(QGeoPolygon(boundingArea_));
else
return QVariant::fromValue(boundingArea_);
}
diff --git a/src/location/declarativeplaces/qdeclarativesearchmodelbase.cpp b/src/location/declarativeplaces/qdeclarativesearchmodelbase.cpp
index 4dfdd25d..92e298d3 100644
--- a/src/location/declarativeplaces/qdeclarativesearchmodelbase.cpp
+++ b/src/location/declarativeplaces/qdeclarativesearchmodelbase.cpp
@@ -45,6 +45,7 @@
#include <QtLocation/QPlaceSearchRequest>
#include <QtLocation/QPlaceSearchReply>
#include <QtPositioning/QGeoCircle>
+#include <QtPositioning/QGeoPolygon>
QT_BEGIN_NAMESPACE
@@ -89,6 +90,8 @@ QVariant QDeclarativeSearchModelBase::searchArea() const
return QVariant::fromValue(QGeoRectangle(s));
else if (s.type() == QGeoShape::CircleType)
return QVariant::fromValue(QGeoCircle(s));
+ else if (s.type() == QGeoShape::PolygonType)
+ return QVariant::fromValue(QGeoPolygon(s));
else
return QVariant::fromValue(s);
}
diff --git a/src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp b/src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp
index fcdc5962..976c51cf 100644
--- a/src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp
+++ b/src/plugins/geoservices/esri/geocodingmanagerengine_esri.cpp
@@ -118,8 +118,8 @@ QGeoCodeReply *GeoCodingManagerEngineEsri::geocode(const QString &address, int l
query.addQueryItem(QStringLiteral("f"), QStringLiteral("json"));
query.addQueryItem(QStringLiteral("outFields"), "*");
- if (bounds.type() == QGeoShape::RectangleType)
- query.addQueryItem(QStringLiteral("searchExtent"), boundingBoxToLtrb(bounds));
+ if (bounds.type() != QGeoShape::UnknownType)
+ query.addQueryItem(QStringLiteral("searchExtent"), boundingBoxToLtrb(bounds.boundingGeoRectangle()));
if (limit != -1)
query.addQueryItem(QStringLiteral("maxLocations"), QString::number(limit));
diff --git a/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp
index b3c74a63..68b2429e 100644
--- a/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp
@@ -111,18 +111,8 @@ QGeoCodeReply *QGeoCodingManagerEngineNokia::geocode(const QGeoAddress &address,
requestString += languageToMarc(locale().language());
bool manualBoundsRequired = false;
- if (bounds.type() == QGeoShape::RectangleType) {
- QGeoRectangle rect(bounds);
- if (rect.isValid()) {
- requestString += "&bbox=";
- requestString += trimDouble(rect.topLeft().latitude());
- requestString += ",";
- requestString += trimDouble(rect.topLeft().longitude());
- requestString += ";";
- requestString += trimDouble(rect.bottomRight().latitude());
- requestString += ",";
- requestString += trimDouble(rect.bottomRight().longitude());
- }
+ if (bounds.type() == QGeoShape::UnknownType) {
+ manualBoundsRequired = true;
} else if (bounds.type() == QGeoShape::CircleType) {
QGeoCircle circ(bounds);
if (circ.isValid()) {
@@ -134,7 +124,17 @@ QGeoCodeReply *QGeoCodingManagerEngineNokia::geocode(const QGeoAddress &address,
requestString += trimDouble(circ.radius());
}
} else {
- manualBoundsRequired = true;
+ QGeoRectangle rect = bounds.boundingGeoRectangle();
+ if (rect.isValid()) {
+ requestString += "&bbox=";
+ requestString += trimDouble(rect.topLeft().latitude());
+ requestString += ",";
+ requestString += trimDouble(rect.topLeft().longitude());
+ requestString += ";";
+ requestString += trimDouble(rect.bottomRight().latitude());
+ requestString += ",";
+ requestString += trimDouble(rect.bottomRight().longitude());
+ }
}
if (address.country().isEmpty()) {
diff --git a/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp
index 693a80a1..6065870a 100644
--- a/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp
@@ -111,8 +111,8 @@ QGeoCodeReply *QGeoCodingManagerEngineOsm::geocode(const QString &address, int l
query.addQueryItem(QStringLiteral("format"), QStringLiteral("json"));
query.addQueryItem(QStringLiteral("accept-language"), locale().name().left(2));
//query.addQueryItem(QStringLiteral("countrycodes"), QStringLiteral("au,jp"));
- if (bounds.type() == QGeoShape::RectangleType) {
- query.addQueryItem(QStringLiteral("viewbox"), boundingBoxToLtrb(bounds));
+ if (bounds.type() != QGeoShape::UnknownType) {
+ query.addQueryItem(QStringLiteral("viewbox"), boundingBoxToLtrb(bounds.boundingGeoRectangle()));
query.addQueryItem(QStringLiteral("bounded"), QStringLiteral("1"));
}
query.addQueryItem(QStringLiteral("polygon_geojson"), QStringLiteral("1"));
diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
index dcf02b13..16632b67 100644
--- a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp
@@ -134,25 +134,7 @@ QPlaceSearchReply *QPlaceManagerEngineOsm::search(const QPlaceSearchRequest &req
//queryItems.addQueryItem(QStringLiteral("accept-language"), QStringLiteral("en"));
- QGeoRectangle boundingBox;
- QGeoShape searchArea = request.searchArea();
- switch (searchArea.type()) {
- case QGeoShape::CircleType: {
- QGeoCircle c(searchArea);
- qreal radius = c.radius();
- if (radius < 0)
- radius = 50000;
-
- boundingBox = QGeoRectangle(c.center().atDistanceAndAzimuth(radius, -45),
- c.center().atDistanceAndAzimuth(radius, 135));
- break;
- }
- case QGeoShape::RectangleType:
- boundingBox = searchArea;
- break;
- default:
- ;
- }
+ QGeoRectangle boundingBox = request.searchArea().boundingGeoRectangle();
if (!boundingBox.isEmpty()) {
queryItems.addQueryItem(QStringLiteral("bounded"), QStringLiteral("1"));