QGIS API Documentation 3.41.0-Master (d5b93354e9c)
Loading...
Searching...
No Matches
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:
34 {
35 public:
37 : mLayerId( vl->id() )
38 , mLayerName( vl->name() )
39 , mFeatureId( fid )
40 {}
41
42 QString layerId() const { return mLayerId; }
43 QString layerName() const { return mLayerName; }
44 QgsFeatureId featureId() const { return mFeatureId; }
45 bool operator==( const OverlappedFeature &other ) const { return mLayerId == other.layerId() && mFeatureId == other.featureId(); }
46
47 private:
48 QString mLayerId;
49 QString mLayerName;
50 QgsFeatureId mFeatureId;
51 };
52
59 QgsGeometryOverlapCheckError( const QgsGeometryCheck *check, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, const QgsGeometry &geometry, const QgsPointXY &errorLocation, const QVariant &value, const QgsGeometryCheckerUtils::LayerFeature &overlappedFeature );
60
64 const OverlappedFeature &overlappedFeature() const { return mOverlappedFeature; }
65
66 bool isEqual( QgsGeometryCheckError *other ) const override;
67
68 bool closeMatch( QgsGeometryCheckError *other ) const override;
69
70 bool handleChanges( const QgsGeometryCheck::Changes &changes ) override;
71
72 QString description() const override;
73
74 QMap<QString, QgsFeatureIds> involvedFeatures() const override;
75 QIcon icon() const override;
76
77 private:
78 OverlappedFeature mOverlappedFeature;
79};
80
87class ANALYSIS_EXPORT QgsGeometryOverlapCheck : public QgsGeometryCheck
88{
89 Q_DECLARE_TR_FUNCTIONS( QgsGeometryOverlapCheck )
90 public:
95 {
97 NoChange
98 };
99
108 QgsGeometryOverlapCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration );
109 QList<Qgis::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
110 void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
111 void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
112 Q_DECL_DEPRECATED QStringList resolutionMethods() const override;
113
114 QString description() const override;
115 QString id() const override;
116 QgsGeometryCheck::Flags flags() const override;
117 QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
118
120 static QString factoryDescription() SIP_SKIP;
121 static QString factoryId() SIP_SKIP;
122 static QgsGeometryCheck::Flags factoryFlags() SIP_SKIP;
123 static QList<Qgis::GeometryType> factoryCompatibleGeometryTypes() SIP_SKIP;
124 static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP;
125 static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
127
128 private:
129 const double mOverlapThresholdMapUnits;
130};
131
132#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:44
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.
QFlags< Flag > Flags
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.
A class to represent a 2D point.
Definition qgspointxy.h:60
Represents a vector layer which manages a vector based data sets.
#define SIP_SKIP
Definition qgis_sip.h:126
void CPL_STDCALL collectErrors(CPLErr, int, const char *msg)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
OverlappedFeature(QgsVectorLayer *vl, QgsFeatureId fid)
bool operator==(const OverlappedFeature &other) const