QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | Protected Attributes | List of all members
QgsDxfRuleBasedLabelProvider Class Reference

Implements a derived label provider for rule based labels internally used for DXF export. More...

#include <qgsdxfpallabeling.h>

Inheritance diagram for QgsDxfRuleBasedLabelProvider:
Inheritance graph

Public Member Functions

 QgsDxfRuleBasedLabelProvider (const QgsRuleBasedLabeling &rules, QgsVectorLayer *layer, QgsDxfExport *dxf)
 construct the provider More...
virtual QgsVectorLayerLabelProvidercreateProvider (QgsVectorLayer *layer, const QString &providerId, bool withFeatureLoop, const QgsPalLayerSettings *settings) override
 create QgsDxfLabelProvider More...
void drawLabel (QgsRenderContext &context, pal::LabelPosition *label) const override
 Re-implementation that writes to DXF file instead of drawing with QPainter. More...
void registerDxfFeature (QgsFeature &feature, QgsRenderContext &context, const QString &dxfLayerName)
 Registration method that keeps track of DXF layer names of individual features. More...
void reinit (QgsVectorLayer *layer)
 Reinitialize the subproviders with QgsDxfLabelProviders. More...
- Public Member Functions inherited from QgsRuleBasedLabelProvider
 QgsRuleBasedLabelProvider (const QgsRuleBasedLabeling &rules, QgsVectorLayer *layer, bool withFeatureLoop=true)
 ~QgsRuleBasedLabelProvider ()
virtual bool prepare (const QgsRenderContext &context, QStringList &attributeNames) override
 Prepare for registration of features. More...
virtual void registerFeature (QgsFeature &feature, QgsRenderContext &context, QgsGeometry *obstacleGeometry=nullptr) override
 Register a feature for labeling as one or more QgsLabelFeature objects stored into mLabels. More...
virtual QList< QgsAbstractLabelProvider * > subProviders () override
 return subproviders More...
- Public Member Functions inherited from QgsVectorLayerLabelProvider
 QgsVectorLayerLabelProvider (QgsVectorLayer *layer, const QString &providerId, bool withFeatureLoop=true, const QgsPalLayerSettings *settings=nullptr, const QString &layerName=QString())
 Convenience constructor to initialize the provider from given vector layer. More...
 QgsVectorLayerLabelProvider (const QgsPalLayerSettings &settings, const QString &layerId, const QgsFields &fields, const QgsCoordinateReferenceSystem &crs, QgsAbstractFeatureSource *source, bool ownsSource, QgsFeatureRendererV2 *renderer=nullptr)
 Construct diagram provider with all the necessary configuration parameters. More...
 ~QgsVectorLayerLabelProvider ()
virtual QList< QgsLabelFeature * > labelFeatures (QgsRenderContext &context) override
 Return list of label features (they are owned by the provider and thus deleted on its destruction) More...
- Public Member Functions inherited from QgsAbstractLabelProvider
 QgsAbstractLabelProvider (const QString &layerId=QString(), const QString &providerId=QString())
 Construct the provider with default values. More...
virtual ~QgsAbstractLabelProvider ()
 Vritual destructor. More...
Flags flags () const
 Flags associated with the provider. More...
QString layerId () const
 Returns ID of associated layer, or empty string if no layer is associated with the provider. More...
unsigned int linePlacementFlags () const
 For layers with linestring geometries - extra placement flags (or-ed combination of QgsPalLayerSettings::LinePlacementFlags) More...
QString name () const
 Name of the layer (for statistics, debugging etc.) - does not need to be unique. More...
QgsPalLayerSettings::ObstacleType obstacleType () const
 How the feature geometries will work as obstacles. More...
QgsPalLayerSettings::Placement placement () const
 What placement strategy to use for the labels. More...
double priority () const
 Default priority of labels (may be overridden by individual labels) More...
QString providerId () const
 Returns provider ID - useful in case there is more than one label provider within a layer (e.g. More...
void setEngine (const QgsLabelingEngineV2 *engine)
 Associate provider with a labeling engine (should be only called internally from QgsLabelingEngineV2) More...
QgsPalLayerSettings::UpsideDownLabels upsidedownLabels () const
 How to handle labels that would be upside down. More...

Protected Attributes

 pointer to parent DXF export where this instance is used More...
- Protected Attributes inherited from QgsRuleBasedLabelProvider
QgsRuleBasedLabeling mRules
 owned copy More...
QgsRuleBasedLabeling::RuleToProviderMap mSubProviders
 label providers are owned by labeling engine More...
- Protected Attributes inherited from QgsVectorLayerLabelProvider
QgsCoordinateReferenceSystem mCrs
 Layer's CRS. More...
QgsFields mFields
 Layer's fields. More...
QList< QgsLabelFeature * > mLabels
 List of generated. More...
QGis::GeometryType mLayerGeometryType
 Geometry type of layer. More...
bool mOwnsSource
 Whether layer's feature source is owned. More...
QgsPalLayerSettings mSettings
 Layer's labeling configuration. More...
 Layer's feature source. More...
- Protected Attributes inherited from QgsAbstractLabelProvider
const QgsLabelingEngineV2mEngine
 Associated labeling engine. More...
Flags mFlags
 Flags altering drawing and registration of features. More...
QString mLayerId
 Associated layer's ID, if applicable. More...
unsigned int mLinePlacementFlags
 Extra placement flags for linestring geometries. More...
QString mName
 Name of the layer. More...
QgsPalLayerSettings::ObstacleType mObstacleType
 Type of the obstacle of feature geometries. More...
QgsPalLayerSettings::Placement mPlacement
 Placement strategy. More...
double mPriority
 Default priority of labels. More...
QString mProviderId
 Associated provider ID (one layer may have multiple providers, e.g. in rule-based labeling) More...
QgsPalLayerSettings::UpsideDownLabels mUpsidedownLabels
 How to handle labels that would be upside down. More...

Additional Inherited Members

- Public Types inherited from QgsAbstractLabelProvider
enum  Flag {
  DrawLabels = 1 << 1, DrawAllLabels = 1 << 2, MergeConnectedLines = 1 << 3, CentroidMustBeInside = 1 << 4,
  LabelPerFeaturePart = 1 << 6
- Static Public Member Functions inherited from QgsVectorLayerLabelProvider
static QgsGeometrygetPointObstacleGeometry (QgsFeature &fet, QgsRenderContext &context, const QgsSymbolV2List &symbols)
 Returns the geometry for a point feature which should be used as an obstacle for labels. More...
- Protected Member Functions inherited from QgsVectorLayerLabelProvider
void drawLabelPrivate (pal::LabelPosition *label, QgsRenderContext &context, QgsPalLayerSettings &tmpLyr, QgsPalLabeling::DrawLabelType drawType, double dpiRatio=1.0) const
 Internal label drawing method. More...
void init ()
 initialization method - called from constructors More...

Detailed Description

Implements a derived label provider for rule based labels internally used for DXF export.

Internal class, not in public API. Added in QGIS 2.15

not available in Python bindings

Definition at line 68 of file qgsdxfpallabeling.h.

Constructor & Destructor Documentation

◆ QgsDxfRuleBasedLabelProvider()

QgsDxfRuleBasedLabelProvider::QgsDxfRuleBasedLabelProvider ( const QgsRuleBasedLabeling rules,
QgsVectorLayer layer,
QgsDxfExport dxf 

construct the provider

Definition at line 43 of file qgsdxfpallabeling.cpp.

Member Function Documentation

◆ createProvider()

QgsVectorLayerLabelProvider * QgsDxfRuleBasedLabelProvider::createProvider ( QgsVectorLayer layer,
const QString providerId,
bool  withFeatureLoop,
const QgsPalLayerSettings settings 

create QgsDxfLabelProvider

Reimplemented from QgsRuleBasedLabelProvider.

Definition at line 55 of file qgsdxfpallabeling.cpp.

◆ drawLabel()

void QgsDxfRuleBasedLabelProvider::drawLabel ( QgsRenderContext context,
pal::LabelPosition label 
) const

Re-implementation that writes to DXF file instead of drawing with QPainter.

contextrender context

Reimplemented from QgsVectorLayerLabelProvider.

Definition at line 62 of file qgsdxfpallabeling.cpp.

◆ registerDxfFeature()

void QgsDxfRuleBasedLabelProvider::registerDxfFeature ( QgsFeature feature,
QgsRenderContext context,
const QString dxfLayerName 

Registration method that keeps track of DXF layer names of individual features.

contextrender context
dxfLayerNamename of dxf layer

Definition at line 69 of file qgsdxfpallabeling.cpp.

◆ reinit()

void QgsDxfRuleBasedLabelProvider::reinit ( QgsVectorLayer layer)

Reinitialize the subproviders with QgsDxfLabelProviders.


Definition at line 49 of file qgsdxfpallabeling.cpp.

Member Data Documentation

◆ mDxfExport

QgsDxfExport* QgsDxfRuleBasedLabelProvider::mDxfExport

pointer to parent DXF export where this instance is used

Definition at line 97 of file qgsdxfpallabeling.h.

The documentation for this class was generated from the following files: