LCOV - code coverage report
Current view: top level - core - qgsgeometrysimplifier.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 0 3 0.0 %
Date: 2021-04-10 08:29:14 Functions: 0 0 -
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /***************************************************************************
       2                 :            :     qgsgeometrysimplifier.h
       3                 :            :     ---------------------
       4                 :            :     begin                : December 2013
       5                 :            :     copyright            : (C) 2013 by Alvaro Huarte
       6                 :            :     email                : http://wiki.osgeo.org/wiki/Alvaro_Huarte
       7                 :            : 
       8                 :            :  ***************************************************************************
       9                 :            :  *                                                                         *
      10                 :            :  *   This program is free software; you can redistribute it and/or modify  *
      11                 :            :  *   it under the terms of the GNU General Public License as published by  *
      12                 :            :  *   the Free Software Foundation; either version 2 of the License, or     *
      13                 :            :  *   (at your option) any later version.                                   *
      14                 :            :  *                                                                         *
      15                 :            :  ***************************************************************************/
      16                 :            : 
      17                 :            : #ifndef QGSGEOMETRYSIMPLIFIER_H
      18                 :            : #define QGSGEOMETRYSIMPLIFIER_H
      19                 :            : 
      20                 :            : #include <QVector>
      21                 :            : #include <QPointF>
      22                 :            : 
      23                 :            : class QgsGeometry;
      24                 :            : class QgsRectangle;
      25                 :            : class QgsAbstractGeometry;
      26                 :            : 
      27                 :            : #include "qgis_core.h"
      28                 :            : #include "qgis_sip.h"
      29                 :            : 
      30                 :            : /**
      31                 :            :  * \ingroup core
      32                 :            :  * \brief Abstract base class for simplify geometries using a specific algorithm
      33                 :            :  */
      34                 :          0 : class CORE_EXPORT QgsAbstractGeometrySimplifier
      35                 :            : {
      36                 :            :   public:
      37                 :          0 :     virtual ~QgsAbstractGeometrySimplifier() = default;
      38                 :            : 
      39                 :            :     //! Returns a simplified version the specified geometry
      40                 :            :     virtual QgsGeometry simplify( const QgsGeometry &geometry ) const = 0;
      41                 :            : 
      42                 :            :     /**
      43                 :            :      * Returns a simplified version the specified \a geometry.
      44                 :            :      *
      45                 :            :      * Will return NULLPTR if no simplification is to be performed to the geometry.
      46                 :            :      *
      47                 :            :      * Caller takes ownership of the returned geometry.
      48                 :            :      *
      49                 :            :      * \since QGIS 3.18
      50                 :            :      */
      51                 :            :     virtual QgsAbstractGeometry *simplify( const QgsAbstractGeometry *geometry ) const = 0 SIP_FACTORY;
      52                 :            : 
      53                 :            :     // MapToPixel simplification helper methods
      54                 :            :   public:
      55                 :            :     //! Returns whether the device-envelope can be replaced by its BBOX when is applied the specified tolerance
      56                 :            :     static bool isGeneralizableByDeviceBoundingBox( const QgsRectangle &envelope, float mapToPixelTol = 1.0f );
      57                 :            :     //! Returns whether the device-geometry can be replaced by its BBOX when is applied the specified tolerance
      58                 :            :     static bool isGeneralizableByDeviceBoundingBox( const QVector<QPointF> &points, float mapToPixelTol = 1.0f );
      59                 :            : };
      60                 :            : 
      61                 :            : /***************************************************************************/
      62                 :            : 
      63                 :            : /**
      64                 :            :  * \ingroup core
      65                 :            :  * \brief Implementation of GeometrySimplifier using the Douglas-Peucker algorithm
      66                 :            :  *
      67                 :            :  * Simplifies a geometry, ensuring that the result is a valid geometry having the same dimension and number of components as the input.
      68                 :            :  * The simplification uses a maximum distance difference algorithm similar to the one used in the Douglas-Peucker algorithm.
      69                 :            :  */
      70                 :          0 : class CORE_EXPORT QgsTopologyPreservingSimplifier : public QgsAbstractGeometrySimplifier
      71                 :            : {
      72                 :            :   public:
      73                 :            : 
      74                 :            :     /**
      75                 :            :      * Constructor for QgsTopologyPreservingSimplifier. The tolerance parameter
      76                 :            :      * is specified in layer units.
      77                 :            :      */
      78                 :            :     QgsTopologyPreservingSimplifier( double tolerance );
      79                 :            : 
      80                 :            :     QgsGeometry simplify( const QgsGeometry &geometry ) const override;
      81                 :            :     QgsAbstractGeometry *simplify( const QgsAbstractGeometry *geometry ) const override SIP_FACTORY;
      82                 :            : 
      83                 :            :   protected:
      84                 :            :     //! Distance tolerance for the simplification
      85                 :            :     double mTolerance;
      86                 :            : 
      87                 :            : };
      88                 :            : 
      89                 :            : #endif // QGSGEOMETRYSIMPLIFIER_H

Generated by: LCOV version 1.14