diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-10-30 10:21:17 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-11-11 18:20:01 +0200 |
commit | c6f3cc8b60e0cff032020a780d4fd3de1cb2a112 (patch) | |
tree | 155fe444f21ae88dda664e81cfc8378e28297b0e /src/mbgl/style/layers/fill_layer.cpp | |
parent | e1556fc539607db626b978040895716c1564c9b9 (diff) | |
download | qtlocation-mapboxgl-c6f3cc8b60e0cff032020a780d4fd3de1cb2a112.tar.gz |
[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
Diffstat (limited to 'src/mbgl/style/layers/fill_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/fill_layer.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
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<rapidjson::StringBuffer> // Paint properties PropertyValue<bool> FillLayer::getDefaultFillAntialias() { - return { true }; + return {true}; } const PropertyValue<bool>& FillLayer::getFillAntialias() const { @@ -91,7 +91,7 @@ TransitionOptions FillLayer::getFillAntialiasTransition() const { } PropertyValue<Color> FillLayer::getDefaultFillColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& FillLayer::getFillColor() const { @@ -118,7 +118,7 @@ TransitionOptions FillLayer::getFillColorTransition() const { } PropertyValue<float> FillLayer::getDefaultFillOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& FillLayer::getFillOpacity() const { @@ -145,7 +145,7 @@ TransitionOptions FillLayer::getFillOpacityTransition() const { } PropertyValue<Color> FillLayer::getDefaultFillOutlineColor() { - return { {} }; + return {{}}; } const PropertyValue<Color>& FillLayer::getFillOutlineColor() const { @@ -171,15 +171,15 @@ TransitionOptions FillLayer::getFillOutlineColorTransition() const { return impl().paint.template get<FillOutlineColor>().options; } -PropertyValue<std::string> FillLayer::getDefaultFillPattern() { - return { "" }; +PropertyValue<expression::Image> FillLayer::getDefaultFillPattern() { + return {{}}; } -const PropertyValue<std::string>& FillLayer::getFillPattern() const { +const PropertyValue<expression::Image>& FillLayer::getFillPattern() const { return impl().paint.template get<FillPattern>().value; } -void FillLayer::setFillPattern(const PropertyValue<std::string>& value) { +void FillLayer::setFillPattern(const PropertyValue<expression::Image>& value) { if (value == getFillPattern()) return; auto impl_ = mutableImpl(); @@ -199,7 +199,7 @@ TransitionOptions FillLayer::getFillPatternTransition() const { } PropertyValue<std::array<float, 2>> FillLayer::getDefaultFillTranslate() { - return { {{ 0, 0 }} }; + return {{{0, 0}}}; } const PropertyValue<std::array<float, 2>>& FillLayer::getFillTranslate() const { @@ -226,7 +226,7 @@ TransitionOptions FillLayer::getFillTranslateTransition() const { } PropertyValue<TranslateAnchorType> FillLayer::getDefaultFillTranslateAnchor() { - return { TranslateAnchorType::Map }; + return {TranslateAnchorType::Map}; } const PropertyValue<TranslateAnchorType>& FillLayer::getFillTranslateAnchor() const { @@ -351,7 +351,8 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::FillPattern) { Error error; - optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false); + optional<PropertyValue<expression::Image>> typedValue = + convert<PropertyValue<expression::Image>>(value, error, true, false); if (!typedValue) { return error; } @@ -363,7 +364,8 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::FillTranslate) { Error error; - optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); + optional<PropertyValue<std::array<float, 2>>> typedValue = + convert<PropertyValue<std::array<float, 2>>>(value, error, false, false); if (!typedValue) { return error; } @@ -375,7 +377,8 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::FillTranslateAnchor) { Error error; - optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); + optional<PropertyValue<TranslateAnchorType>> typedValue = + convert<PropertyValue<TranslateAnchorType>>(value, error, false, false); if (!typedValue) { return error; } |