QGIS API Documentation  2.12.0-Lyon
Public Types | Public Member Functions | Protected Attributes | List of all members
QgsAbstractLabelProvider Class Referenceabstract

The QgsAbstractLabelProvider class is an interface class. More...

#include <qgslabelingenginev2.h>

Inheritance diagram for QgsAbstractLabelProvider:
Inheritance graph
[legend]

Public Types

enum  Flag {
  DrawLabels = 1 << 1, DrawAllLabels = 1 << 2, MergeConnectedLines = 1 << 3, CentroidMustBeInside = 1 << 4,
  FitInPolygonOnly = 1 << 5, LabelPerFeaturePart = 1 << 6
}
 

Public Member Functions

 QgsAbstractLabelProvider ()
 Construct the provider with default values. More...
 
virtual ~QgsAbstractLabelProvider ()
 Vritual destructor. More...
 
virtual void drawLabel (QgsRenderContext &context, pal::LabelPosition *label) const =0
 draw this label at the position determined by the labeling engine More...
 
Flags flags () const
 Flags associated with the provider. More...
 
virtual QList< QgsLabelFeature * > labelFeatures (QgsRenderContext &context)=0
 Return list of label features (they are owned by the provider and thus deleted on its destruction) 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...
 
void setEngine (const QgsLabelingEngineV2 *engine)
 Associate provider with a labeling engine (should be only called internally from QgsLabelingEngineV2) More...
 
virtual QList< QgsAbstractLabelProvider * > subProviders ()
 Return list of child providers - useful if the provider needs to put labels into more layers with different configuration. More...
 
QgsPalLayerSettings::UpsideDownLabels upsidedownLabels () const
 How to handle labels that would be upside down. More...
 

Protected Attributes

const QgsLabelingEngineV2mEngine
 Associated labeling engine. More...
 
Flags mFlags
 Flags altering drawing and registration of features. 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...
 
QgsPalLayerSettings::UpsideDownLabels mUpsidedownLabels
 How to handle labels that would be upside down. More...
 

Detailed Description

The QgsAbstractLabelProvider class is an interface class.

Implementations return list of labels and their associated geometries - these are used by QgsLabelingEngineV2 to compute the final layout of labels.

Implementations also take care of drawing the returned final label positions.

Note
this class is not a part of public API yet. See notes in QgsLabelingEngineV2
added in QGIS 2.12

Definition at line 248 of file qgslabelingenginev2.h.

Member Enumeration Documentation

Enumerator
DrawLabels 

whether the labels should be rendered

DrawAllLabels 

whether all features will be labelled even though overlaps occur

MergeConnectedLines 

whether adjacent lines (with the same label text) should be merged

CentroidMustBeInside 

whether location of centroid must be inside of polygons

FitInPolygonOnly 

whether labels must fall completely within the polygon

LabelPerFeaturePart 

whether to label each part of multi-part features separately

Definition at line 260 of file qgslabelingenginev2.h.

Constructor & Destructor Documentation

QgsAbstractLabelProvider::QgsAbstractLabelProvider ( )

Construct the provider with default values.

Definition at line 381 of file qgslabelingenginev2.cpp.

virtual QgsAbstractLabelProvider::~QgsAbstractLabelProvider ( )
inlinevirtual

Vritual destructor.

Definition at line 255 of file qgslabelingenginev2.h.

Member Function Documentation

virtual void QgsAbstractLabelProvider::drawLabel ( QgsRenderContext context,
pal::LabelPosition label 
) const
pure virtual

draw this label at the position determined by the labeling engine

Implemented in QgsVectorLayerDiagramProvider, QgsVectorLayerLabelProvider, and QgsDxfLabelProvider.

Flags QgsAbstractLabelProvider::flags ( ) const
inline

Flags associated with the provider.

Definition at line 284 of file qgslabelingenginev2.h.

virtual QList<QgsLabelFeature*> QgsAbstractLabelProvider::labelFeatures ( QgsRenderContext context)
pure virtual

Return list of label features (they are owned by the provider and thus deleted on its destruction)

Implemented in QgsVectorLayerDiagramProvider, and QgsVectorLayerLabelProvider.

unsigned int QgsAbstractLabelProvider::linePlacementFlags ( ) const
inline

For layers with linestring geometries - extra placement flags (or-ed combination of QgsPalLayerSettings::LinePlacementFlags)

Definition at line 290 of file qgslabelingenginev2.h.

QString QgsAbstractLabelProvider::name ( ) const
inline

Name of the layer (for statistics, debugging etc.) - does not need to be unique.

Definition at line 281 of file qgslabelingenginev2.h.

QgsPalLayerSettings::ObstacleType QgsAbstractLabelProvider::obstacleType ( ) const
inline

How the feature geometries will work as obstacles.

Definition at line 296 of file qgslabelingenginev2.h.

QgsPalLayerSettings::Placement QgsAbstractLabelProvider::placement ( ) const
inline

What placement strategy to use for the labels.

Definition at line 287 of file qgslabelingenginev2.h.

double QgsAbstractLabelProvider::priority ( ) const
inline

Default priority of labels (may be overridden by individual labels)

Definition at line 293 of file qgslabelingenginev2.h.

void QgsAbstractLabelProvider::setEngine ( const QgsLabelingEngineV2 engine)
inline

Associate provider with a labeling engine (should be only called internally from QgsLabelingEngineV2)

Definition at line 258 of file qgslabelingenginev2.h.

virtual QList<QgsAbstractLabelProvider*> QgsAbstractLabelProvider::subProviders ( )
inlinevirtual

Return list of child providers - useful if the provider needs to put labels into more layers with different configuration.

Reimplemented in QgsRuleBasedLabelProvider.

Definition at line 278 of file qgslabelingenginev2.h.

QgsPalLayerSettings::UpsideDownLabels QgsAbstractLabelProvider::upsidedownLabels ( ) const
inline

How to handle labels that would be upside down.

Definition at line 299 of file qgslabelingenginev2.h.

Member Data Documentation

const QgsLabelingEngineV2* QgsAbstractLabelProvider::mEngine
protected

Associated labeling engine.

Definition at line 303 of file qgslabelingenginev2.h.

Flags QgsAbstractLabelProvider::mFlags
protected

Flags altering drawing and registration of features.

Definition at line 308 of file qgslabelingenginev2.h.

unsigned int QgsAbstractLabelProvider::mLinePlacementFlags
protected

Extra placement flags for linestring geometries.

Definition at line 312 of file qgslabelingenginev2.h.

QString QgsAbstractLabelProvider::mName
protected

Name of the layer.

Definition at line 306 of file qgslabelingenginev2.h.

QgsPalLayerSettings::ObstacleType QgsAbstractLabelProvider::mObstacleType
protected

Type of the obstacle of feature geometries.

Definition at line 316 of file qgslabelingenginev2.h.

QgsPalLayerSettings::Placement QgsAbstractLabelProvider::mPlacement
protected

Placement strategy.

Definition at line 310 of file qgslabelingenginev2.h.

double QgsAbstractLabelProvider::mPriority
protected

Default priority of labels.

Definition at line 314 of file qgslabelingenginev2.h.

QgsPalLayerSettings::UpsideDownLabels QgsAbstractLabelProvider::mUpsidedownLabels
protected

How to handle labels that would be upside down.

Definition at line 318 of file qgslabelingenginev2.h.


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