QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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
6  email : [email protected]
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 
26 class QgsPointXY;
27 
35 class ANALYSIS_EXPORT QgsGeometryCheckError
36 {
37  public:
38 
42  enum Status
43  {
47  StatusObsolete
48  };
49 
53  enum ValueType
54  {
57  ValueOther
58  };
59 
67  const QgsGeometryCheckerUtils::LayerFeature &layerFeature,
68  const QgsPointXY &errorLocation,
69  QgsVertexId vidx = QgsVertexId(),
70  const QVariant &value = QVariant(),
71  ValueType valueType = ValueOther );
72 
73  virtual ~QgsGeometryCheckError() = default;
74 
75  const QgsGeometryCheckError &operator=( const QgsGeometryCheckError & ) = delete;
76 
80  const QgsGeometryCheck *check() const { return mCheck; }
81 
85  const QString &layerId() const { return mLayerId; }
86 
90  QgsFeatureId featureId() const { return mFeatureId; }
91 
95  QgsGeometry geometry() const;
96 
100  virtual QgsRectangle affectedAreaBBox() const;
101 
106  virtual QString description() const { return mCheck->description(); }
107 
111  const QgsPointXY &location() const { return mErrorLocation; }
112 
118  QVariant value() const { return mValue; }
119 
124  ValueType valueType() const { return mValueType; }
125 
130  const QgsVertexId &vidx() const { return mVidx; }
131 
135  Status status() const { return mStatus; }
136 
140  QString resolutionMessage() const { return mResolutionMessage; }
141 
146  void setFixed( int method );
147 
151  void setFixFailed( const QString &reason );
152 
156  void setObsolete() { mStatus = StatusObsolete; }
157 
163  virtual bool isEqual( QgsGeometryCheckError *other ) const;
164 
169  virtual bool closeMatch( QgsGeometryCheckError * /*other*/ ) const;
170 
175  virtual void update( const QgsGeometryCheckError *other );
176 
180  virtual bool handleChanges( const QgsGeometryCheck::Changes &changes ) SIP_SKIP;
181 
189  virtual QMap<QString, QgsFeatureIds > involvedFeatures() const SIP_SKIP;
190 
196  virtual QIcon icon() const;
197  protected:
198 
208  const QString &layerId,
209  QgsFeatureId featureId,
210  const QgsGeometry &geometry,
211  const QgsPointXY &errorLocation,
212  QgsVertexId vidx = QgsVertexId(),
213  const QVariant &value = QVariant(),
214  ValueType valueType = ValueOther );
215 
216  const QgsGeometryCheck *mCheck = nullptr;
217  QString mLayerId;
222  QVariant mValue;
226 
227 };
228 
230 
231 #endif // QGSGEOMETRYCHECKERROR_H
A rectangle specified with double values.
Definition: qgsrectangle.h:41
The error is detected and pending to be handled.
Status
The status of an error.
A class to represent a 2D point.
Definition: qgspointxy.h:43
const QgsPointXY & location() const
The location of the error in map units.
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
ValueType
Describes the type of an error value.
void setObsolete()
Set the error status to obsolete.
const QgsGeometryCheck * check() const
The geometry check that created this error.
Utility class for identifying a unique vertex within a geometry.
#define SIP_SKIP
Definition: qgis_sip.h:119
A layer feature combination to uniquely identify and access a feature in a set of layers...
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
This class implements a geometry check.
QString resolutionMessage() const
A message with details, how the error has been resolved.
const QString & layerId() const
The id of the layer on which this error has been detected.
Status status() const
The status of the error.
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
A fix has been tried on the error but failed.
virtual QString description() const
The error description.
QgsFeatureId featureId() const
The id of the feature on which this error has been detected.
This represents an error reported by a geometry check.
QVariant value() const
An additional value for the error.
ValueType valueType() const
The type of the value.
const QgsVertexId & vidx() const
The id of the affected vertex.