Qwt User's Guide 6.1.2

- Main Page
- Related Pages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
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 }
typedef QFlags< BorderFlag > | BorderFlags
| Border flags.

## Public Member Functions
| QwtInterval ()
| Default Constructor. More...
| QwtInterval (double minValue, double maxValue, BorderFlags=IncludeBorders)
void | setInterval (double minValue, double maxValue, BorderFlags=IncludeBorders)
QwtInterval | normalized () const
| Normalize the limits of the interval. More...
QwtInterval | inverted () const
QwtInterval | limited (double minValue, double maxValue) const
bool | operator== (const QwtInterval &) const
| Compare two intervals. More...
bool | operator!= (const QwtInterval &) const
| Compare two intervals. More...
void | setBorderFlags (BorderFlags)
BorderFlags | borderFlags () const
double | minValue () const
double | maxValue () const
double | width () const
| Return the width of an interval. More...
void | setMinValue (double)
void | setMaxValue (double)
bool | contains (double value) const
bool | intersects (const QwtInterval &) const
| Test if two intervals overlap. More...
QwtInterval | intersect (const QwtInterval &) const
| Intersect 2 intervals. More...
QwtInterval | unite (const QwtInterval &) const
| Unite 2 intervals.
QwtInterval | operator| (const QwtInterval &) const
QwtInterval | operator& (const QwtInterval &) const
| Intersection of two intervals. More...
QwtInterval & | operator|= (const QwtInterval &)
| Unite this interval with the given interval. More...
QwtInterval & | operator&= (const QwtInterval &)
| Intersect this interval with the given interval. More...
QwtInterval | extend (double value) const
| Extend the interval. More...
QwtInterval | operator| (double) const
QwtInterval & | operator|= (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

enum QwtInterval::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::QwtInterval | ( |  | ) |
| inline

Default Constructor.

Creates an invalid interval [0.0, -1.0]

See Also
  setInterval(), isValid()

QwtInterval::QwtInterval | ( | double | minValue,
|  | double | maxValue,
|  | BorderFlags | 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

QwtInterval::BorderFlags 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

Returns
  extended interval

See Also
  isValid()

QwtInterval QwtInterval::intersect | ( | const QwtInterval & | other | ) | const

Intersect 2 intervals.

Parameters

  other | Interval to be intersect with

Returns
  Intersection

bool QwtInterval::intersects | ( | const QwtInterval & | other | ) | const

Test if two intervals overlap.

Parameters

  other | Interval

Returns
  True, when the intervals are intersecting

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

Returns
  True, when the interval is valid

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.

Parameters

  other | Interval to compare with

Returns
  True, when this and other are not equal

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

Intersection of two intervals.

Parameters

  other | Interval to intersect with

Returns
  Intersection of this and other

See Also
  intersect()

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

Intersect this interval with the given interval.

Parameters

  other | Interval to be intersected with

Returns
  This interval

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

Compare two intervals.

Parameters

  other | Interval to compare with

Returns
  True, when this and other are equal

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

Union of two intervals

Parameters

  other | Interval to unite with

Returns
  Union of this and other

See Also
  unite()

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

Extend an interval

Parameters

  value | Value

Returns
  Extended interval

See Also
  extend()

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

Unite this interval with the given interval.

Parameters

  other | Interval to be united with

Returns
  This interval

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

Extend an interval

Parameters

  value | Value

Returns
  Reference of the extended interval

See Also
  extend()

void QwtInterval::setBorderFlags | ( | BorderFlags | borderFlags | ) |
| inline

Change the border flags

Parameters

  borderFlags | Or'd BorderMode flags

See Also
  borderFlags()

void QwtInterval::setInterval | ( | double | minValue,
|  | double | maxValue,
|  | BorderFlags | 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

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