QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QwtInterval Class Reference

A class representing an interval. More...

#include <qwt_interval.h>

Public Types

enum  BorderFlag { IncludeBorders = 0x00 , ExcludeMinimum = 0x01 , ExcludeMaximum = 0x02 , ExcludeBorders = ExcludeMinimum | ExcludeMaximum }
 Flag indicating if a border is included or excluded. More...
 

Public Member Functions

constexpr QwtInterval () noexcept
 Border flags.
 
constexpr QwtInterval (double minValue, double maxValue, BorderFlags=IncludeBorders) noexcept
 Constructor with min/max values.
 
void setInterval (double minValue, double maxValue, BorderFlags=IncludeBorders) noexcept
 Assign the limits of the interval.
 
QwtInterval normalized () const
 Normalize the limits of the interval.
 
QwtInterval inverted () const
 Invert the interval.
 
QwtInterval limited (double lowerBound, double upperBound) const
 Limit the interval, keeping the border modes.
 
bool operator== (const QwtInterval &) const
 Compare two intervals.
 
bool operator!= (const QwtInterval &) const
 Compare two intervals.
 
void setBorderFlags (BorderFlags) noexcept
 Change the border flags.
 
constexpr BorderFlags borderFlags () const noexcept
 
constexpr double minValue () const noexcept
 
constexpr double maxValue () const noexcept
 
constexpr double centerValue () const noexcept
 
constexpr double width () const noexcept
 Return the width of an interval.
 
constexpr long double widthL () const noexcept
 Return the width of an interval as long double.
 
void setMinValue (double) noexcept
 Assign the lower limit of the interval.
 
void setMaxValue (double) noexcept
 Assign the upper limit of the interval.
 
bool contains (double value) const
 Test if a value is inside an interval.
 
bool contains (const QwtInterval &) const
 Test if an interval is inside an interval.
 
bool intersects (const QwtInterval &) const
 Test if two intervals overlap.
 
QwtInterval intersect (const QwtInterval &) const
 Intersect two intervals.
 
QwtInterval unite (const QwtInterval &) const
 Unite two intervals.
 
QwtInterval operator| (const QwtInterval &) const
 Union of two intervals.
 
QwtInterval operator& (const QwtInterval &) const
 Intersection of two intervals.
 
QwtIntervaloperator|= (const QwtInterval &)
 Unite this interval with the given interval.
 
QwtIntervaloperator&= (const QwtInterval &)
 Intersect this interval with the given interval.
 
QwtInterval extend (double value) const
 Extend the interval.
 
QwtInterval operator| (double) const
 Extend an interval.
 
QwtIntervaloperator|= (double)
 Extend an interval.
 
constexpr bool isValid () const noexcept
 Check if the interval is valid.
 
constexpr bool isNull () const noexcept
 Check if interval is null.
 
void invalidate () noexcept
 Invalidate the interval.
 
QwtInterval symmetrize (double value) const
 Symmetrize the interval around a value.
 

Detailed Description

A class representing an interval.

The interval is represented by 2 doubles, the lower and the upper limit.

Member Enumeration Documentation

◆ BorderFlag

Flag indicating if a border is included or excluded.

See also
setBorderFlags(), borderFlags()
Enumerator
IncludeBorders 

Min/Max values are inside the interval.

ExcludeMinimum 

Min value is not included in the interval.

ExcludeMaximum 

Max value is not included in the interval.

ExcludeBorders 

Min/Max values are not included in the interval.

Constructor & Destructor Documentation

◆ QwtInterval() [1/2]

constexpr QwtInterval::QwtInterval ( )
inlineconstexprnoexcept

Border flags.

Default Constructor.

Creates an invalid interval [0.0, -1.0]

See also
setInterval(), isValid()

◆ QwtInterval() [2/2]

constexpr QwtInterval::QwtInterval ( double  minValue,
double  maxValue,
BorderFlags  borderFlags = IncludeBorders 
)
inlineconstexprnoexcept

Constructor with min/max values.

Parameters
minValueMinimum value
maxValueMaximum value
borderFlagsInclude/Exclude borders

Member Function Documentation

◆ borderFlags()

constexpr QwtInterval::BorderFlags QwtInterval::borderFlags ( ) const
inlineconstexprnoexcept
Returns
Border flags
See also
setBorderFlags()

◆ centerValue()

constexpr double QwtInterval::centerValue ( ) const
inlineconstexprnoexcept
Returns
Center of the interval
See also
width()

◆ contains() [1/2]

bool QwtInterval::contains ( const QwtInterval interval) const

Test if an interval is inside an interval.

Parameters
[in]intervalInterval to test
Returns
True if interval lies inside the boundaries

◆ contains() [2/2]

bool QwtInterval::contains ( double  value) const

Test if a value is inside an interval.

Parameters
[in]valueValue to test
Returns
True if value lies inside the boundaries

◆ extend()

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.

Parameters
[in]valueValue to extend with
Returns
Extended interval
See also
isValid()

◆ intersect()

QwtInterval QwtInterval::intersect ( const QwtInterval other) const

Intersect two intervals.

Parameters
[in]otherInterval to intersect with
Returns
Intersection of this and other

◆ intersects()

bool QwtInterval::intersects ( const QwtInterval other) const

Test if two intervals overlap.

Parameters
[in]otherInterval to test
Returns
True when the intervals are intersecting

◆ invalidate()

void QwtInterval::invalidate ( )
inlinenoexcept

Invalidate the interval.

The limits are set to interval [0.0, -1.0]

See also
isValid()

◆ inverted()

QwtInterval QwtInterval::inverted ( ) const

Invert the interval.

minValue() and maxValue() are swapped, border flags remain unchanged.

◆ isNull()

constexpr bool QwtInterval::isNull ( ) const
inlineconstexprnoexcept

Check if interval is null.

Returns
True if isValid() && (minValue() >= maxValue())

◆ isValid()

constexpr bool QwtInterval::isValid ( ) const
inlineconstexprnoexcept

Check if the interval is valid.

A interval is valid when minValue() <= maxValue(). In case of QwtInterval::ExcludeBorders it is true when minValue() < maxValue()

Returns
True, if the interval is valid
See also
isValid()

◆ limited()

QwtInterval QwtInterval::limited ( double  lowerBound,
double  upperBound 
) const

Limit the interval, keeping the border modes.

Parameters
[in]lowerBoundLower limit
[in]upperBoundUpper limit
Returns
Limited interval

◆ maxValue()

constexpr double QwtInterval::maxValue ( ) const
inlineconstexprnoexcept
Returns
Maximum value of the interval
See also
setMaxValue()

◆ minValue()

constexpr double QwtInterval::minValue ( ) const
inlineconstexprnoexcept
Returns
Minimum value of the interval
See also
setMinValue()

◆ normalized()

QwtInterval QwtInterval::normalized ( ) const

Normalize the limits of the interval.

If maxValue() < minValue() the limits will be inverted.

◆ operator!=()

bool QwtInterval::operator!= ( const QwtInterval other) const
inline

Compare two intervals.

Parameters
[in]otherInterval to compare with
Returns
True when this and other are not equal

◆ operator&()

QwtInterval QwtInterval::operator& ( const QwtInterval other) const
inline

Intersection of two intervals.

Parameters
[in]otherInterval to intersect with
Returns
Intersection of this and other
See also
intersect()

◆ operator&=()

QwtInterval & QwtInterval::operator&= ( const QwtInterval other)

Intersect this interval with the given interval.

Parameters
[in]otherInterval to be intersected with
Returns
Reference to this interval

◆ operator==()

bool QwtInterval::operator== ( const QwtInterval other) const
inline

Compare two intervals.

Parameters
[in]otherInterval to compare with
Returns
True when this and other are equal

◆ operator|() [1/2]

QwtInterval QwtInterval::operator| ( const QwtInterval other) const
inline

Union of two intervals.

Parameters
[in]otherInterval to unite with
Returns
Union of this and other
See also
unite()

◆ operator|() [2/2]

QwtInterval QwtInterval::operator| ( double  value) const
inline

Extend an interval.

Parameters
[in]valueValue to extend with
Returns
Extended interval
See also
extend()

◆ operator|=() [1/2]

QwtInterval & QwtInterval::operator|= ( const QwtInterval other)

Unite this interval with the given interval.

Parameters
[in]otherInterval to be united with
Returns
Reference to this interval

◆ operator|=() [2/2]

QwtInterval & QwtInterval::operator|= ( double  value)

Extend an interval.

Parameters
[in]valueValue to extend with
Returns
Reference to the extended interval
See also
extend()

◆ setBorderFlags()

void QwtInterval::setBorderFlags ( BorderFlags  borderFlags)
inlinenoexcept

Change the border flags.

Parameters
borderFlagsOr'd BorderMode flags
See also
borderFlags()

◆ setInterval()

void QwtInterval::setInterval ( double  minValue,
double  maxValue,
BorderFlags  borderFlags = IncludeBorders 
)
inlinenoexcept

Assign the limits of the interval.

Parameters
minValueMinimum value
maxValueMaximum value
borderFlagsInclude/Exclude borders

◆ setMaxValue()

void QwtInterval::setMaxValue ( double  maxValue)
inlinenoexcept

Assign the upper limit of the interval.

Parameters
maxValueMaximum value

◆ setMinValue()

void QwtInterval::setMinValue ( double  minValue)
inlinenoexcept

Assign the lower limit of the interval.

Parameters
minValueMinimum value

◆ symmetrize()

QwtInterval QwtInterval::symmetrize ( double  value) const

Symmetrize the interval around a value.

Adjust the limit that is closer to value, so that value becomes the center of the interval.

Parameters
[in]valueCenter value
Returns
Interval with value as center

◆ unite()

QwtInterval QwtInterval::unite ( const QwtInterval other) const

Unite two intervals.

Parameters
[in]otherInterval to unite with
Returns
Union of this and other
See also
intersect()

◆ width()

constexpr double QwtInterval::width ( ) const
inlineconstexprnoexcept

Return the width of an interval.

The width of invalid intervals is 0.0, otherwise the result is maxValue() - minValue().

Returns
Interval width
See also
isValid()

◆ widthL()

constexpr long double QwtInterval::widthL ( ) const
inlineconstexprnoexcept

Return the width of an interval as long double.

The width of invalid intervals is 0.0, otherwise the result is maxValue() - minValue().

Returns
Interval width
See also
isValid()

The documentation for this class was generated from the following files: