QGIS API Documentation
2.6.0-Brighton
|
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 | renderLabel (QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes=0) |
render label | |
void | readXML (const QDomNode &node) |
Reads the renderer configuration from an XML file. | |
void | writeXML (QDomNode &label_node, QDomDocument &document) const |
Writes the contents of the renderer to a configuration file. | |
void | addRequiredFields (QgsAttributeList &fields) const |
add vector of required fields to existing list of fields | |
void | setFields (const QgsFields &fields) |
Set available fields. | |
QgsFields & | fields () |
Available vector fields. | |
QgsLabelAttributes * | labelAttributes () |
Pointer to default attributes. | |
void | setLabelField (int attr, int fieldIndex) |
Set label field. | |
QString | labelField (int attr) const |
label field | |
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. | |
void | setMinScale (float theMinScale) |
Accessor and mutator for the minimum scale member. | |
float | minScale () const |
void | setMaxScale (float theMaxScale) |
Accessor and mutator for the maximum scale member. | |
float | maxScale () const |
void | setScaleBasedVisibility (bool theVisibilityFlag) |
Accessor and mutator for the scale based visilibility flag. | |
bool | scaleBasedVisibility () const |
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.
enum QgsLabel::LabelField |
QgsLabel::QgsLabel | ( | const QgsFields & | fields | ) |
QgsLabel::~QgsLabel | ( | ) |
void QgsLabel::addRequiredFields | ( | QgsAttributeList & | fields | ) | const |
add vector of required fields to existing list of fields
QgsFields & QgsLabel::fields | ( | void | ) |
Available vector fields.
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.
QgsLabelAttributes * QgsLabel::labelAttributes | ( | void | ) |
Pointer to default attributes.
QString QgsLabel::labelField | ( | int | attr | ) | const |
label field
float QgsLabel::maxScale | ( | ) | const |
float QgsLabel::minScale | ( | ) | const |
void QgsLabel::readXML | ( | const QDomNode & | node | ) |
Reads the renderer configuration from an XML file.
node | the Dom node to read |
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 |
bool QgsLabel::scaleBasedVisibility | ( | ) | const |
void QgsLabel::setFields | ( | const QgsFields & | fields | ) |
Set available fields.
void QgsLabel::setLabelField | ( | int | attr, |
int | fieldIndex | ||
) |
Set label field.
void QgsLabel::setMaxScale | ( | float | theMaxScale | ) |
Accessor and mutator for the maximum scale member.
void QgsLabel::setMinScale | ( | float | theMinScale | ) |
Accessor and mutator for the minimum scale member.
void QgsLabel::setScaleBasedVisibility | ( | bool | theVisibilityFlag | ) |
Accessor and mutator for the scale based visilibility flag.
void QgsLabel::writeXML | ( | QDomNode & | label_node, |
QDomDocument & | document | ||
) | const |
Writes the contents of the renderer to a configuration file.