diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/style/color_ramp_property_value.hpp (renamed from include/mbgl/style/heatmap_color_property_value.hpp) | 20 | ||||
-rw-r--r-- | include/mbgl/style/conversion/color_ramp_property_value.hpp (renamed from include/mbgl/style/conversion/heatmap_color_property_value.hpp) | 12 | ||||
-rw-r--r-- | include/mbgl/style/layers/heatmap_layer.hpp | 8 | ||||
-rw-r--r-- | include/mbgl/style/layers/layer.hpp.ejs | 6 |
4 files changed, 23 insertions, 23 deletions
diff --git a/include/mbgl/style/heatmap_color_property_value.hpp b/include/mbgl/style/color_ramp_property_value.hpp index 130639c6e2..3e93285d5a 100644 --- a/include/mbgl/style/heatmap_color_property_value.hpp +++ b/include/mbgl/style/color_ramp_property_value.hpp @@ -11,21 +11,21 @@ namespace style { * Special-case implementation of (a subset of) the PropertyValue<T> interface * used for building the HeatmapColor paint property traits class. */ -class HeatmapColorPropertyValue { +class ColorRampPropertyValue { private: std::shared_ptr<expression::Expression> value; - friend bool operator==(const HeatmapColorPropertyValue& lhs, const HeatmapColorPropertyValue& rhs) { + friend bool operator==(const ColorRampPropertyValue& lhs, const ColorRampPropertyValue& rhs) { return (lhs.isUndefined() && rhs.isUndefined()) || (lhs.value && rhs.value && *(lhs.value) == *(rhs.value)); } - friend bool operator!=(const HeatmapColorPropertyValue& lhs, const HeatmapColorPropertyValue& rhs) { + friend bool operator!=(const ColorRampPropertyValue& lhs, const ColorRampPropertyValue& rhs) { return !(lhs == rhs); } public: - HeatmapColorPropertyValue() : value(nullptr) {} - HeatmapColorPropertyValue(std::shared_ptr<expression::Expression> value_) : value(std::move(value_)) {} + ColorRampPropertyValue() : value(nullptr) {} + ColorRampPropertyValue(std::shared_ptr<expression::Expression> value_) : value(std::move(value_)) {} bool isUndefined() const { return value.get() == nullptr; } @@ -33,14 +33,14 @@ public: template <typename Evaluator> Color evaluate(const Evaluator&, TimePoint = {}) const { return {}; } - Color evaluate(double heatmapDensity) const { - const auto result = value->evaluate(expression::EvaluationContext({}, nullptr, {heatmapDensity})); + Color evaluate(double rampEvaluationParameter) const { + const auto result = value->evaluate(expression::EvaluationContext({}, nullptr, {rampEvaluationParameter})); return *expression::fromExpressionValue<Color>(*result); } - bool isDataDriven() const { return false; } - bool hasDataDrivenPropertyDifference(const HeatmapColorPropertyValue&) const { return false; } - + bool isDataDriven() const { return false; } + bool hasDataDrivenPropertyDifference(const ColorRampPropertyValue&) const { return false; } + const expression::Expression& getExpression() const { return *value; } }; diff --git a/include/mbgl/style/conversion/heatmap_color_property_value.hpp b/include/mbgl/style/conversion/color_ramp_property_value.hpp index a4710792d2..cf5d5e55d9 100644 --- a/include/mbgl/style/conversion/heatmap_color_property_value.hpp +++ b/include/mbgl/style/conversion/color_ramp_property_value.hpp @@ -1,6 +1,6 @@ #pragma once -#include <mbgl/style/heatmap_color_property_value.hpp> +#include <mbgl/style/color_ramp_property_value.hpp> #include <mbgl/style/conversion.hpp> #include <mbgl/style/conversion/constant.hpp> #include <mbgl/style/conversion/function.hpp> @@ -15,11 +15,11 @@ namespace style { namespace conversion { template <> -struct Converter<HeatmapColorPropertyValue> { - optional<HeatmapColorPropertyValue> operator()(const Convertible& value, Error& error) const { +struct Converter<ColorRampPropertyValue> { + optional<ColorRampPropertyValue> operator()(const Convertible& value, Error& error) const { using namespace mbgl::style::expression; if (isUndefined(value)) { - return HeatmapColorPropertyValue(); + return ColorRampPropertyValue(); } else if (isExpression(value)) { ParsingContext ctx(type::Color); ParseResult expression = ctx.parseLayerPropertyExpression(value); @@ -36,9 +36,9 @@ struct Converter<HeatmapColorPropertyValue> { error = { "zoom expressions not supported" }; return {}; } - return {HeatmapColorPropertyValue(std::move(*expression))}; + return {ColorRampPropertyValue(std::move(*expression))}; } else { - error = { "heatmap-color must be an expression" }; + error = { "color ramp must be an expression" }; return {}; } } diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp index 33d927ad38..4c434b2aff 100644 --- a/include/mbgl/style/layers/heatmap_layer.hpp +++ b/include/mbgl/style/layers/heatmap_layer.hpp @@ -2,11 +2,11 @@ #pragma once +#include <mbgl/style/color_ramp_property_value.hpp> #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> #include <mbgl/style/data_driven_property_value.hpp> -#include <mbgl/style/heatmap_color_property_value.hpp> #include <mbgl/util/color.hpp> @@ -55,9 +55,9 @@ public: void setHeatmapIntensityTransition(const TransitionOptions&); TransitionOptions getHeatmapIntensityTransition() const; - static HeatmapColorPropertyValue getDefaultHeatmapColor(); - HeatmapColorPropertyValue getHeatmapColor() const; - void setHeatmapColor(HeatmapColorPropertyValue); + static ColorRampPropertyValue getDefaultHeatmapColor(); + ColorRampPropertyValue getHeatmapColor() const; + void setHeatmapColor(ColorRampPropertyValue); void setHeatmapColorTransition(const TransitionOptions&); TransitionOptions getHeatmapColorTransition() const; diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs index 6d40405ccd..e15ff74f17 100644 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -7,13 +7,13 @@ #pragma once +<% if (type === 'heatmap') { -%> +#include <mbgl/style/color_ramp_property_value.hpp> +<% } -%> #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> #include <mbgl/style/data_driven_property_value.hpp> -<% if (type === 'heatmap') { -%> -#include <mbgl/style/heatmap_color_property_value.hpp> -<% } -%> #include <mbgl/util/color.hpp> |