summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/style/color_ramp_property_value.hpp (renamed from include/mbgl/style/heatmap_color_property_value.hpp)16
-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/expression/expression.hpp10
-rw-r--r--include/mbgl/style/layers/heatmap_layer.hpp8
-rw-r--r--include/mbgl/style/layers/layer.hpp.ejs4
-rw-r--r--include/mbgl/style/layers/line_layer.hpp7
6 files changed, 32 insertions, 25 deletions
diff --git a/include/mbgl/style/heatmap_color_property_value.hpp b/include/mbgl/style/color_ramp_property_value.hpp
index 130639c6e2..03d74fae0c 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,13 +33,13 @@ 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 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 e3689c524c..eeb9d0ae34 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,10 +15,10 @@ 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 {
if (isUndefined(value)) {
- return HeatmapColorPropertyValue();
+ return ColorRampPropertyValue();
} else if (isExpression(value)) {
optional<std::unique_ptr<Expression>> expression = convert<std::unique_ptr<Expression>>(value, error, expression::type::Color);
if (!expression) {
@@ -33,9 +33,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/expression/expression.hpp b/include/mbgl/style/expression/expression.hpp
index cf9fa0cb21..41205d5a99 100644
--- a/include/mbgl/style/expression/expression.hpp
+++ b/include/mbgl/style/expression/expression.hpp
@@ -30,13 +30,13 @@ public:
EvaluationContext(float zoom_, GeometryTileFeature const * feature_) :
zoom(zoom_), feature(feature_)
{}
- EvaluationContext(optional<float> zoom_, GeometryTileFeature const * feature_, optional<double> heatmapDensity_) :
- zoom(std::move(zoom_)), feature(feature_), heatmapDensity(std::move(heatmapDensity_))
+ EvaluationContext(optional<float> zoom_, GeometryTileFeature const * feature_, optional<double> rampEvaluationParameter_) :
+ zoom(std::move(zoom_)), feature(feature_), rampEvaluationParameter(std::move(rampEvaluationParameter_))
{}
-
+
optional<float> zoom;
GeometryTileFeature const * feature;
- optional<double> heatmapDensity;
+ optional<double> rampEvaluationParameter;
};
template <typename T>
@@ -127,7 +127,7 @@ public:
type::Type getType() const { return type; };
- EvaluationResult evaluate(optional<float> zoom, const Feature& feature, optional<double> heatmapDensity) const;
+ EvaluationResult evaluate(optional<float> zoom, const Feature& feature, optional<double> rampEvaluationParameter) const;
/**
* Statically analyze the expression, attempting to enumerate possible outputs. Returns
diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp
index 33d927ad38..79619d4bb5 100644
--- a/include/mbgl/style/layers/heatmap_layer.hpp
+++ b/include/mbgl/style/layers/heatmap_layer.hpp
@@ -6,7 +6,7 @@
#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/style/color_ramp_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..3f13b0d7d4 100644
--- a/include/mbgl/style/layers/layer.hpp.ejs
+++ b/include/mbgl/style/layers/layer.hpp.ejs
@@ -11,8 +11,8 @@
#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>
+<% if (type === 'heatmap' || type === 'line') { -%>
+#include <mbgl/style/color_ramp_property_value.hpp>
<% } -%>
#include <mbgl/util/color.hpp>
diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp
index 4519296323..fe3d5d9635 100644
--- a/include/mbgl/style/layers/line_layer.hpp
+++ b/include/mbgl/style/layers/line_layer.hpp
@@ -6,6 +6,7 @@
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
#include <mbgl/style/data_driven_property_value.hpp>
+#include <mbgl/style/color_ramp_property_value.hpp>
#include <mbgl/util/color.hpp>
@@ -116,6 +117,12 @@ public:
void setLinePatternTransition(const TransitionOptions&);
TransitionOptions getLinePatternTransition() const;
+ static ColorRampPropertyValue getDefaultLineGradient();
+ ColorRampPropertyValue getLineGradient() const;
+ void setLineGradient(ColorRampPropertyValue);
+ void setLineGradientTransition(const TransitionOptions&);
+ TransitionOptions getLineGradientTransition() const;
+
// Private implementation
class Impl;