A class representing an interval. More...
#include <qwt_interval.h>
Public Types | |
enum | BorderFlag { IncludeBorders = 0x00, ExcludeMinimum = 0x01, ExcludeMaximum = 0x02, ExcludeBorders = ExcludeMinimum | ExcludeMaximum } |
Public Member Functions | |
BorderFlags | borderFlags () const |
bool | contains (const QwtInterval &) const |
bool | contains (double value) const |
QwtInterval | extend (double value) const |
Extend the interval. More... | |
QwtInterval | intersect (const QwtInterval &) const |
Intersect 2 intervals. More... | |
bool | intersects (const QwtInterval &) const |
Test if two intervals overlap. More... | |
void | invalidate () |
QwtInterval | inverted () const |
bool | isNull () const |
bool | isValid () const |
QwtInterval | limited (double lowerBound, double upperBound) const |
double | maxValue () const |
double | minValue () const |
QwtInterval | normalized () const |
Normalize the limits of the interval. More... | |
bool | operator!= (const QwtInterval &) const |
Compare two intervals. More... | |
QwtInterval | operator& (const QwtInterval &) const |
Intersection of two intervals. More... | |
QwtInterval & | operator&= (const QwtInterval &) |
Intersect this interval with the given interval. More... | |
bool | operator== (const QwtInterval &) const |
Compare two intervals. More... | |
QwtInterval | operator| (const QwtInterval &) const |
QwtInterval | operator| (double) const |
QwtInterval & | operator|= (const QwtInterval &) |
Unite this interval with the given interval. More... | |
QwtInterval & | operator|= (double) |
QwtInterval () | |
Border flags. More... | |
QwtInterval (double minValue, double maxValue, BorderFlags=IncludeBorders) | |
void | setBorderFlags (BorderFlags) |
void | setInterval (double minValue, double maxValue, BorderFlags=IncludeBorders) |
void | setMaxValue (double) |
void | setMinValue (double) |
QwtInterval | symmetrize (double value) const |
QwtInterval | unite (const QwtInterval &) const |
Unite 2 intervals. More... | |
double | width () const |
Return the width of an interval. More... | |
long double | widthL () const |
Return the width of an interval as long double. More... | |
Private Attributes | |
BorderFlags | m_borderFlags |
double | m_maxValue |
double | m_minValue |
A class representing an interval.
The interval is represented by 2 doubles, the lower and the upper limit.
Definition at line 22 of file qwt_interval.h.
Flag indicating if a border is included or excluded
Definition at line 36 of file qwt_interval.h.
|
inline |
Border flags.
Default Constructor.
Creates an invalid interval [0.0, -1.0]
Definition at line 112 of file qwt_interval.h.
|
inline |
Constructor
Build an interval with from min/max values
minValue | Minimum value |
maxValue | Maximum value |
borderFlags | Include/Exclude borders |
Definition at line 128 of file qwt_interval.h.
|
inline |
bool QwtInterval::contains | ( | const QwtInterval & | interval | ) | const |
Test if an interval is inside an interval
interval | Interval |
Definition at line 90 of file qwt_interval.cpp.
bool QwtInterval::contains | ( | double | value | ) | const |
Test if a value is inside an interval
value | Value |
Definition at line 67 of file qwt_interval.cpp.
QwtInterval QwtInterval::extend | ( | double | value | ) | const |
Extend the interval.
If value is below minValue(), value becomes the lower limit. If value is above maxValue(), value becomes the upper limit.
extend() has no effect for invalid intervals
value | Value |
Definition at line 363 of file qwt_interval.cpp.
QwtInterval QwtInterval::intersect | ( | const QwtInterval & | other | ) | const |
Intersect 2 intervals.
other | Interval to be intersect with |
Definition at line 186 of file qwt_interval.cpp.
bool QwtInterval::intersects | ( | const QwtInterval & | other | ) | const |
Test if two intervals overlap.
other | Interval |
Definition at line 277 of file qwt_interval.cpp.
|
inline |
Invalidate the interval
The limits are set to interval [0.0, -1.0]
Definition at line 325 of file qwt_interval.h.
QwtInterval QwtInterval::inverted | ( | ) | const |
Invert the limits of the interval
Definition at line 48 of file qwt_interval.cpp.
|
inline |
Definition at line 314 of file qwt_interval.h.
|
inline |
A interval is valid when minValue() <= maxValue(). In case of QwtInterval::ExcludeBorders it is true when minValue() < maxValue()
Definition at line 210 of file qwt_interval.h.
QwtInterval QwtInterval::limited | ( | double | lowerBound, |
double | upperBound | ||
) | const |
Limit the interval, keeping the border modes
lowerBound | Lower limit |
upperBound | Upper limit |
Definition at line 336 of file qwt_interval.cpp.
|
inline |
Definition at line 198 of file qwt_interval.h.
|
inline |
Definition at line 192 of file qwt_interval.h.
QwtInterval QwtInterval::normalized | ( | ) | const |
Normalize the limits of the interval.
If maxValue() < minValue() the limits will be inverted.
Definition at line 29 of file qwt_interval.cpp.
|
inline |
Compare two intervals.
other | Interval to compare with |
Definition at line 296 of file qwt_interval.h.
|
inline |
Intersection of two intervals.
other | Interval to intersect with |
Definition at line 258 of file qwt_interval.h.
QwtInterval & QwtInterval::operator&= | ( | const QwtInterval & | other | ) |
Intersect this interval with the given interval.
other | Interval to be intersected with |
Definition at line 265 of file qwt_interval.cpp.
|
inline |
Compare two intervals.
other | Interval to compare with |
Definition at line 284 of file qwt_interval.h.
|
inline |
Union of two intervals
other | Interval to unite with |
Definition at line 272 of file qwt_interval.h.
|
inline |
Extend an interval
value | Value |
Definition at line 308 of file qwt_interval.h.
QwtInterval & QwtInterval::operator|= | ( | const QwtInterval & | other | ) |
Unite this interval with the given interval.
other | Interval to be united with |
Definition at line 253 of file qwt_interval.cpp.
QwtInterval & QwtInterval::operator|= | ( | double | value | ) |
Extend an interval
value | Value |
Definition at line 380 of file qwt_interval.cpp.
|
inline |
Change the border flags
borderFlags | Or'd BorderMode flags |
Definition at line 157 of file qwt_interval.h.
|
inline |
Assign the limits of the interval
minValue | Minimum value |
maxValue | Maximum value |
borderFlags | Include/Exclude borders |
Definition at line 143 of file qwt_interval.h.
|
inline |
Assign the upper limit of the interval
maxValue | Maximum value |
Definition at line 186 of file qwt_interval.h.
|
inline |
Assign the lower limit of the interval
minValue | Minimum value |
Definition at line 176 of file qwt_interval.h.
QwtInterval QwtInterval::symmetrize | ( | double | value | ) | const |
Adjust the limit that is closer to value, so that value becomes the center of the interval.
value | Center |
Definition at line 317 of file qwt_interval.cpp.
QwtInterval QwtInterval::unite | ( | const QwtInterval & | other | ) | const |
Unite 2 intervals.
Definition at line 123 of file qwt_interval.cpp.
|
inline |
Return the width of an interval.
The width of invalid intervals is 0.0, otherwise the result is maxValue() - minValue().
Definition at line 227 of file qwt_interval.h.
|
inline |
Return the width of an interval as long double.
The width of invalid intervals is 0.0, otherwise the result is maxValue() - minValue().
Definition at line 241 of file qwt_interval.h.
|
private |
Definition at line 106 of file qwt_interval.h.
|
private |
Definition at line 105 of file qwt_interval.h.
|
private |
Definition at line 104 of file qwt_interval.h.