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

           Branch data     Line data    Source code
       1                 :            : /***************************************************************************
       2                 :            :   qgsrenderedfeaturehandlerinterface.h
       3                 :            :   --------------------------------------
       4                 :            :   Date                 : August 2019
       5                 :            :   Copyright            : (C) 2019 by Nyall Dawson
       6                 :            :   Email                : nyall dot dawson at gmail 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                 :            : 
      16                 :            : #ifndef QGSRENDEREDFEATUREHANDLERINTERFACE_H
      17                 :            : #define QGSRENDEREDFEATUREHANDLERINTERFACE_H
      18                 :            : 
      19                 :            : #include "qgis_core.h"
      20                 :            : #include "qgis_sip.h"
      21                 :            : #include <QSet>
      22                 :            : #include <QString>
      23                 :            : 
      24                 :            : class QgsFeature;
      25                 :            : class QgsGeometry;
      26                 :            : class QgsRenderContext;
      27                 :            : class QgsVectorLayer;
      28                 :            : 
      29                 :            : /**
      30                 :            :  * \ingroup core
      31                 :            :  *
      32                 :            :  * \brief An interface for classes which provider custom handlers for features rendered
      33                 :            :  * as part of a map render job.
      34                 :            :  *
      35                 :            :  * QgsRenderedFeatureHandlerInterface objects are registered in the QgsMapSettings
      36                 :            :  * objects used to construct map render jobs. During the rendering operation,
      37                 :            :  * the handleRenderedFeature() method will be called once for every rendered feature,
      38                 :            :  * allowing the handler to perform some custom task based on the provided information.
      39                 :            :  *
      40                 :            :  * They can be used for custom tasks which operate on a set of rendered features,
      41                 :            :  * such as creating spatial indexes of the location and rendered symbology bounding box
      42                 :            :  * of all features rendered on a map.
      43                 :            :  *
      44                 :            :  * \since QGIS 3.10
      45                 :            :  */
      46                 :          0 : class CORE_EXPORT QgsRenderedFeatureHandlerInterface
      47                 :            : {
      48                 :            :   public:
      49                 :          0 :     virtual ~QgsRenderedFeatureHandlerInterface() = default;
      50                 :            : 
      51                 :            :     struct CORE_EXPORT RenderedFeatureContext
      52                 :            :     {
      53                 :            : 
      54                 :            :         /**
      55                 :            :          * Constructor for RenderedFeatureContext.
      56                 :            :          * \param renderContext The render context which was used while rendering feature.
      57                 :            :          */
      58                 :          0 :         RenderedFeatureContext( const QgsRenderContext &renderContext )
      59                 :          0 :           : renderContext( renderContext )
      60                 :          0 :         {}
      61                 :            : 
      62                 :            :         /**
      63                 :            :          * The render context which was used while rendering feature.
      64                 :            :          */
      65                 :            :         const QgsRenderContext &renderContext;
      66                 :            : 
      67                 :            :       private:
      68                 :            : #ifdef SIP_RUN
      69                 :            :         RenderedFeatureContext &operator=( const RenderedFeatureContext & );
      70                 :            : #endif
      71                 :            :     };
      72                 :            : 
      73                 :            :     /**
      74                 :            :      * Called whenever a \a feature is rendered during a map render job.
      75                 :            :      *
      76                 :            :      * The \a renderedBounds argument specifies the (approximate) bounds of the rendered feature's
      77                 :            :      * symbology. E.g. for point geometry features, this will be the bounding box of the marker symbol
      78                 :            :      * used to symbolize the point. \a renderedBounds geometries are specified in painter units (not
      79                 :            :      * map units).
      80                 :            :      *
      81                 :            :      * \warning This method may be called from many different threads (for multi-threaded map render operations),
      82                 :            :      * and accordingly care must be taken to ensure that handleRenderedFeature() implementations are
      83                 :            :      * appropriately thread safe.
      84                 :            :      *
      85                 :            :      * The \a context argument is used to provide additional context relating to the rendering of a feature.
      86                 :            :      */
      87                 :            :     virtual void handleRenderedFeature( const QgsFeature &feature, const QgsGeometry &renderedBounds, const QgsRenderedFeatureHandlerInterface::RenderedFeatureContext &context ) = 0;
      88                 :            : 
      89                 :            :     /**
      90                 :            :      * Returns a list of attributes required by this handler, for the specified \a layer. Attributes not listed in here may
      91                 :            :      * not be requested from the provider at rendering time.
      92                 :            :      */
      93                 :          0 :     virtual QSet<QString> usedAttributes( QgsVectorLayer *layer, const QgsRenderContext &context ) const { Q_UNUSED( layer ); Q_UNUSED( context ); return QSet< QString >(); }
      94                 :            : };
      95                 :            : 
      96                 :            : #endif // QGSRENDEREDFEATUREHANDLERINTERFACE_H

Generated by: LCOV version 1.14