Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #10524 (fix zoom to full)
  • Loading branch information
wonder-sk committed Jun 10, 2014
1 parent 7f30ad2 commit 3af01b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion python/core/qgsrectangle.sip
Expand Up @@ -79,7 +79,8 @@ class QgsRectangle
//! test if rectangle is empty
//! Empty rectangle may still be non-null if it contains valid information (e.g. bounding box of a point)
bool isEmpty() const;
//! test if the rectangle has all coordinates zero. Null rectangle is also an empty rectangle.
//! test if the rectangle is null (all coordinates zero or after call to setMinimal()).
//! Null rectangle is also an empty rectangle.
//! @note added in 2.4
bool isNull() const;
//! returns string representation in Wkt form
Expand Down
5 changes: 4 additions & 1 deletion src/core/qgsrectangle.cpp
Expand Up @@ -196,7 +196,10 @@ bool QgsRectangle::isEmpty() const

bool QgsRectangle::isNull() const
{
return xmin == 0 && xmax == 0 && ymin == 0 && ymax == 0;
// rectangle created QgsRectangle() or with rect.setMinimal() ?
return ( xmin == 0 && xmax == 0 && ymin == 0 && ymax == 0 ) ||
( xmin == std::numeric_limits<double>::max() && ymin == std::numeric_limits<double>::max() &&
xmax == -std::numeric_limits<double>::max() && ymax == -std::numeric_limits<double>::max() );
}

QString QgsRectangle::asWktCoordinates() const
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsrectangle.h
Expand Up @@ -102,7 +102,8 @@ class CORE_EXPORT QgsRectangle
//! test if rectangle is empty.
//! Empty rectangle may still be non-null if it contains valid information (e.g. bounding box of a point)
bool isEmpty() const;
//! test if the rectangle has all coordinates zero. Null rectangle is also an empty rectangle.
//! test if the rectangle is null (all coordinates zero or after call to setMinimal()).
//! Null rectangle is also an empty rectangle.
//! @note added in 2.4
bool isNull() const;
//! returns string representation in Wkt form
Expand Down

0 comments on commit 3af01b3

Please sign in to comment.