QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgslabelsink.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslabelsink.h
3  -------------------
4  begin : January 2014
5  copyright : (C) 2014 by Marco Hugentobler
6  email : marco at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSLABELSINK_H
19 #define QGSLABELSINK_H
20 
21 #define SIP_NO_FILE
22 
24 #include "qgsrulebasedlabeling.h"
25 
28 
38 {
39  public:
40  virtual ~QgsLabelSink() = default;
41 
47  virtual void drawLabel( const QString &layerId, QgsRenderContext &context, pal::LabelPosition *label, const QgsPalLayerSettings &settings ) = 0;
48 };
49 
58 {
59  public:
62 
63  void drawLabel( QgsRenderContext &context, pal::LabelPosition *label ) const override;
64 
65  private:
66  QgsLabelSink *mLabelSink = nullptr;
67 };
68 
77 {
78  public:
81 
86  Q_DECL_DEPRECATED void reinit( QgsVectorLayer *layer );
87 
88  void drawLabel( QgsRenderContext &context, pal::LabelPosition *label ) const override;
89 
91  QgsVectorLayerLabelProvider *createProvider( QgsVectorLayer *layer, const QString &providerId, bool withFeatureLoop, const QgsPalLayerSettings *settings ) override;
92 
93  private:
94  QgsLabelSink *mLabelSink = nullptr;
95 };
96 
97 
98 
99 #endif // QGSLABELSINK_H
QgsPalLayerSettings
Definition: qgspallabeling.h:205
QgsRuleBasedLabelSinkProvider
Definition: qgslabelsink.h:76
pal::LabelPosition
LabelPosition is a candidate feature label position.
Definition: labelposition.h:55
QgsLabelSink
Definition: qgslabelsink.h:37
QgsRenderContext
Definition: qgsrendercontext.h:57
QgsRuleBasedLabelSinkProvider::QgsRuleBasedLabelSinkProvider
QgsRuleBasedLabelSinkProvider(const QgsRuleBasedLabeling &rules, QgsVectorLayer *layer, QgsLabelSink *sink)
Creates a rule based label sink provider which will draw/register labels in sink.
Definition: qgslabelsink.cpp:35
QgsVectorLayerLabelProvider
The QgsVectorLayerLabelProvider class implements a label provider for vector layers....
Definition: qgsvectorlayerlabelprovider.h:40
QgsRuleBasedLabeling
Definition: qgsrulebasedlabeling.h:40
QgsVectorLayerLabelProvider::settings
const QgsPalLayerSettings & settings() const
Returns the layer's settings.
Definition: qgsvectorlayerlabelprovider.cpp:647
QgsLabelSink::~QgsLabelSink
virtual ~QgsLabelSink()=default
qgsrulebasedlabeling.h
QgsRuleBasedLabelSinkProvider::drawLabel
void drawLabel(QgsRenderContext &context, pal::LabelPosition *label) const override
Draw this label at the position determined by the labeling engine.
Definition: qgslabelsink.cpp:53
QgsLabelSinkProvider::QgsLabelSinkProvider
QgsLabelSinkProvider(QgsVectorLayer *layer, const QString &providerId, QgsLabelSink *sink, const QgsPalLayerSettings *settings)
Creates a rule based label sink provider which will draw/register labels in sink.
Definition: qgslabelsink.cpp:23
QgsRuleBasedLabelSinkProvider::reinit
Q_DECL_DEPRECATED void reinit(QgsVectorLayer *layer)
Reinitialize the subproviders with QgsLabelSinkProviders.
Definition: qgslabelsink.cpp:42
QgsAbstractLabelProvider::providerId
QString providerId() const
Returns provider ID - useful in case there is more than one label provider within a layer (e....
Definition: qgslabelingengine.h:137
QgsLabelSink::drawLabel
virtual void drawLabel(const QString &layerId, QgsRenderContext &context, pal::LabelPosition *label, const QgsPalLayerSettings &settings)=0
The drawLabel method is called for each label that is being drawn.
QgsLabelSinkProvider::drawLabel
void drawLabel(QgsRenderContext &context, pal::LabelPosition *label) const override
Draw this label at the position determined by the labeling engine.
Definition: qgslabelsink.cpp:29
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsLabelSinkProvider
Definition: qgslabelsink.h:57
QgsAbstractLabelProvider::layer
QgsMapLayer * layer() const
Returns the associated layer, or nullptr if no layer is associated with the provider.
Definition: qgslabelingengine.h:130
qgsvectorlayerlabelprovider.h
QgsRuleBasedLabelSinkProvider::createProvider
QgsVectorLayerLabelProvider * createProvider(QgsVectorLayer *layer, const QString &providerId, bool withFeatureLoop, const QgsPalLayerSettings *settings) override
Creates a QgsRuleBasedLabelSinkProvider.
Definition: qgslabelsink.cpp:47
QgsRuleBasedLabelProvider
Definition: qgsrulebasedlabeling.h:401