summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/style/expression/distance.hpp38
-rw-r--r--include/mbgl/style/expression/expression.hpp3
-rw-r--r--include/mbgl/style/expression/within.hpp1
3 files changed, 40 insertions, 2 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
diff --git a/include/mbgl/style/expression/expression.hpp b/include/mbgl/style/expression/expression.hpp
index e522821185..51cc3b0f15 100644
--- a/include/mbgl/style/expression/expression.hpp
+++ b/include/mbgl/style/expression/expression.hpp
@@ -169,7 +169,8 @@ enum class Kind : int32_t {
NumberFormat,
ImageExpression,
In,
- Within
+ Within,
+ Distance
};
class Expression {
diff --git a/include/mbgl/style/expression/within.hpp b/include/mbgl/style/expression/within.hpp
index a8e45f9bf0..37e27f4940 100644
--- a/include/mbgl/style/expression/within.hpp
+++ b/include/mbgl/style/expression/within.hpp
@@ -2,7 +2,6 @@
#include <mbgl/style/expression/expression.hpp>
#include <mbgl/util/geojson.hpp>
-#include <mbgl/util/geometry_within.hpp>
#include <mbgl/util/optional.hpp>
namespace mbgl {