[QGIS Commit] r9973 - in trunk/qgis: python/core src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Jan 15 13:02:58 EST 2009
Author: wonder
Date: 2009-01-15 13:02:58 -0500 (Thu, 15 Jan 2009)
New Revision: 9973
Modified:
trunk/qgis/python/core/qgsrect.sip
trunk/qgis/src/core/qgsrectangle.cpp
trunk/qgis/src/core/qgsrectangle.h
Log:
Added QgsRectangle::contains predicate.
Modified: trunk/qgis/python/core/qgsrect.sip
===================================================================
--- trunk/qgis/python/core/qgsrect.sip 2009-01-14 21:34:00 UTC (rev 9972)
+++ trunk/qgis/python/core/qgsrect.sip 2009-01-15 18:02:58 UTC (rev 9973)
@@ -61,6 +61,9 @@
QgsRectangle intersect(QgsRectangle *rect);
//! returns true when rectangle intersects with other rectangle
bool intersects(const QgsRectangle& rect) const;
+ //! return true when rectangle contains other rectangle
+ //! @note added in version 1.1
+ bool contains( const QgsRectangle& rect ) const;
//! expand the rectangle so that covers both the original rectangle and the given rectangle
void combineExtentWith(QgsRectangle *rect);
//! expand the rectangle so that covers both the original rectangle and the given point
Modified: trunk/qgis/src/core/qgsrectangle.cpp
===================================================================
--- trunk/qgis/src/core/qgsrectangle.cpp 2009-01-14 21:34:00 UTC (rev 9972)
+++ trunk/qgis/src/core/qgsrectangle.cpp 2009-01-15 18:02:58 UTC (rev 9973)
@@ -156,7 +156,12 @@
return TRUE;
}
+bool QgsRectangle::contains( const QgsRectangle& rect ) const
+{
+ return (rect.xmin >= xmin && rect.xmax <= xmax && rect.ymin >= ymin && rect.ymax <= ymax);
+}
+
void QgsRectangle::combineExtentWith( QgsRectangle * rect )
{
Modified: trunk/qgis/src/core/qgsrectangle.h
===================================================================
--- trunk/qgis/src/core/qgsrectangle.h 2009-01-14 21:34:00 UTC (rev 9972)
+++ trunk/qgis/src/core/qgsrectangle.h 2009-01-15 18:02:58 UTC (rev 9973)
@@ -84,6 +84,9 @@
QgsRectangle intersect( QgsRectangle *rect ) const;
//! returns true when rectangle intersects with other rectangle
bool intersects( const QgsRectangle& rect ) const;
+ //! return true when rectangle contains other rectangle
+ //! @note added in version 1.1
+ bool contains( const QgsRectangle& rect ) const;
//! expand the rectangle so that covers both the original rectangle and the given rectangle
void combineExtentWith( QgsRectangle *rect );
//! expand the rectangle so that covers both the original rectangle and the given point
More information about the QGIS-commit
mailing list