diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-02-02 17:26:02 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-02-08 15:55:47 +0200 |
commit | 8b9a51135738a1e77ec03444fea8ae7fd8a07e4f (patch) | |
tree | 495eb8ec351eaa4ec828e67442fe1cbd3019db19 | |
parent | 343d161ac1735992a94539794ed4da7d7a6cfd0f (diff) | |
download | qtlocation-mapboxgl-8b9a51135738a1e77ec03444fea8ae7fd8a07e4f.tar.gz |
[Qt] Added QMapboxGL::layerExists
-rw-r--r-- | platform/qt/include/qmapboxgl.hpp | 1 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp index 0f1ab7c293..2cee941eaa 100644 --- a/platform/qt/include/qmapboxgl.hpp +++ b/platform/qt/include/qmapboxgl.hpp @@ -221,6 +221,7 @@ public: void* context, char* before = NULL); void addLayer(const QVariantMap ¶ms); + bool layerExists(const QString &id); void removeLayer(const QString &id); void setFilter(const QString &layer, const QVariant &filter); diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index fb56c4d993..61a71cf24d 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1390,7 +1390,15 @@ void QMapboxGL::addLayer(const QVariantMap ¶ms) } /*! - Removes the layer \a id. + Returns true if the layer with given \a id exists, false otherwise. +*/ +bool QMapboxGL::layerExists(const QString& id) +{ + return !!d_ptr->mapObj->getLayer(id.toStdString()); +} + +/*! + Removes the layer with given \a id. */ void QMapboxGL::removeLayer(const QString& id) { |