Rename EvaluationContext::heatmapDensity to colorRampParameter

More generic name as the same class member is to be used by the
linear gradient properties.
This commit is contained in:
Mikhail Pozdnyakov
2018-08-07 18:02:43 +03:00
committed by Bruno de Oliveira Abinader
parent 1dabfe783d
commit 0ec4a84c31
3 changed files with 8 additions and 8 deletions

View File

@@ -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> colorRampParameter_) :
zoom(std::move(zoom_)), feature(feature_), colorRampParameter(std::move(colorRampParameter_))
{}
optional<float> zoom;
GeometryTileFeature const * feature;
optional<double> heatmapDensity;
optional<double> colorRampParameter;
};
template <typename T>
@@ -151,7 +151,7 @@ public:
Kind getKind() const { return kind; };
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> colorRampParameter) const;
/**
* Statically analyze the expression, attempting to enumerate possible outputs. Returns

View File

@@ -343,12 +343,12 @@ std::unordered_map<std::string, CompoundExpressionRegistry::Definition> initiali
});
define("heatmap-density", [](const EvaluationContext& params) -> Result<double> {
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<bool> {

View File

@@ -28,9 +28,9 @@ public:
};
EvaluationResult Expression::evaluate(optional<float> zoom, const Feature& feature, optional<double> heatmapDensity) const {
EvaluationResult Expression::evaluate(optional<float> zoom, const Feature& feature, optional<double> colorRampParameter) const {
GeoJSONFeature f(feature);
return this->evaluate(EvaluationContext(zoom, &f, heatmapDensity));
return this->evaluate(EvaluationContext(zoom, &f, colorRampParameter));
}
} // namespace expression