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 }
 
typedef QFlags< BorderFlagBorderFlags
 Border flags. More...
 

Public Member Functions

BorderFlags borderFlags () 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 minValue, double maxValue) 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 ()
 Default Constructor. 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 d_borderFlags
 
double d_maxValue
 
double d_minValue
 

Detailed Description

A class representing an interval.

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

Definition at line 26 of file qwt_interval.h.

Member Typedef Documentation

Border flags.

Definition at line 49 of file qwt_interval.h.

Member Enumeration Documentation

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 33 of file qwt_interval.h.

Constructor & Destructor Documentation

QwtInterval::QwtInterval ( )
inline

Default Constructor.

Creates an invalid interval [0.0, -1.0]

See also
setInterval(), isValid()

Definition at line 113 of file qwt_interval.h.

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 129 of file qwt_interval.h.

Member Function Documentation

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

Definition at line 167 of file qwt_interval.h.

bool QwtInterval::contains ( double  value) const

Test if a value is inside an interval

Parameters
valueValue
Returns
true, if value >= minValue() && value <= maxValue()

Definition at line 58 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

Parameters
valueValue
Returns
extended interval
See also
isValid()

Definition at line 316 of file qwt_interval.cpp.

QwtInterval QwtInterval::intersect ( const QwtInterval other) const

Intersect 2 intervals.

Parameters
otherInterval to be intersect with
Returns
Intersection

Definition at line 139 of file qwt_interval.cpp.

bool QwtInterval::intersects ( const QwtInterval other) const

Test if two intervals overlap.

Parameters
otherInterval
Returns
True, when the intervals are intersecting

Definition at line 230 of file qwt_interval.cpp.

void QwtInterval::invalidate ( )
inline

Invalidate the interval

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

See also
isValid()

Definition at line 326 of file qwt_interval.h.

QwtInterval QwtInterval::inverted ( ) const

Invert the limits of the interval

Returns
Inverted interval
See also
normalized()

Definition at line 41 of file qwt_interval.cpp.

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

Definition at line 315 of file qwt_interval.h.

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 211 of file qwt_interval.h.

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 289 of file qwt_interval.cpp.

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

Definition at line 199 of file qwt_interval.h.

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

Definition at line 193 of file qwt_interval.h.

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 22 of file qwt_interval.cpp.

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 297 of file qwt_interval.h.

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 259 of file qwt_interval.h.

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 218 of file qwt_interval.cpp.

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 285 of file qwt_interval.h.

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 273 of file qwt_interval.h.

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

Extend an interval

Parameters
valueValue
Returns
Extended interval
See also
extend()

Definition at line 309 of file qwt_interval.h.

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 206 of file qwt_interval.cpp.

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

Extend an interval

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

Definition at line 333 of file qwt_interval.cpp.

void QwtInterval::setBorderFlags ( BorderFlags  borderFlags)
inline

Change the border flags

Parameters
borderFlagsOr'd BorderMode flags
See also
borderFlags()

Definition at line 158 of file qwt_interval.h.

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 144 of file qwt_interval.h.

void QwtInterval::setMaxValue ( double  maxValue)
inline

Assign the upper limit of the interval

Parameters
maxValueMaximum value

Definition at line 187 of file qwt_interval.h.

void QwtInterval::setMinValue ( double  minValue)
inline

Assign the lower limit of the interval

Parameters
minValueMinimum value

Definition at line 177 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.

Parameters
valueCenter
Returns
Interval with value as center

Definition at line 270 of file qwt_interval.cpp.

QwtInterval QwtInterval::unite ( const QwtInterval other) const

Unite 2 intervals.

Definition at line 76 of file qwt_interval.cpp.

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 228 of file qwt_interval.h.

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 242 of file qwt_interval.h.

Member Data Documentation

BorderFlags QwtInterval::d_borderFlags
private

Definition at line 102 of file qwt_interval.h.

double QwtInterval::d_maxValue
private

Definition at line 101 of file qwt_interval.h.

double QwtInterval::d_minValue
private

Definition at line 100 of file qwt_interval.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18