mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
added asPolygon function to return the rectangle as a set of polyogn coordinates
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@862 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
6a7590c880
commit
472544329e
@ -107,20 +107,23 @@ bool QgsRect::isEmpty()
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Return a string representation of the rectangle with high precision
|
||||
QString QgsRect::stringRep() const
|
||||
{
|
||||
QString tmp;
|
||||
QString rep = tmp.setNum(xmin);;
|
||||
rep += " ";
|
||||
rep += tmp.setNum(ymin);
|
||||
rep += ",";
|
||||
rep += tmp.setNum(xmax);
|
||||
rep += " ";
|
||||
rep += tmp.setNum(ymax);
|
||||
QString rep = tmp.sprintf("%16f %16f,%16f %16f", xmin, ymin, xmax, ymax);
|
||||
return rep;
|
||||
}
|
||||
|
||||
// Return the rectangle as a set of polygon coordinates
|
||||
QString QgsRect::asPolygon() const
|
||||
{
|
||||
QString tmp;
|
||||
QString rep = tmp.sprintf("%16f %16f,%16f %16f,%16f %16f,%16f %16f,%16f %16f",
|
||||
xmin, ymin, xmin, ymax, xmax, ymax, xmax, ymin, xmin, ymin);
|
||||
return rep;
|
||||
|
||||
}
|
||||
bool QgsRect::operator==(const QgsRect & r1)
|
||||
{
|
||||
return (r1.xMax() == this->xMax() && r1.xMin() == this->xMin() && r1.yMax() == this->yMax() && r1.yMin() == this->yMin());
|
||||
|
@ -71,6 +71,8 @@ class QgsRect{
|
||||
bool isEmpty();
|
||||
//! returns string representation of form xmin,ymin xmax,ymax
|
||||
QString stringRep() const;
|
||||
//! returns rectangle s a polygon
|
||||
QString asPolygon() const;
|
||||
/*! Comparison operator
|
||||
@return True if rectangles are equal
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user