From 0ec4a84c310f4bf95265939698d71f267af5802e Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Tue, 7 Aug 2018 18:02:43 +0300 Subject: [PATCH] Rename `EvaluationContext::heatmapDensity` to `colorRampParameter` More generic name as the same class member is to be used by the linear gradient properties. --- include/mbgl/style/expression/expression.hpp | 8 ++++---- src/mbgl/style/expression/compound_expression.cpp | 4 ++-- src/mbgl/style/expression/expression.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/mbgl/style/expression/expression.hpp b/include/mbgl/style/expression/expression.hpp index 26124f646..bfd1e08ee 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 zoom_, GeometryTileFeature const * feature_, optional heatmapDensity_) : - zoom(std::move(zoom_)), feature(feature_), heatmapDensity(std::move(heatmapDensity_)) + EvaluationContext(optional zoom_, GeometryTileFeature const * feature_, optional colorRampParameter_) : + zoom(std::move(zoom_)), feature(feature_), colorRampParameter(std::move(colorRampParameter_)) {} optional zoom; GeometryTileFeature const * feature; - optional heatmapDensity; + optional colorRampParameter; }; template @@ -151,7 +151,7 @@ public: Kind getKind() const { return kind; }; type::Type getType() const { return type; }; - EvaluationResult evaluate(optional zoom, const Feature& feature, optional heatmapDensity) const; + EvaluationResult evaluate(optional zoom, const Feature& feature, optional colorRampParameter) const; /** * Statically analyze the expression, attempting to enumerate possible outputs. Returns diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp index 53ce91f0b..4c476a374 100644 --- a/src/mbgl/style/expression/compound_expression.cpp +++ b/src/mbgl/style/expression/compound_expression.cpp @@ -343,12 +343,12 @@ std::unordered_map initiali }); define("heatmap-density", [](const EvaluationContext& params) -> Result { - if (!params.heatmapDensity) { + if (!params.colorRampParameter) { return EvaluationError { "The 'heatmap-density' expression is unavailable in the current evaluation context." }; } - return *(params.heatmapDensity); + return *(params.colorRampParameter); }); define("has", [](const EvaluationContext& params, const std::string& key) -> Result { diff --git a/src/mbgl/style/expression/expression.cpp b/src/mbgl/style/expression/expression.cpp index d9dbbfa1d..3c2580de0 100644 --- a/src/mbgl/style/expression/expression.cpp +++ b/src/mbgl/style/expression/expression.cpp @@ -28,9 +28,9 @@ public: }; -EvaluationResult Expression::evaluate(optional zoom, const Feature& feature, optional heatmapDensity) const { +EvaluationResult Expression::evaluate(optional zoom, const Feature& feature, optional colorRampParameter) const { GeoJSONFeature f(feature); - return this->evaluate(EvaluationContext(zoom, &f, heatmapDensity)); + return this->evaluate(EvaluationContext(zoom, &f, colorRampParameter)); } } // namespace expression