QGIS API Documentation  3.20.0-Odense (decaadbb31)
Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsRasterRange Class Reference

Raster values range container. More...

#include <qgsrasterrange.h>

Public Types

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

Public Member Functions

 QgsRasterRange ()=default
 Default constructor, both min and max value for the range will be set to NaN. More...
 
 QgsRasterRange (double min, double max, BoundsType bounds=IncludeMinAndMax)
 Constructor for a range with the given min and max values. More...
 
QString asText () const
 Returns a text representation of the range. More...
 
BoundsType 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. More...
 
bool contains (double value) const
 Returns true if this range contains the specified value. More...
 
double max () const
 Returns the maximum value for the range. More...
 
double min () const
 Returns the minimum value for the range. More...
 
bool operator== (const QgsRasterRange &o) const
 
bool overlaps (const QgsRasterRange &other) const
 Returns true if this range overlaps another range. More...
 
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. More...
 
double setMax (double max)
 Sets the maximum value for the range. More...
 
double setMin (double min)
 Sets the minimum value for the range. More...
 

Static Public Member Functions

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

Detailed Description

Raster values range container.

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

Definition at line 35 of file qgsrasterrange.h.

Member Enumeration Documentation

◆ BoundsType

Handling for min and max bounds.

Enumerator
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.

Definition at line 40 of file qgsrasterrange.h.

Constructor & Destructor Documentation

◆ QgsRasterRange() [1/2]

QgsRasterRange::QgsRasterRange ( )
default

Default constructor, both min and max value for the range will be set to NaN.

◆ QgsRasterRange() [2/2]

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.

Definition at line 20 of file qgsrasterrange.cpp.

Member Function Documentation

◆ asText()

QString QgsRasterRange::asText ( ) const

Returns a text representation of the range.

Since
QGIS 3.2

Definition at line 68 of file qgsrasterrange.cpp.

◆ bounds()

BoundsType QgsRasterRange::bounds ( ) const
inline

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

See also
setBounds()
Since
QGIS 3.2

Definition at line 80 of file qgsrasterrange.h.

◆ contains() [1/2]

bool QgsRasterRange::contains ( double  value) const
inline

Returns true if this range contains the specified value.

Since
QGIS 3.2

Definition at line 114 of file qgsrasterrange.h.

◆ contains() [2/2]

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

Tests if a value is within the list of ranges.

Parameters
valuevalue
rangeListlist of ranges
Returns
true if value is in at least one of ranges

Definition at line 131 of file qgsrasterrange.h.

◆ max()

double QgsRasterRange::max ( ) const
inline

Returns the maximum value for the range.

See also
setMax()

Definition at line 71 of file qgsrasterrange.h.

◆ min()

double QgsRasterRange::min ( ) const
inline

Returns the minimum value for the range.

See also
setMin()

Definition at line 65 of file qgsrasterrange.h.

◆ operator==()

bool QgsRasterRange::operator== ( const QgsRasterRange o) const
inline

Definition at line 103 of file qgsrasterrange.h.

◆ overlaps()

bool QgsRasterRange::overlaps ( const QgsRasterRange other) const

Returns true if this range overlaps another range.

Since
QGIS 3.2

Definition at line 27 of file qgsrasterrange.cpp.

◆ setBounds()

void QgsRasterRange::setBounds ( BoundsType  type)
inline

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

See also
bounds()
Since
QGIS 3.2

Definition at line 101 of file qgsrasterrange.h.

◆ setMax()

double QgsRasterRange::setMax ( double  max)
inline

Sets the maximum value for the range.

See also
max()

Definition at line 92 of file qgsrasterrange.h.

◆ setMin()

double QgsRasterRange::setMin ( double  min)
inline

Sets the minimum value for the range.

See also
min()

Definition at line 86 of file qgsrasterrange.h.


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