summaryrefslogtreecommitdiff
path: root/include/mbgl/style/expression/interpolate.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/style/expression/interpolate.hpp')
-rw-r--r--include/mbgl/style/expression/interpolate.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/mbgl/style/expression/interpolate.hpp b/include/mbgl/style/expression/interpolate.hpp
index 8d11bbcb05..5e9842e774 100644
--- a/include/mbgl/style/expression/interpolate.hpp
+++ b/include/mbgl/style/expression/interpolate.hpp
@@ -32,6 +32,10 @@ public:
},
input);
}
+
+ bool operator==(const ExponentialInterpolator& rhs) const {
+ return base == rhs.base;
+ }
};
class CubicBezierInterpolator {
@@ -42,6 +46,10 @@ public:
return ub.solve(input / (inputLevels.max - inputLevels.min), 1e-6);
}
+ bool operator==(const CubicBezierInterpolator& rhs) const {
+ return ub == rhs.ub;
+ }
+
util::UnitBezier ub;
};
@@ -111,6 +119,30 @@ public:
}
}
+ bool operator==(const Expression& e) const override {
+ if (auto rhs = dynamic_cast<const Interpolate*>(&e)) {
+ if (interpolator != rhs->interpolator ||
+ *input != *(rhs->input) ||
+ stops.size() != rhs->stops.size())
+ {
+ return false;
+ }
+
+ for (auto leftChild = stops.begin(), rightChild = rhs->stops.begin();
+ leftChild != stops.end();
+ leftChild++, rightChild++)
+ {
+ if (leftChild->first != rightChild->first ||
+ *(leftChild->second) != *(rightChild->second))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
const std::unique_ptr<Expression>& getInput() const { return input; }
// Return the smallest range of stops that covers the interval [lower, upper]