Added a set(const QgsRect&) function

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@3222 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
g_j_m 2005-04-25 08:41:08 +00:00
parent a0fde81dce
commit 458f33b56f
2 changed files with 13 additions and 5 deletions

View File

@ -34,11 +34,7 @@ QgsRect::QgsRect(double newxmin, double newymin, double newxmax, double newymax)
QgsRect::QgsRect(QgsPoint const & p1, QgsPoint const & p2)
{
xmin = p1.x();
xmax = p2.x();
ymin = p1.y();
ymax = p2.y();
normalize();
set(p1, p2);
}
QgsRect::QgsRect(const QgsRect &r)
@ -49,6 +45,15 @@ QgsRect::QgsRect(const QgsRect &r)
ymax = r.yMax();
}
void QgsRect::set(const QgsPoint& p1, const QgsPoint& p2)
{
xmin = p1.x();
xmax = p2.x();
ymin = p1.y();
ymax = p2.y();
normalize();
}
void QgsRect::normalize()
{
double temp;

View File

@ -45,6 +45,9 @@ class QgsRect
QgsRect(const QgsRect &other);
//! Destructor
~QgsRect();
//! Set the rectangle from two QgsPoints. The rectangle is
//normalised after construction.
void set(const QgsPoint& p1, const QgsPoint& p2);
//! Set the minimum x value
void setXmin(double x);
//! Set the maximum x value