Skip to content
Permalink
Browse files

Move qgslabelsink to core/labeling and docs

  • Loading branch information
m-kuhn committed May 8, 2020
1 parent 50e63a7 commit 1514c08460ae16b97a171a1c94211df0a094dea7
@@ -287,7 +287,6 @@ SET(QGIS_CORE_SRCS
qgsimagecache.cpp
qgsinterval.cpp
qgsjsonutils.cpp
qgslabelsink.cpp
qgslayerdefinition.cpp
qgslegendrenderer.cpp
qgslegendsettings.cpp
@@ -593,6 +592,7 @@ SET(QGIS_CORE_SRCS
labeling/qgslabelingenginesettings.cpp
labeling/qgslabelobstaclesettings.cpp
labeling/qgslabelsearchtree.cpp
labeling/qgslabelsink.cpp
labeling/qgslabelthinningsettings.cpp
labeling/qgspallabeling.cpp
labeling/qgsrulebasedlabeling.cpp
File renamed without changes.
@@ -26,6 +26,14 @@
class QgsPalLayerSettings;
class QgsRuleBasedLabeling;

/**
* \ingroup core
* Abstract base class that can be used to intercept rendered labels from
* a labeling / rendering job.
*
* Internal class, not in public API. Added in QGIS 3.14
* \note not available in Python bindings
*/
class QgsLabelSink
{
public:
@@ -36,42 +44,35 @@ class QgsLabelSink

/**
* \ingroup core
* Implements a derived label provider internally used for DXF export
* Implements a derived label provider for use with QgsLabelSink.
*
* Internal class, not in public API. Added in QGIS 2.12
* \note not available in Python bindings
*/
class QgsLabelSinkProvider : public QgsVectorLayerLabelProvider
{
public:
//! construct the provider
explicit QgsLabelSinkProvider( QgsVectorLayer *layer, const QString &providerId, QgsLabelSink *dxf, const QgsPalLayerSettings *settings );
//! Creates a rule based label sink provider which will draw/register labels in \a sink.
explicit QgsLabelSinkProvider( QgsVectorLayer *layer, const QString &providerId, QgsLabelSink *sink, const QgsPalLayerSettings *settings );

/**
* Re-implementation that writes to DXF file instead of drawing with QPainter
* \param context render context
* \param label label
*/
void drawLabel( QgsRenderContext &context, pal::LabelPosition *label ) const override;

private:
//! pointer to parent DXF export where this instance is used
QgsLabelSink *mLabelSink = nullptr;
};

/**
* \ingroup core
* Implements a derived label provider for rule based labels internally used
* for DXF export
* Implements a derived label provider for rule based labels for use with QgsLabelSink.
*
* Internal class, not in public API. Added in QGIS 2.15
* \note not available in Python bindings
*/
class QgsRuleBasedLabelSinkProvider : public QgsRuleBasedLabelProvider
{
public:
//! construct the provider
explicit QgsRuleBasedLabelSinkProvider( const QgsRuleBasedLabeling &rules, QgsVectorLayer *layer, QgsLabelSink *destination );
//! Creates a rule based label sink provider which will draw/register labels in \a sink.
explicit QgsRuleBasedLabelSinkProvider( const QgsRuleBasedLabeling &rules, QgsVectorLayer *layer, QgsLabelSink *sink );

/**
* Reinitialize the subproviders with QgsLabelSinkProviders
@@ -80,18 +81,12 @@ class QgsRuleBasedLabelSinkProvider : public QgsRuleBasedLabelProvider
*/
Q_DECL_DEPRECATED void reinit( QgsVectorLayer *layer );

/**
* Re-implementation that writes to DXF file instead of drawing with QPainter
* \param context render context
* \param label label
*/
void drawLabel( QgsRenderContext &context, pal::LabelPosition *label ) const override;

//! create QgsRuleBasedLabelSinkProvider
//! Creates a QgsRuleBasedLabelSinkProvider
QgsVectorLayerLabelProvider *createProvider( QgsVectorLayer *layer, const QString &providerId, bool withFeatureLoop, const QgsPalLayerSettings *settings ) override;

private:
//! pointer to parent DXF export where this instance is used
QgsLabelSink *mLabelSink = nullptr;
};

0 comments on commit 1514c08

Please sign in to comment.
You can’t perform that action at this time.