diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-06-11 22:20:55 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-06-12 15:11:45 +0200 |
commit | c0436cc0a96b0bf864cbe3f2cbb8bb72741fa299 (patch) | |
tree | 38d2181438c2164ab76b39bc97b929aee5030121 /platform/qt/src | |
parent | 9af5172f98a4319ba4d8d9d4cb7a24ac8bd9ea12 (diff) | |
download | qtlocation-mapboxgl-upstream/qmapboxgl-layer-ids.tar.gz |
[Qt] Add QMapboxGL::layerIds()upstream/qmapboxgl-layer-ids
Diffstat (limited to 'platform/qt/src')
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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. |