QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
31typedef qint64 QgsFeatureId;
35class QgsMapLayer;
36class QgsVectorLayer;
37class QgsFeaturePool;
38class QMutex;
39
47class 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:
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
73 private:
74 QgsGeometryChecker *mInstance = nullptr;
75 };
76
77 QList<QgsGeometryCheck *> mChecks;
78 QgsGeometryCheckContext *mContext = nullptr;
79 QList<QgsGeometryCheckError *> mCheckErrors;
80 QStringList mMessages;
81 QMutex mErrorListMutex;
82 QMap<QString, int> mMergeAttributeIndices;
83 QgsFeedback mFeedback;
84 QMap<QString, QgsFeaturePool *> mFeaturePools;
85
86 void runCheck( const QMap<QString, QgsFeaturePool *> &featurePools, const QgsGeometryCheck *check );
87
88 private slots:
89 void emitProgressValue();
90};
91
92#endif // QGS_GEOMETRY_CHECKER_H
A feature pool is based on a vector layer and caches features.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Base configuration for geometry checks.
This represents an error reported by a geometry check.
This class implements a geometry check.
Manages and runs a set of geometry checks.
QStringList getMessages() const
void progressValue(int value)
void errorAdded(QgsGeometryCheckError *error)
void errorUpdated(QgsGeometryCheckError *error, bool statusChanged)
void setMergeAttributeIndices(const QMap< QString, int > &mergeAttributeIndices)
const QMap< QString, QgsFeaturePool * > & featurePools() const
const QList< QgsGeometryCheck * > getChecks() const
QgsGeometryCheckContext * getContext() const
Base class for all map layer types.
Definition qgsmaplayer.h:76
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFER
Definition qgis_sip.h:36
qint64 QgsFeatureId