30#include "qwt_global.h"
49 IncludeBorders = 0x00,
52 ExcludeMinimum = 0x01,
55 ExcludeMaximum = 0x02,
58 ExcludeBorders = ExcludeMinimum | ExcludeMaximum
62 Q_DECLARE_FLAGS(BorderFlags, BorderFlag)
65 QwtInterval(
double minValue,
double maxValue, BorderFlags = IncludeBorders);
67 void setInterval(
double minValue,
double maxValue, BorderFlags = IncludeBorders);
71 QwtInterval limited(
double lowerBound,
double upperBound)
const;
76 void setBorderFlags(BorderFlags);
77 BorderFlags borderFlags()
const;
79 double minValue()
const;
80 double maxValue()
const;
81 double centerValue()
const;
84 long double widthL()
const;
86 void setMinValue(
double);
87 void setMaxValue(
double);
89 bool contains(
double value)
const;
106 bool isValid()
const;
115 BorderFlags m_borderFlags;
118Q_DECLARE_OPERATORS_FOR_FLAGS(QwtInterval::BorderFlags)
142 : m_minValue(minValue), m_maxValue(maxValue), m_borderFlags(borderFlags)
177 return m_borderFlags;
215 return isValid() ? (m_minValue + (m_maxValue - m_minValue) * 0.5) : 0.0;
227 return m_minValue <= m_maxValue;
229 return m_minValue < m_maxValue;
243 return isValid() ? (m_maxValue - m_minValue) : 0.0;
260 return static_cast< long double >(m_maxValue) -
static_cast< long double >(m_minValue);
297 return (m_minValue == other.m_minValue) && (m_maxValue == other.m_maxValue) && (m_borderFlags == other.m_borderFlags);
307 return (!(*
this == other));
325 return isValid() && m_minValue >= m_maxValue;
340#ifndef QT_NO_DEBUG_STREAM
341QWT_EXPORT QDebug operator<<(QDebug,
const QwtInterval&);
A class representing an interval.
Definition qwt_interval.h:40
void setInterval(double minValue, double maxValue, BorderFlags=IncludeBorders)
Assign the limits of the interval.
Definition qwt_interval.h:153
double minValue() const
Definition qwt_interval.h:201
QwtInterval operator|(const QwtInterval &) const
Union of two intervals.
Definition qwt_interval.h:284
double width() const
Return the width of an interval.
Definition qwt_interval.h:241
BorderFlag
Flag indicating if a border is included or excluded.
Definition qwt_interval.h:47
@ ExcludeBorders
Min/Max values are not included in the interval.
Definition qwt_interval.h:58
long double widthL() const
Return the width of an interval as long double.
Definition qwt_interval.h:255
void setMaxValue(double)
Assign the upper limit of the interval.
Definition qwt_interval.h:195
double maxValue() const
Definition qwt_interval.h:207
QwtInterval unite(const QwtInterval &) const
Unite 2 intervals.
Definition qwt_interval.cpp:134
void invalidate()
Invalidate the interval.
Definition qwt_interval.h:334
bool operator==(const QwtInterval &) const
Compare two intervals.
Definition qwt_interval.h:295
bool operator!=(const QwtInterval &) const
Compare two intervals.
Definition qwt_interval.h:305
QwtInterval operator&(const QwtInterval &) const
Intersection of two intervals.
Definition qwt_interval.h:271
QwtInterval extend(double value) const
Extend the interval.
Definition qwt_interval.cpp:346
void setMinValue(double)
Assign the lower limit of the interval.
Definition qwt_interval.h:185
QwtInterval intersect(const QwtInterval &) const
Intersect 2 intervals.
Definition qwt_interval.cpp:188
BorderFlags borderFlags() const
Definition qwt_interval.h:175
bool isNull() const
Definition qwt_interval.h:323
QwtInterval()
Border flags.
Definition qwt_interval.h:128
void setBorderFlags(BorderFlags)
Change the border flags.
Definition qwt_interval.h:166
bool isValid() const
A interval is valid when minValue() <= maxValue().
Definition qwt_interval.h:224
double centerValue() const
Definition qwt_interval.h:213