From c6f3cc8b60e0cff032020a780d4fd3de1cb2a112 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Wed, 30 Oct 2019 10:21:17 +0200 Subject: [core] Implement image expression (#15877) * [core] Bump gl-js version * [core] Implement image expression * [core] Use new image expression * [core] Coerce image expression to / from string * [core] Serialize evaluated image * [core] Pass available images to layout * [core] Pass images to evaluation context * [core] Set available flag value based on image availability * [core] Allow image coercion to boolean to indicate image availability * [core] Coalesce image expression * [core] Add image expression to next build system * [core] Align serialization format and evaluated type with gl-js * [core] Add images to expression evaluation method * [core] Add support for Image expression to expression test runner * [core] Unskip image expression tests * [core] Update unit tests * [core] Use image expression in annotation manager * [core] Add string to ImageExpression conversion * [core] Add image expression to expression dsl * [core] Convert tokens for implicitly created Image literal * [core] Fix clang format * [core] Split generated style code lines that are over 120 characters * [core] Add unit test for image expression equality * [core] Add image property expression evaluation unit test * [core] Unskip image expression render test * [core] Skip 'in' expression tests * [core] Ignore fill-pattern/update-feature-state render test * [core] Rename Image::serialize to Image::toValue --- src/mbgl/style/layers/fill_layer.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/mbgl/style/layers/fill_layer.cpp') diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp index e3d6c6c708..ad1f0ae847 100644 --- a/src/mbgl/style/layers/fill_layer.cpp +++ b/src/mbgl/style/layers/fill_layer.cpp @@ -64,7 +64,7 @@ void FillLayer::Impl::stringifyLayout(rapidjson::Writer // Paint properties PropertyValue FillLayer::getDefaultFillAntialias() { - return { true }; + return {true}; } const PropertyValue& FillLayer::getFillAntialias() const { @@ -91,7 +91,7 @@ TransitionOptions FillLayer::getFillAntialiasTransition() const { } PropertyValue FillLayer::getDefaultFillColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue& FillLayer::getFillColor() const { @@ -118,7 +118,7 @@ TransitionOptions FillLayer::getFillColorTransition() const { } PropertyValue FillLayer::getDefaultFillOpacity() { - return { 1 }; + return {1}; } const PropertyValue& FillLayer::getFillOpacity() const { @@ -145,7 +145,7 @@ TransitionOptions FillLayer::getFillOpacityTransition() const { } PropertyValue FillLayer::getDefaultFillOutlineColor() { - return { {} }; + return {{}}; } const PropertyValue& FillLayer::getFillOutlineColor() const { @@ -171,15 +171,15 @@ TransitionOptions FillLayer::getFillOutlineColorTransition() const { return impl().paint.template get().options; } -PropertyValue FillLayer::getDefaultFillPattern() { - return { "" }; +PropertyValue FillLayer::getDefaultFillPattern() { + return {{}}; } -const PropertyValue& FillLayer::getFillPattern() const { +const PropertyValue& FillLayer::getFillPattern() const { return impl().paint.template get().value; } -void FillLayer::setFillPattern(const PropertyValue& value) { +void FillLayer::setFillPattern(const PropertyValue& value) { if (value == getFillPattern()) return; auto impl_ = mutableImpl(); @@ -199,7 +199,7 @@ TransitionOptions FillLayer::getFillPatternTransition() const { } PropertyValue> FillLayer::getDefaultFillTranslate() { - return { {{ 0, 0 }} }; + return {{{0, 0}}}; } const PropertyValue>& FillLayer::getFillTranslate() const { @@ -226,7 +226,7 @@ TransitionOptions FillLayer::getFillTranslateTransition() const { } PropertyValue FillLayer::getDefaultFillTranslateAnchor() { - return { TranslateAnchorType::Map }; + return {TranslateAnchorType::Map}; } const PropertyValue& FillLayer::getFillTranslateAnchor() const { @@ -351,7 +351,8 @@ optional FillLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::FillPattern) { Error error; - optional> typedValue = convert>(value, error, true, false); + optional> typedValue = + convert>(value, error, true, false); if (!typedValue) { return error; } @@ -363,7 +364,8 @@ optional FillLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::FillTranslate) { Error error; - optional>> typedValue = convert>>(value, error, false, false); + optional>> typedValue = + convert>>(value, error, false, false); if (!typedValue) { return error; } @@ -375,7 +377,8 @@ optional FillLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::FillTranslateAnchor) { Error error; - optional> typedValue = convert>(value, error, false, false); + optional> typedValue = + convert>(value, error, false, false); if (!typedValue) { return error; } -- cgit v1.2.1