QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsgeometryoverlapcheck.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometryoverlapcheck.h
3  ---------------------
4  begin : September 2015
5  copyright : (C) 2014 by Sandro Mani / Sourcepole AG
6  email : smani at sourcepole dot ch
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 QGS_GEOMETRY_OVERLAP_CHECK_H
19 #define QGS_GEOMETRY_OVERLAP_CHECK_H
20 
21 #include "qgsgeometrycheck.h"
22 #include "qgsgeometrycheckerror.h"
23 
31 {
32  public:
33 
35  {
36  public:
38  : mLayerId( vl->id() )
39  , mLayerName( vl->name() )
40  , mFeatureId( fid )
41  {}
42 
43  QString layerId() const {return mLayerId;}
44  QString layerName() const {return mLayerName;}
45  QgsFeatureId featureId() const {return mFeatureId;}
46  bool operator==( const OverlappedFeature &other ) const {return mLayerId == other.layerId() && mFeatureId == other.featureId();}
47 
48  private:
49  QString mLayerId;
50  QString mLayerName;
51  QgsFeatureId mFeatureId;
52  };
53 
61  const QgsGeometryCheckerUtils::LayerFeature &layerFeature,
62  const QgsGeometry &geometry,
63  const QgsPointXY &errorLocation,
64  const QVariant &value,
65  const QgsGeometryCheckerUtils::LayerFeature &overlappedFeature );
66 
70  const OverlappedFeature &overlappedFeature() const { return mOverlappedFeature; }
71 
72  bool isEqual( QgsGeometryCheckError *other ) const override;
73 
74  bool closeMatch( QgsGeometryCheckError *other ) const override;
75 
76  bool handleChanges( const QgsGeometryCheck::Changes &changes ) override;
77 
78  QString description() const override;
79 
80  QMap<QString, QgsFeatureIds > involvedFeatures() const override;
81  QIcon icon() const override;
82 
83  private:
84  OverlappedFeature mOverlappedFeature;
85 };
86 
93 class ANALYSIS_EXPORT QgsGeometryOverlapCheck : public QgsGeometryCheck
94 {
95  public:
96 
101  {
103  NoChange
104  };
105 
114  QgsGeometryOverlapCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration );
115  QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
116  void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
117  void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
118  QStringList resolutionMethods() const override;
119 
120  QString description() const override;
121  QString id() const override;
122  QgsGeometryCheck::Flags flags() const override;
123  QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
124 
126  static QString factoryDescription() SIP_SKIP;
127  static QString factoryId() SIP_SKIP;
128  static QgsGeometryCheck::Flags factoryFlags() SIP_SKIP;
129  static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() SIP_SKIP;
130  static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP;
131  static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
133 
134  private:
135  const double mOverlapThresholdMapUnits;
136 
137 };
138 
139 #endif // QGS_GEOMETRY_OVERLAP_CHECK_H
Subtract the overlap region from the polygon.
Checks if geometries overlap.
A class to represent a 2D point.
Definition: qgspointxy.h:43
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25
CheckType
The type of a check.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const override
A list of geometry types for which this check can be performed.
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.
An error of a QgsGeometryOverlapCheck.
#define SIP_SKIP
Definition: qgis_sip.h:119
const OverlappedFeature & overlappedFeature() const
Returns the overlapped feature.
A layer feature combination to uniquely identify and access a feature in a set of layers...
This class implements a geometry check.
A list of layers and feature ids for each of these layers.
QgsGeometryCheck::CheckType checkType() const override
Returns the check type.
bool operator==(const OverlappedFeature &other) const
ResolutionMethod
Available resolution methods.
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
This represents an error reported by a geometry check.
OverlappedFeature(QgsVectorLayer *vl, QgsFeatureId fid)
Represents a vector layer which manages a vector based data sets.