QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsgeometryoverlapcheck.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometryoverlapcheck.cpp
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 
17 #include "qgsgeometryengine.h"
19 #include "qgsfeaturepool.h"
20 #include "qgsvectorlayer.h"
21 #include "qgsfeedback.h"
22 #include "qgsapplication.h"
23 
24 QgsGeometryOverlapCheck::QgsGeometryOverlapCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration )
25  : QgsGeometryCheck( context, configuration )
26  , mOverlapThresholdMapUnits( configurationValue<double>( QStringLiteral( "maxOverlapArea" ) ) )
27 
28 {
29 
30 }
31 
32 void QgsGeometryOverlapCheck::collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids ) const
33 {
34  const QMap<QString, QgsFeatureIds> featureIds = ids.isEmpty() ? allLayerFeatureIds( featurePools ) : ids.toMap();
35  const QgsGeometryCheckerUtils::LayerFeatures layerFeaturesA( featurePools, featureIds, compatibleGeometryTypes(), feedback, mContext, true );
36  QList<QString> layerIds = featureIds.keys();
37  for ( const QgsGeometryCheckerUtils::LayerFeature &layerFeatureA : layerFeaturesA )
38  {
39  if ( feedback && feedback->isCanceled() )
40  break;
41 
42  // Ensure each pair of layers only gets compared once: remove the current layer from the layerIds, but add it to the layerList for layerFeaturesB
43  layerIds.removeOne( layerFeatureA.layer()->id() );
44 
45  const QgsGeometry geomA = layerFeatureA.geometry();
46  const QgsRectangle bboxA = geomA.boundingBox();
47  std::unique_ptr< QgsGeometryEngine > geomEngineA = QgsGeometryCheckerUtils::createGeomEngine( geomA.constGet(), mContext->tolerance );
48  geomEngineA->prepareGeometry();
49  if ( !geomEngineA->isValid() )
50  {
51  messages.append( tr( "Overlap check failed for (%1): the geometry is invalid" ).arg( layerFeatureA.id() ) );
52  continue;
53  }
54 
55  const QgsGeometryCheckerUtils::LayerFeatures layerFeaturesB( featurePools, QList<QString>() << layerFeatureA.layer()->id() << layerIds, bboxA, compatibleGeometryTypes(), mContext );
56  for ( const QgsGeometryCheckerUtils::LayerFeature &layerFeatureB : layerFeaturesB )
57  {
58  if ( feedback && feedback->isCanceled() )
59  break;
60 
61  // > : only report overlaps within same layer once
62  if ( layerFeatureA.layerId() == layerFeatureB.layerId() && layerFeatureB.feature().id() >= layerFeatureA.feature().id() )
63  {
64  continue;
65  }
66 
67  QString errMsg;
68  const QgsGeometry geometryB = layerFeatureB.geometry();
69  const QgsAbstractGeometry *geomB = geometryB.constGet();
70  if ( geomEngineA->overlaps( geomB, &errMsg ) )
71  {
72  std::unique_ptr<QgsAbstractGeometry> interGeom( geomEngineA->intersection( geomB ) );
73  if ( interGeom && !interGeom->isEmpty() )
74  {
75  QgsGeometryCheckerUtils::filter1DTypes( interGeom.get() );
76  for ( int iPart = 0, nParts = interGeom->partCount(); iPart < nParts; ++iPart )
77  {
78  QgsAbstractGeometry *interPart = QgsGeometryCheckerUtils::getGeomPart( interGeom.get(), iPart );
79  const double area = interPart->area();
80  if ( area > mContext->reducedTolerance && ( area < mOverlapThresholdMapUnits || mOverlapThresholdMapUnits == 0.0 ) )
81  {
82  errors.append( new QgsGeometryOverlapCheckError( this, layerFeatureA, QgsGeometry( interPart->clone() ), interPart->centroid(), area, layerFeatureB ) );
83  }
84  }
85  }
86  else if ( !errMsg.isEmpty() )
87  {
88  messages.append( tr( "Overlap check between features %1 and %2 %3" ).arg( layerFeatureA.id(), layerFeatureB.id(), errMsg ) );
89  }
90  }
91  }
92  }
93 }
94 
95 void QgsGeometryOverlapCheck::fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> & /*mergeAttributeIndices*/, Changes &changes ) const
96 {
97  QString errMsg;
98  QgsGeometryOverlapCheckError *overlapError = static_cast<QgsGeometryOverlapCheckError *>( error );
99 
100  QgsFeaturePool *featurePoolA = featurePools[ overlapError->layerId() ];
101  QgsFeaturePool *featurePoolB = featurePools[ overlapError->overlappedFeature().layerId() ];
102  QgsFeature featureA;
103  QgsFeature featureB;
104  if ( !featurePoolA->getFeature( overlapError->featureId(), featureA ) ||
105  !featurePoolB->getFeature( overlapError->overlappedFeature().featureId(), featureB ) )
106  {
107  error->setObsolete();
108  return;
109  }
110 
111  // Check if error still applies
112  const QgsGeometryCheckerUtils::LayerFeature layerFeatureA( featurePoolA, featureA, mContext, true );
113  const QgsGeometryCheckerUtils::LayerFeature layerFeatureB( featurePoolB, featureB, mContext, true );
114  const QgsGeometry geometryA = layerFeatureA.geometry();
115  std::unique_ptr< QgsGeometryEngine > geomEngineA = QgsGeometryCheckerUtils::createGeomEngine( geometryA.constGet(), mContext->tolerance );
116  geomEngineA->prepareGeometry();
117 
118  const QgsGeometry geometryB = layerFeatureB.geometry();
119  if ( !geomEngineA->overlaps( geometryB.constGet() ) )
120  {
121  error->setObsolete();
122  return;
123  }
124  std::unique_ptr< QgsAbstractGeometry > interGeom( geomEngineA->intersection( geometryB.constGet(), &errMsg ) );
125  if ( !interGeom )
126  {
127  error->setFixFailed( tr( "Failed to compute intersection between overlapping features: %1" ).arg( errMsg ) );
128  return;
129  }
130 
131  // Search which overlap part this error parametrizes (using fuzzy-matching of the area and centroid...)
132  QgsAbstractGeometry *interPart = nullptr;
133  for ( int iPart = 0, nParts = interGeom->partCount(); iPart < nParts; ++iPart )
134  {
135  QgsAbstractGeometry *part = QgsGeometryCheckerUtils::getGeomPart( interGeom.get(), iPart );
136  if ( std::fabs( part->area() - overlapError->value().toDouble() ) < mContext->reducedTolerance &&
138  {
139  interPart = part;
140  break;
141  }
142  }
143  if ( !interPart || interPart->isEmpty() )
144  {
145  error->setObsolete();
146  return;
147  }
148 
149  // Fix error
150  if ( method == NoChange )
151  {
152  error->setFixed( method );
153  }
154  else if ( method == Subtract )
155  {
156  std::unique_ptr< QgsGeometryEngine > geomEngineDiffA = QgsGeometryCheckerUtils::createGeomEngine( geometryA.constGet(), 0 );
157  std::unique_ptr< QgsAbstractGeometry > diff1( geomEngineDiffA->difference( interPart, &errMsg ) );
158  if ( !diff1 || diff1->isEmpty() )
159  {
160  diff1.reset();
161  }
162  else
163  {
165  }
166  std::unique_ptr< QgsGeometryEngine > geomEngineDiffB = QgsGeometryCheckerUtils::createGeomEngine( geometryB.constGet(), 0 );
167  std::unique_ptr< QgsAbstractGeometry > diff2( geomEngineDiffB->difference( interPart, &errMsg ) );
168  if ( !diff2 || diff2->isEmpty() )
169  {
170  diff2.reset();
171  }
172  else
173  {
175  }
176  const double shared1 = diff1 ? QgsGeometryCheckerUtils::sharedEdgeLength( diff1.get(), interPart, mContext->reducedTolerance ) : 0;
177  const double shared2 = diff2 ? QgsGeometryCheckerUtils::sharedEdgeLength( diff2.get(), interPart, mContext->reducedTolerance ) : 0;
178  if ( !diff1 || !diff2 || shared1 == 0. || shared2 == 0. )
179  {
180  error->setFixFailed( tr( "Could not find shared edges between intersection and overlapping features" ) );
181  }
182  else
183  {
184  if ( shared1 < shared2 )
185  {
186  const QgsCoordinateTransform ct( featurePoolA->crs(), mContext->mapCrs, mContext->transformContext );
187  diff1->transform( ct, Qgis::TransformDirection::Reverse );
188  featureA.setGeometry( QgsGeometry( std::move( diff1 ) ) );
189 
190  changes[error->layerId()][featureA.id()].append( Change( ChangeFeature, ChangeChanged ) );
191  featurePoolA->updateFeature( featureA );
192  }
193  else
194  {
195  const QgsCoordinateTransform ct( featurePoolB->crs(), mContext->mapCrs, mContext->transformContext );
196  diff2->transform( ct, Qgis::TransformDirection::Reverse );
197  featureB.setGeometry( QgsGeometry( std::move( diff2 ) ) );
198 
199  changes[overlapError->overlappedFeature().layerId()][featureB.id()].append( Change( ChangeFeature, ChangeChanged ) );
200  featurePoolB->updateFeature( featureB );
201  }
202 
203  error->setFixed( method );
204  }
205  }
206  else
207  {
208  error->setFixFailed( tr( "Unknown method" ) );
209  }
210 }
211 
213 {
214  static const QStringList methods = QStringList()
215  << tr( "Remove overlapping area from neighboring polygon with shortest shared edge" )
216  << tr( "No action" );
217  return methods;
218 }
219 
221 {
222  return factoryDescription();
223 }
224 
226 {
227  return factoryId();
228 }
229 
230 QgsGeometryCheck::Flags QgsGeometryOverlapCheck::flags() const
231 {
232  return factoryFlags();
233 }
234 
236 QString QgsGeometryOverlapCheck::factoryDescription()
237 {
238  return tr( "Overlap" );
239 }
240 
241 QgsGeometryCheck::CheckType QgsGeometryOverlapCheck::factoryCheckType()
242 {
244 }
245 
246 QString QgsGeometryOverlapCheck::factoryId()
247 {
248  return QStringLiteral( "QgsGeometryOverlapCheck" );
249 }
250 
251 QgsGeometryCheck::Flags QgsGeometryOverlapCheck::factoryFlags()
252 {
254 }
255 
256 QList<QgsWkbTypes::GeometryType> QgsGeometryOverlapCheck::factoryCompatibleGeometryTypes()
257 {
259 }
260 
261 bool QgsGeometryOverlapCheck::factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP
262 {
263  return factoryCompatibleGeometryTypes().contains( layer->geometryType() );
264 }
265 
267 QgsGeometryOverlapCheckError::QgsGeometryOverlapCheckError( const QgsGeometryCheck *check, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, const QgsGeometry &geometry, const QgsPointXY &errorLocation, const QVariant &value, const QgsGeometryCheckerUtils::LayerFeature &overlappedFeature )
268  : QgsGeometryCheckError( check, layerFeature.layer()->id(), layerFeature.feature().id(), geometry, errorLocation, QgsVertexId(), value, ValueArea )
269  , mOverlappedFeature( OverlappedFeature( overlappedFeature.layer(), overlappedFeature.feature().id() ) )
270 {
271 
272 }
273 
275 {
276  QgsGeometryOverlapCheckError *err = dynamic_cast<QgsGeometryOverlapCheckError *>( other );
277  return err &&
278  other->layerId() == layerId() &&
279  other->featureId() == featureId() &&
280  err->overlappedFeature() == overlappedFeature() &&
282  std::fabs( value().toDouble() - other->value().toDouble() ) < mCheck->context()->reducedTolerance;
283 }
284 
286 {
287  QgsGeometryOverlapCheckError *err = dynamic_cast<QgsGeometryOverlapCheckError *>( other );
288  return err && other->layerId() == layerId() && other->featureId() == featureId() && err->overlappedFeature() == overlappedFeature();
289 }
290 
292 {
293  if ( !QgsGeometryCheckError::handleChanges( changes ) )
294  {
295  return false;
296  }
297  if ( changes.value( mOverlappedFeature.layerId() ).contains( mOverlappedFeature.featureId() ) )
298  {
299  return false;
300  }
301  return true;
302 }
303 
305 {
306  return QCoreApplication::translate( "QgsGeometryTypeCheckError", "Overlap with %1 at feature %2" ).arg( mOverlappedFeature.layerName(), QString::number( mOverlappedFeature.featureId() ) );
307 }
308 
309 QMap<QString, QgsFeatureIds> QgsGeometryOverlapCheckError::involvedFeatures() const
310 {
311  QMap<QString, QgsFeatureIds> features;
312  features[layerId()].insert( featureId() );
313  features[mOverlappedFeature.layerId()].insert( mOverlappedFeature.featureId() );
314  return features;
315 }
316 
318 {
319 
321  return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) );
322  else
323  return QgsApplication::getThemeIcon( QStringLiteral( "/checks/Overlap.svg" ) );
324 }
QgsGeometryCheckError::value
QVariant value() const
An additional value for the error.
Definition: qgsgeometrycheckerror.h:128
QgsGeometryCheckError::setFixFailed
void setFixFailed(const QString &reason)
Set the error status to failed and specify the reason for failure.
Definition: qgsgeometrycheckerror.cpp:109
QgsGeometryOverlapCheckError::icon
QIcon icon() const override
Returns an icon that should be shown for this kind of error.
Definition: qgsgeometryoverlapcheck.cpp:317
QgsGeometryCheck::Change
Descripts a change to fix a geometry.
Definition: qgsgeometrycheck.h:176
QgsGeometryOverlapCheck::Subtract
@ Subtract
Subtract the overlap region from the polygon.
Definition: qgsgeometryoverlapcheck.h:103
QgsGeometryCheckerUtils::getGeomPart
static QgsAbstractGeometry * getGeomPart(QgsAbstractGeometry *geom, int partIdx)
Definition: qgsgeometrycheckerutils.cpp:268
QgsGeometryCheck::ChangeFeature
@ ChangeFeature
This change happens on feature level.
Definition: qgsgeometrycheck.h:131
QgsGeometryCheckError::StatusFixed
@ StatusFixed
The error is fixed.
Definition: qgsgeometrycheckerror.h:46
QgsGeometryOverlapCheck::fixError
void fixError(const QMap< QString, QgsFeaturePool * > &featurePools, QgsGeometryCheckError *error, int method, const QMap< QString, int > &mergeAttributeIndices, Changes &changes) const override
Fixes the error error with the specified method.
Definition: qgsgeometryoverlapcheck.cpp:95
QgsGeometryCheckError::setObsolete
void setObsolete()
Set the error status to obsolete.
Definition: qgsgeometrycheckerror.h:166
QgsGeometryOverlapCheckError::handleChanges
bool handleChanges(const QgsGeometryCheck::Changes &changes) override
Apply a list of changes.
Definition: qgsgeometryoverlapcheck.cpp:291
QgsGeometryOverlapCheck::QgsGeometryOverlapCheck
QgsGeometryOverlapCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration)
Checks for overlapping polygons.
Definition: qgsgeometryoverlapcheck.cpp:24
QgsGeometryCheckError::featureId
QgsFeatureId featureId() const
The id of the feature on which this error has been detected.
Definition: qgsgeometrycheckerror.h:90
QgsGeometryCheck::Changes
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
Definition: qgsgeometrycheck.h:220
QgsGeometryCheck::allLayerFeatureIds
QMap< QString, QgsFeatureIds > allLayerFeatureIds(const QMap< QString, QgsFeaturePool * > &featurePools) const
Returns all layers and feature ids.
Definition: qgsgeometrycheck.cpp:82
QgsGeometryCheckerUtils::LayerFeature::geometry
QgsGeometry geometry() const
Returns the geometry of this feature.
Definition: qgsgeometrycheckerutils.cpp:70
QgsGeometryCheck::LayerFeatureIds::isEmpty
bool isEmpty() const
Definition: qgsgeometrycheck.h:117
QgsGeometryOverlapCheckError::OverlappedFeature::layerName
QString layerName() const
Definition: qgsgeometryoverlapcheck.h:44
QgsGeometryOverlapCheck::compatibleGeometryTypes
QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const override
A list of geometry types for which this check can be performed.
Definition: qgsgeometryoverlapcheck.h:116
QgsFeedback::isCanceled
bool isCanceled() const SIP_HOLDGIL
Tells whether the operation has been canceled already.
Definition: qgsfeedback.h:67
QgsGeometryCheck::LayerCheck
@ LayerCheck
The check controls a whole layer (topology checks)
Definition: qgsgeometrycheck.h:158
QgsGeometryOverlapCheck::collectErrors
void collectErrors(const QMap< QString, QgsFeaturePool * > &featurePools, QList< QgsGeometryCheckError * > &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids=LayerFeatureIds()) const override
The main worker method.
Definition: qgsgeometryoverlapcheck.cpp:32
QgsGeometryCheck::context
const QgsGeometryCheckContext * context() const
Returns the context.
Definition: qgsgeometrycheck.h:329
QgsGeometryCheck::ChangeChanged
@ ChangeChanged
Something has been updated.
Definition: qgsgeometrycheck.h:146
QgsFeaturePool::getFeature
bool getFeature(QgsFeatureId id, QgsFeature &feature)
Retrieves the feature with the specified id into feature.
Definition: qgsfeaturepool.cpp:41
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsGeometryOverlapCheck::NoChange
@ NoChange
Do not change anything.
Definition: qgsgeometryoverlapcheck.h:104
QgsWkbTypes::PolygonGeometry
@ PolygonGeometry
Definition: qgswkbtypes.h:144
QgsGeometryOverlapCheckError::QgsGeometryOverlapCheckError
QgsGeometryOverlapCheckError(const QgsGeometryCheck *check, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, const QgsGeometry &geometry, const QgsPointXY &errorLocation, const QVariant &value, const QgsGeometryCheckerUtils::LayerFeature &overlappedFeature)
Creates a new overlap check error for check and the layerFeature combination.
Definition: qgsgeometryoverlapcheck.cpp:267
QgsGeometryCheck::LayerFeatureIds::toMap
QMap< QString, QgsFeatureIds > toMap() const
Definition: qgsgeometrycheck.h:112
qgsfeaturepool.h
QgsGeometryOverlapCheckError::OverlappedFeature::layerId
QString layerId() const
Definition: qgsgeometryoverlapcheck.h:43
qgsapplication.h
QgsGeometryOverlapCheck::resolutionMethods
Q_DECL_DEPRECATED QStringList resolutionMethods() const override
Returns a list of descriptions for available resolutions for errors.
Definition: qgsgeometryoverlapcheck.cpp:212
QgsGeometryCheck
This class implements a geometry check.
Definition: qgsgeometrycheck.h:91
QgsFeature::id
QgsFeatureId id
Definition: qgsfeature.h:68
QgsAbstractGeometry::area
virtual double area() const
Returns the planar, 2-dimensional area of the geometry.
Definition: qgsabstractgeometry.cpp:176
qgsgeometryengine.h
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsGeometryOverlapCheck::flags
QgsGeometryCheck::Flags flags() const override
Flags for this geometry check.
Definition: qgsgeometryoverlapcheck.cpp:230
qgsgeometrycheckcontext.h
QgsGeometryOverlapCheckError::description
QString description() const override
The error description.
Definition: qgsgeometryoverlapcheck.cpp:304
QgsGeometryOverlapCheckError::OverlappedFeature
Definition: qgsgeometryoverlapcheck.h:34
QgsFeature::setGeometry
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
Definition: qgsfeature.cpp:170
QgsGeometryCheckerUtils::sharedEdgeLength
static double sharedEdgeLength(const QgsAbstractGeometry *geom1, const QgsAbstractGeometry *geom2, double tol)
Definition: qgsgeometrycheckerutils.cpp:364
QgsFeaturePool::updateFeature
virtual void updateFeature(QgsFeature &feature)=0
Updates a feature in this pool.
QgsGeometryCheckError::setFixed
void setFixed(int method)
Set the status to fixed and specify the method that has been used to fix the error.
Definition: qgsgeometrycheckerror.cpp:98
QgsGeometryCheckError::handleChanges
virtual bool handleChanges(const QgsGeometryCheck::Changes &changes)
Apply a list of changes.
Definition: qgsgeometrycheckerror.cpp:128
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
QgsGeometryCheckError::location
const QgsPointXY & location() const
The location of the error in map units.
Definition: qgsgeometrycheckerror.h:121
QgsAbstractGeometry::clone
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
QgsGeometryOverlapCheck::description
QString description() const override
Returns a human readable description for this check.
Definition: qgsgeometryoverlapcheck.cpp:220
QgsGeometryCheckContext
Base configuration for geometry checks.
Definition: qgsgeometrycheckcontext.h:31
QgsGeometryCheckContext::mapCrs
const QgsCoordinateReferenceSystem mapCrs
The coordinate system in which calculations should be done.
Definition: qgsgeometrycheckcontext.h:74
QgsGeometryCheckerUtils::LayerFeature
A layer feature combination to uniquely identify and access a feature in a set of layers.
Definition: qgsgeometrycheckerutils.h:51
QgsGeometryCheckError::status
Status status() const
The status of the error.
Definition: qgsgeometrycheckerror.h:145
QgsGeometryOverlapCheckError::involvedFeatures
QMap< QString, QgsFeatureIds > involvedFeatures() const override
Returns a list of involved features.
Definition: qgsgeometryoverlapcheck.cpp:309
QgsGeometryCheckContext::reducedTolerance
const double reducedTolerance
The tolerance to allow for in geometry checks.
Definition: qgsgeometrycheckcontext.h:69
QgsGeometryCheck::LayerFeatureIds
A list of layers and feature ids for each of these layers.
Definition: qgsgeometrycheck.h:104
QgsAbstractGeometry::isEmpty
virtual bool isEmpty() const
Returns true if the geometry is empty.
Definition: qgsabstractgeometry.cpp:378
QgsGeometry::constGet
const QgsAbstractGeometry * constGet() const SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Definition: qgsgeometry.cpp:136
qgsgeometryoverlapcheck.h
QgsFeaturePool::crs
QgsCoordinateReferenceSystem crs() const
The coordinate reference system of this layer.
Definition: qgsfeaturepool.cpp:171
QgsAbstractGeometry
Abstract base class for all geometries.
Definition: qgsabstractgeometry.h:79
QgsGeometryOverlapCheckError
An error of a QgsGeometryOverlapCheck.
Definition: qgsgeometryoverlapcheck.h:30
QgsGeometryCheck::mContext
const QgsGeometryCheckContext * mContext
Definition: qgsgeometrycheck.h:365
QgsGeometryOverlapCheckError::OverlappedFeature::featureId
QgsFeatureId featureId() const
Definition: qgsgeometryoverlapcheck.h:45
qgsvectorlayer.h
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:58
QgsGeometryCheck::AvailableInValidation
@ AvailableInValidation
This geometry check should be available in layer validation on the vector layer peroperties.
Definition: qgsgeometrycheck.h:166
QgsGeometryOverlapCheck::id
QString id() const override
Returns an id for this check.
Definition: qgsgeometryoverlapcheck.cpp:225
QgsGeometryCheckerUtils::filter1DTypes
static void filter1DTypes(QgsAbstractGeometry *geom)
Definition: qgsgeometrycheckerutils.cpp:303
QgsAbstractGeometry::centroid
virtual QgsPoint centroid() const
Returns the centroid of the geometry.
Definition: qgsabstractgeometry.cpp:201
QgsGeometry
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsGeometryCheckerUtils::LayerFeatures
Contains a set of layers and feature ids in those layers to pass to a geometry check.
Definition: qgsgeometrycheckerutils.h:112
QgsGeometryCheck::CheckType
CheckType
The type of a check.
Definition: qgsgeometrycheck.h:154
QgsVertexId
Utility class for identifying a unique vertex within a geometry.
Definition: qgsvertexid.h:30
QgsGeometryCheckContext::tolerance
const double tolerance
The tolerance to allow for in geometry checks.
Definition: qgsgeometrycheckcontext.h:61
QgsGeometryOverlapCheckError::closeMatch
bool closeMatch(QgsGeometryCheckError *other) const override
Check if this error is almost equal to other.
Definition: qgsgeometryoverlapcheck.cpp:285
QgsGeometryCheckError::mCheck
const QgsGeometryCheck * mCheck
Definition: qgsgeometrycheckerror.h:226
QgsGeometryCheckerUtils::createGeomEngine
static std::unique_ptr< QgsGeometryEngine > createGeomEngine(const QgsAbstractGeometry *geometry, double tolerance)
Definition: qgsgeometrycheckerutils.cpp:263
QgsGeometry::boundingBox
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
Definition: qgsgeometry.cpp:1080
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:55
QgsApplication::getThemeIcon
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Definition: qgsapplication.cpp:693
QgsGeometryCheckError::layerId
const QString & layerId() const
The id of the layer on which this error has been detected.
Definition: qgsgeometrycheckerror.h:85
QgsCoordinateTransform
Class for doing transforms between two map coordinate systems.
Definition: qgscoordinatetransform.h:57
qgsfeedback.h
QgsGeometryCheckError
This represents an error reported by a geometry check.
Definition: qgsgeometrycheckerror.h:35
QgsGeometryCheckContext::transformContext
const QgsCoordinateTransformContext transformContext
The coordinate transform context with which transformations will be done.
Definition: qgsgeometrycheckcontext.h:79
QgsFeaturePool
A feature pool is based on a vector layer and caches features.
Definition: qgsfeaturepool.h:37
QgsGeometryOverlapCheckError::overlappedFeature
const OverlappedFeature & overlappedFeature() const
Returns the overlapped feature.
Definition: qgsgeometryoverlapcheck.h:70
QgsGeometryCheckerUtils::pointsFuzzyEqual
static bool pointsFuzzyEqual(const QgsPointXY &p1, const QgsPointXY &p2, double tol)
Determine whether two points are equal up to the specified tolerance.
Definition: qgsgeometrycheckerutils.h:261
QgsGeometryOverlapCheckError::isEqual
bool isEqual(QgsGeometryCheckError *other) const override
Check if this error is equal to other.
Definition: qgsgeometryoverlapcheck.cpp:274