Public Types | Public Member Functions | Private Attributes | 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 }
 

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...
 
QwtIntervaloperator&= (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
 
QwtIntervaloperator|= (const QwtInterval &)
 Unite this interval with the given interval. More...
 
QwtIntervaloperator|= (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
 

Detailed Description

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.

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.

Definition at line 36 of file qwt_interval.h.

Constructor & Destructor Documentation

◆ QwtInterval() [1/2]

QwtInterval::QwtInterval ( )
inline

Border flags.

Default Constructor.

Creates an invalid interval [0.0, -1.0]

See also
setInterval(), isValid()

Definition at line 112 of file qwt_interval.h.

◆ QwtInterval() [2/2]

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

Constructor

Build an interval with from min/max values

Parameters
minValueMinimum value
maxValueMaximum value
borderFlagsInclude/Exclude borders

Definition at line 128 of file qwt_interval.h.

Member Function Documentation

◆ borderFlags()

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

Definition at line 166 of file qwt_interval.h.

◆ contains() [1/2]

bool QwtInterval::contains ( const QwtInterval interval) const

Test if an interval is inside an interval

Parameters
intervalInterval
Returns
true, if interval lies inside the boundaries

Definition at line 90 of file qwt_interval.cpp.

◆ contains() [2/2]

bool QwtInterval::contains ( double  value) const

Test if a value is inside an interval

Parameters
valueValue
Returns
true, if value lies inside the boundaries

Definition at line 67 of file qwt_interval.cpp.

◆ 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
valueValue
Returns
extended interval
See also
isValid()

Definition at line 363 of file qwt_interval.cpp.

◆ intersect()

QwtInterval QwtInterval::intersect ( const QwtInterval other) const

Intersect 2 intervals.

Parameters
otherInterval to be intersect with
Returns
Intersection

Definition at line 186 of file qwt_interval.cpp.

◆ intersects()

bool QwtInterval::intersects ( const QwtInterval other) const

Test if two intervals overlap.

Parameters
otherInterval
Returns
True, when the intervals are intersecting

Definition at line 277 of file qwt_interval.cpp.

◆ invalidate()

void QwtInterval::invalidate ( )
inline

Invalidate the interval

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

See also
isValid()

Definition at line 325 of file qwt_interval.h.

◆ inverted()

QwtInterval QwtInterval::inverted ( ) const

Invert the limits of the interval

Returns
Inverted interval
See also
normalized()

Definition at line 48 of file qwt_interval.cpp.

◆ isNull()

bool QwtInterval::isNull ( ) const
inline
Returns
true, if isValid() && (minValue() >= maxValue())

Definition at line 314 of file qwt_interval.h.

◆ isValid()

bool QwtInterval::isValid ( ) const
inline

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

Returns
True, when the interval is valid

Definition at line 210 of file qwt_interval.h.

◆ limited()

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

Limit the interval, keeping the border modes

Parameters
lowerBoundLower limit
upperBoundUpper limit
Returns
Limited interval

Definition at line 336 of file qwt_interval.cpp.

◆ maxValue()

double QwtInterval::maxValue ( ) const
inline
Returns
Upper limit of the interval

Definition at line 198 of file qwt_interval.h.

◆ minValue()

double QwtInterval::minValue ( ) const
inline
Returns
Lower limit of the interval

Definition at line 192 of file qwt_interval.h.

◆ normalized()

QwtInterval QwtInterval::normalized ( ) const

Normalize the limits of the interval.

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

Returns
Normalized interval
See also
isValid(), inverted()

Definition at line 29 of file qwt_interval.cpp.

◆ operator!=()

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

Compare two intervals.

Parameters
otherInterval to compare with
Returns
True, when this and other are not equal

Definition at line 296 of file qwt_interval.h.

◆ operator&()

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

Intersection of two intervals.

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

Definition at line 258 of file qwt_interval.h.

◆ operator&=()

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

Intersect this interval with the given interval.

Parameters
otherInterval to be intersected with
Returns
This interval

Definition at line 265 of file qwt_interval.cpp.

◆ operator==()

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

Compare two intervals.

Parameters
otherInterval to compare with
Returns
True, when this and other are equal

Definition at line 284 of file qwt_interval.h.

◆ operator|() [1/2]

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

Union of two intervals

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

Definition at line 272 of file qwt_interval.h.

◆ operator|() [2/2]

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

Extend an interval

Parameters
valueValue
Returns
Extended interval
See also
extend()

Definition at line 308 of file qwt_interval.h.

◆ operator|=() [1/2]

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

Unite this interval with the given interval.

Parameters
otherInterval to be united with
Returns
This interval

Definition at line 253 of file qwt_interval.cpp.

◆ operator|=() [2/2]

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

Extend an interval

Parameters
valueValue
Returns
Reference of the extended interval
See also
extend()

Definition at line 380 of file qwt_interval.cpp.

◆ setBorderFlags()

void QwtInterval::setBorderFlags ( BorderFlags  borderFlags)
inline

Change the border flags

Parameters
borderFlagsOr'd BorderMode flags
See also
borderFlags()

Definition at line 157 of file qwt_interval.h.

◆ setInterval()

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

Assign the limits of the interval

Parameters
minValueMinimum value
maxValueMaximum value
borderFlagsInclude/Exclude borders

Definition at line 143 of file qwt_interval.h.

◆ setMaxValue()

void QwtInterval::setMaxValue ( double  maxValue)
inline

Assign the upper limit of the interval

Parameters
maxValueMaximum value

Definition at line 186 of file qwt_interval.h.

◆ setMinValue()

void QwtInterval::setMinValue ( double  minValue)
inline

Assign the lower limit of the interval

Parameters
minValueMinimum value

Definition at line 176 of file qwt_interval.h.

◆ symmetrize()

QwtInterval QwtInterval::symmetrize ( double  value) const

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

Parameters
valueCenter
Returns
Interval with value as center

Definition at line 317 of file qwt_interval.cpp.

◆ unite()

QwtInterval QwtInterval::unite ( const QwtInterval other) const

Unite 2 intervals.

Definition at line 123 of file qwt_interval.cpp.

◆ width()

double QwtInterval::width ( ) const
inline

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()

Definition at line 227 of file qwt_interval.h.

◆ widthL()

long double QwtInterval::widthL ( ) const
inline

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()

Definition at line 241 of file qwt_interval.h.

Member Data Documentation

◆ m_borderFlags

BorderFlags QwtInterval::m_borderFlags
private

Definition at line 106 of file qwt_interval.h.

◆ m_maxValue

double QwtInterval::m_maxValue
private

Definition at line 105 of file qwt_interval.h.

◆ m_minValue

double QwtInterval::m_minValue
private

Definition at line 104 of file qwt_interval.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50