QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsgeometrymissingvertexcheck.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometrymissingvertexcheck.h
3  ---------------------
4  begin : September 2018
5  copyright : (C) 2018 Matthias Kuhn
6  email : [email protected]
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #define SIP_NO_FILE
17 
18 #ifndef QGSGEOMETRYMISSINGVERTEXCHECK_H
19 #define QGSGEOMETRYMISSINGVERTEXCHECK_H
20 
21 #include "qgsgeometrycheck.h"
22 #include "qgsgeometrycheckerror.h"
23 
24 class QgsCurvePolygon;
25 
38 {
39  public:
40 
45  const QgsGeometryCheckerUtils::LayerFeature &layerFeature,
46  const QgsPointXY &errorLocation,
47  QgsVertexId vidx = QgsVertexId(),
48  const QVariant &value = QVariant(),
49  ValueType valueType = ValueOther );
50 
51  QgsRectangle affectedAreaBBox() const override;
52 
58  void setAffectedAreaBBox( const QgsRectangle &affectedAreaBBox );
59 
60  QMap<QString, QgsFeatureIds> involvedFeatures() const override;
61 
68  void setInvolvedFeatures( const QMap<QString, QgsFeatureIds> &involvedFeatures );
69 
70  QIcon icon() const override;
71 
72  private:
73  QgsRectangle mAffectedAreaBBox;
74  QMap<QString, QgsFeatureIds> mInvolvedFeatures;
75 };
76 
87 class ANALYSIS_EXPORT QgsGeometryMissingVertexCheck : public QgsGeometryCheck
88 {
89  Q_DECLARE_TR_FUNCTIONS( QgsGeometryMissingVertexCheck )
90 
91  public:
92 
97  {
99  AddMissingVertex
100  };
101  Q_ENUM( ResolutionMethod )
102 
103 
106  explicit QgsGeometryMissingVertexCheck( const QgsGeometryCheckContext *context, const QVariantMap &geometryCheckConfiguration );
107  void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
108  void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
109  Q_DECL_DEPRECATED QStringList resolutionMethods() const override;
110 
111  QString description() const override;
112  QString id() const override;
113  QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override;
114  QgsGeometryCheck::Flags flags() const override;
115  QgsGeometryCheck::CheckType checkType() const override;
116 
118  static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() SIP_SKIP;
119  static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP;
120  static QString factoryDescription() SIP_SKIP;
121  static QString factoryId() SIP_SKIP;
122  static QgsGeometryCheck::Flags factoryFlags() SIP_SKIP;
123  static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
125 
126  private:
127  void processPolygon( const QgsCurvePolygon *polygon, QgsFeaturePool *featurePool, QList<QgsGeometryCheckError *> &errors, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, QgsFeedback *feedback ) const;
128 
129  QgsRectangle contextBoundingBox( const QgsCurvePolygon *polygon, const QgsVertexId &vertexId, const QgsPoint &point ) const;
130 };
131 
132 
133 
134 #endif // QGSGEOMETRYMISSINGVERTEXCHECK_H
QgsGeometryCheck::compatibleGeometryTypes
virtual QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const =0
A list of geometry types for which this check can be performed.
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:48
QgsGeometryMissingVertexCheck
A topology check for missing vertices.
Definition: qgsgeometrymissingvertexcheck.h:87
QgsGeometryCheckError::ValueType
ValueType
Describes the type of an error value.
Definition: qgsgeometrycheckerror.h:53
QgsCurvePolygon
Curve polygon geometry type.
Definition: qgscurvepolygon.h:34
QgsGeometryCheck::description
virtual QString description() const =0
Returns a human readable description for this check.
QgsGeometryCheck::resolutionMethods
virtual Q_DECL_DEPRECATED QStringList resolutionMethods() const
Returns a list of descriptions for available resolutions for errors.
Definition: qgsgeometrycheck.cpp:77
qgsgeometrycheckerror.h
QgsGeometryCheck::collectErrors
virtual void collectErrors(const QMap< QString, QgsFeaturePool * > &featurePools, QList< QgsGeometryCheckError * > &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids=QgsGeometryCheck::LayerFeatureIds()) const =0
The main worker method.
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsGeometryCheck
This class implements a geometry check.
Definition: qgsgeometrycheck.h:91
QgsGeometryCheck::flags
virtual QgsGeometryCheck::Flags flags() const
Flags for this geometry check.
Definition: qgsgeometrycheck.cpp:45
QgsGeometryCheck::fixError
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.
Definition: qgsgeometrycheck.cpp:50
QgsGeometryCheck::id
virtual QString id() const =0
Returns an id for this check.
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgsgeometrycheck.h
QgsGeometryCheck::checkType
virtual CheckType checkType() const =0
Returns the check type.
QgsGeometryCheckError::affectedAreaBBox
virtual QgsRectangle affectedAreaBBox() const
The bounding box of the affected area of the error.
Definition: qgsgeometrycheckerror.cpp:93
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
QgsGeometryCheckContext
Base configuration for geometry checks.
Definition: qgsgeometrycheckcontext.h:31
QgsGeometryCheckerUtils::LayerFeature
A layer feature combination to uniquely identify and access a feature in a set of layers.
Definition: qgsgeometrycheckerutils.h:51
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:58
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsGeometryCheck::CheckType
CheckType
The type of a check.
Definition: qgsgeometrycheck.h:154
QgsVertexId
Utility class for identifying a unique vertex within a geometry.
Definition: qgsvertexid.h:30
QgsGeometryCheckerUtils
Contains utilities required for geometry checks.
Definition: qgsgeometrycheckerutils.h:39
QgsGeometryMissingVertexCheck::ResolutionMethod
ResolutionMethod
The available resolutions for missing vertex check.
Definition: qgsgeometrymissingvertexcheck.h:96
QgsGeometryCheckError
This represents an error reported by a geometry check.
Definition: qgsgeometrycheckerror.h:35
QgsGeometryCheckError::icon
virtual QIcon icon() const
Returns an icon that should be shown for this kind of error.
Definition: qgsgeometrycheckerror.cpp:199
QgsGeometryMissingVertexCheck::NoChange
@ NoChange
Do nothing.
Definition: qgsgeometrymissingvertexcheck.h:98
QgsFeaturePool
A feature pool is based on a vector layer and caches features.
Definition: qgsfeaturepool.h:37
QgsGeometryMissingVertexCheckError
A geometry check error for a missing vertex.
Definition: qgsgeometrymissingvertexcheck.h:37
QgsGeometryCheckError::involvedFeatures
virtual QMap< QString, QgsFeatureIds > involvedFeatures() const
Returns a list of involved features.
Definition: qgsgeometrycheckerror.cpp:194