13class ExpandableTickRange
17 std::optional<std::pair<double, double>>
range = std::nullopt)
19 if (
range.has_value ())
22 start_ =
range->first;
24 is_full_content_ =
false;
37 void expand (std::pair<double, double> range_to_add)
43 assert (range_to_add.second >= range_to_add.first);
44 start_ = std::min (start_, range_to_add.first);
45 end_ = std::max (end_, range_to_add.second);
48 void expand_to_full ()
50 is_full_content_ =
true;
55 void expand (
const ExpandableTickRange &range_to_add)
57 if (range_to_add.is_full_content ())
63 expand (range_to_add.range ().value ());
70 auto range () const -> std::optional<std::pair<
double,
double>>
77 return std::make_pair (start_, end_);
83 bool is_full_content_{
true };
89 if (range.is_full_content ())
91 return "AffectedTickRange: (full content)";
93 const auto tick_range = range.range ().value ();
94 return fmt::format (
"AffectedTickRange: {}", tick_range);
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.