10class ExpandableTickRange
14 std::optional<std::pair<double, double>>
range = std::nullopt)
16 if (
range.has_value ())
19 start_ =
range->first;
21 is_full_content_ =
false;
34 void expand (std::pair<double, double> range_to_add)
40 assert (range_to_add.second >= range_to_add.first);
41 start_ = std::min (start_, range_to_add.first);
42 end_ = std::max (end_, range_to_add.second);
45 void expand_to_full ()
47 is_full_content_ =
true;
52 void expand (
const ExpandableTickRange &range_to_add)
54 if (range_to_add.is_full_content ())
60 expand (range_to_add.range ().value ());
67 auto range () const -> std::optional<std::pair<
double,
double>>
74 return std::make_pair (start_, end_);
80 bool is_full_content_{
true };
bool is_full_content() const
Returns whether the range is the full content (ie, there is no range).
void expand(std::pair< double, double > range_to_add)
Expands to the given range.
auto range() const -> std::optional< std::pair< double, double > >
Returns the range, or nullopt if the full content is covered.