diff options
Diffstat (limited to 'src/mbgl/style/layers')
-rw-r--r-- | src/mbgl/style/layers/background_layer.cpp | 15 | ||||
-rw-r--r-- | src/mbgl/style/layers/background_layer_properties.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/layers/circle_layer.cpp | 31 | ||||
-rw-r--r-- | src/mbgl/style/layers/circle_layer_properties.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_extrusion_layer.cpp | 31 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_extrusion_layer_properties.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_layer.cpp | 29 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_layer_properties.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/layers/heatmap_layer.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/layers/hillshade_layer.cpp | 15 | ||||
-rw-r--r-- | src/mbgl/style/layers/layer.cpp.ejs | 15 | ||||
-rw-r--r-- | src/mbgl/style/layers/line_layer.cpp | 40 | ||||
-rw-r--r-- | src/mbgl/style/layers/line_layer_properties.hpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/layers/raster_layer.cpp | 19 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer.cpp | 76 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_properties.hpp | 22 |
16 files changed, 183 insertions, 144 deletions
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp index 9187784452..6629044018 100644 --- a/src/mbgl/style/layers/background_layer.cpp +++ b/src/mbgl/style/layers/background_layer.cpp @@ -64,7 +64,7 @@ void BackgroundLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringB // Paint properties PropertyValue<Color> BackgroundLayer::getDefaultBackgroundColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& BackgroundLayer::getBackgroundColor() const { @@ -91,7 +91,7 @@ TransitionOptions BackgroundLayer::getBackgroundColorTransition() const { } PropertyValue<float> BackgroundLayer::getDefaultBackgroundOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& BackgroundLayer::getBackgroundOpacity() const { @@ -117,15 +117,15 @@ TransitionOptions BackgroundLayer::getBackgroundOpacityTransition() const { return impl().paint.template get<BackgroundOpacity>().options; } -PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() { - return { "" }; +PropertyValue<expression::Image> BackgroundLayer::getDefaultBackgroundPattern() { + return {{}}; } -const PropertyValue<std::string>& BackgroundLayer::getBackgroundPattern() const { +const PropertyValue<expression::Image>& BackgroundLayer::getBackgroundPattern() const { return impl().paint.template get<BackgroundPattern>().value; } -void BackgroundLayer::setBackgroundPattern(const PropertyValue<std::string>& value) { +void BackgroundLayer::setBackgroundPattern(const PropertyValue<expression::Image>& value) { if (value == getBackgroundPattern()) return; auto impl_ = mutableImpl(); @@ -208,7 +208,8 @@ optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const if (property == Property::BackgroundPattern) { Error error; - optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false); + optional<PropertyValue<expression::Image>> typedValue = + convert<PropertyValue<expression::Image>>(value, error, false, false); if (!typedValue) { return error; } diff --git a/src/mbgl/style/layers/background_layer_properties.hpp b/src/mbgl/style/layers/background_layer_properties.hpp index 11328f78bb..b926295c00 100644 --- a/src/mbgl/style/layers/background_layer_properties.hpp +++ b/src/mbgl/style/layers/background_layer_properties.hpp @@ -24,8 +24,8 @@ struct BackgroundOpacity : PaintProperty<float> { static float defaultValue() { return 1; } }; -struct BackgroundPattern : CrossFadedPaintProperty<std::string> { - static std::string defaultValue() { return ""; } +struct BackgroundPattern : CrossFadedPaintProperty<expression::Image> { + static expression::Image defaultValue() { return {}; } }; class BackgroundPaintProperties : public Properties< diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp index 145d76a9a8..619c58c366 100644 --- a/src/mbgl/style/layers/circle_layer.cpp +++ b/src/mbgl/style/layers/circle_layer.cpp @@ -64,7 +64,7 @@ void CircleLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffe // Paint properties PropertyValue<float> CircleLayer::getDefaultCircleBlur() { - return { 0 }; + return {0}; } const PropertyValue<float>& CircleLayer::getCircleBlur() const { @@ -91,7 +91,7 @@ TransitionOptions CircleLayer::getCircleBlurTransition() const { } PropertyValue<Color> CircleLayer::getDefaultCircleColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& CircleLayer::getCircleColor() const { @@ -118,7 +118,7 @@ TransitionOptions CircleLayer::getCircleColorTransition() const { } PropertyValue<float> CircleLayer::getDefaultCircleOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& CircleLayer::getCircleOpacity() const { @@ -145,7 +145,7 @@ TransitionOptions CircleLayer::getCircleOpacityTransition() const { } PropertyValue<AlignmentType> CircleLayer::getDefaultCirclePitchAlignment() { - return { AlignmentType::Viewport }; + return {AlignmentType::Viewport}; } const PropertyValue<AlignmentType>& CircleLayer::getCirclePitchAlignment() const { @@ -172,7 +172,7 @@ TransitionOptions CircleLayer::getCirclePitchAlignmentTransition() const { } PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() { - return { CirclePitchScaleType::Map }; + return {CirclePitchScaleType::Map}; } const PropertyValue<CirclePitchScaleType>& CircleLayer::getCirclePitchScale() const { @@ -199,7 +199,7 @@ TransitionOptions CircleLayer::getCirclePitchScaleTransition() const { } PropertyValue<float> CircleLayer::getDefaultCircleRadius() { - return { 5 }; + return {5}; } const PropertyValue<float>& CircleLayer::getCircleRadius() const { @@ -226,7 +226,7 @@ TransitionOptions CircleLayer::getCircleRadiusTransition() const { } PropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& CircleLayer::getCircleStrokeColor() const { @@ -253,7 +253,7 @@ TransitionOptions CircleLayer::getCircleStrokeColorTransition() const { } PropertyValue<float> CircleLayer::getDefaultCircleStrokeOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& CircleLayer::getCircleStrokeOpacity() const { @@ -280,7 +280,7 @@ TransitionOptions CircleLayer::getCircleStrokeOpacityTransition() const { } PropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() { - return { 0 }; + return {0}; } const PropertyValue<float>& CircleLayer::getCircleStrokeWidth() const { @@ -307,7 +307,7 @@ TransitionOptions CircleLayer::getCircleStrokeWidthTransition() const { } PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() { - return { {{ 0, 0 }} }; + return {{{0, 0}}}; } const PropertyValue<std::array<float, 2>>& CircleLayer::getCircleTranslate() const { @@ -334,7 +334,7 @@ TransitionOptions CircleLayer::getCircleTranslateTransition() const { } PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor() { - return { TranslateAnchorType::Map }; + return {TranslateAnchorType::Map}; } const PropertyValue<TranslateAnchorType>& CircleLayer::getCircleTranslateAnchor() const { @@ -497,7 +497,8 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con if (property == Property::CirclePitchScale) { Error error; - optional<PropertyValue<CirclePitchScaleType>> typedValue = convert<PropertyValue<CirclePitchScaleType>>(value, error, false, false); + optional<PropertyValue<CirclePitchScaleType>> typedValue = + convert<PropertyValue<CirclePitchScaleType>>(value, error, false, false); if (!typedValue) { return error; } @@ -509,7 +510,8 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con if (property == Property::CircleTranslate) { 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; } @@ -521,7 +523,8 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con if (property == Property::CircleTranslateAnchor) { 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; } diff --git a/src/mbgl/style/layers/circle_layer_properties.hpp b/src/mbgl/style/layers/circle_layer_properties.hpp index a5f7a584df..5204421d0b 100644 --- a/src/mbgl/style/layers/circle_layer_properties.hpp +++ b/src/mbgl/style/layers/circle_layer_properties.hpp @@ -53,7 +53,7 @@ struct CircleStrokeWidth : DataDrivenPaintProperty<float, attributes::stroke_wid }; struct CircleTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } + static std::array<float, 2> defaultValue() { return {{0, 0}}; } }; struct CircleTranslateAnchor : PaintProperty<TranslateAnchorType> { diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp index 87e196926f..e04e192298 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer.cpp +++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp @@ -64,7 +64,7 @@ void FillExtrusionLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::Stri // Paint properties PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() { - return { 0 }; + return {0}; } const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionBase() const { @@ -91,7 +91,7 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition() const { } PropertyValue<Color> FillExtrusionLayer::getDefaultFillExtrusionColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& FillExtrusionLayer::getFillExtrusionColor() const { @@ -118,7 +118,7 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionColorTransition() const { } PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() { - return { 0 }; + return {0}; } const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionHeight() const { @@ -145,7 +145,7 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition() const { } PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionOpacity() const { @@ -171,15 +171,15 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition() const return impl().paint.template get<FillExtrusionOpacity>().options; } -PropertyValue<std::string> FillExtrusionLayer::getDefaultFillExtrusionPattern() { - return { "" }; +PropertyValue<expression::Image> FillExtrusionLayer::getDefaultFillExtrusionPattern() { + return {{}}; } -const PropertyValue<std::string>& FillExtrusionLayer::getFillExtrusionPattern() const { +const PropertyValue<expression::Image>& FillExtrusionLayer::getFillExtrusionPattern() const { return impl().paint.template get<FillExtrusionPattern>().value; } -void FillExtrusionLayer::setFillExtrusionPattern(const PropertyValue<std::string>& value) { +void FillExtrusionLayer::setFillExtrusionPattern(const PropertyValue<expression::Image>& value) { if (value == getFillExtrusionPattern()) return; auto impl_ = mutableImpl(); @@ -199,7 +199,7 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionPatternTransition() const } PropertyValue<std::array<float, 2>> FillExtrusionLayer::getDefaultFillExtrusionTranslate() { - return { {{ 0, 0 }} }; + return {{{0, 0}}}; } const PropertyValue<std::array<float, 2>>& FillExtrusionLayer::getFillExtrusionTranslate() const { @@ -226,7 +226,7 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateTransition() cons } PropertyValue<TranslateAnchorType> FillExtrusionLayer::getDefaultFillExtrusionTranslateAnchor() { - return { TranslateAnchorType::Map }; + return {TranslateAnchorType::Map}; } const PropertyValue<TranslateAnchorType>& FillExtrusionLayer::getFillExtrusionTranslateAnchor() const { @@ -253,7 +253,7 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateAnchorTransition( } PropertyValue<bool> FillExtrusionLayer::getDefaultFillExtrusionVerticalGradient() { - return { true }; + return {true}; } const PropertyValue<bool>& FillExtrusionLayer::getFillExtrusionVerticalGradient() const { @@ -382,7 +382,8 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co if (property == Property::FillExtrusionPattern) { 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; } @@ -394,7 +395,8 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co if (property == Property::FillExtrusionTranslate) { 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; } @@ -406,7 +408,8 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co if (property == Property::FillExtrusionTranslateAnchor) { 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; } diff --git a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp index 6936d5e0c4..60a2340b0d 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp @@ -32,12 +32,12 @@ struct FillExtrusionOpacity : PaintProperty<float> { static float defaultValue() { return 1; } }; -struct FillExtrusionPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { - static std::string defaultValue() { return ""; } +struct FillExtrusionPattern : CrossFadedDataDrivenPaintProperty<expression::Image, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { + static expression::Image defaultValue() { return {}; } }; struct FillExtrusionTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } + static std::array<float, 2> defaultValue() { return {{0, 0}}; } }; struct FillExtrusionTranslateAnchor : PaintProperty<TranslateAnchorType> { 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; } diff --git a/src/mbgl/style/layers/fill_layer_properties.hpp b/src/mbgl/style/layers/fill_layer_properties.hpp index 38ca506199..ad8ed84892 100644 --- a/src/mbgl/style/layers/fill_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_layer_properties.hpp @@ -32,12 +32,12 @@ struct FillOutlineColor : DataDrivenPaintProperty<Color, attributes::outline_col static Color defaultValue() { return {}; } }; -struct FillPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { - static std::string defaultValue() { return ""; } +struct FillPattern : CrossFadedDataDrivenPaintProperty<expression::Image, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { + static expression::Image defaultValue() { return {}; } }; struct FillTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } + static std::array<float, 2> defaultValue() { return {{0, 0}}; } }; struct FillTranslateAnchor : PaintProperty<TranslateAnchorType> { diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp index 332c65c6b4..234dda6c73 100644 --- a/src/mbgl/style/layers/heatmap_layer.cpp +++ b/src/mbgl/style/layers/heatmap_layer.cpp @@ -93,7 +93,7 @@ TransitionOptions HeatmapLayer::getHeatmapColorTransition() const { } PropertyValue<float> HeatmapLayer::getDefaultHeatmapIntensity() { - return { 1 }; + return {1}; } const PropertyValue<float>& HeatmapLayer::getHeatmapIntensity() const { @@ -120,7 +120,7 @@ TransitionOptions HeatmapLayer::getHeatmapIntensityTransition() const { } PropertyValue<float> HeatmapLayer::getDefaultHeatmapOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& HeatmapLayer::getHeatmapOpacity() const { @@ -147,7 +147,7 @@ TransitionOptions HeatmapLayer::getHeatmapOpacityTransition() const { } PropertyValue<float> HeatmapLayer::getDefaultHeatmapRadius() { - return { 30 }; + return {30}; } const PropertyValue<float>& HeatmapLayer::getHeatmapRadius() const { @@ -174,7 +174,7 @@ TransitionOptions HeatmapLayer::getHeatmapRadiusTransition() const { } PropertyValue<float> HeatmapLayer::getDefaultHeatmapWeight() { - return { 1 }; + return {1}; } const PropertyValue<float>& HeatmapLayer::getHeatmapWeight() const { diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp index a55c079c49..5d84b7ded3 100644 --- a/src/mbgl/style/layers/hillshade_layer.cpp +++ b/src/mbgl/style/layers/hillshade_layer.cpp @@ -64,7 +64,7 @@ void HillshadeLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBu // Paint properties PropertyValue<Color> HillshadeLayer::getDefaultHillshadeAccentColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& HillshadeLayer::getHillshadeAccentColor() const { @@ -91,7 +91,7 @@ TransitionOptions HillshadeLayer::getHillshadeAccentColorTransition() const { } PropertyValue<float> HillshadeLayer::getDefaultHillshadeExaggeration() { - return { 0.5 }; + return {0.5}; } const PropertyValue<float>& HillshadeLayer::getHillshadeExaggeration() const { @@ -118,7 +118,7 @@ TransitionOptions HillshadeLayer::getHillshadeExaggerationTransition() const { } PropertyValue<Color> HillshadeLayer::getDefaultHillshadeHighlightColor() { - return { Color::white() }; + return {Color::white()}; } const PropertyValue<Color>& HillshadeLayer::getHillshadeHighlightColor() const { @@ -145,7 +145,7 @@ TransitionOptions HillshadeLayer::getHillshadeHighlightColorTransition() const { } PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getDefaultHillshadeIlluminationAnchor() { - return { HillshadeIlluminationAnchorType::Viewport }; + return {HillshadeIlluminationAnchorType::Viewport}; } const PropertyValue<HillshadeIlluminationAnchorType>& HillshadeLayer::getHillshadeIlluminationAnchor() const { @@ -172,7 +172,7 @@ TransitionOptions HillshadeLayer::getHillshadeIlluminationAnchorTransition() con } PropertyValue<float> HillshadeLayer::getDefaultHillshadeIlluminationDirection() { - return { 335 }; + return {335}; } const PropertyValue<float>& HillshadeLayer::getHillshadeIlluminationDirection() const { @@ -199,7 +199,7 @@ TransitionOptions HillshadeLayer::getHillshadeIlluminationDirectionTransition() } PropertyValue<Color> HillshadeLayer::getDefaultHillshadeShadowColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& HillshadeLayer::getHillshadeShadowColor() const { @@ -320,7 +320,8 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const if (property == Property::HillshadeIlluminationAnchor) { Error error; - optional<PropertyValue<HillshadeIlluminationAnchorType>> typedValue = convert<PropertyValue<HillshadeIlluminationAnchorType>>(value, error, false, false); + optional<PropertyValue<HillshadeIlluminationAnchorType>> typedValue = + convert<PropertyValue<HillshadeIlluminationAnchorType>>(value, error, false, false); if (!typedValue) { return error; } diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index 775288264f..a47e5b95b4 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -77,6 +77,15 @@ layerCapabilities['heatmap'] = defaults.require('Source') .set('TileKind', 'Geometry') .finalize(); layerCapabilities['raster'] = defaults.require('Source').set('TileKind', 'Raster').finalize(); + +// Splits lines that are over 120 characters at the firts occurance of '='. +const split120Line = line => { + if (line.length > 120) { + return line.replace('=', '=\n '); + } + return line; +}; + %> // static const LayerTypeInfo* <%- camelize(type) %>Layer::Impl::staticTypeInfo() noexcept { @@ -155,7 +164,7 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(const <%- pro std::string rawValue = R"JSON(<%- JSON.stringify(property.default) %>)JSON"; return *conversion::convertJSON<<%- propertyValueType(property)%>>(rawValue, error); <% } else { -%> - return { <%- defaultValue(property) %> }; + return {<%- defaultValue(property) %>}; <% } -%> } @@ -243,7 +252,7 @@ optional<Error> <%- camelize(type) %>Layer::setPaintProperty(const std::string& %> if (<%- properties.map(p => `property == Property::${camelize(p.name)}`).join(' || ') %>) { Error error; - <%- key %>; + <%- split120Line(key) %>; if (!typedValue) { return error; } @@ -323,7 +332,7 @@ optional<Error> <%- camelize(type) %>Layer::setLayoutProperty(const std::string& %> if (<%- properties.map(p => `property == Property::${camelize(p.name)}`).join(' || ') %>) { Error error; - <%- key %>; + <%- split120Line(key) %>; if (!typedValue) { return error; } diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp index 309a81ae2b..813ef68dec 100644 --- a/src/mbgl/style/layers/line_layer.cpp +++ b/src/mbgl/style/layers/line_layer.cpp @@ -129,7 +129,7 @@ void LineLayer::setLineRoundLimit(const PropertyValue<float>& value) { // Paint properties PropertyValue<float> LineLayer::getDefaultLineBlur() { - return { 0 }; + return {0}; } const PropertyValue<float>& LineLayer::getLineBlur() const { @@ -156,7 +156,7 @@ TransitionOptions LineLayer::getLineBlurTransition() const { } PropertyValue<Color> LineLayer::getDefaultLineColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& LineLayer::getLineColor() const { @@ -183,7 +183,7 @@ TransitionOptions LineLayer::getLineColorTransition() const { } PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() { - return { { } }; + return {{}}; } const PropertyValue<std::vector<float>>& LineLayer::getLineDasharray() const { @@ -210,7 +210,7 @@ TransitionOptions LineLayer::getLineDasharrayTransition() const { } PropertyValue<float> LineLayer::getDefaultLineGapWidth() { - return { 0 }; + return {0}; } const PropertyValue<float>& LineLayer::getLineGapWidth() const { @@ -237,7 +237,7 @@ TransitionOptions LineLayer::getLineGapWidthTransition() const { } ColorRampPropertyValue LineLayer::getDefaultLineGradient() { - return { {} }; + return {{}}; } const ColorRampPropertyValue& LineLayer::getLineGradient() const { @@ -264,7 +264,7 @@ TransitionOptions LineLayer::getLineGradientTransition() const { } PropertyValue<float> LineLayer::getDefaultLineOffset() { - return { 0 }; + return {0}; } const PropertyValue<float>& LineLayer::getLineOffset() const { @@ -291,7 +291,7 @@ TransitionOptions LineLayer::getLineOffsetTransition() const { } PropertyValue<float> LineLayer::getDefaultLineOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& LineLayer::getLineOpacity() const { @@ -317,15 +317,15 @@ TransitionOptions LineLayer::getLineOpacityTransition() const { return impl().paint.template get<LineOpacity>().options; } -PropertyValue<std::string> LineLayer::getDefaultLinePattern() { - return { "" }; +PropertyValue<expression::Image> LineLayer::getDefaultLinePattern() { + return {{}}; } -const PropertyValue<std::string>& LineLayer::getLinePattern() const { +const PropertyValue<expression::Image>& LineLayer::getLinePattern() const { return impl().paint.template get<LinePattern>().value; } -void LineLayer::setLinePattern(const PropertyValue<std::string>& value) { +void LineLayer::setLinePattern(const PropertyValue<expression::Image>& value) { if (value == getLinePattern()) return; auto impl_ = mutableImpl(); @@ -345,7 +345,7 @@ TransitionOptions LineLayer::getLinePatternTransition() const { } PropertyValue<std::array<float, 2>> LineLayer::getDefaultLineTranslate() { - return { {{ 0, 0 }} }; + return {{{0, 0}}}; } const PropertyValue<std::array<float, 2>>& LineLayer::getLineTranslate() const { @@ -372,7 +372,7 @@ TransitionOptions LineLayer::getLineTranslateTransition() const { } PropertyValue<TranslateAnchorType> LineLayer::getDefaultLineTranslateAnchor() { - return { TranslateAnchorType::Map }; + return {TranslateAnchorType::Map}; } const PropertyValue<TranslateAnchorType>& LineLayer::getLineTranslateAnchor() const { @@ -399,7 +399,7 @@ TransitionOptions LineLayer::getLineTranslateAnchorTransition() const { } PropertyValue<float> LineLayer::getDefaultLineWidth() { - return { 1 }; + return {1}; } const PropertyValue<float>& LineLayer::getLineWidth() const { @@ -552,7 +552,8 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::LineDasharray) { Error error; - optional<PropertyValue<std::vector<float>>> typedValue = convert<PropertyValue<std::vector<float>>>(value, error, false, false); + optional<PropertyValue<std::vector<float>>> typedValue = + convert<PropertyValue<std::vector<float>>>(value, error, false, false); if (!typedValue) { return error; } @@ -576,7 +577,8 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::LinePattern) { 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; } @@ -588,7 +590,8 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::LineTranslate) { 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; } @@ -600,7 +603,8 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve if (property == Property::LineTranslateAnchor) { 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; } diff --git a/src/mbgl/style/layers/line_layer_properties.hpp b/src/mbgl/style/layers/line_layer_properties.hpp index 2ecbb10993..29ba9ec641 100644 --- a/src/mbgl/style/layers/line_layer_properties.hpp +++ b/src/mbgl/style/layers/line_layer_properties.hpp @@ -45,7 +45,7 @@ struct LineColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::c }; struct LineDasharray : CrossFadedPaintProperty<std::vector<float>> { - static std::vector<float> defaultValue() { return { }; } + static std::vector<float> defaultValue() { return {}; } }; struct LineFloorWidth : DataDrivenPaintProperty<float, attributes::floorwidth, uniforms::floorwidth> { @@ -68,12 +68,12 @@ struct LineOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniform static float defaultValue() { return 1; } }; -struct LinePattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { - static std::string defaultValue() { return ""; } +struct LinePattern : CrossFadedDataDrivenPaintProperty<expression::Image, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> { + static expression::Image defaultValue() { return {}; } }; struct LineTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } + static std::array<float, 2> defaultValue() { return {{0, 0}}; } }; struct LineTranslateAnchor : PaintProperty<TranslateAnchorType> { diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp index 359e502f3e..b990409886 100644 --- a/src/mbgl/style/layers/raster_layer.cpp +++ b/src/mbgl/style/layers/raster_layer.cpp @@ -64,7 +64,7 @@ void RasterLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffe // Paint properties PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMax() { - return { 1 }; + return {1}; } const PropertyValue<float>& RasterLayer::getRasterBrightnessMax() const { @@ -91,7 +91,7 @@ TransitionOptions RasterLayer::getRasterBrightnessMaxTransition() const { } PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMin() { - return { 0 }; + return {0}; } const PropertyValue<float>& RasterLayer::getRasterBrightnessMin() const { @@ -118,7 +118,7 @@ TransitionOptions RasterLayer::getRasterBrightnessMinTransition() const { } PropertyValue<float> RasterLayer::getDefaultRasterContrast() { - return { 0 }; + return {0}; } const PropertyValue<float>& RasterLayer::getRasterContrast() const { @@ -145,7 +145,7 @@ TransitionOptions RasterLayer::getRasterContrastTransition() const { } PropertyValue<float> RasterLayer::getDefaultRasterFadeDuration() { - return { 300 }; + return {300}; } const PropertyValue<float>& RasterLayer::getRasterFadeDuration() const { @@ -172,7 +172,7 @@ TransitionOptions RasterLayer::getRasterFadeDurationTransition() const { } PropertyValue<float> RasterLayer::getDefaultRasterHueRotate() { - return { 0 }; + return {0}; } const PropertyValue<float>& RasterLayer::getRasterHueRotate() const { @@ -199,7 +199,7 @@ TransitionOptions RasterLayer::getRasterHueRotateTransition() const { } PropertyValue<float> RasterLayer::getDefaultRasterOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& RasterLayer::getRasterOpacity() const { @@ -226,7 +226,7 @@ TransitionOptions RasterLayer::getRasterOpacityTransition() const { } PropertyValue<RasterResamplingType> RasterLayer::getDefaultRasterResampling() { - return { RasterResamplingType::Linear }; + return {RasterResamplingType::Linear}; } const PropertyValue<RasterResamplingType>& RasterLayer::getRasterResampling() const { @@ -253,7 +253,7 @@ TransitionOptions RasterLayer::getRasterResamplingTransition() const { } PropertyValue<float> RasterLayer::getDefaultRasterSaturation() { - return { 0 }; + return {0}; } const PropertyValue<float>& RasterLayer::getRasterSaturation() const { @@ -383,7 +383,8 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con if (property == Property::RasterResampling) { Error error; - optional<PropertyValue<RasterResamplingType>> typedValue = convert<PropertyValue<RasterResamplingType>>(value, error, false, false); + optional<PropertyValue<RasterResamplingType>> typedValue = + convert<PropertyValue<RasterResamplingType>>(value, error, false, false); if (!typedValue) { return error; } diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index b3ee0f698c..1383293d6d 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -109,15 +109,15 @@ void SymbolLayer::setIconIgnorePlacement(const PropertyValue<bool>& value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -PropertyValue<std::string> SymbolLayer::getDefaultIconImage() { +PropertyValue<expression::Image> SymbolLayer::getDefaultIconImage() { return IconImage::defaultValue(); } -const PropertyValue<std::string>& SymbolLayer::getIconImage() const { +const PropertyValue<expression::Image>& SymbolLayer::getIconImage() const { return impl().layout.get<IconImage>(); } -void SymbolLayer::setIconImage(const PropertyValue<std::string>& value) { +void SymbolLayer::setIconImage(const PropertyValue<expression::Image>& value) { if (value == getIconImage()) return; auto impl_ = mutableImpl(); @@ -721,7 +721,7 @@ void SymbolLayer::setTextWritingMode(const PropertyValue<std::vector<TextWriting // Paint properties PropertyValue<Color> SymbolLayer::getDefaultIconColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& SymbolLayer::getIconColor() const { @@ -748,7 +748,7 @@ TransitionOptions SymbolLayer::getIconColorTransition() const { } PropertyValue<float> SymbolLayer::getDefaultIconHaloBlur() { - return { 0 }; + return {0}; } const PropertyValue<float>& SymbolLayer::getIconHaloBlur() const { @@ -775,7 +775,7 @@ TransitionOptions SymbolLayer::getIconHaloBlurTransition() const { } PropertyValue<Color> SymbolLayer::getDefaultIconHaloColor() { - return { {} }; + return {{}}; } const PropertyValue<Color>& SymbolLayer::getIconHaloColor() const { @@ -802,7 +802,7 @@ TransitionOptions SymbolLayer::getIconHaloColorTransition() const { } PropertyValue<float> SymbolLayer::getDefaultIconHaloWidth() { - return { 0 }; + return {0}; } const PropertyValue<float>& SymbolLayer::getIconHaloWidth() const { @@ -829,7 +829,7 @@ TransitionOptions SymbolLayer::getIconHaloWidthTransition() const { } PropertyValue<float> SymbolLayer::getDefaultIconOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& SymbolLayer::getIconOpacity() const { @@ -856,7 +856,7 @@ TransitionOptions SymbolLayer::getIconOpacityTransition() const { } PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconTranslate() { - return { {{ 0, 0 }} }; + return {{{0, 0}}}; } const PropertyValue<std::array<float, 2>>& SymbolLayer::getIconTranslate() const { @@ -883,7 +883,7 @@ TransitionOptions SymbolLayer::getIconTranslateTransition() const { } PropertyValue<TranslateAnchorType> SymbolLayer::getDefaultIconTranslateAnchor() { - return { TranslateAnchorType::Map }; + return {TranslateAnchorType::Map}; } const PropertyValue<TranslateAnchorType>& SymbolLayer::getIconTranslateAnchor() const { @@ -910,7 +910,7 @@ TransitionOptions SymbolLayer::getIconTranslateAnchorTransition() const { } PropertyValue<Color> SymbolLayer::getDefaultTextColor() { - return { Color::black() }; + return {Color::black()}; } const PropertyValue<Color>& SymbolLayer::getTextColor() const { @@ -937,7 +937,7 @@ TransitionOptions SymbolLayer::getTextColorTransition() const { } PropertyValue<float> SymbolLayer::getDefaultTextHaloBlur() { - return { 0 }; + return {0}; } const PropertyValue<float>& SymbolLayer::getTextHaloBlur() const { @@ -964,7 +964,7 @@ TransitionOptions SymbolLayer::getTextHaloBlurTransition() const { } PropertyValue<Color> SymbolLayer::getDefaultTextHaloColor() { - return { {} }; + return {{}}; } const PropertyValue<Color>& SymbolLayer::getTextHaloColor() const { @@ -991,7 +991,7 @@ TransitionOptions SymbolLayer::getTextHaloColorTransition() const { } PropertyValue<float> SymbolLayer::getDefaultTextHaloWidth() { - return { 0 }; + return {0}; } const PropertyValue<float>& SymbolLayer::getTextHaloWidth() const { @@ -1018,7 +1018,7 @@ TransitionOptions SymbolLayer::getTextHaloWidthTransition() const { } PropertyValue<float> SymbolLayer::getDefaultTextOpacity() { - return { 1 }; + return {1}; } const PropertyValue<float>& SymbolLayer::getTextOpacity() const { @@ -1045,7 +1045,7 @@ TransitionOptions SymbolLayer::getTextOpacityTransition() const { } PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextTranslate() { - return { {{ 0, 0 }} }; + return {{{0, 0}}}; } const PropertyValue<std::array<float, 2>>& SymbolLayer::getTextTranslate() const { @@ -1072,7 +1072,7 @@ TransitionOptions SymbolLayer::getTextTranslateTransition() const { } PropertyValue<TranslateAnchorType> SymbolLayer::getDefaultTextTranslateAnchor() { - return { TranslateAnchorType::Map }; + return {TranslateAnchorType::Map}; } const PropertyValue<TranslateAnchorType>& SymbolLayer::getTextTranslateAnchor() const { @@ -1332,7 +1332,8 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con if (property == Property::IconTranslate || property == Property::TextTranslate) { 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; } @@ -1351,7 +1352,8 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con if (property == Property::IconTranslateAnchor || property == Property::TextTranslateAnchor) { 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; } @@ -1665,7 +1667,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::IconAnchor || property == Property::TextAnchor) { Error error; - optional<PropertyValue<SymbolAnchorType>> typedValue = convert<PropertyValue<SymbolAnchorType>>(value, error, true, false); + optional<PropertyValue<SymbolAnchorType>> typedValue = + convert<PropertyValue<SymbolAnchorType>>(value, error, true, false); if (!typedValue) { return error; } @@ -1684,7 +1687,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::IconImage) { Error error; - optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, true); + optional<PropertyValue<expression::Image>> typedValue = + convert<PropertyValue<expression::Image>>(value, error, true, true); if (!typedValue) { return error; } @@ -1696,7 +1700,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::IconOffset || property == Property::TextOffset) { Error error; - optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, true, false); + optional<PropertyValue<std::array<float, 2>>> typedValue = + convert<PropertyValue<std::array<float, 2>>>(value, error, true, false); if (!typedValue) { return error; } @@ -1827,7 +1832,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::IconTextFit) { Error error; - optional<PropertyValue<IconTextFitType>> typedValue = convert<PropertyValue<IconTextFitType>>(value, error, false, false); + optional<PropertyValue<IconTextFitType>> typedValue = + convert<PropertyValue<IconTextFitType>>(value, error, false, false); if (!typedValue) { return error; } @@ -1839,7 +1845,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::IconTextFitPadding) { Error error; - optional<PropertyValue<std::array<float, 4>>> typedValue = convert<PropertyValue<std::array<float, 4>>>(value, error, false, false); + optional<PropertyValue<std::array<float, 4>>> typedValue = + convert<PropertyValue<std::array<float, 4>>>(value, error, false, false); if (!typedValue) { return error; } @@ -1851,7 +1858,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::SymbolPlacement) { Error error; - optional<PropertyValue<SymbolPlacementType>> typedValue = convert<PropertyValue<SymbolPlacementType>>(value, error, false, false); + optional<PropertyValue<SymbolPlacementType>> typedValue = + convert<PropertyValue<SymbolPlacementType>>(value, error, false, false); if (!typedValue) { return error; } @@ -1863,7 +1871,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::SymbolZOrder) { Error error; - optional<PropertyValue<SymbolZOrderType>> typedValue = convert<PropertyValue<SymbolZOrderType>>(value, error, false, false); + optional<PropertyValue<SymbolZOrderType>> typedValue = + convert<PropertyValue<SymbolZOrderType>>(value, error, false, false); if (!typedValue) { return error; } @@ -1875,7 +1884,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::TextField) { Error error; - optional<PropertyValue<expression::Formatted>> typedValue = convert<PropertyValue<expression::Formatted>>(value, error, true, true); + optional<PropertyValue<expression::Formatted>> typedValue = + convert<PropertyValue<expression::Formatted>>(value, error, true, true); if (!typedValue) { return error; } @@ -1887,7 +1897,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::TextFont) { Error error; - optional<PropertyValue<std::vector<std::string>>> typedValue = convert<PropertyValue<std::vector<std::string>>>(value, error, true, false); + optional<PropertyValue<std::vector<std::string>>> typedValue = + convert<PropertyValue<std::vector<std::string>>>(value, error, true, false); if (!typedValue) { return error; } @@ -1911,7 +1922,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::TextTransform) { Error error; - optional<PropertyValue<TextTransformType>> typedValue = convert<PropertyValue<TextTransformType>>(value, error, true, false); + optional<PropertyValue<TextTransformType>> typedValue = + convert<PropertyValue<TextTransformType>>(value, error, true, false); if (!typedValue) { return error; } @@ -1923,7 +1935,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::TextVariableAnchor) { Error error; - optional<PropertyValue<std::vector<TextVariableAnchorType>>> typedValue = convert<PropertyValue<std::vector<TextVariableAnchorType>>>(value, error, false, false); + optional<PropertyValue<std::vector<TextVariableAnchorType>>> typedValue = + convert<PropertyValue<std::vector<TextVariableAnchorType>>>(value, error, false, false); if (!typedValue) { return error; } @@ -1935,7 +1948,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co if (property == Property::TextWritingMode) { Error error; - optional<PropertyValue<std::vector<TextWritingModeType>>> typedValue = convert<PropertyValue<std::vector<TextWritingModeType>>>(value, error, false, false); + optional<PropertyValue<std::vector<TextWritingModeType>>> typedValue = + convert<PropertyValue<std::vector<TextWritingModeType>>>(value, error, false, false); if (!typedValue) { return error; } diff --git a/src/mbgl/style/layers/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp index e44e7e404f..6552589971 100644 --- a/src/mbgl/style/layers/symbol_layer_properties.hpp +++ b/src/mbgl/style/layers/symbol_layer_properties.hpp @@ -31,9 +31,9 @@ struct IconIgnorePlacement : LayoutProperty<bool> { static bool defaultValue() { return false; } }; -struct IconImage : DataDrivenLayoutProperty<std::string> { +struct IconImage : DataDrivenLayoutProperty<expression::Image> { static constexpr const char *name() { return "icon-image"; } - static std::string defaultValue() { return ""; } + static expression::Image defaultValue() { return {}; } }; struct IconKeepUpright : LayoutProperty<bool> { @@ -43,7 +43,7 @@ struct IconKeepUpright : LayoutProperty<bool> { struct IconOffset : DataDrivenLayoutProperty<std::array<float, 2>> { static constexpr const char *name() { return "icon-offset"; } - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } + static std::array<float, 2> defaultValue() { return {{0, 0}}; } }; struct IconOptional : LayoutProperty<bool> { @@ -83,7 +83,7 @@ struct IconTextFit : LayoutProperty<IconTextFitType> { struct IconTextFitPadding : LayoutProperty<std::array<float, 4>> { static constexpr const char *name() { return "icon-text-fit-padding"; } - static std::array<float, 4> defaultValue() { return {{ 0, 0, 0, 0 }}; } + static std::array<float, 4> defaultValue() { return {{0, 0, 0, 0}}; } }; struct SymbolAvoidEdges : LayoutProperty<bool> { @@ -123,12 +123,12 @@ struct TextAnchor : DataDrivenLayoutProperty<SymbolAnchorType> { struct TextField : DataDrivenLayoutProperty<expression::Formatted> { static constexpr const char *name() { return "text-field"; } - static expression::Formatted defaultValue() { return ""; } + static expression::Formatted defaultValue() { return {}; } }; struct TextFont : DataDrivenLayoutProperty<std::vector<std::string>> { static constexpr const char *name() { return "text-font"; } - static std::vector<std::string> defaultValue() { return { "Open Sans Regular", "Arial Unicode MS Regular" }; } + static std::vector<std::string> defaultValue() { return {{"Open Sans Regular"}, {"Arial Unicode MS Regular"}}; } }; struct TextIgnorePlacement : LayoutProperty<bool> { @@ -168,7 +168,7 @@ struct TextMaxWidth : DataDrivenLayoutProperty<float> { struct TextOffset : DataDrivenLayoutProperty<std::array<float, 2>> { static constexpr const char *name() { return "text-offset"; } - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } + static std::array<float, 2> defaultValue() { return {{0, 0}}; } }; struct TextOptional : LayoutProperty<bool> { @@ -213,12 +213,12 @@ struct TextTransform : DataDrivenLayoutProperty<TextTransformType> { struct TextVariableAnchor : LayoutProperty<std::vector<TextVariableAnchorType>> { static constexpr const char *name() { return "text-variable-anchor"; } - static std::vector<TextVariableAnchorType> defaultValue() { return { }; } + static std::vector<TextVariableAnchorType> defaultValue() { return {}; } }; struct TextWritingMode : LayoutProperty<std::vector<TextWritingModeType>> { static constexpr const char *name() { return "text-writing-mode"; } - static std::vector<TextWritingModeType> defaultValue() { return { }; } + static std::vector<TextWritingModeType> defaultValue() { return {}; } }; struct IconColor : DataDrivenPaintProperty<Color, attributes::fill_color, uniforms::fill_color> { @@ -242,7 +242,7 @@ struct IconOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniform }; struct IconTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } + static std::array<float, 2> defaultValue() { return {{0, 0}}; } }; struct IconTranslateAnchor : PaintProperty<TranslateAnchorType> { @@ -273,7 +273,7 @@ struct TextOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniform }; struct TextTranslate : PaintProperty<std::array<float, 2>> { - static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } + static std::array<float, 2> defaultValue() { return {{0, 0}}; } }; struct TextTranslateAnchor : PaintProperty<TranslateAnchorType> { |