2017-04-12 14:39:02 +10:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
2017-04-12 14:55:39 +10:00
|
|
|
* src/core/geometry/qgsrectangle.h *
|
2017-04-12 14:39:02 +10:00
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2008-11-09 00:14:12 +00:00
|
|
|
class QgsRectangle
|
2007-01-09 02:39:15 +00:00
|
|
|
{
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
A rectangle specified with double values.
|
|
|
|
|
|
|
|
QgsRectangle is used to store a rectangle when double values are required.
|
|
|
|
Examples are storing a layer extent or the current view extent of a map
|
2017-04-12 14:39:02 +10:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:class:`QgsBox3d`
|
2007-01-09 02:39:15 +00:00
|
|
|
%End
|
2012-12-20 12:35:09 +02:00
|
|
|
|
2017-04-12 14:39:02 +10:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsrectangle.h"
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
public:
|
2018-02-09 15:26:56 +10:00
|
|
|
|
|
|
|
QgsRectangle(); // optimised constructor for null rectangle - no need to call normalize here
|
|
|
|
|
|
|
|
explicit QgsRectangle( double xMin, double yMin = 0, double xMax = 0, double yMax = 0 );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
|
|
|
Constructor
|
|
|
|
%End
|
2018-06-19 11:30:27 +10:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsRectangle( const QgsPointXY &p1, const QgsPointXY &p2 );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
|
|
|
Construct a rectangle from two points. The rectangle is normalized after construction.
|
|
|
|
%End
|
2018-06-19 11:30:27 +10:00
|
|
|
|
2017-04-12 14:39:02 +10:00
|
|
|
QgsRectangle( const QRectF &qRectF );
|
|
|
|
%Docstring
|
|
|
|
Construct a rectangle from a QRectF. The rectangle is normalized after construction.
|
|
|
|
%End
|
2018-06-19 11:30:27 +10:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
QgsRectangle( const QgsRectangle &other );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
|
|
|
Copy constructor
|
|
|
|
%End
|
|
|
|
|
2017-08-31 13:53:00 +10:00
|
|
|
~QgsRectangle();
|
|
|
|
|
2017-10-11 20:17:34 +02:00
|
|
|
static QgsRectangle fromWkt( const QString &wkt );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Creates a new rectangle from a ``wkt`` string.
|
|
|
|
The WKT must contain only 5 vertices, representing a rectangle aligned with X and Y axes.
|
|
|
|
|
2017-10-11 20:17:34 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-10-21 11:22:19 +10:00
|
|
|
static QgsRectangle fromCenterAndSize( QgsPointXY center, double width, double height );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Creates a new rectangle, given the specified ``center`` point
|
|
|
|
and ``width`` and ``height``.
|
|
|
|
|
2017-10-21 11:22:19 +10:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
void set( const QgsPointXY &p1, const QgsPointXY &p2 );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-19 11:43:52 -04:00
|
|
|
Sets the rectangle from two :py:class:`QgsPoints`. The rectangle is
|
2017-12-15 10:36:55 -04:00
|
|
|
normalised after construction.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2018-06-19 11:30:27 +10:00
|
|
|
void set( double xMin, double yMin, double xMax, double yMax );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the rectangle from four points. The rectangle is
|
|
|
|
normalised after construction.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void setXMinimum( double x );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the minimum x value.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void setXMaximum( double x );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the maximum x value.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void setYMinimum( double y );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the minimum y value.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void setYMaximum( double y );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the maximum y value.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
void setMinimal();
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set a rectangle so that min corner is at max
|
|
|
|
and max corner is at min. It is NOT normalized.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2008-11-09 00:14:12 +00:00
|
|
|
double xMaximum() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the x maximum value (right side of rectangle).
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2011-03-14 21:36:02 +00:00
|
|
|
double xMinimum() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the x minimum value (left side of rectangle).
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2011-03-14 21:36:02 +00:00
|
|
|
double yMaximum() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the y maximum value (top side of rectangle).
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2008-11-09 00:14:12 +00:00
|
|
|
double yMinimum() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the y minimum value (bottom side of rectangle).
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
void normalize();
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Normalize the rectangle so it has non-negative width/height.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
double width() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the width of the rectangle.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`height`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`area`
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
double height() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the height of the rectangle.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`width`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`area`
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
double area() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the area of the rectangle.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`width`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`height`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`perimeter`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
double perimeter() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the perimeter of the rectangle.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`area`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY center() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the center point of the rectangle.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
void scale( double scaleFactor, const QgsPointXY *c = 0 );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Scale the rectangle around its center point.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2014-01-12 18:17:20 +01:00
|
|
|
void scale( double scaleFactor, double centerX, double centerY );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Scale the rectangle around its center point.
|
2018-10-25 13:36:46 -04:00
|
|
|
%End
|
|
|
|
|
2018-10-25 13:49:03 -04:00
|
|
|
QgsRectangle scaled( double scaleFactor, const QgsPointXY *center = 0 ) const;
|
2018-10-25 13:36:46 -04:00
|
|
|
%Docstring
|
|
|
|
Scale the rectangle around its ``center`` point.
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2015-09-09 17:45:31 +02:00
|
|
|
void grow( double delta );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Grows the rectangle in place by the specified amount.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`buffered`
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
void include( const QgsPointXY &p );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Updates the rectangle to include the specified point.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2017-09-25 13:46:13 +10:00
|
|
|
QgsRectangle buffered( double width ) const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2018-05-26 18:44:30 +10:00
|
|
|
Gets rectangle enlarged by buffer.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-10-04 09:05:21 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
In earlier QGIS releases this method was named buffer().
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`grow`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2018-06-17 15:29:13 +10:00
|
|
|
QgsRectangle intersect( const QgsRectangle &rect ) const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the intersection with the given rectangle.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
bool intersects( const QgsRectangle &rect ) const;
|
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` when rectangle intersects with other rectangle.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
bool contains( const QgsRectangle &rect ) const;
|
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` when rectangle contains other rectangle.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
bool contains( const QgsPointXY &p ) const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` when rectangle contains a point.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void combineExtentWith( const QgsRectangle &rect );
|
|
|
|
%Docstring
|
2018-06-08 10:55:56 -04:00
|
|
|
Expands the rectangle so that it covers both the original rectangle and the given rectangle.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void combineExtentWith( double x, double y );
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2018-06-08 10:55:56 -04:00
|
|
|
Expands the rectangle so that it covers both the original rectangle and the given point.
|
2018-06-07 15:11:50 -04:00
|
|
|
%End
|
|
|
|
|
|
|
|
void combineExtentWith( const QgsPointXY &point );
|
|
|
|
%Docstring
|
2018-06-08 10:55:56 -04:00
|
|
|
Expands the rectangle so that it covers both the original rectangle and the given point.
|
2018-06-07 15:11:50 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2018-06-04 21:56:07 +10:00
|
|
|
QgsRectangle operator-( QgsVector v ) const;
|
2017-06-21 23:46:16 +03:00
|
|
|
|
2018-06-04 21:56:07 +10:00
|
|
|
QgsRectangle operator+( QgsVector v ) const;
|
2017-06-21 23:46:16 +03:00
|
|
|
|
2018-06-04 21:56:07 +10:00
|
|
|
QgsRectangle &operator-=( QgsVector v );
|
2017-06-21 23:46:16 +03:00
|
|
|
|
2018-06-04 21:56:07 +10:00
|
|
|
QgsRectangle &operator+=( QgsVector v );
|
2017-06-21 23:46:16 +03:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
bool isEmpty() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` if the rectangle is empty.
|
2017-12-15 10:36:55 -04:00
|
|
|
An empty rectangle may still be non-null if it contains valid information (e.g. bounding box of a point).
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2014-06-09 13:42:40 +07:00
|
|
|
bool isNull() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
|
|
|
|
A null rectangle is also an empty rectangle.
|
|
|
|
|
2017-04-12 14:39:02 +10:00
|
|
|
.. versionadded:: 2.4
|
|
|
|
%End
|
|
|
|
|
2008-08-23 09:19:49 +00:00
|
|
|
QString asWktCoordinates() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a string representation of the rectangle in WKT format.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2012-09-10 16:04:22 +02:00
|
|
|
QString asWktPolygon() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a string representation of the rectangle as a WKT Polygon.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2012-09-16 18:56:14 +02:00
|
|
|
QRectF toRectF() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a QRectF with same coordinates as the rectangle.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2017-03-21 06:58:39 +01:00
|
|
|
QString toString( int precision = 16 ) const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a string representation of form xmin,ymin : xmax,ymax
|
|
|
|
Coordinates will be truncated to the specified precision.
|
|
|
|
If the specified precision is less than 0, a suitable minimum precision is used.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
QString asPolygon() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the rectangle as a polygon.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
bool operator==( const QgsRectangle &r1 ) const;
|
2017-04-12 14:39:02 +10:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
bool operator!=( const QgsRectangle &r1 ) const;
|
2017-04-12 14:39:02 +10:00
|
|
|
|
2017-04-26 11:31:56 +02:00
|
|
|
|
2014-01-27 09:22:24 +01:00
|
|
|
bool isFinite() const;
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` if the rectangle has finite boundaries. Will
|
|
|
|
return ``False`` if any of the rectangle boundaries are NaN or Inf.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2012-03-25 11:11:51 +02:00
|
|
|
void invert();
|
2017-04-12 14:39:02 +10:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Swap x/y coordinates in the rectangle.
|
2017-04-12 14:39:02 +10:00
|
|
|
%End
|
|
|
|
|
2017-04-12 14:45:47 +10:00
|
|
|
QgsBox3d toBox3d( double zMin, double zMax ) const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Converts the rectangle to a 3D box, with the specified
|
|
|
|
``zMin`` and ``zMax`` z values.
|
|
|
|
|
2017-04-12 14:45:47 +10:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-08-31 20:54:43 +10:00
|
|
|
operator QVariant() const;
|
|
|
|
|
2018-10-25 20:31:28 +02:00
|
|
|
QgsRectangle snappedToGrid( double spacing ) const;
|
|
|
|
%Docstring
|
|
|
|
Returns a copy of this rectangle that is snapped to a grid with
|
|
|
|
the specified ``spacing`` between the grid lines.
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
|
|
|
%End
|
|
|
|
|
2018-06-19 07:28:49 -04:00
|
|
|
SIP_PYOBJECT __repr__();
|
|
|
|
%MethodCode
|
2018-06-19 09:06:54 -04:00
|
|
|
QString str = QStringLiteral( "<QgsRectangle: %1>" ).arg( sipCpp->asWktCoordinates() );
|
2018-10-06 15:39:40 +02:00
|
|
|
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
2018-06-19 07:28:49 -04:00
|
|
|
%End
|
2018-06-05 08:54:45 -04:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
};
|
2017-04-12 14:39:02 +10:00
|
|
|
|
|
|
|
|
2017-08-31 15:19:28 +10:00
|
|
|
|
2017-04-12 14:39:02 +10:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
2017-04-12 14:55:39 +10:00
|
|
|
* src/core/geometry/qgsrectangle.h *
|
2017-04-12 14:39:02 +10:00
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|