MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
step.hpp
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <mbgl/util/range.hpp>
8 
9 #include <memory>
10 #include <map>
11 #include <optional>
12 
13 namespace mbgl {
14 namespace style {
15 namespace expression {
16 
17 class Step : public Expression {
18 public:
19  Step(const type::Type& type_,
20  std::unique_ptr<Expression> input_,
21  std::map<double, std::unique_ptr<Expression>> stops_);
22 
23  EvaluationResult evaluate(const EvaluationContext& params) const override;
24  void eachChild(const std::function<void(const Expression&)>& visit) const override;
25  void eachStop(const std::function<void(double, const Expression&)>& visit) const;
26 
27  const std::unique_ptr<Expression>& getInput() const { return input; }
28  Range<float> getCoveringStops(double lower, double upper) const;
29 
30  bool operator==(const Expression& e) const override;
31 
32  std::vector<std::optional<Value>> possibleOutputs() const override;
33 
35 
36  mbgl::Value serialize() const override;
37  std::string getOperator() const override { return "step"; }
38 
39 private:
40  const std::unique_ptr<Expression> input;
41  const std::map<double, std::unique_ptr<Expression>> stops;
42 };
43 
44 } // namespace expression
45 } // namespace style
46 } // namespace mbgl
std::vector< std::optional< Value > > possibleOutputs() const override
Step(const type::Type &type_, std::unique_ptr< Expression > input_, std::map< double, std::unique_ptr< Expression >> stops_)
Range< float > getCoveringStops(double lower, double upper) const
const std::unique_ptr< Expression > & getInput() const
Definition: step.hpp:27
std::string getOperator() const override
Definition: step.hpp:37
EvaluationResult evaluate(const EvaluationContext &params) const override
mbgl::Value serialize() const override
void eachStop(const std::function< void(double, const Expression &)> &visit) const
bool operator==(const Expression &e) const override
void eachChild(const std::function< void(const Expression &)> &visit) const override
static ParseResult parse(const mbgl::style::conversion::Convertible &value, ParsingContext &ctx)
std::unique_ptr< Expression > string(std::unique_ptr< Expression >, std::unique_ptr< Expression > def=nullptr)
variant< NullType, NumberType, BooleanType, StringType, ColorType, ObjectType, ValueType, mapbox::util::recursive_wrapper< Array >, CollatorType, FormattedType, ErrorType, ImageType > Type
Definition: type.hpp:108
std::optional< std::unique_ptr< Expression > > ParseResult
Definition: actor.hpp:15
mapbox::base::Value Value
Definition: feature.hpp:11