QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
vector
geometry_checker
qgsgeometrysliverpolygoncheck.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsgeometryareacheck.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
16
#include "
qgsgeometrysliverpolygoncheck.h
"
17
18
#include "
qgsfeaturepool.h
"
19
20
bool
QgsGeometrySliverPolygonCheck::checkThreshold(
double
layerToMapUnits,
const
QgsAbstractGeometry
*geom,
double
&value )
const
21
{
22
const
double
maxArea = mMaxArea / ( layerToMapUnits * layerToMapUnits );
23
const
QgsRectangle bb = geom->
boundingBox
();
24
const
double
maxDim = std::max( bb.
width
(), bb.
height
() );
25
const
double
area = geom->
area
();
26
value = ( maxDim * maxDim ) / area;
27
if
( maxArea > 0. && area > maxArea )
28
{
29
return
false
;
30
}
31
return
value > mThresholdMapUnits;
// the sliver threshold is actually a map unit independent number, just abusing QgsGeometryAreaCheck::mThresholdMapUnits to store it
32
}
QgsAbstractGeometry
Abstract base class for all geometries.
Definition
qgsabstractgeometry.h:82
QgsAbstractGeometry::boundingBox
virtual QgsRectangle boundingBox() const
Returns the minimal bounding box for the geometry.
Definition
qgsabstractgeometry.cpp:119
QgsAbstractGeometry::area
virtual double area() const
Returns the planar, 2-dimensional area of the geometry.
Definition
qgsabstractgeometry.cpp:207
QgsRectangle::height
double height
Definition
qgsrectangle.h:55
QgsRectangle::width
double width
Definition
qgsrectangle.h:54
qgsfeaturepool.h
qgsgeometrysliverpolygoncheck.h
Generated on
for QGIS API Documentation by
1.17.0