LCOV - code coverage report
Current view: top level - core/symbology - qgsinvertedpolygonrenderer.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 0 3 0.0 %
Date: 2021-03-26 12:19:53 Functions: 0 0 -
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /***************************************************************************
       2                 :            :     qgsinvertedpolygonrenderer.h
       3                 :            :     ---------------------
       4                 :            :     begin                : April 2014
       5                 :            :     copyright            : (C) 2014 Hugo Mercier / Oslandia
       6                 :            :     email                : hugo dot mercier at oslandia dot com
       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                 :            : #ifndef QGSINVERTEDPOLYGONRENDERER_H
      16                 :            : #define QGSINVERTEDPOLYGONRENDERER_H
      17                 :            : 
      18                 :            : #include "qgis_core.h"
      19                 :            : #include "qgis_sip.h"
      20                 :            : #include "qgis.h"
      21                 :            : #include "qgsrenderer.h"
      22                 :            : #include "qgsexpression.h"
      23                 :            : #include "qgsfeature.h"
      24                 :            : #include "qgsgeometry.h"
      25                 :            : #include "qgsmergedfeaturerenderer.h"
      26                 :            : 
      27                 :            : /**
      28                 :            :  * \ingroup core
      29                 :            :  * \brief QgsInvertedPolygonRenderer is a polygon-only feature renderer used to
      30                 :            :  * display features inverted, where the exterior is turned to an interior
      31                 :            :  * and where the exterior theoretically spans the entire plane, allowing
      32                 :            :  * to mask the surroundings of some features.
      33                 :            :  *
      34                 :            :  * It is designed on top of another feature renderer, which is called "embedded"
      35                 :            :  * Most of the methods are then only proxies to the embedded renderer.
      36                 :            :  *
      37                 :            :  * Features are collected to form one "inverted" polygon
      38                 :            :  * during renderFeature() and rendered on stopRender().
      39                 :            :  *
      40                 :            :  * \since QGIS 2.4
      41                 :            :  */
      42                 :          0 : class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsMergedFeatureRenderer
      43                 :            : {
      44                 :            :   public:
      45                 :            : 
      46                 :            :     /**
      47                 :            :      * Constructor
      48                 :            :      * \param embeddedRenderer optional embeddedRenderer. If NULLPTR, a default one will be assigned.
      49                 :            :      * Ownership will be transferred.
      50                 :            :      */
      51                 :            :     QgsInvertedPolygonRenderer( QgsFeatureRenderer *embeddedRenderer SIP_TRANSFER = nullptr );
      52                 :            : 
      53                 :            :     //! Direct copies are forbidden. Use clone() instead.
      54                 :            :     QgsInvertedPolygonRenderer( const QgsInvertedPolygonRenderer & ) = delete;
      55                 :            :     //! Direct copies are forbidden. Use clone() instead.
      56                 :            :     QgsInvertedPolygonRenderer &operator=( const QgsInvertedPolygonRenderer & ) = delete;
      57                 :            : 
      58                 :            :     QgsInvertedPolygonRenderer *clone() const override SIP_FACTORY;
      59                 :            : 
      60                 :            :     QString dump() const override;
      61                 :            : 
      62                 :            :     //! Creates a renderer out of an XML, for loading
      63                 :            :     static QgsFeatureRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
      64                 :            : 
      65                 :            :     QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) override;
      66                 :            : 
      67                 :            :     //! \returns TRUE if the geometries are to be preprocessed (merged with an union) before rendering.
      68                 :          0 :     bool preprocessingEnabled() const { return mOperation == MergeAndInvert; }
      69                 :            : 
      70                 :            :     /**
      71                 :            :      * \param enabled enables or disables the preprocessing.
      72                 :            :      * When enabled, geometries will be merged with an union before being rendered.
      73                 :            :      * It allows fixing some rendering artifacts (when rendering overlapping polygons for instance).
      74                 :            :      * This will involve some CPU-demanding computations and is thus disabled by default.
      75                 :            :      */
      76                 :          0 :     void setPreprocessingEnabled( bool enabled ) { mOperation = enabled ? MergeAndInvert : InvertOnly; }
      77                 :            : 
      78                 :            :     /**
      79                 :            :      * Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.
      80                 :            :      * \returns a new renderer if the conversion was possible, otherwise NULLPTR.
      81                 :            :      * \since QGIS 2.5
      82                 :            :      */
      83                 :            :     static QgsInvertedPolygonRenderer *convertFromRenderer( const QgsFeatureRenderer *renderer ) SIP_FACTORY;
      84                 :            : 
      85                 :            : };
      86                 :            : 
      87                 :            : 
      88                 :            : #endif // QGSINVERTEDPOLYGONRENDERER_H

Generated by: LCOV version 1.14