[Qt] Add QMapboxGL::layerIds()
This commit is contained in:
@@ -236,6 +236,8 @@ public:
|
||||
bool layerExists(const QString &id);
|
||||
void removeLayer(const QString &id);
|
||||
|
||||
QList<QString> layerIds() const;
|
||||
|
||||
void setFilter(const QString &layer, const QVariant &filter);
|
||||
|
||||
// When rendering on a different thread,
|
||||
|
||||
@@ -1465,6 +1465,23 @@ void QMapboxGL::removeLayer(const QString& id)
|
||||
d_ptr->mapObj->getStyle().removeLayer(id.toStdString());
|
||||
}
|
||||
|
||||
/*!
|
||||
List of all existing layer ids from the current style.
|
||||
*/
|
||||
QList<QString> QMapboxGL::layerIds() const
|
||||
{
|
||||
const auto &layers = d_ptr->mapObj->getStyle().getLayers();
|
||||
|
||||
QList<QString> layerIds;
|
||||
layerIds.reserve(layers.size());
|
||||
|
||||
for (const mbgl::style::Layer *layer : layers) {
|
||||
layerIds.append(QString::fromStdString(layer->getID()));
|
||||
}
|
||||
|
||||
return layerIds;
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds the \a image with the identifier \a id that can be used
|
||||
later by a symbol layer.
|
||||
|
||||
Reference in New Issue
Block a user