[Qt] Added QMapboxGL::sourceExists

This commit is contained in:
Bruno de Oliveira Abinader
2017-02-08 20:17:51 +02:00
parent bcc9eda012
commit b9af073e98
2 changed files with 9 additions and 0 deletions

View File

@@ -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);

View File

@@ -1243,6 +1243,14 @@ void QMapboxGL::addSource(const QString &id, const QVariantMap &params)
d_ptr->mapObj->addSource(std::move(*source));
}
/*!
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.