summaryrefslogtreecommitdiff
path: root/platform/qt
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-06-11 22:20:55 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-06-12 16:32:47 +0300
commitae61b9d35f7a1bce078974524c79328e4b767b78 (patch)
tree38d2181438c2164ab76b39bc97b929aee5030121 /platform/qt
parent9af5172f98a4319ba4d8d9d4cb7a24ac8bd9ea12 (diff)
downloadqtlocation-mapboxgl-ae61b9d35f7a1bce078974524c79328e4b767b78.tar.gz
[Qt] Add QMapboxGL::layerIds()
Diffstat (limited to 'platform/qt')
-rw-r--r--platform/qt/include/qmapboxgl.hpp2
-rw-r--r--platform/qt/src/qmapboxgl.cpp17
2 files changed, 19 insertions, 0 deletions
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp
index 79eb672d1f..ac143066e3 100644
--- a/platform/qt/include/qmapboxgl.hpp
+++ b/platform/qt/include/qmapboxgl.hpp
@@ -236,6 +236,8 @@ public:
bool layerExists(const QString &id);
void removeLayer(const QString &id);
+ QList<QString> layerIds() const;
+
void setFilter(const QString &layer, const QVariant &filter);
// When rendering on a different thread,
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 58158c1822..581a1c4111 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -1466,6 +1466,23 @@ void QMapboxGL::removeLayer(const QString& id)
}
/*!
+ List of all existing layer ids from the current style.
+*/
+QList<QString> QMapboxGL::layerIds() const
+{
+ const auto &layers = d_ptr->mapObj->getStyle().getLayers();
+
+ QList<QString> layerIds;
+ layerIds.reserve(layers.size());
+
+ for (const mbgl::style::Layer *layer : layers) {
+ layerIds.append(QString::fromStdString(layer->getID()));
+ }
+
+ return layerIds;
+}
+
+/*!
Adds the \a image with the identifier \a id that can be used
later by a symbol layer.