QGIS API Documentation 4.5.0-Master (f3f69a543c6)
Loading...
Searching...
No Matches
qgsgeometryvalidator.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsgeometryvalidator.cpp - geometry validation thread
3 -------------------------------------------------------------------
4Date : 03.01.2012
5Copyright : (C) 2012 by Juergen E. Fischer
6email : jef at norbit dot de
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#include "qgsconfig.h"
18
19#include "qgis.h"
20#include "qgscurve.h"
21#include "qgscurvepolygon.h"
22#include "qgsgeometry.h"
24#include "qgsgeos.h"
25#include "qgslogger.h"
28#include "qgsvertexid.h"
29
30#include <QString>
31
32using namespace Qt::StringLiterals;
33
34#ifdef HAVE_SFCGAL
35#include "qgssfcgalgeometry.h"
36#endif
37
38#include "moc_qgsgeometryvalidator.cpp"
39
40QgsGeometryValidator::QgsGeometryValidator( const QgsGeometry &geometry, QVector<QgsGeometry::Error> *errors, Qgis::GeometryValidationEngine method )
41 : mGeometry( geometry )
42 , mErrors( errors )
43 , mMethod( method )
44{}
45
51
53{
54 mStop = true;
55}
56
57void QgsGeometryValidator::checkRingIntersections( int partIndex0, int ringIndex0, const QgsCurve *ring0, int partIndex1, int ringIndex1, const QgsCurve *ring1 )
58{
60 std::unique_ptr< QgsLineString > segmentisedRing0;
61 if ( !ringLine0 )
62 {
63 segmentisedRing0.reset( qgsgeometry_cast< QgsLineString * >( ring0->segmentize() ) );
64 ringLine0 = segmentisedRing0.get();
65 }
66
67 const QgsLineString *ringLine1 = qgsgeometry_cast< const QgsLineString * >( ring1 );
68 std::unique_ptr< QgsLineString > segmentisedRing1;
69 if ( !ringLine1 )
70 {
71 segmentisedRing1.reset( qgsgeometry_cast< QgsLineString * >( ring1->segmentize() ) );
72 ringLine1 = segmentisedRing1.get();
73 }
74
75 Q_ASSERT( ringLine0 );
76 Q_ASSERT( ringLine1 );
77
78 for ( int i = 0; !mStop && i < ringLine0->numPoints() - 1; i++ )
79 {
80 const double ring0XAti = ringLine0->xAt( i );
81 const double ring0YAti = ringLine0->yAt( i );
82 const QgsVector v( ringLine0->xAt( i + 1 ) - ring0XAti, ringLine0->yAt( i + 1 ) - ring0YAti );
83
84 for ( int j = 0; !mStop && j < ringLine1->numPoints() - 1; j++ )
85 {
86 const double ring1XAtj = ringLine1->xAt( j );
87 const double ring1YAtj = ringLine1->yAt( j );
88 const QgsVector w( ringLine1->xAt( j + 1 ) - ring1XAtj, ringLine1->yAt( j + 1 ) - ring1YAtj );
89
90 double sX;
91 double sY;
92 if ( intersectLines( ring0XAti, ring0YAti, v, ring1XAtj, ring1YAtj, w, sX, sY ) )
93 {
94 double d = -distLine2Point( ring0XAti, ring0YAti, v.perpVector(), sX, sY );
95
96 if ( d >= 0 && d <= v.length() )
97 {
98 d = -distLine2Point( ring1XAtj, ring1YAtj, w.perpVector(), sX, sY );
99 if ( d > 0
100 && d < w.length()
101 && ringLine0->pointN( i + 1 ) != ringLine1->pointN( j + 1 )
102 && ringLine0->pointN( i + 1 ) != ringLine1->pointN( j )
103 && ringLine0->pointN( i + 0 ) != ringLine1->pointN( j + 1 )
104 && ringLine0->pointN( i + 0 ) != ringLine1->pointN( j ) )
105 {
106 const QString msg = QObject::tr( "segment %1 of ring %2 of polygon %3 intersects segment %4 of ring %5 of polygon %6 at %7, %8" )
107 .arg( i )
108 .arg( ringIndex0 )
109 .arg( partIndex0 )
110 .arg( j )
111 .arg( ringIndex1 )
112 .arg( partIndex1 )
113 .arg( sX )
114 .arg( sY );
115 emit errorFound( QgsGeometry::Error( msg, QgsPointXY( sX, sY ) ) );
116 mErrorCount++;
117 }
118 }
119 }
120 }
121 }
122}
123
124void QgsGeometryValidator::validatePolyline( int i, const QgsLineString *line, bool ring )
125{
126 if ( !line )
127 return;
128
129 if ( ring )
130 {
131 if ( line->numPoints() < 4 )
132 {
133 const QString msg = QObject::tr( "ring %1 with less than four points" ).arg( i );
134 QgsDebugMsgLevel( msg, 2 );
135 emit errorFound( QgsGeometry::Error( msg ) );
136 mErrorCount++;
137 return;
138 }
139
140 if ( !line->isClosed() )
141 {
142 const QgsPoint startPoint = line->startPoint();
143 const QgsPoint endPoint = line->endPoint();
144 QString msg;
145 if ( line->is3D() && line->isClosed2D() )
146 {
147 msg = QObject::tr( "ring %1 not closed, Z mismatch: %2 vs %3" ).arg( i ).arg( startPoint.z() ).arg( endPoint.z() );
148 }
149 else
150 {
151 msg = QObject::tr( "ring %1 not closed" ).arg( i );
152 QgsDebugMsgLevel( msg, 2 );
153 }
154 emit errorFound( QgsGeometry::Error( msg, QgsPointXY( startPoint.x(), startPoint.y() ) ) );
155 mErrorCount++;
156 return;
157 }
158 }
159 else if ( line->numPoints() < 2 )
160 {
161 const QString msg = QObject::tr( "line %1 with less than two points" ).arg( i );
162 QgsDebugMsgLevel( msg, 2 );
163 emit errorFound( QgsGeometry::Error( msg ) );
164 mErrorCount++;
165 return;
166 }
167
168 std::unique_ptr< QgsLineString > noDupes;
169
170 // test for duplicate nodes, and if we find any flag errors and then remove them so that the subsequent
171 // tests work OK.
172 const QVector< QgsVertexId > duplicateNodes = line->collectDuplicateNodes( 1E-8 );
173 if ( !duplicateNodes.empty() )
174 {
175 noDupes.reset( line->clone() );
176 for ( int j = duplicateNodes.size() - 1; j >= 0; j-- )
177 {
178 const QgsVertexId duplicateVertex = duplicateNodes.at( j );
179 const QgsPointXY duplicationLocation = noDupes->vertexAt( duplicateVertex );
180 noDupes->deleteVertex( duplicateVertex );
181 int n = 1;
182
183 // count how many other points exist at this location too
184 for ( int k = j - 1; k >= 0; k-- )
185 {
186 const QgsVertexId prevDupe = duplicateNodes.at( k );
187 const QgsPoint prevPoint = noDupes->vertexAt( prevDupe );
188 if ( qgsDoubleNear( duplicationLocation.x(), prevPoint.x(), 1E-8 ) && qgsDoubleNear( duplicationLocation.y(), prevPoint.y(), 1E-8 ) )
189 {
190 noDupes->deleteVertex( prevDupe );
191 n++;
192 }
193 else
194 {
195 break;
196 }
197 }
198
199 j -= n - 1;
200
201 const QString msg = QObject::tr( "line %1 contains %n duplicate node(s) starting at vertex %2", "number of duplicate nodes", n + 1 ).arg( i + 1 ).arg( duplicateVertex.vertex - n + 1 );
202 QgsDebugMsgLevel( msg, 2 );
203 emit errorFound( QgsGeometry::Error( msg, duplicationLocation ) );
204 mErrorCount++;
205 }
206 line = noDupes.get();
207 }
208
209 // segment Intersection
210 for ( int j = 0; !mStop && j < line->numPoints() - 3; j++ )
211 {
212 const int n = ( j == 0 && ring ) ? line->numPoints() - 2 : line->numPoints() - 1;
213 for ( int k = j + 2; !mStop && k < n; k++ )
214 {
215 double intersectionPointX = std::numeric_limits<double>::quiet_NaN();
216 double intersectionPointY = std::numeric_limits<double>::quiet_NaN();
217 bool isIntersection = false;
218 if ( QgsGeometryUtilsBase::
219 segmentIntersection( line->xAt( j ), line->yAt( j ), line->xAt( j + 1 ), line->yAt( j + 1 ), line->xAt( k ), line->yAt( k ), line->xAt( k + 1 ), line->yAt( k + 1 ), intersectionPointX, intersectionPointY, isIntersection, 1e-8, ring ) )
220 {
221 const QString msg = QObject::tr( "segments %1 and %2 of line %3 intersect at %4, %5" ).arg( j ).arg( k ).arg( i ).arg( intersectionPointX ).arg( intersectionPointY );
222 QgsDebugMsgLevel( msg, 2 );
223 emit errorFound( QgsGeometry::Error( msg, QgsPointXY( intersectionPointX, intersectionPointY ) ) );
224 mErrorCount++;
225 }
226 }
227 }
228}
229
230void QgsGeometryValidator::validatePolygon( int partIndex, const QgsCurvePolygon *polygon )
231{
232 // check if holes are inside polygon
233 for ( int i = 0; !mStop && i < polygon->numInteriorRings(); ++i )
234 {
235 if ( !ringInRing( polygon->interiorRing( i ), polygon->exteriorRing() ) )
236 {
237 const QString msg = QObject::tr( "ring %1 of polygon %2 not in exterior ring" ).arg( i + 1 ).arg( partIndex );
238 QgsDebugMsgLevel( msg, 2 );
239 const QgsCurve *interiorRing = polygon->interiorRing( i );
240
241 if ( interiorRing->numPoints() == 0 )
242 emit errorFound( QgsGeometry::Error( msg ) );
243 else
244 emit errorFound( QgsGeometry::Error( msg, QgsPointXY( interiorRing->startPoint() ) ) );
245
246 mErrorCount++;
247 }
248 }
249
250 // check holes for intersections
251 for ( int i = 0; !mStop && i < polygon->numInteriorRings(); i++ )
252 {
253 for ( int j = i + 1; !mStop && j < polygon->numInteriorRings(); j++ )
254 {
255 checkRingIntersections( partIndex, i + 1, polygon->interiorRing( i ), partIndex, j + 1, polygon->interiorRing( j ) );
256 }
257 }
258
259 // check if rings are self-intersecting
260 validatePolyline( 0, qgsgeometry_cast< const QgsLineString * >( polygon->exteriorRing() ), true );
261 for ( int i = 0; !mStop && i < polygon->numInteriorRings(); i++ )
262 {
263 validatePolyline( i + 1, qgsgeometry_cast< const QgsLineString * >( polygon->interiorRing( i ) ), true );
264 }
265}
266
268{
269 mErrorCount = 0;
270 if ( mGeometry.isNull() )
271 {
272 return;
273 }
274
275 switch ( mMethod )
276 {
278 {
279 // avoid calling geos for trivial point geometries
280 if ( QgsWkbTypes::geometryType( mGeometry.wkbType() ) == Qgis::GeometryType::Point )
281 {
282 return;
283 }
284
285 const QgsGeos geos( mGeometry.constGet(), 0, Qgis::GeosCreationFlags() );
286 QString error;
287 QgsGeometry errorLoc;
288 if ( !geos.isValid( &error, true, &errorLoc ) )
289 {
290 if ( errorLoc.isNull() )
291 {
292 emit errorFound( QgsGeometry::Error( error ) );
293 mErrorCount++;
294 }
295 else
296 {
297 const QgsPointXY point = errorLoc.asPoint();
298 emit errorFound( QgsGeometry::Error( error, point ) );
299 mErrorCount++;
300 }
301 }
302
303 break;
304 }
305
307 {
308 switch ( QgsWkbTypes::flatType( mGeometry.constGet()->wkbType() ) )
309 {
312 break;
313
315 validatePolyline( 0, qgsgeometry_cast< const QgsLineString * >( mGeometry.constGet() ) );
316 break;
317
319 {
320 const QgsGeometryCollection *collection = qgsgeometry_cast< const QgsGeometryCollection * >( mGeometry.constGet() );
321 for ( int i = 0; !mStop && i < collection->numGeometries(); i++ )
322 validatePolyline( i, qgsgeometry_cast< const QgsLineString * >( collection->geometryN( i ) ) );
323 break;
324 }
325
328 validatePolygon( 0, qgsgeometry_cast< const QgsCurvePolygon * >( mGeometry.constGet() ) );
329 break;
330
333 {
334 const QgsGeometryCollection *collection = qgsgeometry_cast< const QgsGeometryCollection * >( mGeometry.constGet() );
335 if ( !collection )
336 {
337 // should not be possible
338 break;
339 }
340
341 for ( int i = 0; !mStop && i < collection->numGeometries(); i++ )
342 validatePolygon( i, qgsgeometry_cast< const QgsCurvePolygon * >( collection->geometryN( i ) ) );
343
344 for ( int i = 0; !mStop && i < collection->numGeometries(); i++ )
345 {
347 if ( !poly->exteriorRing() || poly->exteriorRing()->isEmpty() )
348 {
349 emit errorFound( QgsGeometry::Error( QObject::tr( "Polygon %1 has no rings" ).arg( i ) ) );
350 mErrorCount++;
351 continue;
352 }
353
354 for ( int j = i + 1; !mStop && j < collection->numGeometries(); j++ )
355 {
357 if ( !poly2->exteriorRing() || poly2->exteriorRing()->isEmpty() )
358 continue;
359
360 if ( ringInRing( poly->exteriorRing(), poly2->exteriorRing() ) )
361 {
362 emit errorFound( QgsGeometry::Error( QObject::tr( "Polygon %1 lies inside polygon %2" ).arg( i ).arg( j ) ) );
363 mErrorCount++;
364 }
365 else if ( ringInRing( poly2->exteriorRing(), poly->exteriorRing() ) )
366 {
367 emit errorFound( QgsGeometry::Error( QObject::tr( "Polygon %1 lies inside polygon %2" ).arg( j ).arg( i ) ) );
368 mErrorCount++;
369 }
370 else
371 {
372 checkRingIntersections( i, 0, poly->exteriorRing(), j, 0, poly2->exteriorRing() );
373 }
374 }
375 }
376 break;
377 }
378
380 {
381 emit errorFound( QgsGeometry::Error( QObject::tr( "Unknown geometry type %1" ).arg( qgsEnumValueToKey( mGeometry.wkbType() ) ) ) );
382 mErrorCount++;
383 break;
384 }
385
386 default:
387 break;
388 }
389
390 if ( mStop )
391 {
392 emit validationFinished( QObject::tr( "Geometry validation was aborted." ) );
393 }
394 else if ( mErrorCount > 0 )
395 {
396 emit validationFinished( QObject::tr( "Geometry has %n error(s).", nullptr, mErrorCount ) );
397 }
398 else
399 {
400 emit validationFinished( QObject::tr( "Geometry is valid." ) );
401 }
402 break;
403 }
404
406 {
407 // avoid calling SFCGAL for trivial point geometries
408 if ( QgsWkbTypes::geometryType( mGeometry.wkbType() ) == Qgis::GeometryType::Point )
409 {
410 return;
411 }
412
413#ifdef HAVE_SFCGAL
414 QString errorMsg;
415 QgsGeometry errorLoc;
416 const QgsSfcgalGeometry sfcgalGeom( mGeometry.constGet() );
417 if ( !QgsSfcgalEngine::isValid( sfcgalGeom.sfcgalGeometry().get(), nullptr, &errorMsg, &errorLoc ) )
418 {
419 if ( errorLoc.isNull() )
420 {
421 emit errorFound( QgsGeometry::Error( errorMsg ) );
422 mErrorCount++;
423 }
424 else
425 {
426 const QgsPointXY point = errorLoc.asPoint();
427 emit errorFound( QgsGeometry::Error( errorMsg, point ) );
428 mErrorCount++;
429 }
430 }
431#else
432 QgsDebugError( u"Cannot use SFCGAL validation method in this QGIS build."_s );
433#endif
434
435 break;
436 }
437 }
438}
439
441{
442 if ( mErrors )
443 *mErrors << e;
444}
445
446void QgsGeometryValidator::validateGeometry( const QgsGeometry &geometry, QVector<QgsGeometry::Error> &errors, Qgis::GeometryValidationEngine method )
447{
448 QgsGeometryValidator *gv = new QgsGeometryValidator( geometry, &errors, method );
450 gv->run();
451 gv->wait();
452}
453
454//
455// distance of point q from line through p in direction v
456// return >0 => q lies left of the line
457// <0 => q lies right of the line
458//
459double QgsGeometryValidator::distLine2Point( double px, double py, QgsVector v, double qX, double qY )
460{
461 const double l = v.length();
462 if ( qgsDoubleNear( l, 0 ) )
463 {
464 throw QgsException( QObject::tr( "invalid line" ) );
465 }
466
467 return ( v.x() * ( qY - py ) - v.y() * ( qX - px ) ) / l;
468}
469
470bool QgsGeometryValidator::intersectLines( double px, double py, QgsVector v, double qx, double qy, QgsVector w, double &sX, double &sY )
471{
472 const double d = v.y() * w.x() - v.x() * w.y();
473
474 if ( qgsDoubleNear( d, 0 ) )
475 return false;
476
477 const double dx = qx - px;
478 const double dy = qy - py;
479 const double k = ( dy * w.x() - dx * w.y() ) / d;
480
481 sX = px + v.x() * k;
482 sY = py + v.y() * k;
483
484 return true;
485}
486
487bool QgsGeometryValidator::pointInRing( const QgsCurve *ring, double pX, double pY )
488{
489 if ( !ring->boundingBox().contains( pX, pY ) )
490 return false;
491
492 bool inside = false;
493 int j = ring->numPoints() - 1;
494
495 for ( int i = 0; !mStop && i < ring->numPoints(); i++ )
496 {
497 const double xAti = ring->xAt( i );
498 const double yAti = ring->yAt( i );
499 const double xAtj = ring->xAt( j );
500 const double yAtj = ring->yAt( j );
501
502 if ( qgsDoubleNear( xAti, pX ) && qgsDoubleNear( yAti, pY ) )
503 return true;
504
505 if ( ( yAti < pY && yAtj >= pY ) || ( yAtj < pY && yAti >= pY ) )
506 {
507 if ( xAti + ( pY - yAti ) / ( yAtj - yAti ) * ( xAtj - xAti ) <= pX )
508 inside = !inside;
509 }
510
511 j = i;
512 }
513
514 return inside;
515}
516
517bool QgsGeometryValidator::ringInRing( const QgsCurve *inside, const QgsCurve *outside )
518{
519 if ( !outside->boundingBox().contains( inside->boundingBox() ) )
520 return false;
521
522 for ( int i = 0; !mStop && i < inside->numPoints(); i++ )
523 {
524 if ( !pointInRing( outside, inside->xAt( i ), inside->yAt( i ) ) )
525 return false;
526 }
527
528 return true;
529}
530
GeometryValidationEngine
Available engines for validating geometries.
Definition qgis.h:2256
@ QgisInternal
Use internal QgsGeometryValidator method.
Definition qgis.h:2257
@ Sfcgal
Use SFCGAL validation methods. Only available for QGIS builds with SFCGAL support enabled.
Definition qgis.h:2259
@ Geos
Use GEOS validation methods.
Definition qgis.h:2258
QFlags< GeosCreationFlag > GeosCreationFlags
Geos geometry creation behavior flags.
Definition qgis.h:2343
@ Point
Points.
Definition qgis.h:400
@ Point
Point.
Definition qgis.h:316
@ LineString
LineString.
Definition qgis.h:317
@ MultiPoint
MultiPoint.
Definition qgis.h:320
@ Polygon
Polygon.
Definition qgis.h:318
@ MultiPolygon
MultiPolygon.
Definition qgis.h:322
@ MultiLineString
MultiLineString.
Definition qgis.h:321
@ Unknown
Unknown.
Definition qgis.h:315
@ CurvePolygon
CurvePolygon.
Definition qgis.h:326
@ MultiSurface
MultiSurface.
Definition qgis.h:328
virtual QgsRectangle boundingBox() const
Returns the minimal bounding box for the geometry.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
virtual bool isEmpty() const
Returns true if the geometry is empty.
Curve polygon geometry type.
int numInteriorRings() const
Returns the number of interior rings contained with the curve polygon.
const QgsCurve * exteriorRing() const
Returns the curve polygon's exterior ring.
const QgsCurve * interiorRing(int i) const
Retrieves an interior ring from the curve polygon.
Abstract base class for curved geometry type.
Definition qgscurve.h:36
virtual int numPoints() const =0
Returns the number of points in the curve.
QgsCurve * segmentize(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
Returns a geometry without curves.
Definition qgscurve.cpp:175
virtual double xAt(int index) const =0
Returns the x-coordinate of the specified node in the line string.
virtual QgsPoint startPoint() const =0
Returns the starting point of the curve.
virtual double yAt(int index) const =0
Returns the y-coordinate of the specified node in the line string.
Defines a QGIS exception class.
int numGeometries() const
Returns the number of geometries within the collection.
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
void validationFinished(const QString &summary)
Sent when the validation is finished.
void errorFound(const QgsGeometry::Error &error)
Sent when an error has been found during the validation process.
QgsGeometryValidator(const QgsGeometry &geometry, QVector< QgsGeometry::Error > *errors=nullptr, Qgis::GeometryValidationEngine method=Qgis::GeometryValidationEngine::QgisInternal)
Constructor for QgsGeometryValidator.
static void validateGeometry(const QgsGeometry &geometry, QVector< QgsGeometry::Error > &errors, Qgis::GeometryValidationEngine method=Qgis::GeometryValidationEngine::QgisInternal)
Validate geometry and produce a list of geometry errors.
void addError(const QgsGeometry::Error &)
static Qgis::GeometryValidationEngine defaultValidationEngine()
Returns the geometry validation engine configured in the application settings.
A geometry error.
A geometry is the spatial representation of a feature.
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
Does vector analysis using the GEOS library and handles import, export, and exception handling.
Definition qgsgeos.h:192
Line string geometry type, with support for z-dimension and m-values.
bool isClosed() const override
Returns true if the curve is closed.
QVector< QgsVertexId > collectDuplicateNodes(double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false) const
Returns a list of any duplicate nodes contained in the geometry, within the specified tolerance.
QgsLineString * clone() const override
Clones the geometry by performing a deep copy.
bool isClosed2D() const override
Returns true if the curve is closed.
Represents a 2D point.
Definition qgspointxy.h:62
double y
Definition qgspointxy.h:66
double x
Definition qgspointxy.h:65
double z
Definition qgspoint.h:58
double x
Definition qgspoint.h:56
double y
Definition qgspoint.h:57
bool contains(const QgsRectangle &rect) const
Returns true when rectangle contains other rectangle.
static const QgsSettingsEntryInteger * settingsDigitizingValidateGeometries
Settings entry digitizing validate geometries.
double yAt(int index) const override
Returns the y-coordinate of the specified node in the line string.
int numPoints() const override
Returns the number of points in the curve.
double xAt(int index) const override
Returns the x-coordinate of the specified node in the line string.
QgsPoint startPoint() const override
Returns the starting point of the curve.
QgsPoint endPoint() const override
Returns the end point of the curve.
QgsPoint pointN(int i) const
Returns the specified point from inside the simple curve.
Represent a 2-dimensional vector.
Definition qgsvector.h:34
double y() const
Returns the vector's y-component.
Definition qgsvector.h:155
double x() const
Returns the vector's x-component.
Definition qgsvector.h:146
double length() const
Returns the length of the vector.
Definition qgsvector.h:127
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
Contains geos related utilities and functions.
Definition qgsgeos.h:129
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition qgis.h:8114
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).
Definition qgis.h:7840
T qgsgeometry_cast(QgsAbstractGeometry *geom)
#define QgsDebugMsgLevel(str, level)
Definition qgslogger.h:80
#define QgsDebugError(str)
Definition qgslogger.h:71
int vertex
Vertex number.