From 8b9a51135738a1e77ec03444fea8ae7fd8a07e4f Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 2 Feb 2017 17:26:02 +0200 Subject: [Qt] Added QMapboxGL::layerExists --- platform/qt/include/qmapboxgl.hpp | 1 + platform/qt/src/qmapboxgl.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.1