QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsgeometrymissingvertexcheck.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometrymissingvertexcheck.h
3  ---------------------
4  begin : September 2018
5  copyright : (C) 2018 Matthias Kuhn
6  email : [email protected]
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 #define SIP_NO_FILE
17 
18 #ifndef QGSGEOMETRYMISSINGVERTEXCHECK_H
19 #define QGSGEOMETRYMISSINGVERTEXCHECK_H
20 
21 #include "qgsgeometrycheck.h"
22 #include "qgsgeometrycheckerror.h"
23 
24 class QgsCurvePolygon;
25 
38 {
39  public:
40 
45  const QgsGeometryCheckerUtils::LayerFeature &layerFeature,
46  const QgsPointXY &errorLocation,
47  QgsVertexId vidx = QgsVertexId(),
48  const QVariant &value = QVariant(),
49  ValueType valueType = ValueOther );
50 
51  QgsRectangle affectedAreaBBox() const override;
52 
58  void setAffectedAreaBBox( const QgsRectangle &affectedAreaBBox );
59 
60  QMap<QString, QgsFeatureIds> involvedFeatures() const override;
61 
68  void setInvolvedFeatures( const QMap<QString, QgsFeatureIds> &involvedFeatures );
69 
70  QIcon icon() const override;
71 
72  private:
73  QgsRectangle mAffectedAreaBBox;
74  QMap<QString, QgsFeatureIds> mInvolvedFeatures;
75 };
76 
87 class ANALYSIS_EXPORT QgsGeometryMissingVertexCheck : public QgsGeometryCheck
88 {
89  Q_DECLARE_TR_FUNCTIONS( QgsGeometryMissingVertexCheck )
90 
91  public:
92 
97  {
99  AddMissingVertex
100  };
101  Q_ENUM( ResolutionMethod )
102 
103 
106  explicit QgsGeometryMissingVertexCheck( const QgsGeometryCheckContext *context, const QVariantMap &geometryCheckConfiguration );
107  void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
108  void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
109  Q_DECL_DEPRECATED QStringList resolutionMethods() const override;
110 
111  QString description() const override;
112  QString id() const override;
113  QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override;
114  QgsGeometryCheck::Flags flags() const override;
115  QgsGeometryCheck::CheckType checkType() const override;
116 
118  static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() SIP_SKIP;
119  static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP;
120  static QString factoryDescription() SIP_SKIP;
121  static QString factoryId() SIP_SKIP;
122  static QgsGeometryCheck::Flags factoryFlags() SIP_SKIP;
123  static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
125 
126  private:
127  void processPolygon( const QgsCurvePolygon *polygon, QgsFeaturePool *featurePool, QList<QgsGeometryCheckError *> &errors, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, QgsFeedback *feedback ) const;
128 
129  QgsRectangle contextBoundingBox( const QgsCurvePolygon *polygon, const QgsVertexId &vertexId, const QgsPoint &point ) const;
130 };
131 
132 
133 
134 #endif // QGSGEOMETRYMISSINGVERTEXCHECK_H
Curve polygon geometry type.
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:45
Base configuration for geometry checks.
This represents an error reported by a geometry check.
ValueType
Describes the type of an error value.
virtual QMap< QString, QgsFeatureIds > involvedFeatures() const
Returns a list of involved features.
virtual QString description() const
The error description.
virtual QgsRectangle affectedAreaBBox() const
The bounding box of the affected area of the error.
virtual QIcon icon() const
Returns an icon that should be shown for this kind of error.
This class implements a geometry check.
CheckType
The type of a check.
A layer feature combination to uniquely identify and access a feature in a set of layers.
Contains utilities required for geometry checks.
A geometry check error for a missing vertex.
A topology check for missing vertices.
ResolutionMethod
The available resolutions for missing vertex check.
A class to represent a 2D point.
Definition: qgspointxy.h:59
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Represents a vector layer which manages a vector based data sets.
#define SIP_SKIP
Definition: qgis_sip.h:126
Utility class for identifying a unique vertex within a geometry.