From e78c31c4b53326f260a4274018b5cb98fac0dbb6 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Wed, 25 Sep 2019 23:31:56 +0300 Subject: [core] LayerProperty -> StyleProperty --- include/mbgl/style/conversion_impl.hpp | 20 ++++---- include/mbgl/style/layer.hpp | 8 +-- include/mbgl/style/layers/background_layer.hpp | 2 +- include/mbgl/style/layers/circle_layer.hpp | 2 +- include/mbgl/style/layers/custom_layer.hpp | 2 +- include/mbgl/style/layers/fill_extrusion_layer.hpp | 2 +- include/mbgl/style/layers/fill_layer.hpp | 2 +- include/mbgl/style/layers/heatmap_layer.hpp | 2 +- include/mbgl/style/layers/hillshade_layer.hpp | 2 +- include/mbgl/style/layers/layer.hpp.ejs | 2 +- include/mbgl/style/layers/line_layer.hpp | 2 +- include/mbgl/style/layers/raster_layer.hpp | 2 +- include/mbgl/style/layers/symbol_layer.hpp | 2 +- src/mbgl/style/layers/background_layer.cpp | 16 +++--- src/mbgl/style/layers/circle_layer.cpp | 48 ++++++++--------- src/mbgl/style/layers/custom_layer.cpp | 2 +- src/mbgl/style/layers/fill_extrusion_layer.cpp | 36 ++++++------- src/mbgl/style/layers/fill_layer.cpp | 32 ++++++------ src/mbgl/style/layers/heatmap_layer.cpp | 24 ++++----- src/mbgl/style/layers/hillshade_layer.cpp | 28 +++++----- src/mbgl/style/layers/layer.cpp.ejs | 8 +-- src/mbgl/style/layers/line_layer.cpp | 48 ++++++++--------- src/mbgl/style/layers/raster_layer.cpp | 36 ++++++------- src/mbgl/style/layers/symbol_layer.cpp | 60 +++++++++++----------- test/map/map.test.cpp | 24 ++++----- 25 files changed, 206 insertions(+), 206 deletions(-) diff --git a/include/mbgl/style/conversion_impl.hpp b/include/mbgl/style/conversion_impl.hpp index 866eff9eb5..ebeeee1c79 100644 --- a/include/mbgl/style/conversion_impl.hpp +++ b/include/mbgl/style/conversion_impl.hpp @@ -349,22 +349,22 @@ Value makeValue(T&& arg) { } template -LayerProperty makeLayerProperty(const PropertyValue& value) { - return value.match([](const Undefined&) -> LayerProperty { return {}; }, - [](const T& t) -> LayerProperty { - return {makeValue(t), LayerProperty::Kind::Constant}; +StyleProperty makeStyleProperty(const PropertyValue& value) { + return value.match([](const Undefined&) -> StyleProperty { return {}; }, + [](const T& t) -> StyleProperty { + return {makeValue(t), StyleProperty::Kind::Constant}; }, - [](const PropertyExpression& fn) -> LayerProperty { - return {fn.getExpression().serialize(), LayerProperty::Kind::Expression}; + [](const PropertyExpression& fn) -> StyleProperty { + return {fn.getExpression().serialize(), StyleProperty::Kind::Expression}; }); } -inline LayerProperty makeLayerProperty(const TransitionOptions& value) { - return {makeValue(value), LayerProperty::Kind::Transition}; +inline StyleProperty makeStyleProperty(const TransitionOptions& value) { + return {makeValue(value), StyleProperty::Kind::Transition}; } -inline LayerProperty makeLayerProperty(const ColorRampPropertyValue& value) { - return {makeValue(value), LayerProperty::Kind::Expression}; +inline StyleProperty makeStyleProperty(const ColorRampPropertyValue& value) { + return {makeValue(value), StyleProperty::Kind::Expression}; } } // namespace conversion diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp index 646bad898c..11fd429be9 100644 --- a/include/mbgl/style/layer.hpp +++ b/include/mbgl/style/layer.hpp @@ -66,10 +66,10 @@ struct LayerTypeInfo { const enum class TileKind : uint8_t { Geometry, Raster, RasterDEM, NotRequired } tileKind; }; -struct LayerProperty { +struct StyleProperty { enum class Kind : uint8_t { Undefined, Constant, Expression, Transition }; - LayerProperty(Value value_, Kind kind_) : value(std::move(value_)), kind(kind_) {} - LayerProperty() = default; + StyleProperty(Value value_, Kind kind_) : value(std::move(value_)), kind(kind_) {} + StyleProperty() = default; const Value value; const Kind kind = Kind::Undefined; }; @@ -123,7 +123,7 @@ public: const conversion::Convertible& value) = 0; optional setVisibility(const conversion::Convertible& value); - virtual LayerProperty getPaintProperty(const std::string&) const = 0; + virtual StyleProperty getPaintProperty(const std::string&) const = 0; // Private implementation // TODO : We should not have public mutable data members. diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp index 8caade26b0..ad40e49660 100644 --- a/include/mbgl/style/layers/background_layer.hpp +++ b/include/mbgl/style/layers/background_layer.hpp @@ -24,7 +24,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Paint properties diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp index be4fe5cee4..f0bd18a825 100644 --- a/include/mbgl/style/layers/circle_layer.hpp +++ b/include/mbgl/style/layers/circle_layer.hpp @@ -24,7 +24,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Paint properties diff --git a/include/mbgl/style/layers/custom_layer.hpp b/include/mbgl/style/layers/custom_layer.hpp index 9ae68c4fff..ad27226505 100644 --- a/include/mbgl/style/layers/custom_layer.hpp +++ b/include/mbgl/style/layers/custom_layer.hpp @@ -71,7 +71,7 @@ public: // Dynamic properties optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string&) const final; + StyleProperty getPaintProperty(const std::string&) const final; // Private implementation class Impl; diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp index 63ccf369d4..f2a5284fb9 100644 --- a/include/mbgl/style/layers/fill_extrusion_layer.hpp +++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp @@ -24,7 +24,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Paint properties diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp index acf60cec0d..0f4ce02aea 100644 --- a/include/mbgl/style/layers/fill_layer.hpp +++ b/include/mbgl/style/layers/fill_layer.hpp @@ -24,7 +24,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Paint properties diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp index 7eb7bb8edd..233ed32e36 100644 --- a/include/mbgl/style/layers/heatmap_layer.hpp +++ b/include/mbgl/style/layers/heatmap_layer.hpp @@ -25,7 +25,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Paint properties diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp index 7c8f6fa573..aaed4597dc 100644 --- a/include/mbgl/style/layers/hillshade_layer.hpp +++ b/include/mbgl/style/layers/hillshade_layer.hpp @@ -24,7 +24,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Paint properties diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs index f678adeda7..20dcb86abd 100644 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -40,7 +40,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; <% if (layoutProperties.length) { -%> // Layout properties diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp index a1c69e9475..410b518f7b 100644 --- a/include/mbgl/style/layers/line_layer.hpp +++ b/include/mbgl/style/layers/line_layer.hpp @@ -27,7 +27,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Layout properties diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp index e516e1a0fc..91dab175ec 100644 --- a/include/mbgl/style/layers/raster_layer.hpp +++ b/include/mbgl/style/layers/raster_layer.hpp @@ -24,7 +24,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Paint properties diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp index 578d7d1701..0c128f84a6 100644 --- a/include/mbgl/style/layers/symbol_layer.hpp +++ b/include/mbgl/style/layers/symbol_layer.hpp @@ -26,7 +26,7 @@ public: optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - LayerProperty getPaintProperty(const std::string& name) const final; + StyleProperty getPaintProperty(const std::string& name) const final; // Layout properties diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp index 735d653e85..0e9e95d51a 100644 --- a/src/mbgl/style/layers/background_layer.cpp +++ b/src/mbgl/style/layers/background_layer.cpp @@ -150,7 +150,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { BackgroundColor, BackgroundOpacity, BackgroundPattern, @@ -244,7 +244,7 @@ optional BackgroundLayer::setPaintProperty(const std::string& name, const return Error{"layer doesn't support this property"}; } -LayerProperty BackgroundLayer::getPaintProperty(const std::string& name) const { +StyleProperty BackgroundLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -252,17 +252,17 @@ LayerProperty BackgroundLayer::getPaintProperty(const std::string& name) const { switch (static_cast(it->second)) { case Property::BackgroundColor: - return makeLayerProperty(getBackgroundColor()); + return makeStyleProperty(getBackgroundColor()); case Property::BackgroundOpacity: - return makeLayerProperty(getBackgroundOpacity()); + return makeStyleProperty(getBackgroundOpacity()); case Property::BackgroundPattern: - return makeLayerProperty(getBackgroundPattern()); + return makeStyleProperty(getBackgroundPattern()); case Property::BackgroundColorTransition: - return makeLayerProperty(getBackgroundColorTransition()); + return makeStyleProperty(getBackgroundColorTransition()); case Property::BackgroundOpacityTransition: - return makeLayerProperty(getBackgroundOpacityTransition()); + return makeStyleProperty(getBackgroundOpacityTransition()); case Property::BackgroundPatternTransition: - return makeLayerProperty(getBackgroundPatternTransition()); + return makeStyleProperty(getBackgroundPatternTransition()); } return {}; } diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp index 73171713b8..8b5359149c 100644 --- a/src/mbgl/style/layers/circle_layer.cpp +++ b/src/mbgl/style/layers/circle_layer.cpp @@ -366,7 +366,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { CircleBlur, CircleColor, CircleOpacity, @@ -597,7 +597,7 @@ optional CircleLayer::setPaintProperty(const std::string& name, const Con return Error{"layer doesn't support this property"}; } -LayerProperty CircleLayer::getPaintProperty(const std::string& name) const { +StyleProperty CircleLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -605,49 +605,49 @@ LayerProperty CircleLayer::getPaintProperty(const std::string& name) const { switch (static_cast(it->second)) { case Property::CircleBlur: - return makeLayerProperty(getCircleBlur()); + return makeStyleProperty(getCircleBlur()); case Property::CircleColor: - return makeLayerProperty(getCircleColor()); + return makeStyleProperty(getCircleColor()); case Property::CircleOpacity: - return makeLayerProperty(getCircleOpacity()); + return makeStyleProperty(getCircleOpacity()); case Property::CirclePitchAlignment: - return makeLayerProperty(getCirclePitchAlignment()); + return makeStyleProperty(getCirclePitchAlignment()); case Property::CirclePitchScale: - return makeLayerProperty(getCirclePitchScale()); + return makeStyleProperty(getCirclePitchScale()); case Property::CircleRadius: - return makeLayerProperty(getCircleRadius()); + return makeStyleProperty(getCircleRadius()); case Property::CircleStrokeColor: - return makeLayerProperty(getCircleStrokeColor()); + return makeStyleProperty(getCircleStrokeColor()); case Property::CircleStrokeOpacity: - return makeLayerProperty(getCircleStrokeOpacity()); + return makeStyleProperty(getCircleStrokeOpacity()); case Property::CircleStrokeWidth: - return makeLayerProperty(getCircleStrokeWidth()); + return makeStyleProperty(getCircleStrokeWidth()); case Property::CircleTranslate: - return makeLayerProperty(getCircleTranslate()); + return makeStyleProperty(getCircleTranslate()); case Property::CircleTranslateAnchor: - return makeLayerProperty(getCircleTranslateAnchor()); + return makeStyleProperty(getCircleTranslateAnchor()); case Property::CircleBlurTransition: - return makeLayerProperty(getCircleBlurTransition()); + return makeStyleProperty(getCircleBlurTransition()); case Property::CircleColorTransition: - return makeLayerProperty(getCircleColorTransition()); + return makeStyleProperty(getCircleColorTransition()); case Property::CircleOpacityTransition: - return makeLayerProperty(getCircleOpacityTransition()); + return makeStyleProperty(getCircleOpacityTransition()); case Property::CirclePitchAlignmentTransition: - return makeLayerProperty(getCirclePitchAlignmentTransition()); + return makeStyleProperty(getCirclePitchAlignmentTransition()); case Property::CirclePitchScaleTransition: - return makeLayerProperty(getCirclePitchScaleTransition()); + return makeStyleProperty(getCirclePitchScaleTransition()); case Property::CircleRadiusTransition: - return makeLayerProperty(getCircleRadiusTransition()); + return makeStyleProperty(getCircleRadiusTransition()); case Property::CircleStrokeColorTransition: - return makeLayerProperty(getCircleStrokeColorTransition()); + return makeStyleProperty(getCircleStrokeColorTransition()); case Property::CircleStrokeOpacityTransition: - return makeLayerProperty(getCircleStrokeOpacityTransition()); + return makeStyleProperty(getCircleStrokeOpacityTransition()); case Property::CircleStrokeWidthTransition: - return makeLayerProperty(getCircleStrokeWidthTransition()); + return makeStyleProperty(getCircleStrokeWidthTransition()); case Property::CircleTranslateTransition: - return makeLayerProperty(getCircleTranslateTransition()); + return makeStyleProperty(getCircleTranslateTransition()); case Property::CircleTranslateAnchorTransition: - return makeLayerProperty(getCircleTranslateAnchorTransition()); + return makeStyleProperty(getCircleTranslateAnchorTransition()); } return {}; } diff --git a/src/mbgl/style/layers/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp index f96cc682e5..98ca68aa48 100644 --- a/src/mbgl/style/layers/custom_layer.cpp +++ b/src/mbgl/style/layers/custom_layer.cpp @@ -47,7 +47,7 @@ optional CustomLayer::setLayoutProperty(const std::string&, const Convert return Error { "layer doesn't support this property" }; } -LayerProperty CustomLayer::getPaintProperty(const std::string&) const { +StyleProperty CustomLayer::getPaintProperty(const std::string&) const { return {}; } diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp index 04206e670d..690d74b2f5 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer.cpp +++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp @@ -285,7 +285,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { FillExtrusionBase, FillExtrusionColor, FillExtrusionHeight, @@ -479,7 +479,7 @@ optional FillExtrusionLayer::setPaintProperty(const std::string& name, co return Error{"layer doesn't support this property"}; } -LayerProperty FillExtrusionLayer::getPaintProperty(const std::string& name) const { +StyleProperty FillExtrusionLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -487,37 +487,37 @@ LayerProperty FillExtrusionLayer::getPaintProperty(const std::string& name) cons switch (static_cast(it->second)) { case Property::FillExtrusionBase: - return makeLayerProperty(getFillExtrusionBase()); + return makeStyleProperty(getFillExtrusionBase()); case Property::FillExtrusionColor: - return makeLayerProperty(getFillExtrusionColor()); + return makeStyleProperty(getFillExtrusionColor()); case Property::FillExtrusionHeight: - return makeLayerProperty(getFillExtrusionHeight()); + return makeStyleProperty(getFillExtrusionHeight()); case Property::FillExtrusionOpacity: - return makeLayerProperty(getFillExtrusionOpacity()); + return makeStyleProperty(getFillExtrusionOpacity()); case Property::FillExtrusionPattern: - return makeLayerProperty(getFillExtrusionPattern()); + return makeStyleProperty(getFillExtrusionPattern()); case Property::FillExtrusionTranslate: - return makeLayerProperty(getFillExtrusionTranslate()); + return makeStyleProperty(getFillExtrusionTranslate()); case Property::FillExtrusionTranslateAnchor: - return makeLayerProperty(getFillExtrusionTranslateAnchor()); + return makeStyleProperty(getFillExtrusionTranslateAnchor()); case Property::FillExtrusionVerticalGradient: - return makeLayerProperty(getFillExtrusionVerticalGradient()); + return makeStyleProperty(getFillExtrusionVerticalGradient()); case Property::FillExtrusionBaseTransition: - return makeLayerProperty(getFillExtrusionBaseTransition()); + return makeStyleProperty(getFillExtrusionBaseTransition()); case Property::FillExtrusionColorTransition: - return makeLayerProperty(getFillExtrusionColorTransition()); + return makeStyleProperty(getFillExtrusionColorTransition()); case Property::FillExtrusionHeightTransition: - return makeLayerProperty(getFillExtrusionHeightTransition()); + return makeStyleProperty(getFillExtrusionHeightTransition()); case Property::FillExtrusionOpacityTransition: - return makeLayerProperty(getFillExtrusionOpacityTransition()); + return makeStyleProperty(getFillExtrusionOpacityTransition()); case Property::FillExtrusionPatternTransition: - return makeLayerProperty(getFillExtrusionPatternTransition()); + return makeStyleProperty(getFillExtrusionPatternTransition()); case Property::FillExtrusionTranslateTransition: - return makeLayerProperty(getFillExtrusionTranslateTransition()); + return makeStyleProperty(getFillExtrusionTranslateTransition()); case Property::FillExtrusionTranslateAnchorTransition: - return makeLayerProperty(getFillExtrusionTranslateAnchorTransition()); + return makeStyleProperty(getFillExtrusionTranslateAnchorTransition()); case Property::FillExtrusionVerticalGradientTransition: - return makeLayerProperty(getFillExtrusionVerticalGradientTransition()); + return makeStyleProperty(getFillExtrusionVerticalGradientTransition()); } return {}; } diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp index 25bf97bb6d..e4f2a8cc53 100644 --- a/src/mbgl/style/layers/fill_layer.cpp +++ b/src/mbgl/style/layers/fill_layer.cpp @@ -258,7 +258,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { FillAntialias, FillColor, FillOpacity, @@ -431,7 +431,7 @@ optional FillLayer::setPaintProperty(const std::string& name, const Conve return Error{"layer doesn't support this property"}; } -LayerProperty FillLayer::getPaintProperty(const std::string& name) const { +StyleProperty FillLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -439,33 +439,33 @@ LayerProperty FillLayer::getPaintProperty(const std::string& name) const { switch (static_cast(it->second)) { case Property::FillAntialias: - return makeLayerProperty(getFillAntialias()); + return makeStyleProperty(getFillAntialias()); case Property::FillColor: - return makeLayerProperty(getFillColor()); + return makeStyleProperty(getFillColor()); case Property::FillOpacity: - return makeLayerProperty(getFillOpacity()); + return makeStyleProperty(getFillOpacity()); case Property::FillOutlineColor: - return makeLayerProperty(getFillOutlineColor()); + return makeStyleProperty(getFillOutlineColor()); case Property::FillPattern: - return makeLayerProperty(getFillPattern()); + return makeStyleProperty(getFillPattern()); case Property::FillTranslate: - return makeLayerProperty(getFillTranslate()); + return makeStyleProperty(getFillTranslate()); case Property::FillTranslateAnchor: - return makeLayerProperty(getFillTranslateAnchor()); + return makeStyleProperty(getFillTranslateAnchor()); case Property::FillAntialiasTransition: - return makeLayerProperty(getFillAntialiasTransition()); + return makeStyleProperty(getFillAntialiasTransition()); case Property::FillColorTransition: - return makeLayerProperty(getFillColorTransition()); + return makeStyleProperty(getFillColorTransition()); case Property::FillOpacityTransition: - return makeLayerProperty(getFillOpacityTransition()); + return makeStyleProperty(getFillOpacityTransition()); case Property::FillOutlineColorTransition: - return makeLayerProperty(getFillOutlineColorTransition()); + return makeStyleProperty(getFillOutlineColorTransition()); case Property::FillPatternTransition: - return makeLayerProperty(getFillPatternTransition()); + return makeStyleProperty(getFillPatternTransition()); case Property::FillTranslateTransition: - return makeLayerProperty(getFillTranslateTransition()); + return makeStyleProperty(getFillTranslateTransition()); case Property::FillTranslateAnchorTransition: - return makeLayerProperty(getFillTranslateAnchorTransition()); + return makeStyleProperty(getFillTranslateAnchorTransition()); } return {}; } diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp index 3db78c4cf5..5cda778d0f 100644 --- a/src/mbgl/style/layers/heatmap_layer.cpp +++ b/src/mbgl/style/layers/heatmap_layer.cpp @@ -206,7 +206,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { HeatmapColor, HeatmapIntensity, HeatmapOpacity, @@ -332,7 +332,7 @@ optional HeatmapLayer::setPaintProperty(const std::string& name, const Co return Error{"layer doesn't support this property"}; } -LayerProperty HeatmapLayer::getPaintProperty(const std::string& name) const { +StyleProperty HeatmapLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -340,25 +340,25 @@ LayerProperty HeatmapLayer::getPaintProperty(const std::string& name) const { switch (static_cast(it->second)) { case Property::HeatmapColor: - return makeLayerProperty(getHeatmapColor()); + return makeStyleProperty(getHeatmapColor()); case Property::HeatmapIntensity: - return makeLayerProperty(getHeatmapIntensity()); + return makeStyleProperty(getHeatmapIntensity()); case Property::HeatmapOpacity: - return makeLayerProperty(getHeatmapOpacity()); + return makeStyleProperty(getHeatmapOpacity()); case Property::HeatmapRadius: - return makeLayerProperty(getHeatmapRadius()); + return makeStyleProperty(getHeatmapRadius()); case Property::HeatmapWeight: - return makeLayerProperty(getHeatmapWeight()); + return makeStyleProperty(getHeatmapWeight()); case Property::HeatmapColorTransition: - return makeLayerProperty(getHeatmapColorTransition()); + return makeStyleProperty(getHeatmapColorTransition()); case Property::HeatmapIntensityTransition: - return makeLayerProperty(getHeatmapIntensityTransition()); + return makeStyleProperty(getHeatmapIntensityTransition()); case Property::HeatmapOpacityTransition: - return makeLayerProperty(getHeatmapOpacityTransition()); + return makeStyleProperty(getHeatmapOpacityTransition()); case Property::HeatmapRadiusTransition: - return makeLayerProperty(getHeatmapRadiusTransition()); + return makeStyleProperty(getHeatmapRadiusTransition()); case Property::HeatmapWeightTransition: - return makeLayerProperty(getHeatmapWeightTransition()); + return makeStyleProperty(getHeatmapWeightTransition()); } return {}; } diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp index bda125da4a..7e67409a35 100644 --- a/src/mbgl/style/layers/hillshade_layer.cpp +++ b/src/mbgl/style/layers/hillshade_layer.cpp @@ -231,7 +231,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { HillshadeAccentColor, HillshadeExaggeration, HillshadeHighlightColor, @@ -371,7 +371,7 @@ optional HillshadeLayer::setPaintProperty(const std::string& name, const return Error{"layer doesn't support this property"}; } -LayerProperty HillshadeLayer::getPaintProperty(const std::string& name) const { +StyleProperty HillshadeLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -379,29 +379,29 @@ LayerProperty HillshadeLayer::getPaintProperty(const std::string& name) const { switch (static_cast(it->second)) { case Property::HillshadeAccentColor: - return makeLayerProperty(getHillshadeAccentColor()); + return makeStyleProperty(getHillshadeAccentColor()); case Property::HillshadeExaggeration: - return makeLayerProperty(getHillshadeExaggeration()); + return makeStyleProperty(getHillshadeExaggeration()); case Property::HillshadeHighlightColor: - return makeLayerProperty(getHillshadeHighlightColor()); + return makeStyleProperty(getHillshadeHighlightColor()); case Property::HillshadeIlluminationAnchor: - return makeLayerProperty(getHillshadeIlluminationAnchor()); + return makeStyleProperty(getHillshadeIlluminationAnchor()); case Property::HillshadeIlluminationDirection: - return makeLayerProperty(getHillshadeIlluminationDirection()); + return makeStyleProperty(getHillshadeIlluminationDirection()); case Property::HillshadeShadowColor: - return makeLayerProperty(getHillshadeShadowColor()); + return makeStyleProperty(getHillshadeShadowColor()); case Property::HillshadeAccentColorTransition: - return makeLayerProperty(getHillshadeAccentColorTransition()); + return makeStyleProperty(getHillshadeAccentColorTransition()); case Property::HillshadeExaggerationTransition: - return makeLayerProperty(getHillshadeExaggerationTransition()); + return makeStyleProperty(getHillshadeExaggerationTransition()); case Property::HillshadeHighlightColorTransition: - return makeLayerProperty(getHillshadeHighlightColorTransition()); + return makeStyleProperty(getHillshadeHighlightColorTransition()); case Property::HillshadeIlluminationAnchorTransition: - return makeLayerProperty(getHillshadeIlluminationAnchorTransition()); + return makeStyleProperty(getHillshadeIlluminationAnchorTransition()); case Property::HillshadeIlluminationDirectionTransition: - return makeLayerProperty(getHillshadeIlluminationDirectionTransition()); + return makeStyleProperty(getHillshadeIlluminationDirectionTransition()); case Property::HillshadeShadowColorTransition: - return makeLayerProperty(getHillshadeShadowColorTransition()); + return makeStyleProperty(getHillshadeShadowColorTransition()); } return {}; } diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index 81b04be267..723c2b87ca 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -192,7 +192,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { <% for (const property of paintProperties) { -%> <%- camelize(property.name) %>, <% } -%> @@ -265,7 +265,7 @@ optional <%- camelize(type) %>Layer::setPaintProperty(const std::string& return Error{"layer doesn't support this property"}; } -LayerProperty <%- camelize(type) %>Layer::getPaintProperty(const std::string& name) const { +StyleProperty <%- camelize(type) %>Layer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -274,11 +274,11 @@ LayerProperty <%- camelize(type) %>Layer::getPaintProperty(const std::string& na switch (static_cast(it->second)) { <% for (const property of paintProperties) { -%> case Property::<%- camelize(property.name) %>: - return makeLayerProperty(get<%- camelize(property.name) %>()); + return makeStyleProperty(get<%- camelize(property.name) %>()); <% } -%> <% for (const property of paintProperties) { -%> case Property::<%- camelize(property.name) %>Transition: - return makeLayerProperty(get<%- camelize(property.name) %>Transition()); + return makeStyleProperty(get<%- camelize(property.name) %>Transition()); <% } -%> } return {}; diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp index ee1cfe2966..96b84ee1c5 100644 --- a/src/mbgl/style/layers/line_layer.cpp +++ b/src/mbgl/style/layers/line_layer.cpp @@ -432,7 +432,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { LineBlur, LineColor, LineDasharray, @@ -668,7 +668,7 @@ optional LineLayer::setPaintProperty(const std::string& name, const Conve return Error{"layer doesn't support this property"}; } -LayerProperty LineLayer::getPaintProperty(const std::string& name) const { +StyleProperty LineLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -676,49 +676,49 @@ LayerProperty LineLayer::getPaintProperty(const std::string& name) const { switch (static_cast(it->second)) { case Property::LineBlur: - return makeLayerProperty(getLineBlur()); + return makeStyleProperty(getLineBlur()); case Property::LineColor: - return makeLayerProperty(getLineColor()); + return makeStyleProperty(getLineColor()); case Property::LineDasharray: - return makeLayerProperty(getLineDasharray()); + return makeStyleProperty(getLineDasharray()); case Property::LineGapWidth: - return makeLayerProperty(getLineGapWidth()); + return makeStyleProperty(getLineGapWidth()); case Property::LineGradient: - return makeLayerProperty(getLineGradient()); + return makeStyleProperty(getLineGradient()); case Property::LineOffset: - return makeLayerProperty(getLineOffset()); + return makeStyleProperty(getLineOffset()); case Property::LineOpacity: - return makeLayerProperty(getLineOpacity()); + return makeStyleProperty(getLineOpacity()); case Property::LinePattern: - return makeLayerProperty(getLinePattern()); + return makeStyleProperty(getLinePattern()); case Property::LineTranslate: - return makeLayerProperty(getLineTranslate()); + return makeStyleProperty(getLineTranslate()); case Property::LineTranslateAnchor: - return makeLayerProperty(getLineTranslateAnchor()); + return makeStyleProperty(getLineTranslateAnchor()); case Property::LineWidth: - return makeLayerProperty(getLineWidth()); + return makeStyleProperty(getLineWidth()); case Property::LineBlurTransition: - return makeLayerProperty(getLineBlurTransition()); + return makeStyleProperty(getLineBlurTransition()); case Property::LineColorTransition: - return makeLayerProperty(getLineColorTransition()); + return makeStyleProperty(getLineColorTransition()); case Property::LineDasharrayTransition: - return makeLayerProperty(getLineDasharrayTransition()); + return makeStyleProperty(getLineDasharrayTransition()); case Property::LineGapWidthTransition: - return makeLayerProperty(getLineGapWidthTransition()); + return makeStyleProperty(getLineGapWidthTransition()); case Property::LineGradientTransition: - return makeLayerProperty(getLineGradientTransition()); + return makeStyleProperty(getLineGradientTransition()); case Property::LineOffsetTransition: - return makeLayerProperty(getLineOffsetTransition()); + return makeStyleProperty(getLineOffsetTransition()); case Property::LineOpacityTransition: - return makeLayerProperty(getLineOpacityTransition()); + return makeStyleProperty(getLineOpacityTransition()); case Property::LinePatternTransition: - return makeLayerProperty(getLinePatternTransition()); + return makeStyleProperty(getLinePatternTransition()); case Property::LineTranslateTransition: - return makeLayerProperty(getLineTranslateTransition()); + return makeStyleProperty(getLineTranslateTransition()); case Property::LineTranslateAnchorTransition: - return makeLayerProperty(getLineTranslateAnchorTransition()); + return makeStyleProperty(getLineTranslateAnchorTransition()); case Property::LineWidthTransition: - return makeLayerProperty(getLineWidthTransition()); + return makeStyleProperty(getLineWidthTransition()); } return {}; } diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp index 263cc0e2f4..20640020e0 100644 --- a/src/mbgl/style/layers/raster_layer.cpp +++ b/src/mbgl/style/layers/raster_layer.cpp @@ -285,7 +285,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { RasterBrightnessMax, RasterBrightnessMin, RasterContrast, @@ -444,7 +444,7 @@ optional RasterLayer::setPaintProperty(const std::string& name, const Con return Error{"layer doesn't support this property"}; } -LayerProperty RasterLayer::getPaintProperty(const std::string& name) const { +StyleProperty RasterLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -452,37 +452,37 @@ LayerProperty RasterLayer::getPaintProperty(const std::string& name) const { switch (static_cast(it->second)) { case Property::RasterBrightnessMax: - return makeLayerProperty(getRasterBrightnessMax()); + return makeStyleProperty(getRasterBrightnessMax()); case Property::RasterBrightnessMin: - return makeLayerProperty(getRasterBrightnessMin()); + return makeStyleProperty(getRasterBrightnessMin()); case Property::RasterContrast: - return makeLayerProperty(getRasterContrast()); + return makeStyleProperty(getRasterContrast()); case Property::RasterFadeDuration: - return makeLayerProperty(getRasterFadeDuration()); + return makeStyleProperty(getRasterFadeDuration()); case Property::RasterHueRotate: - return makeLayerProperty(getRasterHueRotate()); + return makeStyleProperty(getRasterHueRotate()); case Property::RasterOpacity: - return makeLayerProperty(getRasterOpacity()); + return makeStyleProperty(getRasterOpacity()); case Property::RasterResampling: - return makeLayerProperty(getRasterResampling()); + return makeStyleProperty(getRasterResampling()); case Property::RasterSaturation: - return makeLayerProperty(getRasterSaturation()); + return makeStyleProperty(getRasterSaturation()); case Property::RasterBrightnessMaxTransition: - return makeLayerProperty(getRasterBrightnessMaxTransition()); + return makeStyleProperty(getRasterBrightnessMaxTransition()); case Property::RasterBrightnessMinTransition: - return makeLayerProperty(getRasterBrightnessMinTransition()); + return makeStyleProperty(getRasterBrightnessMinTransition()); case Property::RasterContrastTransition: - return makeLayerProperty(getRasterContrastTransition()); + return makeStyleProperty(getRasterContrastTransition()); case Property::RasterFadeDurationTransition: - return makeLayerProperty(getRasterFadeDurationTransition()); + return makeStyleProperty(getRasterFadeDurationTransition()); case Property::RasterHueRotateTransition: - return makeLayerProperty(getRasterHueRotateTransition()); + return makeStyleProperty(getRasterHueRotateTransition()); case Property::RasterOpacityTransition: - return makeLayerProperty(getRasterOpacityTransition()); + return makeStyleProperty(getRasterOpacityTransition()); case Property::RasterResamplingTransition: - return makeLayerProperty(getRasterResamplingTransition()); + return makeStyleProperty(getRasterResamplingTransition()); case Property::RasterSaturationTransition: - return makeLayerProperty(getRasterSaturationTransition()); + return makeStyleProperty(getRasterSaturationTransition()); } return {}; } diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index 48ecc245c5..86c049e509 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -1104,7 +1104,7 @@ using namespace conversion; namespace { -enum class Property { +enum class Property : uint8_t { IconColor, IconHaloBlur, IconHaloColor, @@ -1367,7 +1367,7 @@ optional SymbolLayer::setPaintProperty(const std::string& name, const Con return Error{"layer doesn't support this property"}; } -LayerProperty SymbolLayer::getPaintProperty(const std::string& name) const { +StyleProperty SymbolLayer::getPaintProperty(const std::string& name) const { const auto it = paintProperties.find(name.c_str()); if (it == paintProperties.end()) { return {}; @@ -1375,61 +1375,61 @@ LayerProperty SymbolLayer::getPaintProperty(const std::string& name) const { switch (static_cast(it->second)) { case Property::IconColor: - return makeLayerProperty(getIconColor()); + return makeStyleProperty(getIconColor()); case Property::IconHaloBlur: - return makeLayerProperty(getIconHaloBlur()); + return makeStyleProperty(getIconHaloBlur()); case Property::IconHaloColor: - return makeLayerProperty(getIconHaloColor()); + return makeStyleProperty(getIconHaloColor()); case Property::IconHaloWidth: - return makeLayerProperty(getIconHaloWidth()); + return makeStyleProperty(getIconHaloWidth()); case Property::IconOpacity: - return makeLayerProperty(getIconOpacity()); + return makeStyleProperty(getIconOpacity()); case Property::IconTranslate: - return makeLayerProperty(getIconTranslate()); + return makeStyleProperty(getIconTranslate()); case Property::IconTranslateAnchor: - return makeLayerProperty(getIconTranslateAnchor()); + return makeStyleProperty(getIconTranslateAnchor()); case Property::TextColor: - return makeLayerProperty(getTextColor()); + return makeStyleProperty(getTextColor()); case Property::TextHaloBlur: - return makeLayerProperty(getTextHaloBlur()); + return makeStyleProperty(getTextHaloBlur()); case Property::TextHaloColor: - return makeLayerProperty(getTextHaloColor()); + return makeStyleProperty(getTextHaloColor()); case Property::TextHaloWidth: - return makeLayerProperty(getTextHaloWidth()); + return makeStyleProperty(getTextHaloWidth()); case Property::TextOpacity: - return makeLayerProperty(getTextOpacity()); + return makeStyleProperty(getTextOpacity()); case Property::TextTranslate: - return makeLayerProperty(getTextTranslate()); + return makeStyleProperty(getTextTranslate()); case Property::TextTranslateAnchor: - return makeLayerProperty(getTextTranslateAnchor()); + return makeStyleProperty(getTextTranslateAnchor()); case Property::IconColorTransition: - return makeLayerProperty(getIconColorTransition()); + return makeStyleProperty(getIconColorTransition()); case Property::IconHaloBlurTransition: - return makeLayerProperty(getIconHaloBlurTransition()); + return makeStyleProperty(getIconHaloBlurTransition()); case Property::IconHaloColorTransition: - return makeLayerProperty(getIconHaloColorTransition()); + return makeStyleProperty(getIconHaloColorTransition()); case Property::IconHaloWidthTransition: - return makeLayerProperty(getIconHaloWidthTransition()); + return makeStyleProperty(getIconHaloWidthTransition()); case Property::IconOpacityTransition: - return makeLayerProperty(getIconOpacityTransition()); + return makeStyleProperty(getIconOpacityTransition()); case Property::IconTranslateTransition: - return makeLayerProperty(getIconTranslateTransition()); + return makeStyleProperty(getIconTranslateTransition()); case Property::IconTranslateAnchorTransition: - return makeLayerProperty(getIconTranslateAnchorTransition()); + return makeStyleProperty(getIconTranslateAnchorTransition()); case Property::TextColorTransition: - return makeLayerProperty(getTextColorTransition()); + return makeStyleProperty(getTextColorTransition()); case Property::TextHaloBlurTransition: - return makeLayerProperty(getTextHaloBlurTransition()); + return makeStyleProperty(getTextHaloBlurTransition()); case Property::TextHaloColorTransition: - return makeLayerProperty(getTextHaloColorTransition()); + return makeStyleProperty(getTextHaloColorTransition()); case Property::TextHaloWidthTransition: - return makeLayerProperty(getTextHaloWidthTransition()); + return makeStyleProperty(getTextHaloWidthTransition()); case Property::TextOpacityTransition: - return makeLayerProperty(getTextOpacityTransition()); + return makeStyleProperty(getTextOpacityTransition()); case Property::TextTranslateTransition: - return makeLayerProperty(getTextTranslateTransition()); + return makeStyleProperty(getTextTranslateTransition()); case Property::TextTranslateAnchorTransition: - return makeLayerProperty(getTextTranslateAnchorTransition()); + return makeStyleProperty(getTextTranslateAnchorTransition()); } return {}; } diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 35bae779c4..758d1fa7cd 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -953,17 +953,17 @@ TEST(Map, UniversalStyleGetter) { Layer* lineLayer = test.map.getStyle().getLayer("line"); ASSERT_TRUE(lineLayer); - LayerProperty nonexistent = lineLayer->getPaintProperty("nonexistent"); + StyleProperty nonexistent = lineLayer->getPaintProperty("nonexistent"); ASSERT_FALSE(nonexistent.value); - EXPECT_EQ(LayerProperty::Kind::Undefined, nonexistent.kind); + EXPECT_EQ(StyleProperty::Kind::Undefined, nonexistent.kind); - LayerProperty undefined = lineLayer->getPaintProperty("line-blur"); + StyleProperty undefined = lineLayer->getPaintProperty("line-blur"); ASSERT_FALSE(undefined.value); - EXPECT_EQ(LayerProperty::Kind::Undefined, undefined.kind); + EXPECT_EQ(StyleProperty::Kind::Undefined, undefined.kind); - LayerProperty lineColor = lineLayer->getPaintProperty("line-color"); + StyleProperty lineColor = lineLayer->getPaintProperty("line-color"); ASSERT_TRUE(lineColor.value); - EXPECT_EQ(LayerProperty::Kind::Constant, lineColor.kind); + EXPECT_EQ(StyleProperty::Kind::Constant, lineColor.kind); ASSERT_TRUE(lineColor.value.getObject()); const auto& color = *(lineColor.value.getObject()); EXPECT_EQ(1.0, *color.at("r").getDouble()); @@ -971,21 +971,21 @@ TEST(Map, UniversalStyleGetter) { EXPECT_EQ(0.0, *color.at("b").getDouble()); EXPECT_EQ(1.0, *color.at("a").getDouble()); - LayerProperty lineOpacity = lineLayer->getPaintProperty("line-opacity"); + StyleProperty lineOpacity = lineLayer->getPaintProperty("line-opacity"); ASSERT_TRUE(lineOpacity.value); - EXPECT_EQ(LayerProperty::Kind::Constant, lineOpacity.kind); + EXPECT_EQ(StyleProperty::Kind::Constant, lineOpacity.kind); ASSERT_TRUE(lineOpacity.value.getDouble()); EXPECT_EQ(0.5, *lineOpacity.value.getDouble()); - LayerProperty lineOpacityTransition = lineLayer->getPaintProperty("line-opacity-transition"); + StyleProperty lineOpacityTransition = lineLayer->getPaintProperty("line-opacity-transition"); ASSERT_TRUE(lineOpacityTransition.value); - EXPECT_EQ(LayerProperty::Kind::Transition, lineOpacityTransition.kind); + EXPECT_EQ(StyleProperty::Kind::Transition, lineOpacityTransition.kind); ASSERT_TRUE(lineOpacityTransition.value.getArray()); EXPECT_EQ(3u, lineOpacityTransition.value.getArray()->size()); - LayerProperty lineWidth = lineLayer->getPaintProperty("line-width"); + StyleProperty lineWidth = lineLayer->getPaintProperty("line-width"); ASSERT_TRUE(lineWidth.value); - EXPECT_EQ(LayerProperty::Kind::Expression, lineWidth.kind); + EXPECT_EQ(StyleProperty::Kind::Expression, lineWidth.kind); ASSERT_TRUE(lineWidth.value.getArray()); const auto& expression = *lineWidth.value.getArray(); -- cgit v1.2.1