@@ -67,26 +67,41 @@ class ANALYSIS_EXPORT QgsGeometryCheck
6767#endif
6868 };
6969
70+ /* *
71+ * Description of a change to indicate at which level a change occured.
72+ *
73+ * \since Python bindings since QGIS 3.4
74+ */
7075 enum ChangeWhat
7176 {
72- ChangeFeature,
73- ChangePart,
74- ChangeRing,
75- ChangeNode
77+ ChangeFeature, // !< This change happens on feature level
78+ ChangePart, // !< This change happens on part level
79+ ChangeRing, // !< This change happens on ring level
80+ ChangeNode // !< This change happens on node level
7681 };
7782
83+ /* *
84+ * Description of the type of a change.
85+ *
86+ * \since Python bindings since QGIS 3.4
87+ */
7888 enum ChangeType
7989 {
80- ChangeAdded,
81- ChangeRemoved,
82- ChangeChanged
90+ ChangeAdded, // !< Something has been added
91+ ChangeRemoved, // !< Something has been removed
92+ ChangeChanged // !< Something has been updated
8393 };
8494
95+ /* *
96+ * The type of a check.
97+ *
98+ * \since Python bindings since QGIS 3.4
99+ */
85100 enum CheckType
86101 {
87- FeatureNodeCheck,
88- FeatureCheck,
89- LayerCheck
102+ FeatureNodeCheck, // !< The check controls individual nodes
103+ FeatureCheck, // !< The check controls geometries as a whole
104+ LayerCheck // !< The check controls a whole layer (topology checks)
90105 };
91106
92107 enum Flag
@@ -98,25 +113,53 @@ class ANALYSIS_EXPORT QgsGeometryCheck
98113 Q_DECLARE_FLAGS ( Flags, Flag )
99114 Q_FLAG ( Flags )
100115
116+ /* *
117+ * Descripts a change to fix a geometry.
118+ *
119+ * \since Python bindings since QGIS 3.4
120+ */
101121 struct Change
102122 {
103123 Change () = default ;
124+
125+ /* *
126+ * Create a new Change
127+ */
104128 Change ( ChangeWhat _what, ChangeType _type, QgsVertexId _vidx = QgsVertexId() )
105129 : what( _what )
106130 , type( _type )
107131 , vidx( _vidx )
108132 {}
133+
134+ /* *
135+ * What level this change affects.
136+ */
109137 ChangeWhat what;
138+
139+ /* *
140+ * What action this change performs.
141+ */
110142 ChangeType type;
143+
144+ /* *
145+ * The index of the part / ring / vertex, depending on \see what.
146+ */
111147 QgsVertexId vidx;
112148 bool operator ==( const Change &other )
113149 {
114150 return what == other.what && type == other.type && vidx == other.vidx ;
115151 }
116152 };
117153
154+ /* *
155+ * A collection of changes.
156+ * Grouped by layer id and feature id.
157+ */
118158 typedef QMap<QString, QMap<QgsFeatureId, QList<Change> > > Changes;
119159
160+ /* *
161+ * Create a new geometry check.
162+ */
120163 QgsGeometryCheck ( CheckType checkType,
121164 const QgsGeometryCheckContext *context,
122165 const QVariantMap &configuration )
@@ -134,17 +177,76 @@ class ANALYSIS_EXPORT QgsGeometryCheck
134177 }
135178#endif
136179
180+ /* *
181+ * Returns if this geometry check is compatible with \a layer.
182+ * By default it checks for the geometry type in \a compatibleGeometryTypes().
183+ *
184+ * \since QGIS 3.4
185+ */
137186 virtual bool isCompatible ( QgsVectorLayer *layer ) const ;
187+
188+ /* *
189+ * A list of geometry types for which this check can be performed.
190+ *
191+ * \since QGIS 3.4
192+ */
138193 virtual QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes () const = 0;
194+
195+ /* *
196+ * Flags for this geometry check.
197+ */
139198 virtual QgsGeometryCheck::Flags flags () const {return nullptr ;}
140199
141- virtual void collectErrors ( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr , const LayerFeatureIds &ids = QgsGeometryCheck::LayerFeatureIds() ) const = 0;
142- // ! Fix the error \a error with the specified \a method.
200+ /* *
201+ * The main worker method.
202+ * Check all features available from \a featurePools and write errors found to \a errors.
203+ * Other status messages can be written to \a messages.
204+ * Progress should be reported to \a feedback. Only features and layers listed in \a ids should be checked.
205+ *
206+ * \since QGIS 3.4
207+ */
208+ virtual void collectErrors ( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors SIP_INOUT, QStringList &messages SIP_INOUT, QgsFeedback *feedback = nullptr , const LayerFeatureIds &ids = QgsGeometryCheck::LayerFeatureIds() ) const = 0;
209+
210+ /* *
211+ * Fix the error \a error with the specified \a method.
212+ *
213+ * \since QGIS 3.4
214+ */
143215 virtual void fixError ( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int > &mergeAttributeIndices, Changes &changes SIP_INOUT ) const SIP_SKIP;
216+
217+ /* *
218+ * Returns a list of descriptions for available resolutions for errors. The index will be passed as ``method`` to \see fixError().
219+ *
220+ * \since QGIS 3.4
221+ */
144222 virtual QStringList resolutionMethods () const = 0;
223+
224+ /* *
225+ * Returns a human readable description for this check.
226+ *
227+ * \since QGIS 3.4
228+ */
145229 virtual QString description () const = 0;
230+
231+ /* *
232+ * Returns an id for this check.
233+ *
234+ * \since QGIS 3.4
235+ */
146236 virtual QString id () const = 0;
237+
238+ /* *
239+ * Returns the check type.
240+ *
241+ * \since QGIS 3.4
242+ */
147243 CheckType checkType () const { return mCheckType ; }
244+
245+ /* *
246+ * Returns the context
247+ *
248+ * \since QGIS 3.4
249+ */
148250 const QgsGeometryCheckContext *context () const { return mContext ; }
149251
150252 protected:
0 commit comments