summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/qt/include/qmapboxgl.hpp1
-rw-r--r--platform/qt/src/qmapboxgl.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp
index 2cee941eaa..d5ec4b678f 100644
--- a/platform/qt/include/qmapboxgl.hpp
+++ b/platform/qt/include/qmapboxgl.hpp
@@ -208,6 +208,7 @@ public:
QMargins margins() const;
void addSource(const QString &sourceID, const QVariantMap& params);
+ bool sourceExists(const QString &sourceID);
void updateSource(const QString &sourceID, const QVariantMap& params);
void removeSource(const QString &sourceID);
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index eb908b6083..ca42f51ebd 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -1244,6 +1244,14 @@ void QMapboxGL::addSource(const QString &id, const QVariantMap &params)
}
/*!
+ Returns true if the layer with given \a id exists, false otherwise.
+*/
+bool QMapboxGL::sourceExists(const QString& sourceID)
+{
+ return !!d_ptr->mapObj->getSource(sourceID.toStdString());
+}
+
+/*!
Updates the source \a id with new \a params.
If the source does not exist, it will be added like in addSource(). Only