QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgsgeometrygapcheck.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometrygapcheck.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"
18 #include "qgsgeometrygapcheck.h"
19 #include "qgsgeometrycollection.h"
20 #include "qgsfeaturepool.h"
21 #include "qgsvectorlayer.h"
22 #include "qgsvectorlayerutils.h"
23 #include "qgsfeedback.h"
24 #include "qgsapplication.h"
25 #include "qgsproject.h"
26 
27 #include "geos_c.h"
28 
29 QgsGeometryGapCheck::QgsGeometryGapCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration )
30  : QgsGeometryCheck( context, configuration )
31  , mGapThresholdMapUnits( configuration.value( QStringLiteral( "gapThreshold" ) ).toDouble() )
32 {
33 }
34 
35 void QgsGeometryGapCheck::prepare( const QgsGeometryCheckContext *context, const QVariantMap &configuration )
36 {
37  if ( configuration.value( QStringLiteral( "allowedGapsEnabled" ) ).toBool() )
38  {
39  QgsVectorLayer *layer = context->project()->mapLayer<QgsVectorLayer *>( configuration.value( "allowedGapsLayer" ).toString() );
40  if ( layer )
41  {
42  mAllowedGapsLayer = layer;
43  mAllowedGapsSource = qgis::make_unique<QgsVectorLayerFeatureSource>( layer );
44 
45  mAllowedGapsBuffer = configuration.value( QStringLiteral( "allowedGapsBuffer" ) ).toDouble();
46  }
47  }
48  else
49  {
50  mAllowedGapsSource.reset();
51  }
52 }
53 
54 void QgsGeometryGapCheck::collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids ) const
55 {
56  if ( feedback )
57  feedback->setProgress( feedback->progress() + 1.0 );
58 
59  std::unique_ptr<QgsAbstractGeometry> allowedGapsGeom;
60  std::unique_ptr<QgsGeometryEngine> allowedGapsGeomEngine;
61 
62  if ( mAllowedGapsSource )
63  {
64  QVector<QgsGeometry> allowedGaps;
65  QgsFeatureRequest request;
67  QgsFeatureIterator iterator = mAllowedGapsSource->getFeatures( request );
68  QgsFeature feature;
69 
70  while ( iterator.nextFeature( feature ) )
71  {
72  QgsGeometry geom = feature.geometry();
73  QgsGeometry gg = geom.buffer( mAllowedGapsBuffer, 20 );
74  allowedGaps.append( gg );
75  }
76 
77  std::unique_ptr< QgsGeometryEngine > allowedGapsEngine = QgsGeometryCheckerUtils::createGeomEngine( nullptr, mContext->tolerance );
78 
79  // Create union of allowed gaps
80  QString errMsg;
81  allowedGapsGeom.reset( allowedGapsEngine->combine( allowedGaps, &errMsg ) );
82  allowedGapsGeomEngine = QgsGeometryCheckerUtils::createGeomEngine( allowedGapsGeom.get(), mContext->tolerance );
83  allowedGapsGeomEngine->prepareGeometry();
84  }
85 
86  QVector<QgsGeometry> geomList;
87  QMap<QString, QgsFeatureIds> featureIds = ids.isEmpty() ? allLayerFeatureIds( featurePools ) : ids.toMap();
88  const QgsGeometryCheckerUtils::LayerFeatures layerFeatures( featurePools, featureIds, compatibleGeometryTypes(), nullptr, mContext, true );
89  for ( const QgsGeometryCheckerUtils::LayerFeature &layerFeature : layerFeatures )
90  {
91  geomList.append( layerFeature.geometry() );
92 
93  if ( feedback && feedback->isCanceled() )
94  {
95  geomList.clear();
96  break;
97  }
98  }
99 
100  if ( geomList.isEmpty() )
101  {
102  return;
103  }
104 
105  std::unique_ptr< QgsGeometryEngine > geomEngine = QgsGeometryCheckerUtils::createGeomEngine( nullptr, mContext->tolerance );
106 
107  // Create union of geometry
108  QString errMsg;
109  std::unique_ptr<QgsAbstractGeometry> unionGeom( geomEngine->combine( geomList, &errMsg ) );
110  if ( !unionGeom )
111  {
112  messages.append( tr( "Gap check: %1" ).arg( errMsg ) );
113  return;
114  }
115 
116  // Get envelope of union
117  geomEngine = QgsGeometryCheckerUtils::createGeomEngine( unionGeom.get(), mContext->tolerance );
118  geomEngine->prepareGeometry();
119  std::unique_ptr<QgsAbstractGeometry> envelope( geomEngine->envelope( &errMsg ) );
120  if ( !envelope )
121  {
122  messages.append( tr( "Gap check: %1" ).arg( errMsg ) );
123  return;
124  }
125 
126  // Buffer envelope
127  geomEngine = QgsGeometryCheckerUtils::createGeomEngine( envelope.get(), mContext->tolerance );
128  geomEngine->prepareGeometry();
129  QgsAbstractGeometry *bufEnvelope = geomEngine->buffer( 2, 0, GEOSBUF_CAP_SQUARE, GEOSBUF_JOIN_MITRE, 4. ); //#spellok //#spellok
130  envelope.reset( bufEnvelope );
131 
132  // Compute difference between envelope and union to obtain gap polygons
133  geomEngine = QgsGeometryCheckerUtils::createGeomEngine( envelope.get(), mContext->tolerance );
134  geomEngine->prepareGeometry();
135  std::unique_ptr<QgsAbstractGeometry> diffGeom( geomEngine->difference( unionGeom.get(), &errMsg ) );
136  if ( !diffGeom )
137  {
138  messages.append( tr( "Gap check: %1" ).arg( errMsg ) );
139  return;
140  }
141 
142  // For each gap polygon which does not lie on the boundary, get neighboring polygons and add error
143  QgsGeometryPartIterator parts = diffGeom->parts();
144  while ( parts.hasNext() )
145  {
146  const QgsAbstractGeometry *gapGeom = parts.next();
147  // Skip the gap between features and boundingbox
148  const double spacing = context()->tolerance;
149  if ( gapGeom->boundingBox().snappedToGrid( spacing ) == envelope->boundingBox().snappedToGrid( spacing ) )
150  {
151  continue;
152  }
153 
154  // Skip gaps above threshold
155  if ( ( mGapThresholdMapUnits > 0 && gapGeom->area() > mGapThresholdMapUnits ) || gapGeom->area() < mContext->reducedTolerance )
156  {
157  continue;
158  }
159 
160  QgsRectangle gapAreaBBox = gapGeom->boundingBox();
161 
162  // Get neighboring polygons
163  QMap<QString, QgsFeatureIds> neighboringIds;
164  const QgsGeometryCheckerUtils::LayerFeatures layerFeatures( featurePools, featureIds.keys(), gapAreaBBox, compatibleGeometryTypes(), mContext );
165  for ( const QgsGeometryCheckerUtils::LayerFeature &layerFeature : layerFeatures )
166  {
167  const QgsGeometry geom = layerFeature.geometry();
169  {
170  neighboringIds[layerFeature.layer()->id()].insert( layerFeature.feature().id() );
171  gapAreaBBox.combineExtentWith( layerFeature.geometry().boundingBox() );
172  }
173  }
174 
175  if ( neighboringIds.isEmpty() )
176  {
177  continue;
178  }
179 
180  if ( allowedGapsGeomEngine && allowedGapsGeomEngine->contains( gapGeom ) )
181  {
182  continue;
183  }
184 
185  // Add error
186  double area = gapGeom->area();
187  QgsRectangle gapBbox = gapGeom->boundingBox();
188  errors.append( new QgsGeometryGapCheckError( this, QString(), QgsGeometry( gapGeom->clone() ), neighboringIds, area, gapBbox, gapAreaBBox ) );
189  }
190 }
191 
192 void QgsGeometryGapCheck::fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> & /*mergeAttributeIndices*/, Changes &changes ) const
193 {
194  QMetaEnum metaEnum = QMetaEnum::fromType<QgsGeometryGapCheck::ResolutionMethod>();
195  if ( !metaEnum.isValid() || !metaEnum.valueToKey( method ) )
196  {
197  error->setFixFailed( tr( "Unknown method" ) );
198  }
199  else
200  {
201  ResolutionMethod methodValue = static_cast<ResolutionMethod>( method );
202  switch ( methodValue )
203  {
204  case NoChange:
205  error->setFixed( method );
206  break;
207 
208  case MergeLongestEdge:
209  {
210  QString errMsg;
211  if ( mergeWithNeighbor( featurePools, static_cast<QgsGeometryGapCheckError *>( error ), changes, errMsg ) )
212  {
213  error->setFixed( method );
214  }
215  else
216  {
217  error->setFixFailed( tr( "Failed to merge with neighbor: %1" ).arg( errMsg ) );
218  }
219  break;
220  }
221 
222  case AddToAllowedGaps:
223  {
224  QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( mAllowedGapsLayer.data() );
225  if ( layer )
226  {
227  if ( !layer->isEditable() && !layer->startEditing() )
228  {
229  error->setFixFailed( tr( "Could not start editing layer %1" ).arg( layer->name() ) );
230  }
231  else
232  {
233  QgsFeature feature = QgsVectorLayerUtils::createFeature( layer, error->geometry() );
234  QgsFeatureList features = QgsVectorLayerUtils::makeFeatureCompatible( feature, layer );
235  if ( !layer->addFeatures( features ) )
236  {
237  error->setFixFailed( tr( "Could not add feature to layer %1" ).arg( layer->name() ) );
238  }
239  else
240  {
241  error->setFixed( method );
242  }
243  }
244  }
245  else
246  {
247  error->setFixFailed( tr( "Allowed gaps layer could not be resolved" ) );
248  }
249  break;
250  }
251  }
252  }
253 }
254 
255 bool QgsGeometryGapCheck::mergeWithNeighbor( const QMap<QString, QgsFeaturePool *> &featurePools,
257  Changes &changes, QString &errMsg ) const
258 {
259  double maxVal = 0.;
260  QString mergeLayerId;
261  QgsFeature mergeFeature;
262  int mergePartIdx = -1;
263 
264  const QgsGeometry geometry = err->geometry();
265  const QgsAbstractGeometry *errGeometry = QgsGeometryCheckerUtils::getGeomPart( geometry.constGet(), 0 );
266 
267  const auto layerIds = err->neighbors().keys();
268  // Search for touching neighboring geometries
269  for ( const QString &layerId : layerIds )
270  {
271  QgsFeaturePool *featurePool = featurePools.value( layerId );
272  std::unique_ptr<QgsAbstractGeometry> errLayerGeom( errGeometry->clone() );
275 
276  const auto featureIds = err->neighbors().value( layerId );
277 
278  for ( QgsFeatureId testId : featureIds )
279  {
280  QgsFeature testFeature;
281  if ( !featurePool->getFeature( testId, testFeature ) )
282  {
283  continue;
284  }
285  const QgsGeometry featureGeom = testFeature.geometry();
286  const QgsAbstractGeometry *testGeom = featureGeom.constGet();
287  for ( int iPart = 0, nParts = testGeom->partCount(); iPart < nParts; ++iPart )
288  {
289  double len = QgsGeometryCheckerUtils::sharedEdgeLength( errLayerGeom.get(), QgsGeometryCheckerUtils::getGeomPart( testGeom, iPart ), mContext->reducedTolerance );
290  if ( len > maxVal )
291  {
292  maxVal = len;
293  mergeFeature = testFeature;
294  mergePartIdx = iPart;
295  mergeLayerId = layerId;
296  }
297  }
298  }
299  }
300 
301  if ( maxVal == 0. )
302  {
303  return false;
304  }
305 
306  // Merge geometries
307  QgsFeaturePool *featurePool = featurePools[ mergeLayerId ];
308  std::unique_ptr<QgsAbstractGeometry> errLayerGeom( errGeometry->clone() );
311  const QgsGeometry mergeFeatureGeom = mergeFeature.geometry();
312  const QgsAbstractGeometry *mergeGeom = mergeFeatureGeom.constGet();
313  std::unique_ptr< QgsGeometryEngine > geomEngine = QgsGeometryCheckerUtils::createGeomEngine( errLayerGeom.get(), mContext->reducedTolerance );
314  std::unique_ptr<QgsAbstractGeometry> combinedGeom( geomEngine->combine( QgsGeometryCheckerUtils::getGeomPart( mergeGeom, mergePartIdx ), &errMsg ) );
315  if ( !combinedGeom || combinedGeom->isEmpty() || !QgsWkbTypes::isSingleType( combinedGeom->wkbType() ) )
316  {
317  return false;
318  }
319 
320  // Add merged polygon to destination geometry
321  replaceFeatureGeometryPart( featurePools, mergeLayerId, mergeFeature, mergePartIdx, combinedGeom.release(), changes );
322 
323  return true;
324 }
325 
326 
328 {
329  QStringList methods = QStringList()
330  << tr( "Add gap area to neighboring polygon with longest shared edge" )
331  << tr( "No action" );
332  if ( mAllowedGapsSource )
333  methods << tr( "Add gap to allowed exceptions" );
334 
335  return methods;
336 }
337 
339 {
340  return factoryDescription();
341 }
342 
343 QString QgsGeometryGapCheck::id() const
344 {
345  return factoryId();
346 }
347 
348 QgsGeometryCheck::Flags QgsGeometryGapCheck::flags() const
349 {
350  return factoryFlags();
351 }
352 
354 QString QgsGeometryGapCheck::factoryDescription()
355 {
356  return tr( "Gap" );
357 }
358 
359 QString QgsGeometryGapCheck::factoryId()
360 {
361  return QStringLiteral( "QgsGeometryGapCheck" );
362 }
363 
364 QgsGeometryCheck::Flags QgsGeometryGapCheck::factoryFlags()
365 {
367 }
368 
369 QList<QgsWkbTypes::GeometryType> QgsGeometryGapCheck::factoryCompatibleGeometryTypes()
370 {
372 }
373 
374 bool QgsGeometryGapCheck::factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP
375 {
376  return factoryCompatibleGeometryTypes().contains( layer->geometryType() );
377 }
378 
379 QgsGeometryCheck::CheckType QgsGeometryGapCheck::factoryCheckType()
380 {
382 }
384 
386 {
387  return mContextBoundingBox;
388 }
389 
391 {
392  QgsGeometryGapCheckError *err = dynamic_cast<QgsGeometryGapCheckError *>( other );
393  return err && QgsGeometryCheckerUtils::pointsFuzzyEqual( err->location(), location(), mCheck->context()->reducedTolerance ) && err->neighbors() == neighbors();
394 }
395 
397 {
398  QgsGeometryGapCheckError *err = dynamic_cast<QgsGeometryGapCheckError *>( other );
399  return err && err->layerId() == layerId() && err->neighbors() == neighbors();
400 }
401 
403 {
405  // Static cast since this should only get called if isEqual == true
406  const QgsGeometryGapCheckError *err = static_cast<const QgsGeometryGapCheckError *>( other );
407  mNeighbors = err->mNeighbors;
408  mGapAreaBBox = err->mGapAreaBBox;
409 }
410 
412 {
413  return true;
414 }
415 
417 {
418  return mGapAreaBBox;
419 }
420 
421 QMap<QString, QgsFeatureIds> QgsGeometryGapCheckError::involvedFeatures() const
422 {
423  return mNeighbors;
424 }
425 
427 {
428 
429  if ( status() == QgsGeometryCheckError::StatusFixed )
430  return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) );
431  else
432  return QgsApplication::getThemeIcon( QStringLiteral( "/checks/SliverOrGap.svg" ) );
433 }
Wrapper for iterator of features from vector data provider or vector layer.
A rectangle specified with double values.
Definition: qgsrectangle.h:41
Java-style iterator for traversal of parts of a geometry.
static bool pointsFuzzyEqual(const QgsPointXY &p1, const QgsPointXY &p2, double tol)
Determine whether two points are equal up to the specified tolerance.
QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const override
A list of geometry types for which this check can be performed.
virtual void update(const QgsGeometryCheckError *other)
Update this error with the information from other.
bool closeMatch(QgsGeometryCheckError *other) const override
Check if this error is almost equal to other.
static QgsAbstractGeometry * getGeomPart(QgsAbstractGeometry *geom, int partIdx)
double progress() const
Returns the current progress reported by the feedback object.
Definition: qgsfeedback.h:80
QgsPointXY transform(const QgsPointXY &point, TransformDirection direction=ForwardTransform) const SIP_THROW(QgsCsException)
Transform the point from the source CRS to the destination CRS.
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:571
QString description() const override
Returns a human readable description for this check.
const QgsPointXY & location() const
The location of the error in map units.
void setProgress(double progress)
Sets the current progress for the feedback object.
Definition: qgsfeedback.h:63
bool startEditing()
Makes the layer editable.
QMap< QString, QgsFeatureIds > toMap() const
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
Base configuration for geometry checks.
Contains a set of layers and feature ids in those layers to pass to a geometry check.
CheckType
The type of a check.
QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:122
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
QgsGeometry buffer(double distance, int segments) const
Returns a buffer region around this geometry having the given width and with a specified number of se...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
virtual QgsRectangle boundingBox() const =0
Returns the minimal bounding box for the geometry.
QgsRectangle snappedToGrid(double spacing) const
Returns a copy of this rectangle that is snapped to a grid with the specified spacing between the gri...
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
void replaceFeatureGeometryPart(const QMap< QString, QgsFeaturePool *> &featurePools, const QString &layerId, QgsFeature &feature, int partIdx, QgsAbstractGeometry *newPartGeom, Changes &changes) const
Replaces a part in a feature geometry.
void setFixFailed(const QString &reason)
Set the error status to failed and specify the reason for failure.
QIcon icon() const override
Returns an icon that should be shown for this kind of error.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
Definition: qgsfeedback.h:44
An error produced by a QgsGeometryGapCheck.
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
void prepare(const QgsGeometryCheckContext *context, const QVariantMap &configuration) override
Will be run in the main thread before collectErrors is called (which may be run from a background thr...
static double sharedEdgeLength(const QgsAbstractGeometry *geom1, const QgsAbstractGeometry *geom2, double tol)
void update(const QgsGeometryCheckError *other) override
Update this error with the information from other.
#define SIP_SKIP
Definition: qgis_sip.h:126
QStringList resolutionMethods() const override
Returns a list of descriptions for available resolutions for errors.
bool getFeature(QgsFeatureId id, QgsFeature &feature)
Retrieves the feature with the specified id into feature.
A layer feature combination to uniquely identify and access a feature in a set of layers...
static QgsFeature createFeature(const QgsVectorLayer *layer, const QgsGeometry &geometry=QgsGeometry(), const QgsAttributeMap &attributes=QgsAttributeMap(), QgsExpressionContext *context=nullptr)
Creates a new feature ready for insertion into a layer.
QgsRectangle contextBoundingBox() const override
The context of the error.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=nullptr) FINAL
Adds a list of features to the sink.
const double reducedTolerance
The tolerance to allow for in geometry checks.
This class implements a geometry check.
virtual double area() const
Returns the planar, 2-dimensional area of the geometry.
QgsGeometryCheck::Flags flags() const override
Flags for this geometry check.
Abstract base class for all geometries.
QMap< QString, QgsFeatureIds > allLayerFeatureIds(const QMap< QString, QgsFeaturePool *> &featurePools) const
Returns all layers and feature ids.
const QString & layerId() const
The id of the layer on which this error has been detected.
ResolutionMethod
Resolution methods for geometry gap checks.
const QgsGeometryCheckContext * mContext
const QgsCoordinateReferenceSystem mapCrs
The coordinate system in which calculations should be done.
A list of layers and feature ids for each of these layers.
const QMap< QString, QgsFeatureIds > & neighbors() const
A map of layers and feature ids of the neighbors of the gap.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
QgsGeometry geometry() const
The geometry of the error in map units.
static bool isSingleType(Type type)
Returns true if the WKB type is a single type.
Definition: qgswkbtypes.h:696
void combineExtentWith(const QgsRectangle &rect)
Expands the rectangle so that it covers both the original rectangle and the given rectangle...
Definition: qgsrectangle.h:359
QgsGeometryGapCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration)
The configuration accepts a "gapThreshold" key which specifies the maximum gap size in squared map un...
QMap< QString, QgsFeatureIds > involvedFeatures() const override
Returns a list of involved features.
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
bool isCanceled() const
Tells whether the operation has been canceled already.
Definition: qgsfeedback.h:54
Transform from destination to source CRS.
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.
QgsAbstractGeometry * next()
Returns next part of the geometry (undefined behavior if hasNext() returns false before calling next(...
bool handleChanges(const QgsGeometryCheck::Changes &) override
Apply a list of changes.
const double tolerance
The tolerance to allow for in geometry checks.
A feature pool is based on a vector layer and caches features.
QgsRectangle affectedAreaBBox() const override
The bounding box of the affected area of the error.
void setFixed(int method)
Set the status to fixed and specify the method that has been used to fix the error.
Do not handle the error.
Class for doing transforms between two map coordinate systems.
const QgsProject * project() const
The project can be used to resolve additional layers.
void collectErrors(const QMap< QString, QgsFeaturePool *> &featurePools, QList< QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids=LayerFeatureIds()) const override
The main worker method.
bool isEqual(QgsGeometryCheckError *other) const override
Check if this error is equal to other.
Q_INVOKABLE QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
QString name
Definition: qgsmaplayer.h:83
QgsCoordinateReferenceSystem crs() const
The coordinate reference system of this layer.
QgsGeometry geometry
Definition: qgsfeature.h:67
const QgsGeometryCheckContext * context() const
Returns the context.
QList< int > QgsAttributeList
Definition: qgsfield.h:27
This represents an error reported by a geometry check.
static std::unique_ptr< QgsGeometryEngine > createGeomEngine(const QgsAbstractGeometry *geometry, double tolerance)
bool nextFeature(QgsFeature &f)
static QgsFeatureList makeFeatureCompatible(const QgsFeature &feature, const QgsVectorLayer *layer)
Converts input feature to be compatible with the given layer.
Represents a vector layer which manages a vector based data sets.
QString id() const override
Returns an id for this check.
Merge the gap with the polygon with the longest shared edge.
bool hasNext() const
Find out whether there are more parts.
This geometry check should be available in layer validation on the vector layer peroperties.
virtual int partCount() const =0
Returns count of parts contained in the geometry.
The check controls a whole layer (topology checks)
const QgsCoordinateTransformContext transformContext
The coordinate transform context with which transformations will be done.