File tree 3 files changed +8
-3
lines changed
3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ class QgsRectangle
79
79
//! test if rectangle is empty
80
80
//! Empty rectangle may still be non-null if it contains valid information (e.g. bounding box of a point)
81
81
bool isEmpty() const;
82
- //! test if the rectangle has all coordinates zero. Null rectangle is also an empty rectangle.
82
+ //! test if the rectangle is null (all coordinates zero or after call to setMinimal()).
83
+ //! Null rectangle is also an empty rectangle.
83
84
//! @note added in 2.4
84
85
bool isNull() const;
85
86
//! returns string representation in Wkt form
Original file line number Diff line number Diff line change @@ -196,7 +196,10 @@ bool QgsRectangle::isEmpty() const
196
196
197
197
bool QgsRectangle::isNull () const
198
198
{
199
- return xmin == 0 && xmax == 0 && ymin == 0 && ymax == 0 ;
199
+ // rectangle created QgsRectangle() or with rect.setMinimal() ?
200
+ return ( xmin == 0 && xmax == 0 && ymin == 0 && ymax == 0 ) ||
201
+ ( xmin == std::numeric_limits<double >::max () && ymin == std::numeric_limits<double >::max () &&
202
+ xmax == -std::numeric_limits<double >::max () && ymax == -std::numeric_limits<double >::max () );
200
203
}
201
204
202
205
QString QgsRectangle::asWktCoordinates () const
Original file line number Diff line number Diff line change @@ -102,7 +102,8 @@ class CORE_EXPORT QgsRectangle
102
102
// ! test if rectangle is empty.
103
103
// ! Empty rectangle may still be non-null if it contains valid information (e.g. bounding box of a point)
104
104
bool isEmpty () const ;
105
- // ! test if the rectangle has all coordinates zero. Null rectangle is also an empty rectangle.
105
+ // ! test if the rectangle is null (all coordinates zero or after call to setMinimal()).
106
+ // ! Null rectangle is also an empty rectangle.
106
107
// ! @note added in 2.4
107
108
bool isNull () const ;
108
109
// ! returns string representation in Wkt form
You can’t perform that action at this time.
0 commit comments