diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-18 13:10:38 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-18 13:10:45 +0200 |
commit | d0dc1ae432340a66f0b22102ec514017a23888a2 (patch) | |
tree | 8e6f66f0bab8d24e7b259103282f2411417082b4 /src | |
parent | d999495a01cf6b6cb206a968944b889ab29e3450 (diff) | |
parent | 5d0481603414a4584dbfe89aaba48a6135b9e2d8 (diff) | |
download | qtlocation-d0dc1ae432340a66f0b22102ec514017a23888a2.tar.gz |
Merge remote-tracking branch 'origin/5.7' into 5.8
Change-Id: I5bcca8956007506362c5a96ff345e28718da584c
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/location/qdeclarativegeomap.cpp | 5 | ||||
-rw-r--r-- | src/imports/location/qquickgeomapgesturearea_p.h | 2 | ||||
-rw-r--r-- | src/location/doc/src/plugins/osm.qdoc | 4 | ||||
-rw-r--r-- | src/plugins/geoservices/osm/qgeocodereplyosm.cpp | 57 | ||||
-rw-r--r-- | src/positioning/qgeosatelliteinfosource.cpp | 3 |
5 files changed, 38 insertions, 33 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index 1a624e15..83130b95 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -547,13 +547,14 @@ void QDeclarativeGeoMap::mappingManagerInitialized() //The zoom level limits are only restricted by the plugins values, if the user has set a more //strict zoom level limit before initialization nothing is done here. //minimum zoom level might be changed to limit gray bundaries - if (m_mappingManager->cameraCapabilities().minimumZoomLevel() > m_gestureArea->minimumZoomLevel()) - setMinimumZoomLevel(m_mappingManager->cameraCapabilities().minimumZoomLevel()); if (m_gestureArea->maximumZoomLevel() < 0 || m_mappingManager->cameraCapabilities().maximumZoomLevel() < m_gestureArea->maximumZoomLevel()) setMaximumZoomLevel(m_mappingManager->cameraCapabilities().maximumZoomLevel()); + if (m_mappingManager->cameraCapabilities().minimumZoomLevel() > m_gestureArea->minimumZoomLevel()) + setMinimumZoomLevel(m_mappingManager->cameraCapabilities().minimumZoomLevel()); + // Map tiles are built in this call. m_map->minimumZoom() becomes operational // after this has been called at least once, after creation. diff --git a/src/imports/location/qquickgeomapgesturearea_p.h b/src/imports/location/qquickgeomapgesturearea_p.h index cfd8738e..51c5cc1e 100644 --- a/src/imports/location/qquickgeomapgesturearea_p.h +++ b/src/imports/location/qquickgeomapgesturearea_p.h @@ -242,7 +242,7 @@ private: bool m_enabled; struct Zoom { - Zoom() : m_minimum(-1.0), m_maximum(-1.0), m_start(0.0), m_previous(0.0), + Zoom() : m_minimum(-1.0), m_maximum(20.0), m_start(0.0), m_previous(0.0), maximumChange(4.0) {} qreal m_minimum; qreal m_maximum; diff --git a/src/location/doc/src/plugins/osm.qdoc b/src/location/doc/src/plugins/osm.qdoc index 1459909d..d402307f 100644 --- a/src/location/doc/src/plugins/osm.qdoc +++ b/src/location/doc/src/plugins/osm.qdoc @@ -63,7 +63,9 @@ a prefix. \row \li osm.useragent \li User agent string set when making network requests. This parameter should be set to a - value that uniquely identifies the application. + value that uniquely identifies the application. Note that providers might block applications not setting this + parameter, leaving it to the stock plugin user agent (e.g., \l {http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy}{Nominatim} + for geocoding) \row \li osm.mapping.custom.host \li Url string set when making network requests to the tile server. This parameter should be set to a diff --git a/src/plugins/geoservices/osm/qgeocodereplyosm.cpp b/src/plugins/geoservices/osm/qgeocodereplyosm.cpp index 807f7a9c..15b1724e 100644 --- a/src/plugins/geoservices/osm/qgeocodereplyosm.cpp +++ b/src/plugins/geoservices/osm/qgeocodereplyosm.cpp @@ -77,6 +77,35 @@ void QGeoCodeReplyOsm::abort() m_reply = 0; } +static QGeoAddress parseAddressObject(const QJsonObject &object) +{ + QGeoAddress address; + address.setText(object.value(QStringLiteral("display_name")).toString()); + QJsonObject ao = object.value(QStringLiteral("address")).toObject(); + // setCountry + address.setCountry(ao.value(QStringLiteral("country")).toString()); + // setCountryCode + address.setCountryCode(ao.value(QStringLiteral("country_code")).toString()); + // setState + address.setState(ao.value(QStringLiteral("state")).toString()); + // setCity + if (ao.contains(QLatin1String("city"))) + address.setCity(ao.value(QStringLiteral("city")).toString()); + else if (ao.contains(QLatin1String("town"))) + address.setCity(ao.value(QLatin1String("town")).toString()); + else if (ao.contains(QLatin1String("village"))) + address.setCity(ao.value(QLatin1String("village")).toString()); + else + address.setCity(ao.value(QLatin1String("hamlet")).toString()); + // setDistrict + address.setDistrict(ao.value(QStringLiteral("suburb")).toString()); + // setPostalCode + address.setPostalCode(ao.value(QStringLiteral("postcode")).toString()); + // setStreet + address.setStreet(ao.value(QStringLiteral("road")).toString()); + return address; +} + void QGeoCodeReplyOsm::networkReplyFinished() { if (!m_reply) @@ -96,21 +125,9 @@ void QGeoCodeReplyOsm::networkReplyFinished() coordinate.setLatitude(object.value(QStringLiteral("lat")).toString().toDouble()); coordinate.setLongitude(object.value(QStringLiteral("lon")).toString().toDouble()); - QJsonObject ao = object.value(QStringLiteral("address")).toObject(); - - QGeoAddress address; - address.setText(object.value(QStringLiteral("display_name")).toString()); - address.setCountry(ao.value(QStringLiteral("country")).toString()); - address.setCountryCode(ao.value(QStringLiteral("country_code")).toString()); - address.setState(ao.value(QStringLiteral("state")).toString()); - address.setCity(ao.value(QStringLiteral("city")).toString()); - address.setDistrict(ao.value(QStringLiteral("suburb")).toString()); - address.setPostalCode(ao.value(QStringLiteral("postcode")).toString()); - address.setStreet(ao.value(QStringLiteral("road")).toString()); - QGeoLocation location; location.setCoordinate(coordinate); - location.setAddress(address); + location.setAddress(parseAddressObject(object)); locations.append(location); @@ -141,22 +158,10 @@ void QGeoCodeReplyOsm::networkReplyFinished() } } - QJsonObject ao = object.value(QStringLiteral("address")).toObject(); - - QGeoAddress address; - address.setText(object.value(QStringLiteral("display_name")).toString()); - address.setCountry(ao.value(QStringLiteral("country")).toString()); - address.setCountryCode(ao.value(QStringLiteral("country_code")).toString()); - address.setState(ao.value(QStringLiteral("state")).toString()); - address.setCity(ao.value(QStringLiteral("city")).toString()); - address.setDistrict(ao.value(QStringLiteral("suburb")).toString()); - address.setPostalCode(ao.value(QStringLiteral("postcode")).toString()); - address.setStreet(ao.value(QStringLiteral("road")).toString()); - QGeoLocation location; location.setCoordinate(coordinate); location.setBoundingBox(rectangle); - location.setAddress(address); + location.setAddress(parseAddressObject(object)); locations.append(location); } diff --git a/src/positioning/qgeosatelliteinfosource.cpp b/src/positioning/qgeosatelliteinfosource.cpp index 1cd1588b..297f4849 100644 --- a/src/positioning/qgeosatelliteinfosource.cpp +++ b/src/positioning/qgeosatelliteinfosource.cpp @@ -82,9 +82,6 @@ QT_BEGIN_NAMESPACE Note that the satellite source may have a minimum value requirement for update intervals, as returned by minimumUpdateInterval(). - - \warning On Windows CE it is not possible to detect if a device is GPS enabled. - The default satellite source on a Windows CE device without GPS support will never provide any satellite data. */ class QGeoSatelliteInfoSourcePrivate |