QwtInterval Class Reference

A class representing an interval. More...

#include <qwt_interval.h>

List of all members.

Public Types

enum  BorderMode {
  IncludeBorders = 0,
  ExcludeMinimum = 1,
  ExcludeMaximum = 2,
  ExcludeBorders = ExcludeMinimum | ExcludeMaximum
}

Public Member Functions

 QwtInterval ()
 QwtInterval (double minValue, double maxValue, int borderFlags=IncludeBorders)
void setInterval (double minValue, double maxValue, int borderFlags=IncludeBorders)
QwtInterval normalized () const
QwtInterval inverted () const
QwtInterval limited (double minValue, double maxValue) const
bool operator== (const QwtInterval &) const
bool operator!= (const QwtInterval &) const
void setBorderFlags (int)
int borderFlags () const
double minValue () const
double maxValue () const
double width () const
void setMinValue (double)
void setMaxValue (double)
bool contains (double value) const
bool intersects (const QwtInterval &) const
QwtInterval intersect (const QwtInterval &) const
QwtInterval unite (const QwtInterval &) const
QwtInterval operator| (const QwtInterval &) const
QwtInterval operator& (const QwtInterval &) const
QwtIntervaloperator|= (const QwtInterval &)
QwtIntervaloperator&= (const QwtInterval &)
QwtInterval extend (double value) const
QwtInterval operator| (double) const
QwtIntervaloperator|= (double)
bool isValid () const
bool isNull () const
void invalidate ()
QwtInterval symmetrize (double value) const

Detailed Description

A class representing an interval.

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


Member Enumeration Documentation

Flag indicating if a border is included/excluded from an interval

  • 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
See also:
setBorderMode(), testBorderMode()

Constructor & Destructor Documentation

QwtInterval::QwtInterval (  )  [inline]

Default Constructor.

Creates an invalid interval [0.0, -1.0]

See also:
setInterval(), isValid()
QwtInterval::QwtInterval ( double  minValue,
double  maxValue,
int  borderFlags = IncludeBorders 
) [inline]

Constructor

Build an interval with from min/max values

Parameters:
minValue Minimum value
maxValue Maximum value
borderFlags Include/Exclude borders

Member Function Documentation

int QwtInterval::borderFlags (  )  const [inline]
Returns:
Border flags
See also:
setBorderFlags()
bool QwtInterval::contains ( double  value  )  const

Test if a value is inside an interval

Parameters:
value Value
Returns:
true, if value >= minValue() && value <= maxValue()
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:
value Value
See also:
isValid()
QwtInterval QwtInterval::intersect ( const QwtInterval other  )  const

Intersect 2 intervals.

bool QwtInterval::intersects ( const QwtInterval other  )  const

Test if two intervals overlap

void QwtInterval::invalidate (  )  [inline]

Invalidate the interval

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

See also:
isValid()
QwtInterval QwtInterval::inverted (  )  const

Invert the limits of the interval

Returns:
Inverted interval
See also:
normalized()
bool QwtInterval::isNull (  )  const [inline]
Returns:
true, if isValid() && (minValue() >= maxValue())
bool QwtInterval::isValid (  )  const [inline]

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

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

Limit the interval, keeping the border modes

Parameters:
lowerBound Lower limit
upperBound Upper limit
Returns:
Limited interval
double QwtInterval::maxValue (  )  const [inline]
Returns:
Upper limit of the interval
double QwtInterval::minValue (  )  const [inline]
Returns:
Lower limit of the interval
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()
bool QwtInterval::operator!= ( const QwtInterval other  )  const [inline]

Compare two intervals.

QwtInterval QwtInterval::operator& ( const QwtInterval interval  )  const [inline]

Intersection of two intervals

See also:
intersect()
QwtInterval & QwtInterval::operator&= ( const QwtInterval interval  ) 

Intersects this interval with the given interval.

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

Compare two intervals.

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

Extend an interval

Parameters:
value Value
Returns:
Extended interval
See also:
extend()
QwtInterval QwtInterval::operator| ( const QwtInterval interval  )  const [inline]

Union of two intervals

See also:
unite()
QwtInterval & QwtInterval::operator|= ( double  value  ) 

Extend an interval

Parameters:
value Value
Returns:
Reference of the extended interval
See also:
extend()
QwtInterval & QwtInterval::operator|= ( const QwtInterval interval  ) 

Unites this interval with the given interval.

void QwtInterval::setBorderFlags ( int  borderFlags  )  [inline]

Change the border flags

Parameters:
borderFlags Or'd BorderMode flags
See also:
borderFlags()
void QwtInterval::setInterval ( double  minValue,
double  maxValue,
int  borderFlags = IncludeBorders 
) [inline]

Assign the limits of the interval

Parameters:
minValue Minimum value
maxValue Maximum value
borderFlags Include/Exclude borders
void QwtInterval::setMaxValue ( double  maxValue  )  [inline]

Assign the upper limit of the interval

Parameters:
maxValue Maximum value
void QwtInterval::setMinValue ( double  minValue  )  [inline]

Assign the lower limit of the interval

Parameters:
minValue Minimum value
QwtInterval QwtInterval::symmetrize ( double  value  )  const

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

Parameters:
value Center
Returns:
Interval with value as center
QwtInterval QwtInterval::unite ( const QwtInterval other  )  const

Unite 2 intervals.

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

See also:
isValid()
Generated on Sun Nov 21 12:01:34 2010 for Qwt User's Guide by  doxygen 1.6.3