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

           Branch data     Line data    Source code
       1                 :            : /***************************************************************************
       2                 :            :  qgsmaskidprovider.h
       3                 :            :  ---------------------
       4                 :            :  begin                : August 2019
       5                 :            :  copyright            : (C) 2019 by Hugo Mercier / Oslandia
       6                 :            :  email                : infos 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                 :            : 
      16                 :            : #ifndef QGSMASKIDPROVIDER_H
      17                 :            : #define QGSMASKIDPROVIDER_H
      18                 :            : 
      19                 :            : #include <QList>
      20                 :            : #include <QSet>
      21                 :            : #include "qgssymbollayerreference.h"
      22                 :            : 
      23                 :            : /**
      24                 :            :  * \ingroup core
      25                 :            :  * \class QgsMaskIdProvider
      26                 :            :  *
      27                 :            :  * \brief This class allows the creation of mask ids based on the different label layers and to give a mask id from a label layer.
      28                 :            :  *
      29                 :            :  * Some rendering operations may need multiple mask images. This is the case for label rendering in which we can
      30                 :            :  * have different mask images: one different for each labeling rule for instance.
      31                 :            :  * Some label layers may need to share their mask images, some other need to have distinct mask images.
      32                 :            :  * Label layers share the same mask image if the set of symbol layers they mask is the same.
      33                 :            :  *
      34                 :            :  * A "mask id" is then associated to each label layer. They are contiguous integer numbers starting at 0.
      35                 :            :  *
      36                 :            :  * \since QGIS 3.12
      37                 :            :  */
      38                 :          0 : class CORE_EXPORT QgsMaskIdProvider
      39                 :            : {
      40                 :            :   public:
      41                 :            : 
      42                 :            :     /**
      43                 :            :      * Inserts a label layer to the provider and returns its associated mask id.
      44                 :            :      * \param layerId id of the vector layer that carries these labels
      45                 :            :      * \param ruleId id of the labeling rule, if any
      46                 :            :      * \param maskedSymbolLayers the symbol layers that are masked by this label layer
      47                 :            :      * \return the associated mask id.
      48                 :            :      */
      49                 :            :     int insertLabelLayer( const QString &layerId, const QString &ruleId, const QSet<QgsSymbolLayerReference> &maskedSymbolLayers );
      50                 :            : 
      51                 :            :     /**
      52                 :            :      * Returns the mask id associated with a label layer and its optional label rule.
      53                 :            :      * Returns -1 if not found.
      54                 :            :      */
      55                 :            :     int maskId( const QString &labelLayerId = QString(), const QString &labelRuleId = QString() ) const;
      56                 :            : 
      57                 :            :     /**
      58                 :            :      * Returns the number of identifiers allocated.
      59                 :            :      */
      60                 :            :     int size() const;
      61                 :            : 
      62                 :            :   private:
      63                 :            : 
      64                 :            :     /**
      65                 :            :      * Storage of symbol layer references sets. The index in the list gives the associated mask id.
      66                 :            :      */
      67                 :            :     QList<QSet<QgsSymbolLayerReference>> mLabelLayers;
      68                 :            : 
      69                 :            :     /**
      70                 :            :      * Mapping from a set of label layer identifiers (as string) to an integer (its index in the list)
      71                 :            :      */
      72                 :            :     QList<QSet<QString>> mMaskIds;
      73                 :            : };
      74                 :            : 
      75                 :            : #endif

Generated by: LCOV version 1.14