diff options
author | Tadej Novak <tadej@tano.si> | 2020-11-02 11:59:21 +0100 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2021-02-09 14:41:17 +0200 |
commit | 6b1dc419f9cf32ee8ec739f4f12f44b1addca2d9 (patch) | |
tree | 3a79efc24d7231f57f8d2d2cc7665b8b4cae07e2 /src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp | |
parent | a924cd38a71af86023e0a9ea19d3379136b68c7f (diff) |
Allow removal of layers and sources created using parameters in MapboxGL
[ChangeLog][MapboxGL] Sources and layers from parameters can be removed
Change-Id: I08db3e02b123f3ffb16e09fb77070ad5b6dbb18a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp')
-rw-r--r-- | src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp index 78e19831..7761d63e 100644 --- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp +++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp @@ -255,6 +255,35 @@ QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleChange::addMapItem(QDe return changes; } +QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleChange::removeMapParameter(QGeoMapParameter *param) +{ + static const QStringList acceptedParameterTypes = QStringList() + << QStringLiteral("paint") << QStringLiteral("layout") << QStringLiteral("filter") + << QStringLiteral("layer") << QStringLiteral("source") << QStringLiteral("image"); + + QList<QSharedPointer<QMapboxGLStyleChange>> changes; + + switch (acceptedParameterTypes.indexOf(param->type())) { + case -1: + qWarning() << "Invalid value for property 'type': " + param->type(); + break; + case 0: // paint + case 1: // layout + case 2: // filter + break; + case 3: // layer + changes << QSharedPointer<QMapboxGLStyleChange>(new QMapboxGLStyleRemoveLayer(param->property("name").toString())); + break; + case 4: // source + changes << QSharedPointer<QMapboxGLStyleChange>(new QMapboxGLStyleRemoveSource(param->property("name").toString())); + break; + case 5: // image + break; + } + + return changes; +} + QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleChange::removeMapItem(QDeclarativeGeoMapItemBase *item) { QList<QSharedPointer<QMapboxGLStyleChange>> changes; |