summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-02-02 17:26:02 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-02-08 17:06:58 +0200
commit45b4c64a5e6429e984e375d30d2d3804df81d004 (patch)
tree11813bec8736f5b98a8d17b2a3d41be78b030060
parent9810dbd7a2959ac114ede3b3c0d452b862f69544 (diff)
downloadqtlocation-mapboxgl-45b4c64a5e6429e984e375d30d2d3804df81d004.tar.gz
[Qt] Added QMapboxGL::layerExists
-rw-r--r--platform/qt/include/qmapboxgl.hpp1
-rw-r--r--platform/qt/src/qmapboxgl.cpp10
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 &params);
+ 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 bdc99994b5..bc5cd1daae 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -1392,7 +1392,15 @@ void QMapboxGL::addLayer(const QVariantMap &params)
}
/*!
- 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)
{