@@ -67,26 +67,41 @@ class ANALYSIS_EXPORT QgsGeometryCheck
67
67
#endif
68
68
};
69
69
70
+ /* *
71
+ * Description of a change to indicate at which level a change occured.
72
+ *
73
+ * \since Python bindings since QGIS 3.4
74
+ */
70
75
enum ChangeWhat
71
76
{
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
76
81
};
77
82
83
+ /* *
84
+ * Description of the type of a change.
85
+ *
86
+ * \since Python bindings since QGIS 3.4
87
+ */
78
88
enum ChangeType
79
89
{
80
- ChangeAdded,
81
- ChangeRemoved,
82
- ChangeChanged
90
+ ChangeAdded, // !< Something has been added
91
+ ChangeRemoved, // !< Something has been removed
92
+ ChangeChanged // !< Something has been updated
83
93
};
84
94
95
+ /* *
96
+ * The type of a check.
97
+ *
98
+ * \since Python bindings since QGIS 3.4
99
+ */
85
100
enum CheckType
86
101
{
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)
90
105
};
91
106
92
107
enum Flag
@@ -98,25 +113,53 @@ class ANALYSIS_EXPORT QgsGeometryCheck
98
113
Q_DECLARE_FLAGS ( Flags, Flag )
99
114
Q_FLAG ( Flags )
100
115
116
+ /* *
117
+ * Descripts a change to fix a geometry.
118
+ *
119
+ * \since Python bindings since QGIS 3.4
120
+ */
101
121
struct Change
102
122
{
103
123
Change () = default ;
124
+
125
+ /* *
126
+ * Create a new Change
127
+ */
104
128
Change ( ChangeWhat _what, ChangeType _type, QgsVertexId _vidx = QgsVertexId() )
105
129
: what( _what )
106
130
, type( _type )
107
131
, vidx( _vidx )
108
132
{}
133
+
134
+ /* *
135
+ * What level this change affects.
136
+ */
109
137
ChangeWhat what;
138
+
139
+ /* *
140
+ * What action this change performs.
141
+ */
110
142
ChangeType type;
143
+
144
+ /* *
145
+ * The index of the part / ring / vertex, depending on \see what.
146
+ */
111
147
QgsVertexId vidx;
112
148
bool operator ==( const Change &other )
113
149
{
114
150
return what == other.what && type == other.type && vidx == other.vidx ;
115
151
}
116
152
};
117
153
154
+ /* *
155
+ * A collection of changes.
156
+ * Grouped by layer id and feature id.
157
+ */
118
158
typedef QMap<QString, QMap<QgsFeatureId, QList<Change> > > Changes;
119
159
160
+ /* *
161
+ * Create a new geometry check.
162
+ */
120
163
QgsGeometryCheck ( CheckType checkType,
121
164
const QgsGeometryCheckContext *context,
122
165
const QVariantMap &configuration )
@@ -134,17 +177,76 @@ class ANALYSIS_EXPORT QgsGeometryCheck
134
177
}
135
178
#endif
136
179
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
+ */
137
186
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
+ */
138
193
virtual QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes () const = 0;
194
+
195
+ /* *
196
+ * Flags for this geometry check.
197
+ */
139
198
virtual QgsGeometryCheck::Flags flags () const {return nullptr ;}
140
199
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
+ */
143
215
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
+ */
144
222
virtual QStringList resolutionMethods () const = 0;
223
+
224
+ /* *
225
+ * Returns a human readable description for this check.
226
+ *
227
+ * \since QGIS 3.4
228
+ */
145
229
virtual QString description () const = 0;
230
+
231
+ /* *
232
+ * Returns an id for this check.
233
+ *
234
+ * \since QGIS 3.4
235
+ */
146
236
virtual QString id () const = 0;
237
+
238
+ /* *
239
+ * Returns the check type.
240
+ *
241
+ * \since QGIS 3.4
242
+ */
147
243
CheckType checkType () const { return mCheckType ; }
244
+
245
+ /* *
246
+ * Returns the context
247
+ *
248
+ * \since QGIS 3.4
249
+ */
148
250
const QgsGeometryCheckContext *context () const { return mContext ; }
149
251
150
252
protected:
0 commit comments