summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-02-08 20:17:51 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-02-13 16:18:46 +0200
commitd0181dc2b72a5cfe473ee1eec4ce5a8ba9e3ac19 (patch)
tree924a3e6db663bc16ea716bc757d62c631ea2a450
parent82528dfe12b88f2c419e9159f4b3eeb7acdf06af (diff)
downloadqtlocation-mapboxgl-d0181dc2b72a5cfe473ee1eec4ce5a8ba9e3ac19.tar.gz
[Qt] Added QMapboxGL::sourceExists
-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 e23f97f679..e94a0e1bc6 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -1247,6 +1247,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