[Qt] Added set style paint properties method
This commit is contained in:
@@ -175,6 +175,7 @@ public:
|
||||
void removeAnnotation(QMapbox::AnnotationID);
|
||||
|
||||
void setLayoutProperty(const QString &layer, const QString &property, const QVariant &value);
|
||||
void setPaintProperty(const QString &layer, const QString &property, const QVariant &value, const QString &klass = QString());
|
||||
|
||||
bool isRotating() const;
|
||||
bool isScaling() const;
|
||||
|
||||
@@ -469,6 +469,29 @@ void QMapboxGL::setLayoutProperty(const QString& layer_, const QString& property
|
||||
d_ptr->mapObj->update(mbgl::Update::RecalculateStyle);
|
||||
}
|
||||
|
||||
void QMapboxGL::setPaintProperty(const QString& layer_, const QString& property, const QVariant& value, const QString& klass_)
|
||||
{
|
||||
using namespace mbgl::style;
|
||||
|
||||
Layer* layer = d_ptr->mapObj->getLayer(layer_.toStdString());
|
||||
if (!layer) {
|
||||
qWarning() << "Layer not found:" << layer_;
|
||||
return;
|
||||
}
|
||||
|
||||
mbgl::optional<std::string> klass;
|
||||
if (!klass_.isEmpty()) {
|
||||
klass = klass_.toStdString();
|
||||
}
|
||||
|
||||
if (conversion::setPaintProperty(*layer, property.toStdString(), value, klass)) {
|
||||
qWarning() << "Error setting paint property:" << layer_ << "-" << property;
|
||||
return;
|
||||
}
|
||||
|
||||
d_ptr->mapObj->update(mbgl::Update::RecalculateStyle | mbgl::Update::Classes);
|
||||
}
|
||||
|
||||
bool QMapboxGL::isRotating() const
|
||||
{
|
||||
return d_ptr->mapObj->isRotating();
|
||||
|
||||
Reference in New Issue
Block a user