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

           Branch data     Line data    Source code
       1                 :            : /***************************************************************************
       2                 :            :     qgssimplifymethod.h
       3                 :            :     ---------------------
       4                 :            :     begin                : December 2013
       5                 :            :     copyright            : (C) 2013 by Matthias Kuhn / Alvaro Huarte
       6                 :            :     email                :
       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                 :            : #ifndef QGSSIMPLIFYMETHOD_H
      17                 :            : #define QGSSIMPLIFYMETHOD_H
      18                 :            : 
      19                 :            : #include "qgis_core.h"
      20                 :            : 
      21                 :            : class QgsAbstractGeometrySimplifier;
      22                 :            : 
      23                 :            : /**
      24                 :            :  * \ingroup core
      25                 :            :  * \brief This class contains information about how to simplify geometries fetched from a QgsFeatureIterator
      26                 :            :  * \since QGIS 2.2
      27                 :            :  */
      28                 :            : class CORE_EXPORT QgsSimplifyMethod
      29                 :            : {
      30                 :            :   public:
      31                 :            :     enum MethodType
      32                 :            :     {
      33                 :            :       NoSimplification,     //!< No simplification is applied
      34                 :            :       OptimizeForRendering, //!< Simplify using the map2pixel data to optimize the rendering of geometries
      35                 :            :       PreserveTopology      //!< Simplify using the Douglas-Peucker algorithm ensuring that the result is a valid geometry
      36                 :            :     };
      37                 :            : 
      38                 :            :     //! construct a default method
      39                 :        846 :     QgsSimplifyMethod() = default;
      40                 :            : 
      41                 :            :     //! Sets the simplification type
      42                 :            :     void setMethodType( MethodType methodType );
      43                 :            :     //! Gets the simplification type
      44                 :          0 :     inline MethodType methodType() const { return mMethodType; }
      45                 :            : 
      46                 :            :     //! Sets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal.
      47                 :            :     void setTolerance( double tolerance );
      48                 :            :     //! Gets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal.
      49                 :          0 :     inline double tolerance() const { return mTolerance; }
      50                 :            : 
      51                 :            :     //! Sets the simplification threshold in pixels. Represents the maximum distance in pixels between two coordinates which can be considered equal.
      52                 :          0 :     void setThreshold( float threshold ) { mThreshold = threshold; }
      53                 :            :     //! Gets the simplification threshold in pixels. Represents the maximum distance in pixels between two coordinates which can be considered equal.
      54                 :            :     inline float threshold() const { return mThreshold; }
      55                 :            : 
      56                 :            :     //! Sets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries
      57                 :            :     void setForceLocalOptimization( bool localOptimization );
      58                 :            :     //! Gets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries
      59                 :            :     inline bool forceLocalOptimization() const { return mForceLocalOptimization; }
      60                 :            : 
      61                 :            :     //! Creates a geometry simplifier according to specified method
      62                 :            :     static QgsAbstractGeometrySimplifier *createGeometrySimplifier( const QgsSimplifyMethod &simplifyMethod );
      63                 :            : 
      64                 :            :   protected:
      65                 :            :     //! Simplification method
      66                 :        846 :     MethodType mMethodType = QgsSimplifyMethod::NoSimplification;
      67                 :            :     //! Simplification tolerance, it represents the maximum distance between two coordinates which can be considered equal
      68                 :        846 :     double mTolerance = 1;
      69                 :            :     //! Simplification threshold
      70                 :        846 :     float mThreshold = 1;
      71                 :            :     //! Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries
      72                 :        846 :     bool mForceLocalOptimization = true;
      73                 :            : };
      74                 :            : 
      75                 :            : #endif // QGSSIMPLIFYMETHOD_H

Generated by: LCOV version 1.14