1
/***************************************************************************
2
qgslabel.h - render vector labels
5
copyright : (C) 2004 by Radim Blazek
7
***************************************************************************/
8
/***************************************************************************
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
15
***************************************************************************/
16
/* $Id: qgslabel.h,v 1.9.2.1 2005/06/03 09:42:55 g_j_m Exp $ */
33
class QgsLabelAttributes;
36
class QgsCoordinateTransform;
38
/** Render class to display labels */
42
QgsLabel ( std::vector<QgsField> const & fields );
71
void dialog( QWidget * parent = 0 );
73
/** \brief render label
74
* \param sizeScale global scale factor for size in pixels, labels in map units are not scaled
76
void renderLabel ( QPainter* painter, QgsRect* viewExtent,
77
const QgsCoordinateTransform& coordTransform,
78
bool doCoordTransform,
79
QgsMapToPixel *transform, QPaintDevice *device,
80
QgsFeature *feature, bool selected, QgsLabelAttributes *classAttributes=0, double sizeScale = 1.);
82
/** Reads the renderer configuration from an XML file
83
@param rnode the DOM node to read
85
void readXML(const QDomNode& node);
87
/** Writes the contents of the renderer to a configuration file */
88
void writeXML(std::ostream& xml);
90
//! add vector of required fields to existing list of fields
91
void addRequiredFields ( std::list<int> *fields );
93
//! Available vector fields
94
std::vector<QgsField> & QgsLabel::fields ( void );
96
//! Pointer to default attributes
97
QgsLabelAttributes *layerAttributes ( void );
100
void setLabelField ( int attr, const QString str );
103
QString labelField ( int attr );
105
/** Get field value if : 1) field name is not empty
107
* 3) value is defined
108
* otherwise returns empty string
110
QString fieldValue ( int attr, QgsFeature *feature );
113
/** Get label point for simple feature in map units */
114
QgsPoint labelPoint ( QgsFeature *feature );
116
/** Color to draw selected features */
117
QColor mSelectionColor;
119
//! Default layer attributes
120
QgsLabelAttributes *mLabelAttributes;
122
//! Available layer fields
123
std::vector<QgsField> mField;
126
std::vector<QString> mLabelField;
128
//! Label field indexes
129
std::vector<int> mLabelFieldIdx;