QgsRasterRange class

Raster values range container.

Represents range of values between min and max including min and max value.

Public types

enum BoundsType { IncludeMinAndMax = 0, IncludeMax, IncludeMin, Exclusive }
Handling for min and max bounds.

Public static functions

static auto contains(double value, const QgsRasterRangeList& rangeList) -> bool
Tests if a value is within the list of ranges.

Constructors, destructors, conversion operators

QgsRasterRange() defaulted
Default constructor, both min and max value for the range will be set to NaN.
QgsRasterRange(double min, double max, BoundsType bounds = IncludeMinAndMax)
Constructor for a range with the given min and max values.

Public functions

auto asText() const -> QString
Returns a text representation of the range.
auto bounds() const -> BoundsType
Returns the bounds type for the range, which specifies whether or not the min and max values themselves are included in the range.
auto contains(double value) const -> bool
Returns true if this range contains the specified value.
auto max() const -> double
Returns the maximum value for the range.
auto min() const -> double
Returns the minimum value for the range.
auto overlaps(const QgsRasterRange& other) const -> bool
Returns true if this range overlaps another range.
void setBounds(BoundsType type)
Sets the bounds type for the range, which specifies whether or not the min and max values themselves are included in the range.
auto setMax(double max) -> double
Sets the maximum value for the range.
auto setMin(double min) -> double
Sets the minimum value for the range.

Enum documentation

enum QgsRasterRange::BoundsType

Handling for min and max bounds.

Enumerators
IncludeMinAndMax

Min and max values are inclusive.

IncludeMax

Include the max value, but not the min value, e.g. min < value <= max.

IncludeMin

Include the min value, but not the max value, e.g. min <= value < max.

Exclusive

Don't include either the min or max value, e.g. min < value < max.

Function documentation

static bool QgsRasterRange::contains(double value, const QgsRasterRangeList& rangeList)

Tests if a value is within the list of ranges.

Parameters
value value
rangeList list of ranges
Returns true if value is in at least one of ranges

QgsRasterRange::QgsRasterRange(double min, double max, BoundsType bounds = IncludeMinAndMax)

Constructor for a range with the given min and max values.

The bounds argument dictates how the min and max value themselves will be handled by the range.

QString QgsRasterRange::asText() const

Returns a text representation of the range.

BoundsType QgsRasterRange::bounds() const

Returns the bounds type for the range, which specifies whether or not the min and max values themselves are included in the range.

bool QgsRasterRange::contains(double value) const

Returns true if this range contains the specified value.

double QgsRasterRange::max() const

Returns the maximum value for the range.

double QgsRasterRange::min() const

Returns the minimum value for the range.

bool QgsRasterRange::overlaps(const QgsRasterRange& other) const

Returns true if this range overlaps another range.

void QgsRasterRange::setBounds(BoundsType type)

Sets the bounds type for the range, which specifies whether or not the min and max values themselves are included in the range.

double QgsRasterRange::setMax(double max)

Sets the maximum value for the range.

double QgsRasterRange::setMin(double min)

Sets the minimum value for the range.