QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsgeometrychecker.h
Go to the documentation of this file.
1 /***************************************************************************
2  * qgsgeometrychecker.h *
3  * ------------------- *
4  * copyright : (C) 2014 by Sandro Mani / Sourcepole AG *
5  * email : [email protected] *
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #define SIP_NO_FILE
18 
19 #ifndef QGS_GEOMETRY_CHECKER_H
20 #define QGS_GEOMETRY_CHECKER_H
21 
22 #include <QFuture>
23 #include <QList>
24 #include <QMutex>
25 #include <QStringList>
26 
27 #include "qgis_analysis.h"
28 #include "qgsfeedback.h"
29 #include "qgsfeatureid.h"
30 
31 typedef qint64 QgsFeatureId;
33 class QgsGeometryCheck;
35 class QgsMapLayer;
36 class QgsVectorLayer;
37 class QgsFeaturePool;
38 class QMutex;
39 
47 class ANALYSIS_EXPORT QgsGeometryChecker : public QObject
48 {
49  Q_OBJECT
50  public:
51  QgsGeometryChecker( const QList<QgsGeometryCheck *> &checks, QgsGeometryCheckContext *context SIP_TRANSFER, const QMap<QString, QgsFeaturePool *> &featurePools );
52  ~QgsGeometryChecker() override;
53  QFuture<void> execute( int *totalSteps = nullptr );
54  bool fixError( QgsGeometryCheckError *error, int method, bool triggerRepaint = false );
55  const QList<QgsGeometryCheck *> getChecks() const { return mChecks; }
56  QStringList getMessages() const { return mMessages; }
57  void setMergeAttributeIndices( const QMap<QString, int> &mergeAttributeIndices ) { mMergeAttributeIndices = mergeAttributeIndices; }
58  QgsGeometryCheckContext *getContext() const { return mContext; }
59  const QMap<QString, QgsFeaturePool *> featurePools() const {return mFeaturePools;}
60 
61  signals:
62  void errorAdded( QgsGeometryCheckError *error );
63  void errorUpdated( QgsGeometryCheckError *error, bool statusChanged );
64  void progressValue( int value );
65 
66  private:
67  class RunCheckWrapper
68  {
69  public:
70  explicit RunCheckWrapper( QgsGeometryChecker *instance );
71  void operator()( const QgsGeometryCheck *check );
72  private:
73  QgsGeometryChecker *mInstance = nullptr;
74  };
75 
76  QList<QgsGeometryCheck *> mChecks;
77  QgsGeometryCheckContext *mContext = nullptr;
78  QList<QgsGeometryCheckError *> mCheckErrors;
79  QStringList mMessages;
80  QMutex mErrorListMutex;
81  QMap<QString, int> mMergeAttributeIndices;
82  QgsFeedback mFeedback;
83  QMap<QString, QgsFeaturePool *> mFeaturePools;
84 
85  void runCheck( const QMap<QString, QgsFeaturePool *> &featurePools, const QgsGeometryCheck *check );
86 
87  private slots:
88  void emitProgressValue();
89 };
90 
91 #endif // QGS_GEOMETRY_CHECKER_H
QgsGeometryChecker::featurePools
const QMap< QString, QgsFeaturePool * > featurePools() const
Definition: qgsgeometrychecker.h:59
qgsfeatureid.h
QgsGeometryCheck
This class implements a geometry check.
Definition: qgsgeometrycheck.h:91
QgsGeometryChecker
Manages and runs a set of geometry checks.
Definition: qgsgeometrychecker.h:47
QgsGeometryChecker::getMessages
QStringList getMessages() const
Definition: qgsgeometrychecker.h:56
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsGeometryCheckContext
Base configuration for geometry checks.
Definition: qgsgeometrycheckcontext.h:31
QgsGeometryChecker::getContext
QgsGeometryCheckContext * getContext() const
Definition: qgsgeometrychecker.h:58
QgsGeometryChecker::setMergeAttributeIndices
void setMergeAttributeIndices(const QMap< QString, int > &mergeAttributeIndices)
Definition: qgsgeometrychecker.h:57
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition: qgsmaplayer.h:72
QgsFeatureId
qint64 QgsFeatureId
Definition: qgsgeometrychecker.h:31
qgsfeedback.h
QgsGeometryCheckError
This represents an error reported by a geometry check.
Definition: qgsgeometrycheckerror.h:35
QgsGeometryChecker::getChecks
const QList< QgsGeometryCheck * > getChecks() const
Definition: qgsgeometrychecker.h:55
QgsFeaturePool
A feature pool is based on a vector layer and caches features.
Definition: qgsfeaturepool.h:37