LCOV - code coverage report
Current view: top level - analysis/vector/geometry_checker - qgsgeometrysliverpolygoncheck.cpp (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 10 10 100.0 %
Date: 2021-03-26 12:19:53 Functions: 0 0 -
Branches: 0 0 -

           Branch data     Line data    Source code
       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                 :            : #include "qgsfeaturepool.h"
      18                 :            : 
      19                 :         26 : bool QgsGeometrySliverPolygonCheck::checkThreshold( double layerToMapUnits, const QgsAbstractGeometry *geom, double &value ) const
      20                 :            : {
      21                 :         26 :   double maxArea = mMaxArea / ( layerToMapUnits * layerToMapUnits );
      22                 :         26 :   QgsRectangle bb = geom->boundingBox();
      23                 :         26 :   double maxDim = std::max( bb.width(), bb.height() );
      24                 :         26 :   double area = geom->area();
      25                 :         26 :   value = ( maxDim * maxDim ) / area;
      26                 :         26 :   if ( maxArea > 0. && area > maxArea )
      27                 :            :   {
      28                 :         18 :     return false;
      29                 :            :   }
      30                 :          8 :   return value > mThresholdMapUnits; // the sliver threshold is actually a map unit independent number, just abusing QgsGeometryAreaCheck::mThresholdMapUnits to store it
      31                 :         26 : }

Generated by: LCOV version 1.14