16#ifndef QGS_GEOMETRY_CHECK_H
17#define QGS_GEOMETRY_CHECK_H
21#include "qgis_analysis.h"
29#include <QApplication>
112 QMap<QString, QgsFeatureIds>
toMap()
const
119 return ids.isEmpty();
166 DuplicatedUniqueId = 2,
167 InvalidReferenceLayer = 3,
168 GeometryOverlayError = 4
222 return !( *
this == other );
230 typedef QMap<QString, QMap<QgsFeatureId, QList<QgsGeometryCheck::Change>>>
Changes;
254 return mConfiguration.value( name,
QgsSettings().value(
"/geometry_checker/" +
id() +
"/" + name, defaultValue ) ).value<T>();
327 virtual QString
id() const = 0;
350 QMap<QString, QgsFeatureIds> allLayerFeatureIds(
const QMap<QString, QgsFeaturePool *> &featurePools )
const SIP_SKIP;
358 void replaceFeatureGeometryPart(
const QMap<QString, QgsFeaturePool *> &featurePools,
const QString &layerId,
QgsFeature &feature,
int partIdx,
QgsAbstractGeometry *newPartGeom, Changes &changes )
const SIP_SKIP;
366 void deleteFeatureGeometryPart(
const QMap<QString, QgsFeaturePool *> &featurePools,
const QString &layerId,
QgsFeature &feature,
int partIdx, Changes &changes )
const SIP_SKIP;
374 void deleteFeatureGeometryRing(
const QMap<QString, QgsFeaturePool *> &featurePools,
const QString &layerId,
QgsFeature &feature,
int partIdx,
int ringIdx, Changes &changes )
const SIP_SKIP;
Abstract base class for all geometries.
A feature pool is based on a vector layer and caches features.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Base configuration for geometry checks.
This represents an error reported by a geometry check.
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
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.
virtual QList< QgsGeometryCheckResolutionMethod > availableResolutionMethods() const
Returns a list of available resolution methods.
virtual Q_DECL_DEPRECATED QStringList resolutionMethods() const
Returns a list of descriptions for available resolutions for errors.
const QgsGeometryCheckContext * mContext
ChangeWhat
Description of a change to indicate at which level a change occurred.
@ ChangeNode
This change happens on node level.
@ ChangeRing
This change happens on ring level.
@ ChangeFeature
This change happens on feature level.
@ ChangePart
This change happens on part level.
Flag
Flags for geometry checks.
@ AvailableInValidation
This geometry check should be available in layer validation on the vector layer peroperties.
CheckType
The type of a check.
@ LayerCheck
The check controls a whole layer (topology checks).
@ FeatureNodeCheck
The check controls individual nodes.
@ FeatureCheck
The check controls geometries as a whole.
Result checkUniqueId(const QgsGeometryCheckerUtils::LayerFeature layerFeature, QMap< QString, QSet< QVariant > > &uniqueIds) const
Checks that there are no duplicated unique IDs.
Result
Result of the geometry checker operation.
QVariantMap mConfiguration
ChangeType
Description of the type of a change.
@ ChangeChanged
Something has been updated.
@ ChangeAdded
Something has been added.
@ ChangeRemoved
Something has been removed.
virtual CheckType checkType() const =0
Returns the check type.
virtual ~QgsGeometryCheck()=default
virtual QString description() const =0
Returns a human readable description for this check.
double scaleFactor(const QPointer< QgsVectorLayer > &layer) const
Determines the scale factor of a layer to the map coordinate reference system.
virtual QgsGeometryCheck::Flags flags() const
Flags for this geometry 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 QList< Qgis::GeometryType > compatibleGeometryTypes() const =0
A list of geometry types for which this check can be performed.
QgsGeometryCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration)
Create a new geometry check.
const QgsGeometryCheckContext * context() const
Returns the context.
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 t...
A layer feature combination to uniquely identify and access a feature in a set of layers.
Stores settings for use within QGIS.
Represents a vector layer which manages a vector based dataset.
#define SIP_ENUM_BASETYPE(type)
void CPL_STDCALL collectErrors(CPLErr, int, const char *msg)
Descripts a change to fix a geometry.
Change(QgsGeometryCheck::ChangeWhat _what, QgsGeometryCheck::ChangeType _type, QgsVertexId _vidx=QgsVertexId())
Create a new Change.
QgsGeometryCheck::ChangeType type
What action this change performs.
QgsVertexId vidx
The index of the part / ring / vertex, depending on.
QgsGeometryCheck::ChangeWhat what
What level this change affects.
bool operator==(const QgsGeometryCheck::Change &other) const
bool operator!=(const QgsGeometryCheck::Change &other) const
A list of layers and feature ids for each of these layers.
QMap< QString, QgsFeatureIds > ids
QMap< QString, QgsFeatureIds > toMap() const
LayerFeatureIds()=default
Utility class for identifying a unique vertex within a geometry.