From 7a9461a8d439458b18656ecfb839923adc5f0e9b Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Thu, 25 Oct 2018 16:15:31 +0300 Subject: Consolidate `style::Layer` properties API The `style::Layer` class now exposes all the properties contained at `style::LayerImpl`. This allowed to drop `style::Layer::accept()` method usage, avoid the repeated generated code and thus save some binary size. This patch is a part of the layers modularization effort. --- platform/qt/src/qmapboxgl.cpp | 45 ++----------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'platform/qt/src/qmapboxgl.cpp') diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index ceed411ca3..d008ad86c9 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1533,38 +1533,14 @@ void QMapboxGL::setFilter(const QString& layer, const QVariant& filter) return; } - Filter filter_; - Error error; mbgl::optional converted = convert(filter, error); if (!converted) { qWarning() << "Error parsing filter:" << error.message.c_str(); return; } - filter_ = std::move(*converted); - - if (layer_->is()) { - layer_->as()->setFilter(filter_); - return; - } - if (layer_->is()) { - layer_->as()->setFilter(filter_); - return; - } - if (layer_->is()) { - layer_->as()->setFilter(filter_); - return; - } - if (layer_->is()) { - layer_->as()->setFilter(filter_); - return; - } - if (layer_->is()) { - layer_->as()->setFilter(filter_); - return; - } - qWarning() << "Layer doesn't support filters"; + layer_->setFilter(std::move(*converted)); } QVariant QVariantFromValue(const mbgl::Value &value) { @@ -1617,24 +1593,7 @@ QVariant QMapboxGL::getFilter(const QString &layer) const { return QVariant(); } - Filter filter_; - - if (layer_->is()) { - filter_ = layer_->as()->getFilter(); - } else if (layer_->is()) { - filter_ = layer_->as()->getFilter(); - } else if (layer_->is()) { - filter_ = layer_->as()->getFilter(); - } else if (layer_->is()) { - filter_ = layer_->as()->getFilter(); - } else if (layer_->is()) { - filter_ = layer_->as()->getFilter(); - } else { - qWarning() << "Layer doesn't support filters"; - return QVariant(); - } - - auto serialized = filter_.serialize(); + auto serialized = layer_->getFilter().serialize(); return QVariantFromValue(serialized); } -- cgit v1.2.1