1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
/************************************************************************
* 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 /BaseType=IntEnum/
{
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 ¢er, 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 /BaseType=IntEnum/
{
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 *
************************************************************************/
|