30#include "qwtcore_global.h"
48 IncludeBorders = 0x00,
51 ExcludeMinimum = 0x01,
54 ExcludeMaximum = 0x02,
57 ExcludeBorders = ExcludeMinimum | ExcludeMaximum
61 Q_DECLARE_FLAGS(BorderFlags, BorderFlag)
64 constexpr
QwtInterval(
double minValue,
double maxValue, BorderFlags = IncludeBorders) noexcept;
67 void setInterval(
double minValue,
double maxValue, BorderFlags = IncludeBorders) noexcept;
74 QwtInterval limited(
double lowerBound,
double upperBound) const;
81 void setBorderFlags(BorderFlags) noexcept;
82 constexpr BorderFlags borderFlags() const noexcept;
84 constexpr
double minValue() const noexcept;
85 constexpr
double maxValue() const noexcept;
86 constexpr
double centerValue() const noexcept;
88 constexpr
double width() const noexcept;
89 constexpr
long double widthL() const noexcept;
91 void setMinValue(
double) noexcept;
92 void setMaxValue(
double) noexcept;
95 bool contains(
double value) const;
123 constexpr
bool isValid() const noexcept;
124 constexpr
bool isNull() const noexcept;
125 void invalidate() noexcept;
131 double m_minValue { 0.0 };
132 double m_maxValue { -1.0 };
133 BorderFlags m_borderFlags { IncludeBorders };
136Q_DECLARE_OPERATORS_FOR_FLAGS(QwtInterval::BorderFlags)
156 : m_minValue(minValue), m_maxValue(maxValue), m_borderFlags(borderFlags)
168 m_minValue = minValue;
169 m_maxValue = maxValue;
170 m_borderFlags = borderFlags;
180 m_borderFlags = borderFlags;
189 return m_borderFlags;
198 m_minValue = minValue;
207 m_maxValue = maxValue;
234 return isValid() ? (m_minValue + (m_maxValue - m_minValue) * 0.5) : 0.0;
246 return ((m_borderFlags &
ExcludeBorders) == 0) ? (m_minValue <= m_maxValue) : (m_minValue < m_maxValue);
257 return isValid() ? (m_maxValue - m_minValue) : 0.0;
269 return isValid() ?
static_cast< long double >(m_maxValue) -
static_cast< long double >(m_minValue) : 0.0L;
301 return (m_minValue == other.m_minValue) && (m_maxValue == other.m_maxValue) && (m_borderFlags == other.m_borderFlags);
311 return (!(*
this == other));
331 return isValid() && m_minValue >= m_maxValue;
345#ifndef QT_NO_DEBUG_STREAM
346QWTCORE_EXPORT QDebug operator<<(QDebug,
const QwtInterval&);
A class representing an interval
Definition qwt_interval.h:39
QwtInterval operator|(const QwtInterval &) const
Union of two intervals
Definition qwt_interval.h:289
BorderFlag
Flag indicating if a border is included or excluded
Definition qwt_interval.h:46
@ ExcludeBorders
Min/Max values are not included in the interval
Definition qwt_interval.h:57
constexpr QwtInterval() noexcept
Border flags
Definition qwt_interval.h:145
void setBorderFlags(BorderFlags) noexcept
Change the border flags
Definition qwt_interval.h:178
void invalidate() noexcept
Invalidate the interval
Definition qwt_interval.h:339
void setMinValue(double) noexcept
Assign the lower limit of the interval
Definition qwt_interval.h:196
QwtInterval unite(const QwtInterval &) const
Unite two intervals
Definition qwt_interval.cpp:137
constexpr double centerValue() const noexcept
Definition qwt_interval.h:232
bool operator==(const QwtInterval &) const
Compare two intervals
Definition qwt_interval.h:299
bool operator!=(const QwtInterval &) const
Compare two intervals
Definition qwt_interval.h:309
constexpr bool isNull() const noexcept
Check if interval is null
Definition qwt_interval.h:329
void setInterval(double minValue, double maxValue, BorderFlags=IncludeBorders) noexcept
Assign the limits of the interval
Definition qwt_interval.h:166
QwtInterval operator&(const QwtInterval &) const
Intersection of two intervals
Definition qwt_interval.h:278
constexpr double minValue() const noexcept
Definition qwt_interval.h:214
QwtInterval extend(double value) const
Extend the interval
Definition qwt_interval.cpp:339
constexpr BorderFlags borderFlags() const noexcept
Definition qwt_interval.h:187
void setMaxValue(double) noexcept
Assign the upper limit of the interval
Definition qwt_interval.h:205
QwtInterval intersect(const QwtInterval &) const
Intersect two intervals
Definition qwt_interval.cpp:190
constexpr double maxValue() const noexcept
Definition qwt_interval.h:223
constexpr long double widthL() const noexcept
Return the width of an interval as long double
Definition qwt_interval.h:267
constexpr double width() const noexcept
Return the width of an interval
Definition qwt_interval.h:255
constexpr bool isValid() const noexcept
Check if the interval is valid
Definition qwt_interval.h:244