21#include <QDomDocument>
41#include "json_fwd.hpp"
42using namespace nlohmann;
140 double mGridSize = -1;
166 Q_PROPERTY(
bool isNull READ isNull )
321 static QgsGeometry collectGeometry(
const QVector<QgsGeometry> &geometries );
338 static QgsGeometry createWedgeBuffer(
const QgsPoint ¢er,
double azimuth,
double angularWidth,
339 double outerRadius,
double innerRadius = 0 );
346 void fromWkb(
unsigned char *wkb,
int length )
SIP_SKIP;
352 void fromWkb(
const QByteArray &wkb );
372 bool isEmpty() const;
418 bool isGeosValid(
Qgis::GeometryValidityFlags flags =
Qgis::GeometryValidityFlags() ) const;
428 bool isSimple() const;
443 bool isAxisParallelRectangle(
double maximumDeviation,
bool simpleRectanglesOnly = false ) const;
473 double length() const;
660 double hausdorffDistance(
const QgsGeometry &geom )
const;
680 double hausdorffDistanceDensify(
const QgsGeometry &geom,
double densifyFraction )
const;
744 double distanceToVertex(
int vertex )
const;
753 double angleAtVertex(
int vertex )
const;
767 void adjacentVertices(
int atVertex,
int &beforeVertex
SIP_OUT,
int &afterVertex
SIP_OUT )
const;
781 bool insertVertex(
double x,
double y,
int beforeVertex );
795 bool insertVertex(
const QgsPoint &point,
int beforeVertex );
804 bool moveVertex(
double x,
double y,
int atVertex );
813 bool moveVertex(
const QgsPoint &p,
int atVertex );
826 bool deleteVertex(
int atVertex );
835 bool toggleCircularAtVertex(
int atVertex );
842 QgsPoint vertexAt(
int atVertex )
const;
876 double closestVertexWithContext(
const QgsPointXY &point,
int &atVertex
SIP_OUT )
const;
942 QgsGeometry removeInteriorRings(
double minimumAllowedArea = -1 )
const;
974 Qgis::GeometryOperationResult transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 );
982 Qgis::GeometryOperationResult rotate(
double rotation, const
QgsPointXY ¢er );
994 Q_DECL_DEPRECATED
Qgis::GeometryOperationResult splitGeometry( const QVector<
QgsPointXY> &splitLine, QVector<
QgsGeometry> &newGeometries,
bool topological, QVector<
QgsPointXY> &topologyTestPoints,
bool splitFeature = true )
SIP_SKIP;
1052 if ( PyList_Check( a0 ) && PyList_GET_SIZE( a0 ) )
1054 PyObject *p0 = PyList_GetItem( a0, 0 );
1055 if ( sipCanConvertToType( p0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
1056 sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1058 QVector<QgsGeometry> newGeometries;
1059 QVector<QgsPointXY> topologyTestPoints;
1061 QVector<QgsPointXY> *splitLine =
reinterpret_cast<QVector<QgsPointXY> *
>( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
1064 sipReleaseType( splitLine, sipType_QVector_0100QgsPointXY, state );
1070 PyObject *o0 = sipConvertFromEnum(
static_cast<int>( result ), sipType_Qgis_GeometryOperationResult );
1071 PyObject *o1 = sipConvertFromType( &newGeometries, sipType_QVector_0100QgsGeometry, Py_None );
1072 PyObject *o2 = sipConvertFromType( &topologyTestPoints, sipType_QVector_0100QgsPointXY, Py_None );
1074 sipRes = PyTuple_New( 3 );
1075 PyTuple_SET_ITEM( sipRes, 0, o0 );
1076 PyTuple_SET_ITEM( sipRes, 1, o1 );
1077 PyTuple_SET_ITEM( sipRes, 2, o2 );
1081 else if ( sipCanConvertToType( p0, sipType_QgsPoint, SIP_NOT_NONE ) &&
1082 sipCanConvertToType( a0, sipType_QVector_0100QgsPoint, SIP_NOT_NONE ) )
1084 QVector<QgsGeometry> newGeometries;
1085 QVector<QgsPoint> topologyTestPoints;
1087 QVector<QgsPoint> *splitLine =
reinterpret_cast<QVector<QgsPoint> *
>( sipConvertToType( a0, sipType_QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
1090 sipReleaseType( splitLine, sipType_QVector_0100QgsPoint, state );
1096 PyObject *o0 = sipConvertFromEnum(
static_cast<int>( result ), sipType_Qgis_GeometryOperationResult );
1097 PyObject *o1 = sipConvertFromType( &newGeometries, sipType_QVector_0100QgsGeometry, Py_None );
1098 PyObject *o2 = sipConvertFromType( &topologyTestPoints, sipType_QVector_0100QgsPoint, Py_None );
1100 sipRes = PyTuple_New( 3 );
1101 PyTuple_SET_ITEM( sipRes, 0, o0 );
1102 PyTuple_SET_ITEM( sipRes, 1, o1 );
1103 PyTuple_SET_ITEM( sipRes, 2, o2 );
1109 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"Could not convert first argument to a list of QgsPoint or QgsPointXY." ).toUtf8().constData() );
1115 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"First argument is not a list of points or is empty." ).toUtf8().constData() );
1211 QgsGeometry orthogonalize(
double tolerance = 1.0E-8,
int maxIterations = 1000,
double angleThreshold = 15.0 ) const;
1225 QgsGeometry triangularWaves(
double wavelength,
double amplitude,
bool strictWavelength = false ) const;
1245 QgsGeometry triangularWavesRandomized(
double minimumWavelength,
double maximumWavelength,
double minimumAmplitude,
double maximumAmplitude,
unsigned long seed = 0 ) const;
1259 QgsGeometry squareWaves(
double wavelength,
double amplitude,
bool strictWavelength = false ) const;
1279 QgsGeometry squareWavesRandomized(
double minimumWavelength,
double maximumWavelength,
double minimumAmplitude,
double maximumAmplitude,
unsigned long seed = 0 ) const;
1293 QgsGeometry roundWaves(
double wavelength,
double amplitude,
bool strictWavelength = false ) const;
1313 QgsGeometry roundWavesRandomized(
double minimumWavelength,
double maximumWavelength,
double minimumAmplitude,
double maximumAmplitude,
unsigned long seed = 0 ) const;
1328 QgsGeometry applyDashPattern( const QVector<
double > &pattern,
1329 Qgis::DashPatternLineEndingRule startRule =
Qgis::DashPatternLineEndingRule::NoRule,
1330 Qgis::DashPatternLineEndingRule endRule =
Qgis::DashPatternLineEndingRule::NoRule,
1331 Qgis::DashPatternSizeAdjustment adjustment =
Qgis::DashPatternSizeAdjustment::ScaleBothDashAndGap,
1332 double patternOffset = 0 ) const;
1346 QgsGeometry snappedToGrid(
double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0 ) const;
1368 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false );
1379 bool intersects( const
QgsRectangle &rectangle ) const;
1395 bool intersects( const
QgsGeometry &geometry ) const;
1406 bool boundingBoxIntersects( const
QgsRectangle &rectangle ) const;
1417 bool boundingBoxIntersects( const
QgsGeometry &geometry ) const;
1434 bool contains( const
QgsGeometry &geometry ) const;
1446 bool disjoint( const
QgsGeometry &geometry ) const;
1458 bool touches( const
QgsGeometry &geometry ) const;
1470 bool overlaps( const
QgsGeometry &geometry ) const;
1494 bool crosses( const
QgsGeometry &geometry ) const;
1503 QgsGeometry buffer(
double distance,
int segments ) const;
1517 QgsGeometry buffer(
double distance,
int segments,
Qgis::EndCapStyle endCapStyle,
Qgis::JoinStyle joinStyle,
double miterLimit ) const;
1527 QgsGeometry offsetCurve(
double distance,
int segments,
Qgis::JoinStyle joinStyle,
double miterLimit ) const;
1544 QgsGeometry singleSidedBuffer(
double distance,
int segments,
Qgis::BufferSide side,
1545 Qgis::JoinStyle joinStyle =
Qgis::JoinStyle::Round,
1546 double miterLimit = 2.0 ) const;
1565 QgsGeometry taperedBuffer(
double startWidth,
double endWidth,
int segments ) const;
1581 QgsGeometry variableWidthBufferByM(
int segments ) const;
1589 QgsGeometry extendLine(
double startDistance,
double endDistance ) const;
1603 QgsGeometry densifyByCount(
int extraNodesPerSegment ) const;
1619 QgsGeometry densifyByDistance(
double distance ) const;
1636 QgsGeometry convertToCurves(
double distanceTolerance = 1e-8,
double angleTolerance = 1e-8 ) const;
1810 QgsGeometry delaunayTriangulation(
double tolerance = 0.0,
bool edgesOnly = false ) const;
1892 double lineLocatePoint( const
QgsGeometry &point ) const;
1903 double interpolateAngle(
double distance ) const;
2039 const
Qgis::GeometryType type = sipCpp->type();
2040 if ( sipCpp->isNull() )
2042 PyErr_SetString( PyExc_ValueError, QStringLiteral(
"Cannot generate points inside a null geometry." ).toUtf8().constData() );
2045 else if ( type != Qgis::GeometryType::Polygon )
2047 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"Cannot generate points inside a %1 geometry. Only Polygon types are permitted." ).arg(
QgsWkbTypes::displayString( sipCpp->wkbType() ) ).toUtf8().constData() );
2052 const sipTypeDef *qvector_type = sipFindType(
"QVector<QgsPointXY>" );
2053 sipRes = sipConvertFromNewType(
new QVector< QgsPointXY >( sipCpp->randomPointsInPolygon( a0, a1 ) ), qvector_type, Py_None );
2068 int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() )
const;
2077 QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() )
const;
2084 QString asWkt(
int precision = 17 )
const;
2087 SIP_PYOBJECT __repr__();
2090 if ( sipCpp->isNull() )
2091 str = QStringLiteral(
"<QgsGeometry: null>" );
2094 QString wkt = sipCpp->asWkt();
2095 if ( wkt.length() > 1000 )
2096 wkt = wkt.left( 1000 ) + QStringLiteral(
"..." );
2097 str = QStringLiteral(
"<QgsGeometry: %1>" ).arg( wkt );
2099 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
2106 QString asJson(
int precision = 17 )
const;
2141 QVector<
QgsGeometry > coerceToType(
Qgis::WkbType type,
double defaultZ = 0,
double defaultM = 0 ) const;
2155 QgsGeometry convertToType(
Qgis::GeometryType destType,
bool destMultipart = false ) const;
2184 if ( sipCpp->isNull() )
2186 PyErr_SetString( PyExc_ValueError, QStringLiteral(
"Null geometry cannot be converted to a point." ).toUtf8().constData() );
2194 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"%1 geometry cannot be converted to a point. Only Point types are permitted." ).arg(
QgsWkbTypes::displayString( geom->
wkbType() ) ).toUtf8().constData() );
2199 sipRes = sipConvertFromNewType(
new QgsPointXY( sipCpp->asPoint() ), sipType_QgsPointXY, Py_None );
2231 const
Qgis::WkbType type = sipCpp->wkbType();
2232 if ( sipCpp->isNull() )
2234 PyErr_SetString( PyExc_ValueError, QStringLiteral(
"Null geometry cannot be converted to a polyline." ).toUtf8().constData() );
2239 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"%1 geometry cannot be converted to a polyline. Only single line or curve types are permitted." ).arg(
QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2244 const sipTypeDef *qvector_type = sipFindType(
"QVector< QgsPointXY >" );
2245 sipRes = sipConvertFromNewType(
new QgsPolylineXY( sipCpp->asPolyline() ), qvector_type, Py_None );
2276 const
Qgis::WkbType type = sipCpp->wkbType();
2277 if ( sipCpp->isNull() )
2279 PyErr_SetString( PyExc_ValueError, QStringLiteral(
"Null geometry cannot be converted to a polygon." ).toUtf8().constData() );
2284 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"%1 geometry cannot be converted to a polygon. Only single polygon or curve polygon types are permitted." ).arg(
QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2289 const sipTypeDef *qvector_type = sipFindType(
"QVector<QVector<QgsPointXY>>" );
2290 sipRes = sipConvertFromNewType(
new QgsPolygonXY( sipCpp->asPolygon() ), qvector_type, Py_None );
2319 const
Qgis::WkbType type = sipCpp->wkbType();
2320 if ( sipCpp->isNull() )
2322 PyErr_SetString( PyExc_ValueError, QStringLiteral(
"Null geometry cannot be converted to a multipoint." ).toUtf8().constData() );
2327 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"%1 geometry cannot be converted to a multipoint. Only multipoint types are permitted." ).arg(
QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2332 const sipTypeDef *qvector_type = sipFindType(
"QVector< QgsPointXY >" );
2333 sipRes = sipConvertFromNewType(
new QgsPolylineXY( sipCpp->asMultiPoint() ), qvector_type, Py_None );
2364 const
Qgis::WkbType type = sipCpp->wkbType();
2365 if ( sipCpp->isNull() )
2367 PyErr_SetString( PyExc_ValueError, QStringLiteral(
"Null geometry cannot be converted to a multilinestring." ).toUtf8().constData() );
2372 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"%1 geometry cannot be converted to a multilinestring. Only multi linestring or curves are permitted." ).arg(
QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2377 const sipTypeDef *qvector_type = sipFindType(
"QVector<QVector<QgsPointXY>>" );
2378 sipRes = sipConvertFromNewType(
new QgsMultiPolylineXY( sipCpp->asMultiPolyline() ), qvector_type, Py_None );
2409 const
Qgis::WkbType type = sipCpp->wkbType();
2410 if ( sipCpp->isNull() )
2412 PyErr_SetString( PyExc_ValueError, QStringLiteral(
"Null geometry cannot be converted to a multipolygon." ).toUtf8().constData() );
2417 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"%1 geometry cannot be converted to a multipolygon. Only multi polygon or curves are permitted." ).arg(
QgsWkbTypes::displayString( type ) ).toUtf8().constData() );
2422 const sipTypeDef *qvector_type = sipFindType(
"QVector<QVector<QVector<QgsPointXY>>>" );
2423 sipRes = sipConvertFromNewType(
new QgsMultiPolygonXY( sipCpp->asMultiPolygon() ), qvector_type, Py_None );
2432 QVector<QgsGeometry> asGeometryCollection()
const;
2461 bool deleteRing(
int ringNum,
int partNum = 0 );
2468 bool deletePart(
int partNum );
2478 bool convertToMultiType();
2495 bool convertToCurvedMultiType();
2506 bool convertToSingleType();
2517 bool convertGeometryCollectionToSubclass(
Qgis::GeometryType geomType );
2530 int avoidIntersections( const QList<
QgsVectorLayer *> &avoidIntersectionsLayers,
2598 : mMessage( QStringLiteral(
"none" ) )
2608 , mHasLocation( true ) {}
2613 QString what()
const;
2623 bool hasWhere()
const;
2626 SIP_PYOBJECT __repr__();
2628 QString
str = QStringLiteral(
"<QgsGeometry.Error: %1>" ).arg( sipCpp->what() );
2629 sipRes = PyUnicode_FromString(
str.toUtf8().data() );
2636 return other.mMessage == mMessage && other.mHasLocation == mHasLocation && other.mLocation == mLocation;
2642 bool mHasLocation =
false;
2653 void validateGeometry( QVector<QgsGeometry::Error> &errors
SIP_OUT,
Qgis::GeometryValidationEngine method = Qgis::GeometryValidationEngine::QgisInternal, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() )
const;
2684 static QgsGeometry polygonize(
const QVector<QgsGeometry> &geometries );
2701 bool requiresConversionToStraightSegments()
const;
2715 void draw( QPainter &p )
const;
2760 void filterVertices( const std::function<
bool( const
QgsPoint & ) > &filter )
SIP_SKIP;
2792 static
QgsGeometry fromQPolygonF( const QPolygonF &polygon );
2824 double epsilon = 4 * std::numeric_limits<double>::epsilon() );
2836 double epsilon = 4 * std::numeric_limits<double>::epsilon() );
2849 double epsilon = 4 * std::numeric_limits<double>::epsilon() );
2871 static bool compare( PyObject *obj1, PyObject *obj2,
double epsilon = 4 * std::numeric_limits<double>::epsilon() );
2879 if ( PyList_Check( a0 ) && PyList_Check( a1 ) &&
2880 PyList_GET_SIZE( a0 ) && PyList_GET_SIZE( a1 ) )
2882 PyObject *o0 = PyList_GetItem( a0, 0 );
2883 PyObject *o1 = PyList_GetItem( a1, 0 );
2887 if ( sipCanConvertToType( o0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2888 sipCanConvertToType( o1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2889 sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
2890 sipCanConvertToType( a1, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) )
2894 p0 =
reinterpret_cast<QgsPolylineXY *
>( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
2895 p1 =
reinterpret_cast<QgsPolylineXY *
>( sipConvertToType( a1, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
2898 sipReleaseType( p0, sipType_QVector_0100QgsPointXY, state0 );
2899 sipReleaseType( p1, sipType_QVector_0100QgsPointXY, state1 );
2906 else if ( PyList_Check( o0 ) && PyList_Check( o1 ) &&
2907 PyList_GET_SIZE( o0 ) && PyList_GET_SIZE( o1 ) )
2909 PyObject *oo0 = PyList_GetItem( o0, 0 );
2910 PyObject *oo1 = PyList_GetItem( o1, 0 );
2914 if ( sipCanConvertToType( oo0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2915 sipCanConvertToType( oo1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2916 sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
2917 sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) )
2921 p0 =
reinterpret_cast<QgsPolygonXY *
>( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
2922 p1 =
reinterpret_cast<QgsPolygonXY *
>( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
2925 sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPointXY, state0 );
2926 sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPointXY, state1 );
2933 else if ( PyList_Check( oo0 ) && PyList_Check( oo1 ) &&
2934 PyList_GET_SIZE( oo0 ) && PyList_GET_SIZE( oo1 ) )
2936 PyObject *ooo0 = PyList_GetItem( oo0, 0 );
2937 PyObject *ooo1 = PyList_GetItem( oo1, 0 );
2941 if ( sipCanConvertToType( ooo0, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2942 sipCanConvertToType( ooo1, sipType_QgsPointXY, SIP_NOT_NONE ) &&
2943 sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
2944 sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) )
2948 p0 =
reinterpret_cast<QgsMultiPolygonXY *
>( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
2949 p1 =
reinterpret_cast<QgsMultiPolygonXY *
>( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
2952 sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state0 );
2953 sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state1 );
2986 QgsGeometry smooth(
unsigned int iterations = 1,
double offset = 0.25,
2987 double minimumDistance = -1.0,
double maxAngle = 180.0 )
const;
3033 static void convertPointList(
const QVector<QgsPointXY> &input,
QgsPointSequence &output );
3040 static void convertPointList(
const QgsPointSequence &input, QVector<QgsPointXY> &output );
3043 operator QVariant()
const
3045 return QVariant::fromValue( *
this );
3053 mutable QString mLastError;
3065 void reset( std::unique_ptr< QgsAbstractGeometry > newGeometry );
3070 QgsGeometry convertToPoint(
bool destMultipart )
const;
3072 QgsGeometry convertToLine(
bool destMultipart )
const;
3074 QgsGeometry convertToPolygon(
bool destMultipart )
const;
3087 std::unique_ptr< QgsLineString > smoothLine(
const QgsLineString &line,
unsigned int iterations = 1,
double offset = 0.25,
3088 double minimumDistance = -1,
double maxAngle = 180.0 )
const;
3101 std::unique_ptr< QgsPolygon > smoothPolygon(
const QgsPolygon &polygon,
unsigned int iterations = 1,
double offset = 0.25,
3102 double minimumDistance = -1,
double maxAngle = 180.0 )
const;
The Qgis class provides global constants for use throughout the application.
GeometryOperationResult
Success or failure of a geometry operation.
GeometryValidationEngine
Available engines for validating geometries.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
WkbType
The WKB type describes the number of dimensions a geometry has.
TransformDirection
Flags for raster layer temporal capabilities.
The part_iterator class provides STL-style iterator for const references to geometry parts.
The part_iterator class provides STL-style iterator for geometry parts.
The vertex_iterator class provides STL-style iterator for vertices.
Abstract base class for all geometries.
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
@ MaximumAngle
Maximum angle between generating radii (lines from arc center to output vertices)
virtual const QgsAbstractGeometry * simplifiedTypeRef() const SIP_HOLDGIL
Returns a reference to the simplest lossless representation of this geometry, e.g.
Qgis::WkbType wkbType() const SIP_HOLDGIL
Returns the WKB type of the geometry.
Custom exception class for Coordinate Reference System related exceptions.
Abstract base class for curved geometry type.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Java-style iterator for const traversal of parts of a geometry.
A geometry engine is a low-level representation of a QgsAbstractGeometry object, optimised for use wi...
Encapsulates parameters under which a geometry operation is performed.
double gridSize() const
Returns the grid size which will be used to snap vertices of a geometry.
void setGridSize(double size)
Sets the grid size which will be used to snap vertices of a geometry.
Java-style iterator for traversal of parts of a geometry.
Error(const QString &m, const QgsPointXY &p)
bool operator==(const QgsGeometry::Error &other) const
A geometry is the spatial representation of a feature.
QVector< QgsPointXY > randomPointsInPolygon(int count, const std::function< bool(const QgsPointXY &) > &acceptPoint, unsigned long seed=0, QgsFeedback *feedback=nullptr, int maxTriesPerPoint=0) const
Returns a list of count random points generated inside a (multi)polygon geometry (if acceptPoint is s...
QVector< QgsPointXY > randomPointsInPolygon(int count, unsigned long seed=0, QgsFeedback *feedback=nullptr) const
Returns a list of count random points generated inside a (multi)polygon geometry.
static bool compare(const QgsPolylineXY &p1, const QgsPolylineXY &p2, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compares two polylines for equality within a specified tolerance.
This class offers geometry processing methods.
Line string geometry type, with support for z-dimension and m-values.
Perform transforms between map coordinates and device coordinates.
Custom exception class which is raised when an operation is not supported.
A class to represent a 2D point.
Point geometry type, with support for z-dimension and m-values.
A rectangle specified with double values.
Represents a vector layer which manages a vector based data sets.
Java-style iterator for traversal of vertices of a geometry.
static Qgis::GeometryType geometryType(Qgis::WkbType type) SIP_HOLDGIL
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static bool isMultiType(Qgis::WkbType type) SIP_HOLDGIL
Returns true if the WKB type is a multi type.
static QString displayString(Qgis::WkbType type) SIP_HOLDGIL
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
static Qgis::WkbType flatType(Qgis::WkbType type) SIP_HOLDGIL
Returns the flat type for a WKB type.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
CORE_EXPORT QgsMeshVertex centroid(const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
Returns the centroid of the face.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
#define SIP_TYPEHINT(type)
#define SIP_THROW(name,...)
QVector< QgsPoint > QgsPointSequence
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QVector< QgsPolylineXY > QgsPolygonXY
Polygon: first item of the list is outer ring, inner rings (if any) start from second item.
CORE_EXPORT QDataStream & operator>>(QDataStream &in, QgsGeometry &geometry)
Reads a geometry from stream in into geometry. QGIS version compatibility is not guaranteed.
CORE_EXPORT QDataStream & operator<<(QDataStream &out, const QgsGeometry &geometry)
Writes the geometry to stream out. QGIS version compatibility is not guaranteed.
QVector< QgsPolylineXY > QgsMultiPolylineXY
A collection of QgsPolylines that share a common collection of attributes.
QVector< QgsPointXY > QgsMultiPointXY
A collection of QgsPoints that share a common collection of attributes.
QVector< QgsPointXY > QgsPolylineXY
Polyline as represented as a vector of two-dimensional points.
QVector< QgsPolygonXY > QgsMultiPolygonXY
A collection of QgsPolygons that share a common collection of attributes.
QgsPointSequence QgsPolyline
Polyline as represented as a vector of points.
Utility class for identifying a unique vertex within a geometry.