QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgssinglegeometrycheck.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssinglegeometrycheck.h
3 --------------------------------------
4Date : 6.9.2018
5Copyright : (C) 2018 by Matthias Kuhn
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSSINGLEGEOMETRYCHECK_H
17#define QGSSINGLEGEOMETRYCHECK_H
18
19#include "qgis_analysis.h"
20#include "qgsgeometry.h"
21#include "qgsgeometrycheck.h"
23
24#include <QCoreApplication>
25#include <QList>
26
27class QgsFeature;
29
38class ANALYSIS_EXPORT QgsSingleGeometryCheckError
39{
40 public:
50
51 virtual ~QgsSingleGeometryCheckError() = default;
52
57 virtual void update( const QgsSingleGeometryCheckError *other );
58
64 virtual bool isEqual( const QgsSingleGeometryCheckError *other ) const;
65
69 virtual bool handleChanges( const QList<QgsGeometryCheck::Change> &changes ) SIP_SKIP;
70
74 virtual QString description() const;
75
81 const QgsSingleGeometryCheck *check() const;
82
89
95 QgsVertexId vertexId() const;
96
97 protected:
102};
103
114{
115 public:
120
125
126 bool handleChanges( const QgsGeometryCheck::Changes &changes ) override SIP_SKIP;
127
128 private:
129#ifdef SIP_RUN
131#endif
132
133 QgsSingleGeometryCheckError *mError = nullptr;
134};
135
147class ANALYSIS_EXPORT QgsSingleGeometryCheck : public QgsGeometryCheck
148{
149 public:
153 QgsSingleGeometryCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration )
154 : QgsGeometryCheck( context, configuration )
155 {}
156
157 QgsGeometryCheck::Result collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const QgsGeometryCheck::LayerFeatureIds &ids = QgsGeometryCheck::LayerFeatureIds() ) const final;
158
167 virtual QList<QgsSingleGeometryCheckError *> processGeometry( const QgsGeometry &geometry ) const = 0;
168
169 private:
175 QgsGeometryCheckErrorSingle *convertToGeometryCheckError( QgsSingleGeometryCheckError *singleGeometryCheckError, const QgsGeometryCheckerUtils::LayerFeature &layerFeature ) const;
176};
177
178#endif // QGSSINGLEGEOMETRYCHECK_H
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
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.
Wraps a QgsSingleGeometryError into a standard QgsGeometryCheckError.
QgsGeometryCheckErrorSingle(QgsSingleGeometryCheckError *singleError, const QgsGeometryCheckerUtils::LayerFeature &layerFeature)
Creates a new error for a QgsSingleGeometryCheck.
bool handleChanges(const QgsGeometryCheck::Changes &changes) override
Apply a list of changes.
QgsSingleGeometryCheckError * singleError() const
The underlying single error.
QgsGeometryCheckError(const QgsGeometryCheck *check, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, const QgsPointXY &errorLocation, QgsVertexId vidx=QgsVertexId(), const QVariant &value=QVariant(), ValueType valueType=ValueOther)
Create a new geometry check error with the parent check and for the layerFeature pair at the errorLoc...
const QgsGeometryCheckError & operator=(const QgsGeometryCheckError &)=delete
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
Result
Result of the geometry checker operation.
QgsGeometryCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration)
Create a new geometry check.
const QgsGeometryCheckContext * context() const
Returns the context.
A layer feature combination to uniquely identify and access a feature in a set of layers.
Contains utilities required for geometry checks.
A geometry is the spatial representation of a feature.
An error from a QgsSingleGeometryCheck.
virtual ~QgsSingleGeometryCheckError()=default
QgsGeometry errorLocation() const
The exact location of the error.
const QgsSingleGeometryCheck * mCheck
virtual bool isEqual(const QgsSingleGeometryCheckError *other) const
Check if this error is equal to other.
virtual QString description() const
A human readable description of this error.
QgsSingleGeometryCheckError(const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, const QgsVertexId &vertexId=QgsVertexId())
Creates a new single geometry check error.
virtual bool handleChanges(const QList< QgsGeometryCheck::Change > &changes)
Apply a list of changes.
const QgsSingleGeometryCheck * check() const
The check that created this error.
QgsVertexId vertexId() const
The vertex id of the error.
virtual void update(const QgsSingleGeometryCheckError *other)
Update this error with the information from other.
Base class for geometry checks for a single geometry without any context of the layer or other layers...
QgsSingleGeometryCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration)
Creates a new single geometry check.
virtual QList< QgsSingleGeometryCheckError * > processGeometry(const QgsGeometry &geometry) const =0
Check the geometry for errors.
#define SIP_SKIP
Definition qgis_sip.h:134
void CPL_STDCALL collectErrors(CPLErr, int, const char *msg)
A list of layers and feature ids for each of these layers.
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30