QGIS API Documentation 4.1.0-Master (d6fb7a379fb)
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:
58 QgsGeometryChecker( const QList<QgsGeometryCheck *> &checks, std::unique_ptr<QgsGeometryCheckContext> context, const QMap<QString, QgsFeaturePool *> &featurePools );
59 ~QgsGeometryChecker() override;
60 QFuture<void> execute( int *totalSteps = nullptr );
61 bool fixError( QgsGeometryCheckError *error, int method, bool triggerRepaint = false );
62 const QList<QgsGeometryCheck *> getChecks() const { return mChecks; }
63 QStringList getMessages() const { return mMessages; }
64 void setMergeAttributeIndices( const QMap<QString, int> &mergeAttributeIndices ) { mMergeAttributeIndices = mergeAttributeIndices; }
65 QgsGeometryCheckContext *getContext() const { return mContext.get(); }
66 const QMap<QString, QgsFeaturePool *> &featurePools() const { return mFeaturePools; }
67
68 signals:
70 void errorUpdated( QgsGeometryCheckError *error, bool statusChanged );
71 void progressValue( int value );
72
73 private:
74 class RunCheckWrapper
75 {
76 public:
77 explicit RunCheckWrapper( QgsGeometryChecker *instance );
78 void operator()( const QgsGeometryCheck *check );
79
80 private:
81 QgsGeometryChecker *mInstance = nullptr;
82 };
83
84 QList<QgsGeometryCheck *> mChecks;
85 std::unique_ptr<QgsGeometryCheckContext> mContext;
86 QList<QgsGeometryCheckError *> mCheckErrors;
87 QStringList mMessages;
88 QMutex mErrorListMutex;
89 QMap<QString, int> mMergeAttributeIndices;
90 QgsFeedback mFeedback;
91 QMap<QString, QgsFeaturePool *> mFeaturePools;
92
93 void runCheck( const QMap<QString, QgsFeaturePool *> &featurePools, const QgsGeometryCheck *check );
94
95 private slots:
96 void emitProgressValue();
97};
98
99#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)
QgsGeometryChecker(const QList< QgsGeometryCheck * > &checks, std::unique_ptr< QgsGeometryCheckContext > context, const QMap< QString, QgsFeaturePool * > &featurePools)
Constructor.
QStringList getMessages() const
void progressValue(int value)
bool fixError(QgsGeometryCheckError *error, int method, bool triggerRepaint=false)
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.
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features