QGIS API Documentation
2.8.2-Wien
|
A class to render labels. More...
#include <qgslabel.h>
Classes | |
struct | labelpoint |
Public Types | |
enum | LabelField { Text = 0, Family, Size, SizeType, Bold, Italic, Underline, Color, XCoordinate, YCoordinate, XOffset, YOffset, Angle, Alignment, BufferEnabled, BufferSize, BufferColor, BufferBrush, BorderWidth, BorderColor, BorderStyle, MultilineEnabled, StrikeOut, LabelFieldCount } |
Public Member Functions | |
QgsLabel (const QgsFields &fields) | |
~QgsLabel () | |
void | addRequiredFields (QgsAttributeList &fields) const |
add vector of required fields to existing list of fields | |
QgsFields & | fields () |
Available vector fields. | |
QString | fieldValue (int attr, QgsFeature &feature) |
Get field value if : 1) field name is not empty 2) field exists 3) value is defined otherwise returns empty string. | |
QgsLabelAttributes * | labelAttributes () |
Pointer to default attributes. | |
QString | labelField (int attr) const |
label field | |
float | maxScale () const |
float | minScale () const |
void | readXML (const QDomNode &node) |
Reads the renderer configuration from an XML file. | |
void | renderLabel (QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes=0) |
render label | |
bool | scaleBasedVisibility () const |
void | setFields (const QgsFields &fields) |
Set available fields. | |
void | setLabelField (int attr, int fieldIndex) |
Set label field. | |
void | setMaxScale (float theMaxScale) |
Accessor and mutator for the maximum scale member. | |
void | setMinScale (float theMinScale) |
Accessor and mutator for the minimum scale member. | |
void | setScaleBasedVisibility (bool theVisibilityFlag) |
Accessor and mutator for the scale based visilibility flag. | |
void | writeXML (QDomNode &label_node, QDomDocument &document) const |
Writes the contents of the renderer to a configuration file. |
A class to render labels.
Label rendering properties can be either specified directly or in most cases determined dynamically based on the value of an attribute.
Definition at line 51 of file qgslabel.h.
enum QgsLabel::LabelField |
Definition at line 59 of file qgslabel.h.
QgsLabel::QgsLabel | ( | const QgsFields & | fields | ) |
Definition at line 47 of file qgslabel.cpp.
QgsLabel::~QgsLabel | ( | ) |
Definition at line 61 of file qgslabel.cpp.
void QgsLabel::addRequiredFields | ( | QgsAttributeList & | fields | ) | const |
add vector of required fields to existing list of fields
Definition at line 459 of file qgslabel.cpp.
QgsFields & QgsLabel::fields | ( | void | ) |
Available vector fields.
Definition at line 486 of file qgslabel.cpp.
QString QgsLabel::fieldValue | ( | int | attr, |
QgsFeature & | feature | ||
) |
Get field value if : 1) field name is not empty 2) field exists 3) value is defined otherwise returns empty string.
Definition at line 66 of file qgslabel.cpp.
QgsLabelAttributes * QgsLabel::labelAttributes | ( | void | ) |
Pointer to default attributes.
Definition at line 510 of file qgslabel.cpp.
QString QgsLabel::labelField | ( | int | attr | ) | const |
label field
Definition at line 499 of file qgslabel.cpp.
float QgsLabel::maxScale | ( | ) | const |
Definition at line 1399 of file qgslabel.cpp.
float QgsLabel::minScale | ( | ) | const |
Definition at line 1389 of file qgslabel.cpp.
void QgsLabel::readXML | ( | const QDomNode & | node | ) |
Reads the renderer configuration from an XML file.
node | the Dom node to read |
Definition at line 731 of file qgslabel.cpp.
void QgsLabel::renderLabel | ( | QgsRenderContext & | renderContext, |
QgsFeature & | feature, | ||
bool | selected, | ||
QgsLabelAttributes * | classAttributes = 0 |
||
) |
render label
renderContext | the render context |
feature | feature to render the label for |
selected | feature is selected |
classAttributes | attributes to create the label from |
Definition at line 72 of file qgslabel.cpp.
bool QgsLabel::scaleBasedVisibility | ( | ) | const |
Definition at line 1379 of file qgslabel.cpp.
void QgsLabel::setFields | ( | const QgsFields & | fields | ) |
Set available fields.
Definition at line 481 of file qgslabel.cpp.
void QgsLabel::setLabelField | ( | int | attr, |
int | fieldIndex | ||
) |
Set label field.
Definition at line 491 of file qgslabel.cpp.
void QgsLabel::setMaxScale | ( | float | theMaxScale | ) |
Accessor and mutator for the maximum scale member.
Definition at line 1394 of file qgslabel.cpp.
void QgsLabel::setMinScale | ( | float | theMinScale | ) |
Accessor and mutator for the minimum scale member.
Definition at line 1384 of file qgslabel.cpp.
void QgsLabel::setScaleBasedVisibility | ( | bool | theVisibilityFlag | ) |
Accessor and mutator for the scale based visilibility flag.
Definition at line 1374 of file qgslabel.cpp.
void QgsLabel::writeXML | ( | QDomNode & | label_node, |
QDomDocument & | document | ||
) | const |
Writes the contents of the renderer to a configuration file.
Definition at line 1024 of file qgslabel.cpp.