@@ -175,23 +175,23 @@ class QgsRange
175
175
*/
176
176
bool overlaps ( const QgsRange<T> &other ) const
177
177
{
178
- if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
179
- && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
178
+ if ( ( ( mIncludeLower && other. mIncludeLower && mLower <= other.mLower ) || ( ( !mIncludeLower || !other. mIncludeLower ) && mLower < other.mLower ) )
179
+ && ( ( mIncludeUpper && other. mIncludeUpper && mUpper >= other.mUpper ) || ( ( !mIncludeUpper || !other. mIncludeUpper ) && mUpper > other.mUpper ) ) )
180
180
return true ;
181
181
182
- if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
183
- && ( ( mIncludeUpper && mUpper >= other.mLower ) || ( !mIncludeUpper && mUpper > other.mLower ) ) )
182
+ if ( ( ( mIncludeLower && other. mIncludeLower && mLower <= other.mLower ) || ( ( !mIncludeLower || !other. mIncludeLower ) && mLower < other.mLower ) )
183
+ && ( ( mIncludeUpper && other. mIncludeLower && mUpper >= other.mLower ) || ( ( !mIncludeUpper || !other. mIncludeLower ) && mUpper > other.mLower ) ) )
184
184
return true ;
185
185
186
- if ( ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) )
187
- && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
186
+ if ( ( ( mIncludeLower && other. mIncludeUpper && mLower <= other.mUpper ) || ( ( !mIncludeLower || !other. mIncludeUpper ) && mLower < other.mUpper ) )
187
+ && ( ( mIncludeUpper && other. mIncludeUpper && mUpper >= other.mUpper ) || ( ( !mIncludeUpper || !other. mIncludeUpper ) && mUpper > other.mUpper ) ) )
188
188
return true ;
189
189
190
- if ( ( ( mIncludeLower && mLower >= other.mLower ) || ( !mIncludeLower && mLower > other.mLower ) )
191
- && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
190
+ if ( ( ( mIncludeLower && other. mIncludeLower && mLower >= other.mLower ) || ( ( !mIncludeLower || !other. mIncludeLower ) && mLower > other.mLower ) )
191
+ && ( ( mIncludeLower && other. mIncludeUpper && mLower <= other.mUpper ) || ( ( !mIncludeLower || !other. mIncludeUpper ) && mLower < other.mUpper ) ) )
192
192
return true ;
193
193
194
- if ( mLower == other.mLower && mUpper == other.mUpper )
194
+ if ( mIncludeLower && mIncludeUpper && other. mIncludeLower && other. mIncludeUpper && mLower == other.mLower && mUpper == other.mUpper )
195
195
return true ;
196
196
197
197
return false ;
@@ -574,26 +574,26 @@ class QgsTemporalRange
574
574
*/
575
575
bool overlaps ( const QgsTemporalRange<T> &other ) const
576
576
{
577
- if ( !mUpper .isValid () && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
577
+ if ( !mUpper .isValid () && ( ( mIncludeLower && other. mIncludeUpper && mLower <= other.mUpper ) || ( ( !mIncludeLower || !other. mIncludeUpper ) && mLower < other.mUpper ) ) )
578
578
return true ;
579
579
580
- if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
581
- && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
580
+ if ( ( ( mIncludeLower && other. mIncludeLower && mLower <= other.mLower ) || ( ( !mIncludeLower || !other. mIncludeLower ) && mLower < other.mLower ) )
581
+ && ( ( mIncludeUpper && other. mIncludeUpper && mUpper >= other.mUpper ) || ( ( !mIncludeUpper || !other. mIncludeUpper ) && mUpper > other.mUpper ) ) )
582
582
return true ;
583
583
584
- if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
585
- && ( ( mIncludeUpper && mUpper >= other.mLower ) || ( !mIncludeUpper && mUpper > other.mLower ) ) )
584
+ if ( ( ( mIncludeLower && other. mIncludeLower && mLower <= other.mLower ) || ( ( !mIncludeLower || other. mIncludeLower ) && mLower < other.mLower ) )
585
+ && ( ( mIncludeUpper && other. mIncludeLower && mUpper >= other.mLower ) || ( ( !mIncludeUpper || !other. mIncludeLower ) && mUpper > other.mLower ) ) )
586
586
return true ;
587
587
588
- if ( ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) )
589
- && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
588
+ if ( ( ( mIncludeLower && other. mIncludeUpper && mLower <= other.mUpper ) || ( ( !mIncludeLower || other. mIncludeUpper ) && mLower < other.mUpper ) )
589
+ && ( ( mIncludeUpper && other. mIncludeUpper && mUpper >= other.mUpper ) || ( ( !mIncludeUpper || !other. mIncludeUpper ) && mUpper > other.mUpper ) ) )
590
590
return true ;
591
591
592
- if ( ( ( mIncludeLower && mLower >= other.mLower ) || ( !mIncludeLower && mLower > other.mLower ) )
593
- && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
592
+ if ( ( ( mIncludeLower && other. mIncludeLower && mLower >= other.mLower ) || ( ( !mIncludeLower || !other. mIncludeLower ) && mLower > other.mLower ) )
593
+ && ( ( mIncludeLower && other. mIncludeUpper && mLower <= other.mUpper ) || ( ( !mIncludeLower || !other. mIncludeUpper ) && mLower < other.mUpper ) ) )
594
594
return true ;
595
595
596
- if ( mLower == other.mLower && mUpper == other.mUpper )
596
+ if ( mIncludeLower && other. mIncludeLower && mIncludeUpper && other. mIncludeUpper && mLower == other.mLower && mUpper == other.mUpper )
597
597
return true ;
598
598
599
599
return false ;
0 commit comments