Skip to content

Commit 3af01b3

Browse files
committed
Fix #10524 (fix zoom to full)
1 parent 7f30ad2 commit 3af01b3

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

python/core/qgsrectangle.sip

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ class QgsRectangle
7979
//! test if rectangle is empty
8080
//! Empty rectangle may still be non-null if it contains valid information (e.g. bounding box of a point)
8181
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.
8384
//! @note added in 2.4
8485
bool isNull() const;
8586
//! returns string representation in Wkt form

src/core/qgsrectangle.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ bool QgsRectangle::isEmpty() const
196196

197197
bool QgsRectangle::isNull() const
198198
{
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() );
200203
}
201204

202205
QString QgsRectangle::asWktCoordinates() const

src/core/qgsrectangle.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ class CORE_EXPORT QgsRectangle
102102
//! test if rectangle is empty.
103103
//! Empty rectangle may still be non-null if it contains valid information (e.g. bounding box of a point)
104104
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.
106107
//! @note added in 2.4
107108
bool isNull() const;
108109
//! returns string representation in Wkt form

0 commit comments

Comments
 (0)