QGIS/python/core/auto_generated/geometry/qgsquadrilateral.sip.in
Nyall Dawson 3f6b490218 Sipify
2025-04-02 11:11:10 +10:00

215 lines
6.5 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsquadrilateral.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsQuadrilateral
{
%Docstring(signature="appended")
Quadrilateral geometry type.
A quadrilateral is a polygon with four edges (or sides) and four
vertices or corners. This class allows the creation of simple
quadrilateral (which does not self-intersect).
.. versionadded:: 3.6
%End
%TypeHeaderCode
#include "qgsquadrilateral.h"
%End
public:
QgsQuadrilateral() /HoldGIL/;
%Docstring
Constructor for an empty quadrilateral geometry.
%End
QgsQuadrilateral( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3, const QgsPoint &p4 ) /HoldGIL/;
%Docstring
Construct a QgsQuadrilateral from four :py:class:`QgsPoint`.
:param p1: first point
:param p2: second point
:param p3: third point
:param p4: fourth point
.. seealso:: :py:func:`setPoints`
%End
explicit QgsQuadrilateral( const QgsPointXY &p1, const QgsPointXY &p2, const QgsPointXY &p3, const QgsPointXY &p4 ) /HoldGIL/;
%Docstring
Construct a QgsQuadrilateral from four :py:class:`QgsPointXY`.
:param p1: first point
:param p2: second point
:param p3: third point
:param p4: fourth point
.. seealso:: :py:func:`setPoints`
%End
enum ConstructionOption
{
Distance,
Projected,
};
static QgsQuadrilateral rectangleFrom3Points( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3, ConstructionOption mode ) /HoldGIL/;
%Docstring
Construct a QgsQuadrilateral as a Rectangle from 3 points. In the case
where one of the points is of type PointZ. The other points will also be
of type Z, even if they are of type Point. In addition, the z used will
be the one of the first point with a Z. This ensures consistency in
point types and the ability to export to a Polygon or LineString. M is
taken from point ``p1``.
:param p1: first point
:param p2: second point
:param p3: third point
:param mode: Construction mode to construct the rectangle from 3 points
.. seealso:: ConstructionOption
%End
static QgsQuadrilateral rectangleFromExtent( const QgsPoint &p1, const QgsPoint &p2 ) /HoldGIL/;
%Docstring
Construct a QgsQuadrilateral as a rectangle from an extent, defined by
two opposite corner points. Z and M are taken from point ``p1``.
QgsQuadrilateral will have the same dimension as ``p1`` dimension.
:param p1: first point
:param p2: second point
%End
static QgsQuadrilateral squareFromDiagonal( const QgsPoint &p1, const QgsPoint &p2 ) /HoldGIL/;
%Docstring
Construct a QgsQuadrilateral as a square from a diagonal. Z and M are
taken from point ``p1``. QgsQuadrilateral will have the same dimension
as ``p1`` dimension.
:param p1: first point
:param p2: second point
%End
static QgsQuadrilateral rectangleFromCenterPoint( const QgsPoint &center, const QgsPoint &point ) /HoldGIL/;
%Docstring
Construct a QgsQuadrilateral as a rectangle from center point ``center``
and another point ``point``. Z and M are taken from point ``p1``.
QgsQuadrilateral will have the same dimension as ``center`` dimension.
:param center: center point
:param point: corner point
%End
static QgsQuadrilateral fromRectangle( const QgsRectangle &rectangle ) /HoldGIL/;
%Docstring
Construct a QgsQuadrilateral as a rectangle from a
:py:class:`QgsRectangle`.
:param rectangle: rectangle
%End
bool equals( const QgsQuadrilateral &other, double epsilon = 4 * DBL_EPSILON ) const /HoldGIL/;
%Docstring
Compares two QgsQuadrilateral, allowing specification of the maximum
allowable difference between points.
:param other: the QgsQuadrilateral to compare
:param epsilon: the maximum difference allowed / tolerance
%End
bool operator==( const QgsQuadrilateral &other ) const /HoldGIL/;
bool operator!=( const QgsQuadrilateral &other ) const /HoldGIL/;
bool isValid() const /HoldGIL/;
%Docstring
Convenient method to determine if a QgsQuadrilateral is valid. A
QgsQuadrilateral must be simple (not self-intersecting) and cannot have
collinear points.
%End
enum Point
{
Point1,
Point2,
Point3,
Point4,
};
bool setPoint( const QgsPoint &newPoint, Point index ) /HoldGIL/;
%Docstring
Sets the point ``newPoint`` at the ``index``. Returns ``False`` if the
QgsQuadrilateral is not valid.
.. seealso:: Point
%End
bool setPoints( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3, const QgsPoint &p4 ) /HoldGIL/;
%Docstring
Set all points Returns ``False`` if the QgsQuadrilateral is not valid:
- The points do not have the same type
- The quadrilateral would have auto intersections
- The quadrilateral has double points
- The quadrilateral has collinear points
%End
QgsPointSequence points() const;
%Docstring
Returns a list including the vertices of the quadrilateral.
%End
QgsPolygon *toPolygon( bool force2D = false ) const /Factory/;
%Docstring
Returns the quadrilateral as a new polygon. Ownership is transferred to
the caller.
%End
QgsLineString *toLineString( bool force2D = false ) const /Factory/;
%Docstring
Returns the quadrilateral as a new linestring. Ownership is transferred
to the caller.
%End
QString toString( int pointPrecision = 17 ) const;
%Docstring
Returns a string representation of the quadrilateral. Members will be
truncated to the specified precision.
%End
double area() const /HoldGIL/;
%Docstring
Returns the area of the quadrilateral, or 0 if the quadrilateral is
empty.
%End
double perimeter() const /HoldGIL/;
%Docstring
Returns the perimeter of the quadrilateral, or 0 if the quadrilateral is
empty.
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsQuadrilateral: %1>" ).arg( sipCpp->toString() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsquadrilateral.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/