QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
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"
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
93class ANALYSIS_EXPORT QgsGeometryOverlapCheck : public QgsGeometryCheck
94{
95 Q_DECLARE_TR_FUNCTIONS( QgsGeometryOverlapCheck )
96 public:
97
102 {
104 NoChange
105 };
106
115 QgsGeometryOverlapCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration );
116 QList<Qgis::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
117 void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
118 void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
119 Q_DECL_DEPRECATED QStringList resolutionMethods() const override;
120
121 QString description() const override;
122 QString id() const override;
123 QgsGeometryCheck::Flags flags() const override;
124 QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
125
127 static QString factoryDescription() SIP_SKIP;
128 static QString factoryId() SIP_SKIP;
129 static QgsGeometryCheck::Flags factoryFlags() SIP_SKIP;
130 static QList<Qgis::GeometryType> factoryCompatibleGeometryTypes() SIP_SKIP;
131 static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP;
132 static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
134
135 private:
136 const double mOverlapThresholdMapUnits;
137
138};
139
140#endif // QGS_GEOMETRY_OVERLAP_CHECK_H
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:54
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.
virtual QMap< QString, QgsFeatureIds > involvedFeatures() const
Returns a list of involved features.
virtual QString description() const
The error description.
virtual bool isEqual(QgsGeometryCheckError *other) const
Check if this error is equal to other.
virtual bool closeMatch(QgsGeometryCheckError *) const
Check if this error is almost equal to other.
virtual QIcon icon() const
Returns an icon that should be shown for this kind of error.
virtual bool handleChanges(const QgsGeometryCheck::Changes &changes)
Apply a list of changes.
This class implements a geometry check.
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
CheckType
The type of a check.
A layer feature combination to uniquely identify and access a feature in a set of layers.
An error of a QgsGeometryOverlapCheck.
const OverlappedFeature & overlappedFeature() const
Returns the overlapped feature.
Checks if geometries overlap.
ResolutionMethod
Available resolution methods.
@ Subtract
Subtract the overlap region from the polygon.
QList< Qgis::GeometryType > compatibleGeometryTypes() const override
A list of geometry types for which this check can be performed.
QgsGeometryCheck::CheckType checkType() const override
Returns the check type.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:164
A class to represent a 2D point.
Definition: qgspointxy.h:59
Represents a vector layer which manages a vector based data sets.
#define SIP_SKIP
Definition: qgis_sip.h:126
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition: qgsfeatureid.h:28
OverlappedFeature(QgsVectorLayer *vl, QgsFeatureId fid)
bool operator==(const OverlappedFeature &other) const