|
virtual | ~QgsGeometryEngine ()=default |
|
virtual double | area (QString *errorMsg=nullptr) const =0 |
|
virtual QgsAbstractGeometry * | buffer (double distance, int segments, int endCapStyle, int joinStyle, double miterLimit, QString *errorMsg=nullptr) const =0 |
|
virtual QgsAbstractGeometry * | buffer (double distance, int segments, QString *errorMsg=nullptr) const =0 |
|
virtual QgsPoint * | centroid (QString *errorMsg=nullptr) const =0 |
| Calculates the centroid of this. More...
|
|
virtual QgsAbstractGeometry * | combine (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Calculate the combination of this and geom. More...
|
|
virtual QgsAbstractGeometry * | combine (const QVector< QgsAbstractGeometry * > &geomList, QString *errorMsg) const =0 |
| Calculate the combination of this and geometries. More...
|
|
virtual QgsAbstractGeometry * | combine (const QVector< QgsGeometry > &geometries, QString *errorMsg=nullptr) const =0 |
| Calculate the combination of this and geometries. More...
|
|
virtual bool | contains (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom contains this. More...
|
|
virtual QgsAbstractGeometry * | convexHull (QString *errorMsg=nullptr) const =0 |
| Calculate the convex hull of this. More...
|
|
virtual bool | crosses (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom crosses this. More...
|
|
virtual QgsAbstractGeometry * | difference (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Calculate the difference of this and geom. More...
|
|
virtual bool | disjoint (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom is disjoint from this. More...
|
|
virtual double | distance (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Calculates the distance between this and geom. More...
|
|
virtual QgsAbstractGeometry * | envelope (QString *errorMsg=nullptr) const =0 |
|
virtual void | geometryChanged ()=0 |
| Should be called whenever the geometry associated with the engine has been modified and the engine must be updated to suit. More...
|
|
virtual QgsAbstractGeometry * | interpolate (double distance, QString *errorMsg=nullptr) const =0 |
|
virtual QgsAbstractGeometry * | intersection (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Calculate the intersection of this and geom. More...
|
|
virtual bool | intersects (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom intersects this. More...
|
|
virtual bool | isEmpty (QString *errorMsg) const =0 |
|
virtual bool | isEqual (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if this is equal to geom. More...
|
|
virtual bool | isSimple (QString *errorMsg=nullptr) const =0 |
| Determines whether the geometry is simple (according to OGC definition). More...
|
|
virtual bool | isValid (QString *errorMsg=nullptr, bool allowSelfTouchingHoles=false, QgsGeometry *errorLoc=nullptr) const =0 |
| Returns true if the geometry is valid. More...
|
|
virtual double | length (QString *errorMsg=nullptr) const =0 |
|
virtual QgsAbstractGeometry * | offsetCurve (double distance, int segments, int joinStyle, double miterLimit, QString *errorMsg=nullptr) const =0 |
|
virtual bool | overlaps (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom overlaps this. More...
|
|
virtual QgsPoint * | pointOnSurface (QString *errorMsg=nullptr) const =0 |
| Calculate a point that is guaranteed to be on the surface of this. More...
|
|
virtual void | prepareGeometry ()=0 |
| Prepares the geometry, so that subsequent calls to spatial relation methods are much faster. More...
|
|
virtual QString | relate (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship between the geometries. More...
|
|
virtual bool | relatePattern (const QgsAbstractGeometry *geom, const QString &pattern, QString *errorMsg=nullptr) const =0 |
| Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) pattern. More...
|
|
void | setLogErrors (bool enabled) |
| Sets whether warnings and errors encountered during the geometry operations should be logged. More...
|
|
virtual QgsAbstractGeometry * | simplify (double tolerance, QString *errorMsg=nullptr) const =0 |
|
virtual QgsGeometryEngine::EngineOperationResult | splitGeometry (const QgsLineString &splitLine, QVector< QgsGeometry > &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg=nullptr, bool skipIntersectionCheck=false) const |
| Splits this geometry according to a given line. More...
|
|
virtual QgsAbstractGeometry * | symDifference (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Calculate the symmetric difference of this and geom. More...
|
|
virtual bool | touches (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom touches this. More...
|
|
virtual bool | within (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom is within this. More...
|
|
A geometry engine is a low-level representation of a QgsAbstractGeometry object, optimised for use with external geometry libraries such as GEOS.
QgsGeometryEngine objects provide a mechanism for optimized evaluation of geometric algorithms, including spatial relationships between geometries and operations such as buffers or clipping.
QgsGeometryEngine objects are not created directly, but are instead created by calling QgsGeometry::createGeometryEngine().
Many methods available in the QgsGeometryEngine class can benefit from pre-preparing geometries. For instance, whenever a large number of spatial relationships will be tested (such as calling intersects(), within(), etc) then the geometry should first be prepared by calling prepareGeometry() before performing the tests.
Example
polygon_geometry_engine.prepareGeometry()
for feature in my_layer.getFeatures():
feature_geometry = feature.geometry()
if polygon_geometry_engine.intersects(feature_geometry.constGet()):
print('feature intersects the polygon!')
static QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
static QgsGeometryEngine * createGeometryEngine(const QgsAbstractGeometry *geometry)
Creates and returns a new geometry engine representing the specified geometry.
QgsGeometryEngine operations are backed by the GEOS library (https://trac.osgeo.org/geos/).
- Since
- QGIS 2.10
Definition at line 68 of file qgsgeometryengine.h.