QgsSingleGeometryCheck class

Base class for geometry checks for a single geometry without any context of the layer or other layers in the project.

Classic examples are validity checks like self-intersection.

Subclasses need to implement the processGeometry method.

Base classes

class QgsGeometryCheck
This class implements a geometry check.

Derived classes

class QgsGeometryIsValidCheck
Checks if geometries are valid using the backend configured in the QGIS settings.

Constructors, destructors, conversion operators

QgsSingleGeometryCheck(const QgsGeometryCheckContext* context, const QVariantMap& configuration)
Creates a new single geometry check.

Public functions

void collectErrors(const QMap<QString, QgsFeaturePool*>& featurePools, QList<QgsGeometryCheckError*>& errors, QStringList& messages, QgsFeedback* feedback = nullptr, const QgsGeometryCheck::LayerFeatureIds& ids = QgsGeometryCheck::LayerFeatureIds()) const FINAL virtual
The main worker method.
auto processGeometry(const QgsGeometry& geometry) const -> QList<QgsSingleGeometryCheckError*> pure virtual
Check the geometry for errors.

Function documentation

void QgsSingleGeometryCheck::collectErrors(const QMap<QString, QgsFeaturePool*>& featurePools, QList<QgsGeometryCheckError*>& errors, QStringList& messages, QgsFeedback* feedback = nullptr, const QgsGeometryCheck::LayerFeatureIds& ids = QgsGeometryCheck::LayerFeatureIds()) const FINAL virtual

The main worker method.

Check all features available from featurePools and write errors found to errors. Other status messages can be written to messages. Progress should be reported to feedback. Only features and layers listed in ids should be checked.

QList<QgsSingleGeometryCheckError*> QgsSingleGeometryCheck::processGeometry(const QgsGeometry& geometry) const pure virtual

Check the geometry for errors.

It may make use of configuration options.

Returns a list of QgsSingleGeometryCheckErrors, ownership is transferred to the caller. An empty list is returned for geometries without errors.