18#ifndef QGSRASTERRANGE_H
19#define QGSRASTERRANGE_H
66 double min()
const {
return mMin; }
72 double max()
const {
return mMax; }
106 return ( ( std::isnan( mMin ) && std::isnan( o.mMin ) ) ||
qgsDoubleNear( mMin, o.mMin ) )
107 && ( ( std::isnan( mMax ) && std::isnan( o.mMax ) ) ||
qgsDoubleNear( mMax, o.mMax ) )
117 return ( value > mMin
119 || std::isnan( mMin ) )
123 || std::isnan( mMax ) );
136 if ( range.contains( value ) )
154 QString asText()
const;
157 double mMin = std::numeric_limits<double>::quiet_NaN();
158 double mMax = std::numeric_limits<double>::quiet_NaN();
159 BoundsType mType = IncludeMinAndMax;
Represents a range of raster values between min and max, optionally including the min and max value.
double setMin(double min)
Sets the minimum value for the range.
BoundsType
Handling for min and max bounds.
@ IncludeMin
Include the min value, but not the max value, e.g. min <= value < max.
@ IncludeMinAndMax
Min and max values are inclusive.
@ Exclusive
Don't include either the min or max value, e.g. min < value < max.
@ IncludeMax
Include the max value, but not the min value, e.g. min < value <= max.
bool operator==(const QgsRasterRange &o) const
double min() const
Returns the minimum value for the range.
void setBounds(BoundsType type)
Sets the bounds type for the range, which specifies whether or not the min and max values themselves ...
bool contains(double value) const
Returns true if this range contains the specified value.
double setMax(double max)
Sets the maximum value for the range.
double max() const
Returns the maximum value for the range.
QgsRasterRange()=default
Default constructor, both min and max value for the range will be set to NaN.
BoundsType bounds() const
Returns the bounds type for the range, which specifies whether or not the min and max values themselv...
static bool contains(double value, const QgsRasterRangeList &rangeList)
Tests if a value is within the list of ranges.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).
QList< QgsRasterRange > QgsRasterRangeList