QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsgeometrycheckerror.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgeometrycheckerror.h
3 --------
4 begin : September 2018
5 copyright : (C) 2018 by Denis Rouzaud
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSGEOMETRYCHECKERROR_H
19#define QGSGEOMETRYCHECKERROR_H
20
21#include "qgis_analysis.h"
22
23#include "qgsgeometrycheck.h"
25
26class QgsPointXY;
27
35class ANALYSIS_EXPORT QgsGeometryCheckError
36{
37 public:
48
53 {
56 ValueOther
57 };
58
65 QgsGeometryCheckError( const QgsGeometryCheck *check, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, const QgsPointXY &errorLocation, QgsVertexId vidx = QgsVertexId(), const QVariant &value = QVariant(), ValueType valueType = ValueOther );
66
67 virtual ~QgsGeometryCheckError() = default;
68
70
74 const QgsGeometryCheck *check() const { return mCheck; }
75
79 const QString &layerId() const { return mLayerId; }
80
84 QgsFeatureId featureId() const { return mFeatureId; }
85
89 QgsGeometry geometry() const;
90
99 virtual QgsRectangle contextBoundingBox() const;
100
104 virtual QgsRectangle affectedAreaBBox() const;
105
110 virtual QString description() const { return mCheck->description(); }
111
115 const QgsPointXY &location() const { return mErrorLocation; }
116
122 QVariant value() const { return mValue; }
123
128 ValueType valueType() const { return mValueType; }
129
134 const QgsVertexId &vidx() const { return mVidx; }
135
139 Status status() const { return mStatus; }
140
144 QString resolutionMessage() const { return mResolutionMessage; }
145
150 void setFixed( int method );
151
155 void setFixFailed( const QString &reason );
156
160 void setObsolete() { mStatus = StatusObsolete; }
161
167 virtual bool isEqual( QgsGeometryCheckError *other ) const;
168
173 virtual bool closeMatch( QgsGeometryCheckError * /*other*/ ) const;
174
179 virtual void update( const QgsGeometryCheckError *other );
180
184 virtual bool handleChanges( const QgsGeometryCheck::Changes &changes ) SIP_SKIP;
185
193 virtual QMap<QString, QgsFeatureIds> involvedFeatures() const SIP_SKIP;
194
200 virtual QIcon icon() const;
201
202 protected:
211 QgsGeometryCheckError( const QgsGeometryCheck *check, const QString &layerId, QgsFeatureId featureId, const QgsGeometry &geometry, const QgsPointXY &errorLocation, QgsVertexId vidx = QgsVertexId(), const QVariant &value = QVariant(), ValueType valueType = ValueOther );
212
213 const QgsGeometryCheck *mCheck = nullptr;
214 QString mLayerId;
215 QgsFeatureId mFeatureId;
216 QgsGeometry mGeometry;
217 QgsPointXY mErrorLocation;
219 QVariant mValue;
220 ValueType mValueType;
221 Status mStatus;
222 QString mResolutionMessage;
223
224 private:
225#ifdef SIP_RUN
226 const QgsGeometryCheckError &operator=( const QgsGeometryCheckError & );
227#endif
228};
229
231
232#endif // QGSGEOMETRYCHECKERROR_H
This represents an error reported by a geometry check.
ValueType
Describes the type of an error value.
@ ValueArea
The value is an area.
@ ValueLength
The value is a length.
Status
The status of an error.
@ StatusPending
The error is detected and pending to be handled.
@ StatusFixed
The error is fixed.
@ StatusFixFailed
A fix has been tried on the error but failed.
Status status() const
The status of the error.
QString resolutionMessage() const
A message with details, how the error has been resolved.
const QgsVertexId & vidx() const
The id of the affected vertex.
QgsFeatureId featureId() const
The id of the feature on which this error has been detected.
virtual ~QgsGeometryCheckError()=default
virtual QString description() const
The error description.
ValueType valueType() const
The type of the value.
QVariant value() const
An additional value for the error.
void setObsolete()
Set the error status to obsolete.
const QgsGeometryCheck * check() const
The geometry check that created this error.
const QString & layerId() const
The id of the layer on which this error has been detected.
const QgsGeometryCheckError & operator=(const QgsGeometryCheckError &)=delete
const QgsPointXY & location() const
The location of the error in map units.
This class implements a geometry check.
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
A layer feature combination to uniquely identify and access a feature in a set of layers.
A geometry is the spatial representation of a feature.
A class to represent a 2D point.
Definition qgspointxy.h:60
A rectangle specified with double values.
#define SIP_SKIP
Definition qgis_sip.h:126
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30