summaryrefslogtreecommitdiff
path: root/include/mbgl/style/expression/distance.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/style/expression/distance.hpp')
-rw-r--r--include/mbgl/style/expression/distance.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/mbgl/style/expression/distance.hpp b/include/mbgl/style/expression/distance.hpp
new file mode 100644
index 0000000000..e034b9452f
--- /dev/null
+++ b/include/mbgl/style/expression/distance.hpp
@@ -0,0 +1,38 @@
+#pragma once
+
+#include <mapbox/cheap_ruler.hpp>
+#include <mbgl/style/expression/expression.hpp>
+#include <mbgl/util/geojson.hpp>
+
+namespace mbgl {
+namespace style {
+namespace expression {
+
+class Distance final : public Expression {
+public:
+ Distance(GeoJSON geoJSONSource_, Feature::geometry_type geometries_, mapbox::cheap_ruler::CheapRuler::Unit unit_);
+
+ ~Distance() override;
+
+ EvaluationResult evaluate(const EvaluationContext&) const override;
+
+ static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&);
+
+ void eachChild(const std::function<void(const Expression&)>&) const override {}
+
+ bool operator==(const Expression& e) const override;
+
+ std::vector<optional<Value>> possibleOutputs() const override;
+
+ mbgl::Value serialize() const override;
+ std::string getOperator() const override;
+
+private:
+ GeoJSON geoJSONSource;
+ Feature::geometry_type geometries;
+ mapbox::cheap_ruler::CheapRuler::Unit unit;
+};
+
+} // namespace expression
+} // namespace style
+} // namespace mbgl