QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsSingleGeometryCheck Class Referenceabstract

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

#include <qgssinglegeometrycheck.h>

Inheritance diagram for QgsSingleGeometryCheck:
Inheritance graph
[legend]

Public Member Functions

 QgsSingleGeometryCheck (const QgsGeometryCheckContext *context, const QVariantMap &configuration)
 Creates a new single geometry check.
 
void collectErrors (const QMap< QString, QgsFeaturePool * > &featurePools, QList< QgsGeometryCheckError * > &errors, QStringList &messages, QgsFeedback *feedback=nullptr, const QgsGeometryCheck::LayerFeatureIds &ids=QgsGeometryCheck::LayerFeatureIds()) const FINAL
 The main worker method.
 
virtual QList< QgsSingleGeometryCheckError * > processGeometry (const QgsGeometry &geometry) const =0
 Check the geometry for errors.
 
- Public Member Functions inherited from QgsGeometryCheck
 QgsGeometryCheck (const QgsGeometryCheckContext *context, const QVariantMap &configuration)
 Create a new geometry check.
 
virtual ~QgsGeometryCheck ()=default
 
virtual QList< QgsGeometryCheckResolutionMethodavailableResolutionMethods () const
 Returns a list of available resolution methods.
 
virtual CheckType checkType () const =0
 Returns the check type.
 
virtual QList< Qgis::GeometryTypecompatibleGeometryTypes () const =0
 A list of geometry types for which this check can be performed.
 
template<class T >
configurationValue (const QString &name, const QVariant &defaultValue=QVariant())
 Returns the configuration value with the name, saved in the QGIS settings for this geometry check.
 
const QgsGeometryCheckContextcontext () const
 Returns the context.
 
virtual QString description () const =0
 Returns a human readable description for this check.
 
virtual void fixError (const QMap< QString, QgsFeaturePool * > &featurePools, QgsGeometryCheckError *error, int method, const QMap< QString, int > &mergeAttributeIndices, Changes &changes) const
 Fixes the error error with the specified method.
 
virtual QgsGeometryCheck::Flags flags () const
 Flags for this geometry check.
 
virtual QString id () const =0
 Returns an id for this check.
 
virtual bool isCompatible (QgsVectorLayer *layer) const
 Returns if this geometry check is compatible with layer.
 
virtual void prepare (const QgsGeometryCheckContext *context, const QVariantMap &configuration)
 Will be run in the main thread before collectErrors() is called (which may be run from a background thread).
 
virtual Q_DECL_DEPRECATED QStringList resolutionMethods () const
 Returns a list of descriptions for available resolutions for errors.
 

Additional Inherited Members

- Public Types inherited from QgsGeometryCheck
typedef QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
 A collection of changes.
 
enum  ChangeType { ChangeAdded , ChangeRemoved , ChangeChanged }
 Description of the type of a change. More...
 
enum  ChangeWhat { ChangeFeature , ChangePart , ChangeRing , ChangeNode }
 Description of a change to indicate at which level a change occurred. More...
 
enum  CheckType { FeatureNodeCheck , FeatureCheck , LayerCheck }
 The type of a check. More...
 
enum  Flag { AvailableInValidation = 1 << 1 }
 Flags for geometry checks. More...
 
typedef QFlags< FlagFlags
 
- Protected Member Functions inherited from QgsGeometryCheck
QMap< QString, QgsFeatureIdsallLayerFeatureIds (const QMap< QString, QgsFeaturePool * > &featurePools) const
 Returns all layers and feature ids.
 
void deleteFeatureGeometryPart (const QMap< QString, QgsFeaturePool * > &featurePools, const QString &layerId, QgsFeature &feature, int partIdx, Changes &changes) const
 Deletes a part of a feature geometry.
 
void deleteFeatureGeometryRing (const QMap< QString, QgsFeaturePool * > &featurePools, const QString &layerId, QgsFeature &feature, int partIdx, int ringIdx, Changes &changes) const
 Deletes a ring in a feature geometry.
 
void replaceFeatureGeometryPart (const QMap< QString, QgsFeaturePool * > &featurePools, const QString &layerId, QgsFeature &feature, int partIdx, QgsAbstractGeometry *newPartGeom, Changes &changes) const
 Replaces a part in a feature geometry.
 
double scaleFactor (const QPointer< QgsVectorLayer > &layer) const
 Determines the scale factor of a layer to the map coordinate reference system.
 
- Protected Attributes inherited from QgsGeometryCheck
QVariantMap mConfiguration
 
const QgsGeometryCheckContextmContext
 

Detailed Description

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.

Since
QGIS 3.4

Definition at line 149 of file qgssinglegeometrycheck.h.

Constructor & Destructor Documentation

◆ QgsSingleGeometryCheck()

QgsSingleGeometryCheck::QgsSingleGeometryCheck ( const QgsGeometryCheckContext context,
const QVariantMap &  configuration 
)
inline

Creates a new single geometry check.

Definition at line 156 of file qgssinglegeometrycheck.h.

Member Function Documentation

◆ collectErrors()

void QgsSingleGeometryCheck::collectErrors ( const QMap< QString, QgsFeaturePool * > &  featurePools,
QList< QgsGeometryCheckError * > &  errors,
QStringList &  messages,
QgsFeedback feedback = nullptr,
const QgsGeometryCheck::LayerFeatureIds ids = QgsGeometryCheck::LayerFeatureIds() 
) const
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.

Since
QGIS 3.4

Implements QgsGeometryCheck.

Definition at line 22 of file qgssinglegeometrycheck.cpp.

◆ processGeometry()

virtual 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.

Since
QGIS 3.4

Implemented in QgsGeometryIsValidCheck, QgsGeometryMultipartCheck, QgsGeometrySelfContactCheck, QgsGeometrySelfIntersectionCheck, and QgsGeometryTypeCheck.


The documentation for this class was generated from the following files: