|
virtual | ~QgsGeometryEngine ()=default |
|
virtual double | area (QString *errorMsg=nullptr) const =0 |
|
virtual QgsAbstractGeometry * | buffer (double distance, int segments, Qgis::EndCapStyle endCapStyle, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr) const =0 |
| Buffers a geometry.
|
|
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.
|
|
virtual QgsAbstractGeometry * | combine (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const =0 |
| Calculate the combination of this and geom.
|
|
virtual QgsAbstractGeometry * | combine (const QVector< QgsAbstractGeometry * > &geomList, QString *errorMsg, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const =0 |
| Calculate the combination of this and geometries.
|
|
virtual QgsAbstractGeometry * | combine (const QVector< QgsGeometry > &geometries, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const =0 |
| Calculate the combination of this and geometries.
|
|
virtual bool | contains (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom contains this.
|
|
virtual QgsAbstractGeometry * | convexHull (QString *errorMsg=nullptr) const =0 |
| Calculate the convex hull of this.
|
|
virtual bool | crosses (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom crosses this.
|
|
virtual QgsAbstractGeometry * | difference (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const =0 |
| Calculate the difference of this and geom.
|
|
virtual bool | disjoint (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom is disjoint from this.
|
|
virtual double | distance (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Calculates the distance between this and geom.
|
|
virtual bool | distanceWithin (const QgsAbstractGeometry *geom, double maxdistance, QString *errorMsg=nullptr) const =0 |
| Checks if geom is within maxdistance distance from this geometry.
|
|
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.
|
|
virtual QgsAbstractGeometry * | interpolate (double distance, QString *errorMsg=nullptr) const =0 |
|
virtual QgsAbstractGeometry * | intersection (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const =0 |
| Calculate the intersection of this and geom.
|
|
virtual bool | intersects (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom intersects this.
|
|
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.
|
|
virtual bool | isSimple (QString *errorMsg=nullptr) const =0 |
| Determines whether the geometry is simple (according to OGC definition).
|
|
virtual bool | isValid (QString *errorMsg=nullptr, bool allowSelfTouchingHoles=false, QgsGeometry *errorLoc=nullptr) const =0 |
| Returns true if the geometry is valid.
|
|
virtual double | length (QString *errorMsg=nullptr) const =0 |
|
virtual QgsAbstractGeometry * | offsetCurve (double distance, int segments, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr) const =0 |
| Offsets a curve.
|
|
virtual bool | overlaps (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom overlaps this.
|
|
virtual QgsPoint * | pointOnSurface (QString *errorMsg=nullptr) const =0 |
| Calculate a point that is guaranteed to be on the surface of this.
|
|
virtual void | prepareGeometry ()=0 |
| Prepares the geometry, so that subsequent calls to spatial relation methods are much faster.
|
|
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.
|
|
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.
|
|
void | setLogErrors (bool enabled) |
| Sets whether warnings and errors encountered during the geometry operations should be logged.
|
|
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.
|
|
virtual QgsAbstractGeometry * | symDifference (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const =0 |
| Calculate the symmetric difference of this and geom.
|
|
virtual bool | touches (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom touches this.
|
|
virtual bool | within (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0 |
| Checks if geom is within this.
|
|
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.