[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
This commit is contained in:
Alexander Shalamov
2019-10-30 10:21:17 +02:00
parent e1556fc539
commit c6f3cc8b60
86 changed files with 1056 additions and 531 deletions

View File

@@ -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;
}