31 const bool thisLowerInfinite = !std::isfinite( mMin );
32 const bool thisUpperInfinite = !std::isfinite( mMax );
35 const bool otherLowerInfinite = !std::isfinite( other.mMin );
36 const bool otherUpperInfinite = !std::isfinite( other.mMax );
38 if ( ( ( thisIncludesLower && otherIncludesLower && ( mMin <= other.mMin || thisLowerInfinite ) ) ||
39 ( ( !thisIncludesLower || !otherIncludesLower ) && ( mMin < other.mMin || thisLowerInfinite ) ) )
40 && ( ( thisIncludesUpper && otherIncludesUpper && ( mMax >= other.mMax || thisUpperInfinite ) ) ||
41 ( ( !thisIncludesUpper || !otherIncludesUpper ) && ( mMax > other.mMax || thisUpperInfinite ) ) ) )
44 if ( ( ( otherIncludesLower && ( mMin <= other.mMin || thisLowerInfinite ) ) ||
45 ( !otherIncludesLower && ( mMin < other.mMin || thisLowerInfinite ) ) )
46 && ( ( thisIncludesUpper && otherIncludesLower && ( mMax >= other.mMin || thisUpperInfinite ) ) ||
47 ( ( !thisIncludesUpper || !otherIncludesLower ) && ( mMax > other.mMin || thisUpperInfinite ) ) ) )
50 if ( ( ( thisIncludesLower && otherIncludesUpper && ( mMin <= other.mMax || thisLowerInfinite ) ) ||
51 ( ( !thisIncludesLower || !otherIncludesUpper ) && ( mMin < other.mMax || thisLowerInfinite ) ) )
52 && ( ( thisIncludesUpper && otherIncludesUpper && ( mMax >= other.mMax || thisUpperInfinite ) ) ||
53 ( ( !thisIncludesUpper || !otherIncludesUpper ) && ( mMax > other.mMax || thisUpperInfinite ) ) ) )
56 if ( ( ( thisIncludesLower && otherIncludesLower && ( mMin >= other.mMin || otherLowerInfinite ) ) ||
57 ( ( !thisIncludesLower || !otherIncludesLower ) && ( mMin > other.mMin || otherLowerInfinite ) ) )
58 && ( ( thisIncludesLower && otherIncludesUpper && ( mMin <= other.mMax || thisLowerInfinite || otherUpperInfinite ) ) ||
59 ( ( !thisIncludesLower || !otherIncludesUpper ) && ( mMin < other.mMax || thisLowerInfinite || otherUpperInfinite ) ) ) )
70 const QString minText = std::isnan( mMin ) ? QStringLiteral(
"-%1" ).arg( QChar( 0x221e ) ) : QString::number( mMin );
71 const QString maxText = std::isnan( mMax ) ? QChar( 0x221e ) : QString::number( mMax );
75 return QStringLiteral(
"%1 %2 x %3 %4" ).arg( minText, operator1, operator2, maxText );
Raster values range container.
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.
@ IncludeMax
Include the max value, but not the min value, e.g. min < value <= max.
bool overlaps(const QgsRasterRange &other) const
Returns true if this range overlaps another range.
QString asText() const
Returns a text representation of the range.
QgsRasterRange()=default
Default constructor, both min and max value for the range will be set to NaN.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)