diff options
author | Liang Qi <liang.qi@qt.io> | 2017-07-06 13:54:57 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-07-06 13:55:56 +0200 |
commit | 40b8d8f0b1c4d3dfdb63994f1c5d9e16760496f7 (patch) | |
tree | 0ad7002074b2996460d72722435c97d76ddc6466 /src | |
parent | 420139a36dace3bb8f78f2d65b30f7657668d888 (diff) | |
parent | 5542c721af400750b13bd411dfbb13891f49618e (diff) | |
download | qtlocation-40b8d8f0b1c4d3dfdb63994f1c5d9e16760496f7.tar.gz |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
.qmake.conf
Change-Id: I3241efba9c3a32a4a097a67fd6432c45aad8e6ef
Diffstat (limited to 'src')
20 files changed, 156 insertions, 56 deletions
diff --git a/src/imports/positioning/plugins.qmltypes b/src/imports/positioning/plugins.qmltypes index ace5bfae..859736a1 100644 --- a/src/imports/positioning/plugins.qmltypes +++ b/src/imports/positioning/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtPositioning 5.8' +// 'qmlplugindump -nonrelocatable QtPositioning 5.9' Module { dependencies: ["QtQuick 2.8"] @@ -61,6 +61,18 @@ Module { type: "QGeoCircle" Parameter { name: "center"; type: "QGeoCoordinate" } } + Method { name: "path"; type: "QGeoPath" } + Method { + name: "path" + type: "QGeoPath" + Parameter { name: "value"; type: "QJSValue" } + Parameter { name: "width"; type: "double" } + } + Method { + name: "path" + type: "QGeoPath" + Parameter { name: "value"; type: "QJSValue" } + } Method { name: "shapeToCircle" type: "QGeoCircle" @@ -71,6 +83,11 @@ Module { type: "QGeoRectangle" Parameter { name: "shape"; type: "QGeoShape" } } + Method { + name: "shapeToPath" + type: "QGeoPath" + Parameter { name: "shape"; type: "QGeoShape" } + } } Component { name: "QDeclarativeGeoAddress" @@ -106,7 +123,7 @@ Module { "QtPositioning/Position 5.0", "QtPositioning/Position 5.3", "QtPositioning/Position 5.4", - "QtPositioning/Position 5.8" + "QtPositioning/Position 5.9" ] exportMetaObjectRevisions: [0, 1, 2, 2] Property { name: "latitudeValid"; type: "bool"; isReadonly: true } @@ -191,7 +208,8 @@ Module { values: { "UnknownType": 0, "RectangleType": 1, - "CircleType": 2 + "CircleType": 2, + "PathType": 3 } } Property { name: "type"; type: "ShapeType"; isReadonly: true } @@ -202,6 +220,12 @@ Module { type: "bool" Parameter { name: "coordinate"; type: "QGeoCoordinate" } } + Method { name: "boundingGeoRectangle"; type: "QGeoRectangle" } + Method { name: "center"; type: "QGeoCoordinate" } + Method { + name: "extendShape" + Parameter { name: "coordinate"; type: "QGeoCoordinate" } + } Method { name: "toString"; type: "string" } } Component { diff --git a/src/imports/positioning/positioning.cpp b/src/imports/positioning/positioning.cpp index b1576e3c..585445b5 100644 --- a/src/imports/positioning/positioning.cpp +++ b/src/imports/positioning/positioning.cpp @@ -581,14 +581,14 @@ public: // Introduction of 5.3 version; existing 5.0 exports become automatically available under 5.3 minor = 3; qmlRegisterType<QQuickGeoCoordinateAnimation >(uri, major, minor, "CoordinateAnimation"); - qmlRegisterType<QDeclarativePosition, 1 >(uri, major, minor, "Position"); + qmlRegisterType<QDeclarativePosition, 1>(uri, major, minor, "Position"); minor = 4; qmlRegisterType<QDeclarativePosition, 2>(uri, major, minor, "Position"); - // Register the 5.8 types - // Introduction of 5.8 version; existing 5.4 exports become automatically available under 5.8 - minor = 8; + // Register the 5.9 types + // Introduction of 5.9 version; existing 5.4 exports become automatically available under 5.9 + minor = 9; qmlRegisterType<QDeclarativePosition, 2>(uri, major, minor, "Position"); } else { qDebug() << "Unsupported URI given to load positioning QML plugin: " << QLatin1String(uri); diff --git a/src/location/declarativemaps/qdeclarativegeocodemodel.cpp b/src/location/declarativemaps/qdeclarativegeocodemodel.cpp index d874f9a2..ee435a5a 100644 --- a/src/location/declarativemaps/qdeclarativegeocodemodel.cpp +++ b/src/location/declarativemaps/qdeclarativegeocodemodel.cpp @@ -69,9 +69,9 @@ QT_BEGIN_NAMESPACE will update its output automatically. Otherwise, the \l{update} method may be used. By default, autoUpdate is disabled. - The data stored and returned in the GeocodeModel consists of \l{Location} + The data stored and returned in the GeocodeModel consists of \l [QML] {Location} objects, as a list with the role name "locationData". See the documentation - for \l{Location} for further details on its structure and contents. + for \l [QML] {Location} for further details on its structure and contents. \section2 Example Usage @@ -519,7 +519,7 @@ int QDeclarativeGeocodeModel::count() const /*! \qmlmethod Location QtLocation::GeocodeModel::get(int) - Returns the Location at given index. Use \l count property to check the + Returns the \l [QML] {Location} at given index. Use \l count property to check the amount of locations available. The locations are indexed from zero, so the accessible range is 0...(count - 1). diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index 9f4dae3f..f5d2bdb5 100644 --- a/src/location/declarativemaps/qdeclarativegeomap.cpp +++ b/src/location/declarativemaps/qdeclarativegeomap.cpp @@ -1324,7 +1324,17 @@ QGeoShape QDeclarativeGeoMap::visibleRegion() const for (const QDoubleVector2D &c: visibleRegion) path.addCoordinate(m_map->geoProjection().wrappedMapProjectionToGeo(c)); - return path.boundingGeoRectangle(); + QGeoRectangle vr = path.boundingGeoRectangle(); + + bool empty = vr.topLeft().latitude() == vr.bottomRight().latitude() || + qFuzzyCompare(vr.topLeft().longitude(), vr.bottomRight().longitude()); // QTBUG-57690 + + if (empty) { + vr.setTopLeft(QGeoCoordinate(vr.topLeft().latitude(), -180)); + vr.setBottomRight(QGeoCoordinate(vr.bottomRight().latitude(), 180)); + } + + return vr; } /*! @@ -1831,9 +1841,7 @@ void QDeclarativeGeoMap::clearMapItems() \qmlmethod void QtLocation::Map::addMapItemGroup(MapItemGroup itemGroup) Adds the map items contained in the given \a itemGroup to the Map - (for example MapQuickItem, MapCircle). These items will be reparented, and the map - will be their new parent. Property bindings defined using \e{parent.} inside a MapItemGroup - will therefore not work. + (for example MapQuickItem, MapCircle). \sa MapItemGroup, removeMapItemGroup @@ -1841,13 +1849,11 @@ void QDeclarativeGeoMap::clearMapItems() */ void QDeclarativeGeoMap::addMapItemGroup(QDeclarativeGeoMapItemGroup *itemGroup) { - if (!itemGroup) + if (!itemGroup || itemGroup->quickMap()) // || Already added to some map return; + itemGroup->setQuickMap(this); QPointer<QDeclarativeGeoMapItemGroup> g(itemGroup); - if (m_mapItemGroups.contains(g)) - return; - m_mapItemGroups.append(g); const QList<QQuickItem *> quickKids = g->childItems(); for (auto c: quickKids) { @@ -1869,7 +1875,7 @@ void QDeclarativeGeoMap::addMapItemGroup(QDeclarativeGeoMapItemGroup *itemGroup) */ void QDeclarativeGeoMap::removeMapItemGroup(QDeclarativeGeoMapItemGroup *itemGroup) { - if (!itemGroup) + if (!itemGroup || itemGroup->quickMap() != this) // cant remove an itemGroup added to another map return; QPointer<QDeclarativeGeoMapItemGroup> g(itemGroup); @@ -1882,6 +1888,7 @@ void QDeclarativeGeoMap::removeMapItemGroup(QDeclarativeGeoMapItemGroup *itemGro if (mapItem) removeMapItem(mapItem); } + itemGroup->setQuickMap(nullptr); itemGroup->setParentItem(0); } diff --git a/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice.cpp b/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice.cpp index 1101eb18..1a8489eb 100644 --- a/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice.cpp @@ -129,20 +129,29 @@ void QDeclarativeGeoMapCopyrightNotice::setMapSource(QDeclarativeGeoMap *mapSour if (mapSource) { m_mapSource = mapSource; // First update the copyright. Only Image will do here, no need to store HTML right away. - if (!mapSource->m_copyrights->m_copyrightsImage.isNull()) + if (mapSource->m_copyrights && !mapSource->m_copyrights->m_copyrightsImage.isNull()) m_copyrightsImage = mapSource->m_copyrights->m_copyrightsImage; connect(m_mapSource, SIGNAL(copyrightsChanged(QImage)), this, SLOT(copyrightsChanged(QImage))); connect(m_mapSource, SIGNAL(copyrightsChanged(QString)), this, SLOT(copyrightsChanged(QString))); - connect(m_mapSource->m_map, SIGNAL(copyrightsStyleSheetChanged(QString)), - this, SLOT(onCopyrightsStyleSheetChanged(QString))); - connect(this, SIGNAL(linkActivated(QString)), - m_mapSource, SIGNAL(copyrightLinkActivated(QString))); - onCopyrightsStyleSheetChanged(m_mapSource->m_map->copyrightsStyleSheet()); + if (m_mapSource->m_map) + connectMap(); + else + connect(m_mapSource, &QDeclarativeGeoMap::mapReadyChanged, this, &QDeclarativeGeoMapCopyrightNotice::connectMap); } +} + +void QDeclarativeGeoMapCopyrightNotice::connectMap() +{ + connect(m_mapSource->m_map, SIGNAL(copyrightsStyleSheetChanged(QString)), + this, SLOT(onCopyrightsStyleSheetChanged(QString))); + connect(this, SIGNAL(linkActivated(QString)), + m_mapSource, SIGNAL(copyrightLinkActivated(QString))); + + onCopyrightsStyleSheetChanged(m_mapSource->m_map->copyrightsStyleSheet()); update(); emit mapSourceChanged(); diff --git a/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice_p.h b/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice_p.h index b09d7c1d..0d7f7a20 100644 --- a/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice_p.h +++ b/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice_p.h @@ -96,6 +96,7 @@ protected: void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void rasterizeHtmlAndUpdate(); + void connectMap(); private: void createCopyright(); diff --git a/src/location/declarativemaps/qdeclarativegeomapitemgroup.cpp b/src/location/declarativemaps/qdeclarativegeomapitemgroup.cpp index ee382353..59aaaa26 100644 --- a/src/location/declarativemaps/qdeclarativegeomapitemgroup.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapitemgroup.cpp @@ -135,7 +135,7 @@ QT_BEGIN_NAMESPACE \image api-mapitemgroup.png */ -QDeclarativeGeoMapItemGroup::QDeclarativeGeoMapItemGroup(QQuickItem *parent): QQuickItem(parent) +QDeclarativeGeoMapItemGroup::QDeclarativeGeoMapItemGroup(QQuickItem *parent): QQuickItem(parent), m_quickMap(nullptr) { } @@ -145,4 +145,14 @@ QDeclarativeGeoMapItemGroup::~QDeclarativeGeoMapItemGroup() } +void QDeclarativeGeoMapItemGroup::setQuickMap(QDeclarativeGeoMap *quickMap) +{ + m_quickMap = quickMap; +} + +QDeclarativeGeoMap *QDeclarativeGeoMapItemGroup::quickMap() const +{ + return m_quickMap; +} + QT_END_NAMESPACE diff --git a/src/location/declarativemaps/qdeclarativegeomapitemgroup_p.h b/src/location/declarativemaps/qdeclarativegeomapitemgroup_p.h index 1b008d71..f91d291c 100644 --- a/src/location/declarativemaps/qdeclarativegeomapitemgroup_p.h +++ b/src/location/declarativemaps/qdeclarativegeomapitemgroup_p.h @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE +class QDeclarativeGeoMap; class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapItemGroup : public QQuickItem { Q_OBJECT @@ -60,6 +61,10 @@ public: explicit QDeclarativeGeoMapItemGroup(QQuickItem *parent = 0); virtual ~QDeclarativeGeoMapItemGroup(); + void setQuickMap(QDeclarativeGeoMap *quickMap); + QDeclarativeGeoMap *quickMap() const; +private: + QDeclarativeGeoMap *m_quickMap; }; QT_END_NAMESPACE diff --git a/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp b/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp index cb5cce9a..86d67cf8 100644 --- a/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp @@ -393,9 +393,20 @@ void QDeclarativeGeoMapQuickItem::updatePolish() matrix_->setMatrix(map()->geoProjection().quickItemTransformation(coordinate(), anchorPoint_, zoomLevel_)); setPosition(QPointF(0,0)); } else { - if (matrix_) - matrix_->setMatrix(QMatrix4x4()); - setPositionOnMap(coordinate(), anchorPoint_); + // if the coordinate is behind the camera, we use the transformation to get the item out of the way + if (map()->cameraData().tilt() > 0.0 + && !map()->geoProjection().isProjectable(map()->geoProjection().geoToWrappedMapProjection(coordinate()))) { + if (!matrix_) { + matrix_ = new QMapQuickItemMatrix4x4(this); + matrix_->appendToItem(opacityContainer_); + } + matrix_->setMatrix(map()->geoProjection().quickItemTransformation(coordinate(), anchorPoint_, map()->cameraData().zoomLevel())); + setPosition(QPointF(0,0)); + } else { + if (matrix_) + matrix_->setMatrix(QMatrix4x4()); + setPositionOnMap(coordinate(), anchorPoint_); + } } } diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp index 54f70c11..4b8b2d7c 100644 --- a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp +++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp @@ -36,6 +36,7 @@ #include "qdeclarativegeoserviceprovider_p.h" #include <QtQml/QQmlInfo> +#include <QtQml/QQmlEngine> QT_BEGIN_NAMESPACE @@ -399,6 +400,19 @@ QDeclarativeGeoServiceProviderRequirements *QDeclarativeGeoServiceProvider::requ return required_; } +void QDeclarativeGeoServiceProvider::setRequirements(QDeclarativeGeoServiceProviderRequirements *req) +{ + if (!name().isEmpty() || !req) + return; + + if (required_ && *required_ == *req) + return; + + delete required_; + required_ = req; + QQmlEngine::setObjectOwnership(req, QQmlEngine::CppOwnership); // To prevent the engine from making this object disappear +} + /*! \qmlproperty stringlist Plugin::preferred @@ -732,6 +746,12 @@ bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvid return true; } +bool QDeclarativeGeoServiceProviderRequirements::operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const +{ + return (mapping_ == rhs.mapping_ && routing_ == rhs.routing_ + && geocoding_ == rhs.geocoding_ && places_ == rhs.places_); +} + /******************************************************************************* *******************************************************************************/ diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h index bcf67124..426c6b4d 100644 --- a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h +++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h @@ -100,7 +100,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProvider : public QObject, Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(QStringList availableServiceProviders READ availableServiceProviders CONSTANT) Q_PROPERTY(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> parameters READ parameters) - Q_PROPERTY(QDeclarativeGeoServiceProviderRequirements *required READ requirements) + Q_PROPERTY(QDeclarativeGeoServiceProviderRequirements *required READ requirements WRITE setRequirements) Q_PROPERTY(QStringList locales READ locales WRITE setLocales NOTIFY localesChanged) Q_PROPERTY(QStringList preferred READ preferred WRITE setPreferred NOTIFY preferredChanged) Q_PROPERTY(bool allowExperimental READ allowExperimental WRITE setAllowExperimental NOTIFY allowExperimentalChanged) @@ -182,6 +182,7 @@ public: QStringList availableServiceProviders(); QDeclarativeGeoServiceProviderRequirements *requirements() const; + void setRequirements(QDeclarativeGeoServiceProviderRequirements *req); QStringList preferred() const; void setPreferred(const QStringList &val); @@ -259,6 +260,8 @@ public: Q_INVOKABLE bool matches(const QGeoServiceProvider *provider) const; + bool operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const; + Q_SIGNALS: void mappingRequirementsChanged(const QDeclarativeGeoServiceProvider::MappingFeatures &features); void routingRequirementsChanged(const QDeclarativeGeoServiceProvider::RoutingFeatures &features); diff --git a/src/location/doc/src/plugins/mapbox.qdoc b/src/location/doc/src/plugins/mapbox.qdoc index e962bead..8f83ae55 100644 --- a/src/location/doc/src/plugins/mapbox.qdoc +++ b/src/location/doc/src/plugins/mapbox.qdoc @@ -70,6 +70,9 @@ The following table lists optional parameters that can be passed to the Mapbox p \li \l{https://www.mapbox.com/help/define-map-id/}{ID} of the Mapbox map to show. An example ID is "examples.map-zr0njcqy". If this parameter is present, the specified map type will be used by default, unless another is selected. If not present, the default Mapbox map ID is "mapbox.streets". + \b{Note:} neither in this parameter nor in \b{mapbox.mapping.additional_map_ids} it is allowed to use repeated map_ids. + This includes the map_ids bundled in the plugin by default (documented \l{https://www.mapbox.com/api-documentation/#maps}{here} under + \b{Mapbox classic map IDs}). Failing to do so will cause tile cache corruption. \row \li mapbox.mapping.additional_map_ids \li Additional, comma separated, Mapbox map IDs to be added to the available map types. diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp index 319bf906..783193ed 100644 --- a/src/location/maps/qgeoprojection.cpp +++ b/src/location/maps/qgeoprojection.cpp @@ -254,7 +254,7 @@ QGeoCoordinate QGeoProjectionWebMercator::wrappedMapProjectionToGeo(const QDoubl return mapProjectionToGeo(unwrapMapProjection(wrappedProjection)); } -QMatrix4x4 QGeoProjectionWebMercator::quickItemTransformation(const QGeoCoordinate &coordinate, const QPointF &anchorPoint, double zoomLevel) const +QMatrix4x4 QGeoProjectionWebMercator::quickItemTransformation(const QGeoCoordinate &coordinate, const QPointF &anchorPoint, qreal zoomLevel) const { const QDoubleVector2D coordWrapped = geoToWrappedMapProjection(coordinate); double scale = std::pow(0.5, zoomLevel - m_cameraData.zoomLevel()); diff --git a/src/location/maps/qgeotiledmapscene.cpp b/src/location/maps/qgeotiledmapscene.cpp index 422082fc..ab15e37b 100644 --- a/src/location/maps/qgeotiledmapscene.cpp +++ b/src/location/maps/qgeotiledmapscene.cpp @@ -609,6 +609,8 @@ void QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode *root, #if QT_CONFIG(opengl) if (ogl) static_cast<QSGDefaultImageNode *>(node)->setAnisotropyLevel(QSGTexture::Anisotropy16x); +#else + Q_UNUSED(ogl) #endif dirtyBits |= QSGNode::DirtyMaterial; } diff --git a/src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp b/src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp index 8cc3622b..2792ee78 100644 --- a/src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp +++ b/src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp @@ -45,7 +45,7 @@ QGeoFileTileCacheMapbox::QGeoFileTileCacheMapbox(const QList<QGeoMapType> &mapTy { m_scaleFactor = qBound(1, scaleFactor, 2); for (int i=0; i < mapTypes.size(); i++) - m_mapNameToId.insert(mapTypes[i].name(), i); + m_mapNameToId.insert(mapTypes[i].name(), i+1); } QGeoFileTileCacheMapbox::~QGeoFileTileCacheMapbox() @@ -57,7 +57,7 @@ QString QGeoFileTileCacheMapbox::tileSpecToFilename(const QGeoTileSpec &spec, co { QString filename = spec.plugin(); filename += QLatin1String("-"); - filename += m_mapTypes[spec.mapId()].name(); + filename += m_mapTypes[spec.mapId()-1].name(); filename += QLatin1String("-"); filename += QString::number(spec.zoom()); filename += QLatin1String("-"); @@ -87,7 +87,7 @@ QGeoTileSpec QGeoFileTileCacheMapbox::filenameToTileSpec(const QString &filename { QStringList parts = filename.split('.'); - if (parts.length() != 3) + if (parts.length() != 3) // 3 because the map name has always a dot in it. return QGeoTileSpec(); QString name = parts.at(0) + parts.at(1); diff --git a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp index 3177b6c4..03a574c3 100644 --- a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp +++ b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp @@ -66,41 +66,41 @@ QGeoTiledMappingManagerEngineMapbox::QGeoTiledMappingManagerEngineMapbox(const Q // as index 0 to retain compatibility with the current API, that expects the passed map_id to be on by default. if (parameters.contains(QStringLiteral("mapbox.mapping.map_id"))) { const QString name = parameters.value(QStringLiteral("mapbox.mapping.map_id")).toString(); - mapTypes << QGeoMapType(QGeoMapType::CustomMap, name, name, false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, name, name, false, false, mapTypes.size() + 1, pluginName); } else if (parameters.contains(QStringLiteral("mapbox.map_id"))) { //deprecated const QString name = parameters.value(QStringLiteral("mapbox.map_id")).toString(); - mapTypes << QGeoMapType(QGeoMapType::CustomMap, name, name, false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, name, name, false, false, mapTypes.size() + 1, pluginName); } // As of 2016.06.15, valid mapbox map_ids are documented at https://www.mapbox.com/api-documentation/#maps //: Noun describing map type 'Street map' - mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox.streets"), tr("Street"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox.streets"), tr("Street"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map using light colors (weak contrast) - mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox.light"), tr("Light"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox.light"), tr("Light"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map using dark colors - mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox.dark"), tr("Dark"), false, true, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox.dark"), tr("Dark"), false, true, mapTypes.size() + 1, pluginName); //: Noun describing type of a map created by satellite - mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, QStringLiteral("mapbox.satellite"), tr("Satellite"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, QStringLiteral("mapbox.satellite"), tr("Satellite"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a street map created by satellite - mapTypes << QGeoMapType(QGeoMapType::HybridMap, QStringLiteral("mapbox.streets-satellite"), tr("Streets Satellite"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::HybridMap, QStringLiteral("mapbox.streets-satellite"), tr("Streets Satellite"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map using wheat paste colors - mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.wheatpaste"), tr("Wheatpaste"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.wheatpaste"), tr("Wheatpaste"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a basic street map - mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox.streets-basic"), tr("Streets Basic"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox.streets-basic"), tr("Streets Basic"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map using cartoon-style fonts - mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.comic"), tr("Comic"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.comic"), tr("Comic"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map for outdoor activities - mapTypes << QGeoMapType(QGeoMapType::PedestrianMap, QStringLiteral("mapbox.outdoors"), tr("Outdoors"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::PedestrianMap, QStringLiteral("mapbox.outdoors"), tr("Outdoors"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map for sports - mapTypes << QGeoMapType(QGeoMapType::CycleMap, QStringLiteral("mapbox.run-bike-hike"), tr("Run Bike Hike"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CycleMap, QStringLiteral("mapbox.run-bike-hike"), tr("Run Bike Hike"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map drawn by pencil - mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.pencil"), tr("Pencil"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.pencil"), tr("Pencil"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a treasure map with pirate boat watermark - mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.pirates"), tr("Pirates"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.pirates"), tr("Pirates"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map using emerald colors - mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.emerald"), tr("Emerald"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.emerald"), tr("Emerald"), false, false, mapTypes.size() + 1, pluginName); //: Noun describing type of a map with high contrast - mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.high-contrast"), tr("High Contrast"), false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, QStringLiteral("mapbox.high-contrast"), tr("High Contrast"), false, false, mapTypes.size() + 1, pluginName); // New way to specify multiple customized map_ids via additional_map_ids if (parameters.contains(QStringLiteral("mapbox.mapping.additional_map_ids"))) { @@ -109,7 +109,7 @@ QGeoTiledMappingManagerEngineMapbox::QGeoTiledMappingManagerEngineMapbox(const Q for (const QString &name: idList) { if (!name.isEmpty()) - mapTypes << QGeoMapType(QGeoMapType::CustomMap, name, name, false, false, mapTypes.size(), pluginName); + mapTypes << QGeoMapType(QGeoMapType::CustomMap, name, name, false, false, mapTypes.size() + 1, pluginName); } } diff --git a/src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp b/src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp index 732d04e9..74971692 100644 --- a/src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp +++ b/src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp @@ -87,7 +87,7 @@ QGeoTiledMapReply *QGeoTileFetcherMapbox::getTileImage(const QGeoTileSpec &spec) request.setRawHeader("User-Agent", m_userAgent); request.setUrl(QUrl(QStringLiteral("http://api.tiles.mapbox.com/v4/") + - ((spec.mapId() >= m_mapIds.size()) ? QStringLiteral("mapbox.streets") : m_mapIds[spec.mapId()]) + QLatin1Char('/') + + ((spec.mapId() >= m_mapIds.size()) ? QStringLiteral("mapbox.streets") : m_mapIds[spec.mapId() - 1]) + QLatin1Char('/') + QString::number(spec.zoom()) + QLatin1Char('/') + QString::number(spec.x()) + QLatin1Char('/') + QString::number(spec.y()) + diff --git a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp index ad3ab375..c82b98f3 100644 --- a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp +++ b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp @@ -364,11 +364,11 @@ void QGeoMapMapboxGL::onMapChanged(QMapboxGL::MapChange change) d->m_styleLoaded = false; d->m_styleChanges.clear(); - for (QGeoMapParameter *param : d->m_mapParameters) - d->m_styleChanges << QMapboxGLStyleChange::addMapParameter(param); - for (QDeclarativeGeoMapItemBase *item : d->m_mapItems) d->m_styleChanges << QMapboxGLStyleChange::addMapItem(item, d->m_mapItemsBefore); + + for (QGeoMapParameter *param : d->m_mapParameters) + d->m_styleChanges << QMapboxGLStyleChange::addMapParameter(param); } } diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp index 8229b784..c6972b07 100644 --- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp +++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp @@ -59,7 +59,8 @@ bool isImmutableProperty(const QString &name) QString getId(QDeclarativeGeoMapItemBase *mapItem) { - return QStringLiteral("QDeclarativeGeoMapItemBase-") + QString::number(quint64(mapItem)); + return QStringLiteral("QtLocation-") + + ((mapItem->objectName().isEmpty()) ? QString::number(quint64(mapItem)) : mapItem->objectName()); } // Mapbox GL supports geometry segments that spans above 180 degrees in diff --git a/src/plugins/position/android/jar/src/org/qtproject/qt5/android/positioning/QtPositioning.java b/src/plugins/position/android/jar/src/org/qtproject/qt5/android/positioning/QtPositioning.java index b55a90d4..edc39bd7 100644 --- a/src/plugins/position/android/jar/src/org/qtproject/qt5/android/positioning/QtPositioning.java +++ b/src/plugins/position/android/jar/src/org/qtproject/qt5/android/positioning/QtPositioning.java @@ -110,6 +110,10 @@ public class QtPositioning implements LocationListener static private int[] providerList() { + if (locationManager == null) { + Log.w(TAG, "No locationManager available in QtPositioning"); + return new int[0]; + } List<String> providers = locationManager.getAllProviders(); int retList[] = new int[providers.size()]; for (int i = 0; i < providers.size(); i++) { |