QGIS API Documentation  2.6.0-Brighton
 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 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.
QgsFieldsfields ()
 Available vector fields.
QgsLabelAttributeslabelAttributes ()
 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

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.

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 

Constructor & Destructor Documentation

QgsLabel::QgsLabel ( const QgsFields fields)
QgsLabel::~QgsLabel ( )

Member Function Documentation

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.

Note
this replaces the to-be-deprecated layerAttributes method.
introduced in QGIS 1.4
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.

Parameters
nodethe Dom node to read
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
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.


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