QGIS API Documentation
2.12.0-Lyon
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
core
qgsvectorlayerlabelprovider.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsvectorlayerlabelprovider.h
3
--------------------------------------
4
Date : September 2015
5
Copyright : (C) 2015 by Martin Dobias
6
Email : wonder dot sk at gmail 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 QGSVECTORLAYERLABELPROVIDER_H
17
#define QGSVECTORLAYERLABELPROVIDER_H
18
19
#include "
qgslabelingenginev2.h
"
20
21
class
QgsAbstractFeatureSource
;
22
30
class
CORE_EXPORT
QgsVectorLayerLabelProvider
:
public
QgsAbstractLabelProvider
31
{
32
public
:
33
35
explicit
QgsVectorLayerLabelProvider
(
QgsVectorLayer
* layer,
bool
withFeatureLoop =
true
,
const
QgsPalLayerSettings
* settings = 0,
const
QString
& layerName =
QString
() );
36
38
QgsVectorLayerLabelProvider
(
const
QgsPalLayerSettings
& settings,
39
const
QString
& layerId,
40
const
QgsFields
& fields,
41
const
QgsCoordinateReferenceSystem
& crs,
42
QgsAbstractFeatureSource
* source,
43
bool
ownsSource );
44
45
~
QgsVectorLayerLabelProvider
();
46
47
virtual
QList<QgsLabelFeature*>
labelFeatures
(
QgsRenderContext
& context )
override
;
48
49
virtual
void
drawLabel
(
QgsRenderContext
& context,
pal::LabelPosition
* label )
const override
;
50
51
// new virtual methods
52
59
virtual
bool
prepare(
const
QgsRenderContext
& context,
QStringList
& attributeNames );
60
68
virtual
void
registerFeature(
QgsFeature
& feature,
QgsRenderContext
&context );
69
70
protected
:
72
void
init();
74
void
drawLabelPrivate(
pal::LabelPosition
* label,
QgsRenderContext
& context,
QgsPalLayerSettings
& tmpLyr,
QgsPalLabeling::DrawLabelType
drawType,
double
dpiRatio = 1.0 )
const
;
75
76
protected
:
78
QgsPalLayerSettings
mSettings
;
80
QString
mLayerId
;
81
82
// these are needed only if using own renderer loop
83
85
QgsFields
mFields
;
87
QgsCoordinateReferenceSystem
mCrs
;
89
QgsAbstractFeatureSource
*
mSource
;
91
bool
mOwnsSource
;
92
94
QList<QgsLabelFeature*>
mLabels
;
95
};
96
97
98
#endif // QGSVECTORLAYERLABELPROVIDER_H
QgsVectorLayerLabelProvider::mOwnsSource
bool mOwnsSource
Whether layer's feature source is owned.
Definition:
qgsvectorlayerlabelprovider.h:91
QgsPalLayerSettings
Definition:
qgspallabeling.h:63
QgsFields
Container of fields for a vector layer.
Definition:
qgsfield.h:177
QgsVectorLayerLabelProvider
The QgsVectorLayerLabelProvider class implements a label provider for vector layers.
Definition:
qgsvectorlayerlabelprovider.h:30
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition:
qgsfeature.h:176
QgsVectorLayerLabelProvider::mLabels
QList< QgsLabelFeature * > mLabels
List of generated.
Definition:
qgsvectorlayerlabelprovider.h:94
QgsAbstractLabelProvider::labelFeatures
virtual QList< QgsLabelFeature * > labelFeatures(QgsRenderContext &context)=0
Return list of label features (they are owned by the provider and thus deleted on its destruction) ...
QgsVectorLayerLabelProvider::mSettings
QgsPalLayerSettings mSettings
Layer's labeling configuration.
Definition:
qgsvectorlayerlabelprovider.h:78
QString
QList< QgsLabelFeature * >
QgsAbstractFeatureSource
Base class that can be used for any class that is capable of returning features.
Definition:
qgsfeaturerequest.h:230
QStringList
QgsAbstractLabelProvider
The QgsAbstractLabelProvider class is an interface class.
Definition:
qgslabelingenginev2.h:248
QgsVectorLayerLabelProvider::mFields
QgsFields mFields
Layer's fields.
Definition:
qgsvectorlayerlabelprovider.h:85
QgsVectorLayerLabelProvider::mSource
QgsAbstractFeatureSource * mSource
Layer's feature source.
Definition:
qgsvectorlayerlabelprovider.h:89
QgsRenderContext
Contains information about the context of a rendering operation.
Definition:
qgsrendercontext.h:42
QgsVectorLayerLabelProvider::mCrs
QgsCoordinateReferenceSystem mCrs
Layer's CRS.
Definition:
qgsvectorlayerlabelprovider.h:87
qgslabelingenginev2.h
QgsCoordinateReferenceSystem
Class for storing a coordinate reference system (CRS)
Definition:
qgscoordinatereferencesystem.h:50
pal::LabelPosition
LabelPosition is a candidate feature label position.
Definition:
labelposition.h:48
QgsVectorLayerLabelProvider::mLayerId
QString mLayerId
Layer's ID.
Definition:
qgsvectorlayerlabelprovider.h:80
QgsAbstractLabelProvider::drawLabel
virtual void drawLabel(QgsRenderContext &context, pal::LabelPosition *label) const =0
draw this label at the position determined by the labeling engine
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:628
QgsPalLabeling::DrawLabelType
DrawLabelType
Definition:
qgspallabeling.h:792
Generated on Sat Oct 24 2015 04:11:24 for QGIS API Documentation by
1.8.9.1