QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | List of all members
QgsLabel Class Reference

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
QgsFieldsfields ()
 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.
QgsLabelAttributeslabelAttributes ()
 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.

Detailed Description

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.

Member Enumeration Documentation

Enumerator:
Text 
Family 
Size 
SizeType 
Bold 
Italic 
Underline 
Color 
XCoordinate 
YCoordinate 
XOffset 
YOffset 
Angle 
Alignment 
BufferEnabled 
BufferSize 
BufferColor 
BufferBrush 
BorderWidth 
BorderColor 
BorderStyle 
MultilineEnabled 
StrikeOut 
LabelFieldCount 

Definition at line 59 of file qgslabel.h.

Constructor & Destructor Documentation

QgsLabel::QgsLabel ( const QgsFields fields)

Definition at line 47 of file qgslabel.cpp.

QgsLabel::~QgsLabel ( )

Definition at line 61 of file qgslabel.cpp.

Member Function Documentation

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.

Note
this replaces the to-be-deprecated layerAttributes method.
introduced in QGIS 1.4

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.

Parameters
nodethe 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

Parameters
renderContextthe render context
featurefeature to render the label for
selectedfeature is selected
classAttributesattributes 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.


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