QGIS API Documentation 3.99.0-Master (c22de0620c0)
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
18#ifndef QGS_GEOMETRY_CHECKER_H
19#define QGS_GEOMETRY_CHECKER_H
20
21#include "qgis_analysis.h"
22#include "qgsfeatureid.h"
23#include "qgsfeedback.h"
24
25#include <QFuture>
26#include <QList>
27#include <QMutex>
28#include <QStringList>
29
30#define SIP_NO_FILE
31
32typedef qint64 QgsFeatureId;
36class QgsMapLayer;
37class QgsVectorLayer;
38class QgsFeaturePool;
39class QMutex;
40
48class ANALYSIS_EXPORT QgsGeometryChecker : public QObject
49{
50 Q_OBJECT
51 public:
52 QgsGeometryChecker( const QList<QgsGeometryCheck *> &checks, QgsGeometryCheckContext *context SIP_TRANSFER, const QMap<QString, QgsFeaturePool *> &featurePools );
53 ~QgsGeometryChecker() override;
54 QFuture<void> execute( int *totalSteps = nullptr );
55 bool fixError( QgsGeometryCheckError *error, int method, bool triggerRepaint = false );
56 const QList<QgsGeometryCheck *> getChecks() const { return mChecks; }
57 QStringList getMessages() const { return mMessages; }
58 void setMergeAttributeIndices( const QMap<QString, int> &mergeAttributeIndices ) { mMergeAttributeIndices = mergeAttributeIndices; }
59 QgsGeometryCheckContext *getContext() const { return mContext; }
60 const QMap<QString, QgsFeaturePool *> &featurePools() const { return mFeaturePools; }
61
62 signals:
64 void errorUpdated( QgsGeometryCheckError *error, bool statusChanged );
65 void progressValue( int value );
66
67 private:
68 class RunCheckWrapper
69 {
70 public:
71 explicit RunCheckWrapper( QgsGeometryChecker *instance );
72 void operator()( const QgsGeometryCheck *check );
73
74 private:
75 QgsGeometryChecker *mInstance = nullptr;
76 };
77
78 QList<QgsGeometryCheck *> mChecks;
79 QgsGeometryCheckContext *mContext = nullptr;
80 QList<QgsGeometryCheckError *> mCheckErrors;
81 QStringList mMessages;
82 QMutex mErrorListMutex;
83 QMap<QString, int> mMergeAttributeIndices;
84 QgsFeedback mFeedback;
85 QMap<QString, QgsFeaturePool *> mFeaturePools;
86
87 void runCheck( const QMap<QString, QgsFeaturePool *> &featurePools, const QgsGeometryCheck *check );
88
89 private slots:
90 void emitProgressValue();
91};
92
93#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.
Base class for geometry checks.
QFuture< void > execute(int *totalSteps=nullptr)
QStringList getMessages() const
void progressValue(int value)
bool fixError(QgsGeometryCheckError *error, int method, bool triggerRepaint=false)
QgsGeometryChecker(const QList< QgsGeometryCheck * > &checks, QgsGeometryCheckContext *context, const QMap< QString, QgsFeaturePool * > &featurePools)
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:83
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFER
Definition qgis_sip.h:35
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features