diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-12-20 17:48:00 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-01-09 10:37:50 +0000 |
commit | cc988feee350e3ff35d11c7c484fed08981ef67c (patch) | |
tree | d4f05112f90c240e22ef0f54a93472ed9ba6408a /src/plugins/geoservices/osm | |
parent | 4b7889ff9e3784f9201b7d878606a9f84521815a (diff) | |
download | qtlocation-cc988feee350e3ff35d11c7c484fed08981ef67c.tar.gz |
Use QGeoShapes properly throughout the module
Adds proper support to other valid shapes and use ::boundingGeoRectangle
where appropriate.
Change-Id: Ibba4cb18f5cca08df62d15b76fa0e1f249dc6fbb
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/geoservices/osm')
-rw-r--r-- | src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp | 4 | ||||
-rw-r--r-- | src/plugins/geoservices/osm/qplacemanagerengineosm.cpp | 20 |
2 files changed, 3 insertions, 21 deletions
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")); |