QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
16 #ifndef QGSGEOMETRYENGINE_H
17 #define QGSGEOMETRYENGINE_H
19 #include "qgis_core.h"
45 NothingHappened = 1000,
219 virtual double area( QString *errorMsg =
nullptr )
const = 0;
220 virtual double length( QString *errorMsg =
nullptr )
const = 0;
233 virtual bool isValid( QString *errorMsg =
nullptr,
bool allowSelfTouchingHoles =
false,
QgsGeometry *errorLoc =
nullptr )
const = 0;
242 virtual bool isEmpty( QString *errorMsg )
const = 0;
248 virtual bool isSimple( QString *errorMsg =
nullptr )
const = 0;
262 QVector<QgsGeometry > &newGeometries
SIP_OUT,
264 QgsPointSequence &topologyTestPoints, QString *errorMsg =
nullptr,
bool skipIntersectionCheck =
false )
const
266 Q_UNUSED( splitLine )
267 Q_UNUSED( newGeometries )
268 Q_UNUSED( topological )
269 Q_UNUSED( topologyTestPoints )
271 Q_UNUSED( skipIntersectionCheck )
272 return MethodNotImplemented;
289 bool mLogErrors =
true;
298 void logError(
const QString &engineName,
const QString &message )
const
302 QgsDebugMsg( QStringLiteral(
"%1 notice: %2" ).arg( engineName, message ) );
303 qWarning(
"%s exception: %s", engineName.toLocal8Bit().constData(), message.toLocal8Bit().constData() );
308 : mGeometry( geometry )
312 #endif // QGSGEOMETRYENGINE_H
virtual bool isValid(QString *errorMsg=nullptr, bool allowSelfTouchingHoles=false, QgsGeometry *errorLoc=nullptr) const =0
Returns true if the geometry is valid.
@ InvalidInput
The input is not valid.
virtual bool touches(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom touches this.
virtual QgsAbstractGeometry * interpolate(double distance, QString *errorMsg=nullptr) const =0
void setLogErrors(bool enabled)
Sets whether warnings and errors encountered during the geometry operations should be logged.
Point geometry type, with support for z-dimension and m-values.
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...
@ EngineError
Error occurred in the geometry engine.
virtual QgsAbstractGeometry * convexHull(QString *errorMsg=nullptr) const =0
Calculate the convex hull of this.
@ MethodNotImplemented
Method not implemented in geometry engine.
virtual double length(QString *errorMsg=nullptr) const =0
virtual QgsAbstractGeometry * intersection(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculate the intersection of this and geom.
virtual QString relate(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship bet...
Line string geometry type, with support for z-dimension and m-values.
virtual QgsAbstractGeometry * buffer(double distance, int segments, QString *errorMsg=nullptr) const =0
virtual bool crosses(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom crosses this.
virtual bool disjoint(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom is disjoint from this.
virtual QgsPoint * pointOnSurface(QString *errorMsg=nullptr) const =0
Calculate a point that is guaranteed to be on the surface of this.
virtual bool isEmpty(QString *errorMsg) const =0
virtual void geometryChanged()=0
Should be called whenever the geometry associated with the engine has been modified and the engine mu...
@ NodedGeometryError
Error occurred while creating a noded geometry.
@ InvalidBaseGeometry
The geometry on which the operation occurs is not valid.
virtual QgsAbstractGeometry * combine(const QVector< QgsGeometry > &geometries, QString *errorMsg=nullptr) const =0
Calculate the combination of this and geometries.
virtual ~QgsGeometryEngine()=default
virtual QgsAbstractGeometry * combine(const QVector< QgsAbstractGeometry * > &geomList, QString *errorMsg) const =0
Calculate the combination of this and geometries.
QgsGeometryEngine(const QgsAbstractGeometry *geometry)
virtual bool intersects(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom intersects this.
virtual QgsAbstractGeometry * envelope(QString *errorMsg=nullptr) const =0
virtual QgsAbstractGeometry * combine(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculate the combination of this and geom.
Abstract base class for all geometries.
virtual QgsAbstractGeometry * symDifference(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculate the symmetric difference of this and geom.
virtual bool isSimple(QString *errorMsg=nullptr) const =0
Determines whether the geometry is simple (according to OGC definition).
virtual double distance(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculates the distance between this and geom.
virtual bool isEqual(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if this is equal to geom.
virtual QgsAbstractGeometry * simplify(double tolerance, QString *errorMsg=nullptr) const =0
virtual QgsAbstractGeometry * offsetCurve(double distance, int segments, int joinStyle, double miterLimit, QString *errorMsg=nullptr) const =0
virtual double area(QString *errorMsg=nullptr) const =0
virtual void prepareGeometry()=0
Prepares the geometry, so that subsequent calls to spatial relation methods are much faster.
@ SplitCannotSplitPoint
Points cannot be split.
QVector< QgsPoint > QgsPointSequence
virtual bool within(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom is within this.
A geometry is the spatial representation of a feature.
virtual QgsAbstractGeometry * buffer(double distance, int segments, int endCapStyle, int joinStyle, double miterLimit, 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.
EngineOperationResult
Success or failure of a geometry operation.
virtual QgsAbstractGeometry * difference(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculate the difference of this and geom.
virtual bool overlaps(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom overlaps this.
virtual QgsPoint * centroid(QString *errorMsg=nullptr) const =0
Calculates the centroid of this.
Contains geometry relation and modification algorithms.
void logError(const QString &engineName, const QString &message) const
Logs an error message encountered during an operation.
virtual bool contains(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom contains this.