QgsLabelAttributes Class Reference
[Core]

#include <qgslabelattributes.h>

List of all members.


Detailed Description

A class to store attributes needed for label rendering.

Label attributes: border (color, width, style) / / text bounding box / / +-----------/--+ buffer (color, pattern) | / | / | +----+ |/ --+ | |Text| / |--- text size | +----+ /| --+ | | +--------------+ | | | | >|----|<--- buffer width | >|<--- border width

Text:

Position:

Buffer:

Border:

Each attribute is either set or unset.

Definition at line 77 of file qgslabelattributes.h.

Public Types

enum  Units { MapUnits = 0, PointUnits }

Public Member Functions

 QgsLabelAttributes (bool def=true)
 Constructor.
 ~QgsLabelAttributes ()
void setText (const QString &text)
bool textIsSet (void) const
const QString text (void) const
void setFamily (const QString &family)
bool familyIsSet (void) const
const QString family (void) const
void setBold (bool enable)
bool boldIsSet (void) const
bool bold (void) const
void setItalic (bool enable)
bool italicIsSet (void) const
bool italic (void) const
void setUnderline (bool enable)
bool underlineIsSet (void) const
bool underline (void) const
void setSize (double size, int type)
bool sizeIsSet (void) const
int sizeType (void) const
double size (void) const
void setColor (const QColor &color)
bool colorIsSet (void) const
const QColor & color (void) const
void setOffset (double x, double y, int type)
bool offsetIsSet (void) const
int offsetType (void) const
double xOffset (void) const
double yOffset (void) const
void setAngle (double angle)
bool angleIsSet (void) const
double angle (void) const
bool angleIsAuto (void) const
void setAutoAngle (bool state)
void setAlignment (int alignment)
bool alignmentIsSet (void) const
int alignment (void) const
bool bufferEnabled () const
void setBufferEnabled (bool useBufferFlag)
void setBufferSize (double size, int type)
bool bufferSizeIsSet (void) const
int bufferSizeType (void) const
double bufferSize (void) const
void setBufferColor (const QColor &color)
bool bufferColorIsSet (void) const
QColor bufferColor (void) const
void setBufferStyle (Qt::BrushStyle style)
bool bufferStyleIsSet (void) const
Qt::BrushStyle bufferStyle (void) const
void setBorderColor (const QColor &color)
bool borderColorIsSet (void) const
QColor borderColor (void) const
void setBorderWidth (int width)
bool borderWidthIsSet (void) const
int borderWidth (void) const
void setBorderStyle (Qt::PenStyle style)
bool borderStyleIsSet (void) const
Qt::PenStyle borderStyle (void) const
bool multilineEnabled () const
void setMultilineEnabled (bool useMultiline)

Static Public Member Functions

static QString unitsName (int units)
static int unitsCode (const QString &name)
static QString alignmentName (int alignment)
static int alignmentCode (const QString &name)

Protected Attributes

QString mText
bool mTextIsSet
QFont mFont
 Font (family, weight, italic, underline).
bool mFamilyIsSet
bool mBoldIsSet
bool mItalicIsSet
bool mUnderlineIsSet
int mSizeType
 Font size, size type.
double mSize
bool mSizeIsSet
QColor mColor
 Color.
bool mColorIsSet
int mOffsetType
 Offset.
double mXOffset
double mYOffset
bool mOffsetIsSet
double mAngle
 Angle (degrees).
bool mAngleIsSet
bool mAngleIsAuto
int mAlignment
 Alignment.
bool mAlignmentIsSet
bool mBufferEnabledFlag
 Buffer enablement.
int mBufferSizeType
 Buffer size, size type.
double mBufferSize
bool mBufferSizeIsSet
QBrush mBufferBrush
 Buffer brush (color, style).
bool mBufferColorIsSet
bool mBufferStyleIsSet
QPen mBorderPen
 Border pen (color, width, style).
bool mBorderColorIsSet
bool mBorderWidthIsSet
bool mBorderStyleIsSet
bool mMultilineEnabledFlag
 Multiline enablement.


Member Enumeration Documentation

enum QgsLabelAttributes::Units

Enumerator:
MapUnits 
PointUnits 

Definition at line 88 of file qgslabelattributes.h.


Constructor & Destructor Documentation

QgsLabelAttributes::QgsLabelAttributes ( bool  def = true  ) 

Constructor.

Parameters:
def if true, defaults are set, if false all all attributes are unset

Definition at line 28 of file qgslabelattributes.cpp.

References mBoldIsSet, mFamilyIsSet, mFont, mItalicIsSet, mUnderlineIsSet, PointUnits, setAlignment(), setAngle(), setAutoAngle(), setBorderColor(), setBorderStyle(), setBorderWidth(), setBufferColor(), setBufferSize(), setBufferStyle(), setColor(), setOffset(), setSize(), and setText().

QgsLabelAttributes::~QgsLabelAttributes (  ) 

Definition at line 88 of file qgslabelattributes.cpp.


Member Function Documentation

QString QgsLabelAttributes::unitsName ( int  units  )  [static]

Definition at line 416 of file qgslabelattributes.cpp.

References MapUnits.

Referenced by QgsLabel::writeXML().

int QgsLabelAttributes::unitsCode ( const QString &  name  )  [static]

Definition at line 426 of file qgslabelattributes.cpp.

References MapUnits, and PointUnits.

Referenced by QgsLabel::readXML().

QString QgsLabelAttributes::alignmentName ( int  alignment  )  [static]

Definition at line 437 of file qgslabelattributes.cpp.

References QgsDebugMsg.

Referenced by QgsLabel::writeXML().

int QgsLabelAttributes::alignmentCode ( const QString &  name  )  [static]

Definition at line 453 of file qgslabelattributes.cpp.

Referenced by QgsLabel::readXML().

void QgsLabelAttributes::setText ( const QString &  text  ) 

Definition at line 92 of file qgslabelattributes.cpp.

References mText, and mTextIsSet.

Referenced by QgsLabelAttributes(), and QgsLabel::readXML().

bool QgsLabelAttributes::textIsSet ( void   )  const

Definition at line 98 of file qgslabelattributes.cpp.

References mTextIsSet.

Referenced by QgsLabel::writeXML().

const QString QgsLabelAttributes::text ( void   )  const

Definition at line 103 of file qgslabelattributes.cpp.

References mText.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setFamily ( const QString &  family  ) 

Definition at line 183 of file qgslabelattributes.cpp.

References mFamilyIsSet, and mFont.

Referenced by QgsLabel::readXML().

bool QgsLabelAttributes::familyIsSet ( void   )  const

Definition at line 189 of file qgslabelattributes.cpp.

References mFamilyIsSet.

Referenced by QgsLabel::writeXML().

const QString QgsLabelAttributes::family ( void   )  const

Definition at line 194 of file qgslabelattributes.cpp.

References mFont.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setBold ( bool  enable  ) 

Definition at line 200 of file qgslabelattributes.cpp.

References mBoldIsSet, and mFont.

Referenced by QgsLabel::readXML().

bool QgsLabelAttributes::boldIsSet ( void   )  const

Definition at line 206 of file qgslabelattributes.cpp.

References mBoldIsSet.

Referenced by QgsLabel::writeXML().

bool QgsLabelAttributes::bold ( void   )  const

Definition at line 211 of file qgslabelattributes.cpp.

References mFont.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setItalic ( bool  enable  ) 

Definition at line 217 of file qgslabelattributes.cpp.

References mFont, and mItalicIsSet.

Referenced by QgsLabel::readXML().

bool QgsLabelAttributes::italicIsSet ( void   )  const

Definition at line 223 of file qgslabelattributes.cpp.

References mItalicIsSet.

Referenced by QgsLabel::writeXML().

bool QgsLabelAttributes::italic ( void   )  const

Definition at line 228 of file qgslabelattributes.cpp.

References mFont.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setUnderline ( bool  enable  ) 

Definition at line 234 of file qgslabelattributes.cpp.

References mFont, and mUnderlineIsSet.

Referenced by QgsLabel::readXML().

bool QgsLabelAttributes::underlineIsSet ( void   )  const

Definition at line 240 of file qgslabelattributes.cpp.

References mUnderlineIsSet.

Referenced by QgsLabel::writeXML().

bool QgsLabelAttributes::underline ( void   )  const

Definition at line 245 of file qgslabelattributes.cpp.

References mFont.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setSize ( double  size,
int  type 
)

Definition at line 251 of file qgslabelattributes.cpp.

References mSize, mSizeIsSet, and mSizeType.

Referenced by QgsLabelAttributes(), QgsLabel::readXML(), and QgsQuickPrint::scaleTextLabels().

bool QgsLabelAttributes::sizeIsSet ( void   )  const

Definition at line 258 of file qgslabelattributes.cpp.

References mSizeIsSet.

Referenced by QgsLabel::writeXML().

int QgsLabelAttributes::sizeType ( void   )  const

Definition at line 263 of file qgslabelattributes.cpp.

References mSizeType.

Referenced by QgsLabel::renderLabel(), QgsQuickPrint::scaleTextLabels(), and QgsLabel::writeXML().

double QgsLabelAttributes::size ( void   )  const

Definition at line 268 of file qgslabelattributes.cpp.

References mSize.

Referenced by QgsLabel::renderLabel(), QgsQuickPrint::scaleTextLabels(), and QgsLabel::writeXML().

void QgsLabelAttributes::setColor ( const QColor &  color  ) 

Definition at line 274 of file qgslabelattributes.cpp.

References mColor, and mColorIsSet.

Referenced by QgsLabelAttributes(), and QgsLabel::readXML().

bool QgsLabelAttributes::colorIsSet ( void   )  const

Definition at line 280 of file qgslabelattributes.cpp.

References mColorIsSet.

Referenced by QgsLabel::writeXML().

const QColor & QgsLabelAttributes::color ( void   )  const

Definition at line 285 of file qgslabelattributes.cpp.

References mColor.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setOffset ( double  x,
double  y,
int  type 
)

Definition at line 110 of file qgslabelattributes.cpp.

References mOffsetIsSet, mOffsetType, mXOffset, and mYOffset.

Referenced by QgsLabelAttributes(), and QgsLabel::readXML().

bool QgsLabelAttributes::offsetIsSet ( void   )  const

Definition at line 118 of file qgslabelattributes.cpp.

References mOffsetIsSet.

Referenced by QgsLabel::writeXML().

int QgsLabelAttributes::offsetType ( void   )  const

Definition at line 123 of file qgslabelattributes.cpp.

References mOffsetType.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

double QgsLabelAttributes::xOffset ( void   )  const

Definition at line 128 of file qgslabelattributes.cpp.

References mXOffset.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

double QgsLabelAttributes::yOffset ( void   )  const

Definition at line 133 of file qgslabelattributes.cpp.

References mYOffset.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setAngle ( double  angle  ) 

Definition at line 139 of file qgslabelattributes.cpp.

References mAngle, and mAngleIsSet.

Referenced by QgsLabelAttributes(), and QgsLabel::readXML().

bool QgsLabelAttributes::angleIsSet ( void   )  const

Definition at line 145 of file qgslabelattributes.cpp.

References mAngleIsSet.

Referenced by QgsLabel::writeXML().

double QgsLabelAttributes::angle ( void   )  const

Definition at line 150 of file qgslabelattributes.cpp.

References mAngle.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

bool QgsLabelAttributes::angleIsAuto ( void   )  const

Definition at line 155 of file qgslabelattributes.cpp.

References mAngleIsAuto.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setAutoAngle ( bool  state  ) 

Definition at line 160 of file qgslabelattributes.cpp.

References mAngleIsAuto.

Referenced by QgsLabelAttributes(), and QgsLabel::readXML().

void QgsLabelAttributes::setAlignment ( int  alignment  ) 

Definition at line 166 of file qgslabelattributes.cpp.

References mAlignment, and mAlignmentIsSet.

Referenced by QgsLabelAttributes(), and QgsLabel::readXML().

bool QgsLabelAttributes::alignmentIsSet ( void   )  const

Definition at line 172 of file qgslabelattributes.cpp.

References mAlignmentIsSet.

Referenced by QgsLabel::writeXML().

int QgsLabelAttributes::alignment ( void   )  const

Definition at line 177 of file qgslabelattributes.cpp.

References mAlignment.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

bool QgsLabelAttributes::bufferEnabled (  )  const

Definition at line 291 of file qgslabelattributes.cpp.

References mBufferEnabledFlag.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setBufferEnabled ( bool  useBufferFlag  ) 

Definition at line 295 of file qgslabelattributes.cpp.

References mBufferEnabledFlag.

Referenced by QgsLabel::readXML().

void QgsLabelAttributes::setBufferSize ( double  size,
int  type 
)

Definition at line 299 of file qgslabelattributes.cpp.

References mBufferSize, mBufferSizeIsSet, and mBufferSizeType.

Referenced by QgsLabelAttributes(), and QgsLabel::readXML().

bool QgsLabelAttributes::bufferSizeIsSet ( void   )  const

Definition at line 306 of file qgslabelattributes.cpp.

References mBufferSizeIsSet.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

int QgsLabelAttributes::bufferSizeType ( void   )  const

Definition at line 311 of file qgslabelattributes.cpp.

References mBufferSizeType.

Referenced by QgsLabel::writeXML().

double QgsLabelAttributes::bufferSize ( void   )  const

Definition at line 316 of file qgslabelattributes.cpp.

References mBufferSize.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setBufferColor ( const QColor &  color  ) 

Definition at line 322 of file qgslabelattributes.cpp.

References mBufferBrush, and mBufferColorIsSet.

Referenced by QgsLabelAttributes(), and QgsLabel::readXML().

bool QgsLabelAttributes::bufferColorIsSet ( void   )  const

Definition at line 328 of file qgslabelattributes.cpp.

References mColorIsSet.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

QColor QgsLabelAttributes::bufferColor ( void   )  const

Definition at line 333 of file qgslabelattributes.cpp.

References mBufferBrush.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setBufferStyle ( Qt::BrushStyle  style  ) 

Definition at line 339 of file qgslabelattributes.cpp.

References mBufferBrush, and mBufferStyleIsSet.

Referenced by QgsLabelAttributes().

bool QgsLabelAttributes::bufferStyleIsSet ( void   )  const

Definition at line 345 of file qgslabelattributes.cpp.

References mBufferStyleIsSet.

Qt::BrushStyle QgsLabelAttributes::bufferStyle ( void   )  const

Definition at line 350 of file qgslabelattributes.cpp.

References mBufferBrush.

void QgsLabelAttributes::setBorderColor ( const QColor &  color  ) 

Definition at line 356 of file qgslabelattributes.cpp.

References mBorderColorIsSet, and mBorderPen.

Referenced by QgsLabelAttributes().

bool QgsLabelAttributes::borderColorIsSet ( void   )  const

Definition at line 362 of file qgslabelattributes.cpp.

References mBorderColorIsSet.

QColor QgsLabelAttributes::borderColor ( void   )  const

Definition at line 367 of file qgslabelattributes.cpp.

References mBorderPen.

void QgsLabelAttributes::setBorderWidth ( int  width  ) 

Definition at line 372 of file qgslabelattributes.cpp.

References mBorderPen, and mBorderWidthIsSet.

Referenced by QgsLabelAttributes().

bool QgsLabelAttributes::borderWidthIsSet ( void   )  const

Definition at line 378 of file qgslabelattributes.cpp.

References mBorderWidthIsSet.

int QgsLabelAttributes::borderWidth ( void   )  const

Definition at line 383 of file qgslabelattributes.cpp.

References mBorderPen.

void QgsLabelAttributes::setBorderStyle ( Qt::PenStyle  style  ) 

Definition at line 389 of file qgslabelattributes.cpp.

References mBorderPen, and mBorderStyleIsSet.

Referenced by QgsLabelAttributes().

bool QgsLabelAttributes::borderStyleIsSet ( void   )  const

Definition at line 395 of file qgslabelattributes.cpp.

References mBorderStyleIsSet.

Qt::PenStyle QgsLabelAttributes::borderStyle ( void   )  const

Definition at line 400 of file qgslabelattributes.cpp.

References mBorderPen.

bool QgsLabelAttributes::multilineEnabled (  )  const

Definition at line 406 of file qgslabelattributes.cpp.

References mMultilineEnabledFlag.

Referenced by QgsLabel::renderLabel(), and QgsLabel::writeXML().

void QgsLabelAttributes::setMultilineEnabled ( bool  useMultiline  ) 

Definition at line 410 of file qgslabelattributes.cpp.

References mMultilineEnabledFlag.

Referenced by QgsLabel::readXML().


Member Data Documentation

QString QgsLabelAttributes::mText [protected]

Definition at line 185 of file qgslabelattributes.h.

Referenced by setText(), and text().

bool QgsLabelAttributes::mTextIsSet [protected]

Definition at line 186 of file qgslabelattributes.h.

Referenced by setText(), and textIsSet().

QFont QgsLabelAttributes::mFont [protected]

Font (family, weight, italic, underline).

Definition at line 189 of file qgslabelattributes.h.

Referenced by bold(), family(), italic(), QgsLabelAttributes(), setBold(), setFamily(), setItalic(), setUnderline(), and underline().

bool QgsLabelAttributes::mFamilyIsSet [protected]

Definition at line 190 of file qgslabelattributes.h.

Referenced by familyIsSet(), QgsLabelAttributes(), and setFamily().

bool QgsLabelAttributes::mBoldIsSet [protected]

Definition at line 191 of file qgslabelattributes.h.

Referenced by boldIsSet(), QgsLabelAttributes(), and setBold().

bool QgsLabelAttributes::mItalicIsSet [protected]

Definition at line 192 of file qgslabelattributes.h.

Referenced by italicIsSet(), QgsLabelAttributes(), and setItalic().

bool QgsLabelAttributes::mUnderlineIsSet [protected]

Definition at line 193 of file qgslabelattributes.h.

Referenced by QgsLabelAttributes(), setUnderline(), and underlineIsSet().

int QgsLabelAttributes::mSizeType [protected]

Font size, size type.

Definition at line 196 of file qgslabelattributes.h.

Referenced by setSize(), and sizeType().

double QgsLabelAttributes::mSize [protected]

Definition at line 197 of file qgslabelattributes.h.

Referenced by setSize(), and size().

bool QgsLabelAttributes::mSizeIsSet [protected]

Definition at line 198 of file qgslabelattributes.h.

Referenced by setSize(), and sizeIsSet().

QColor QgsLabelAttributes::mColor [protected]

Color.

Definition at line 201 of file qgslabelattributes.h.

Referenced by color(), and setColor().

bool QgsLabelAttributes::mColorIsSet [protected]

Definition at line 202 of file qgslabelattributes.h.

Referenced by bufferColorIsSet(), colorIsSet(), and setColor().

int QgsLabelAttributes::mOffsetType [protected]

Offset.

Definition at line 205 of file qgslabelattributes.h.

Referenced by offsetType(), and setOffset().

double QgsLabelAttributes::mXOffset [protected]

Definition at line 206 of file qgslabelattributes.h.

Referenced by setOffset(), and xOffset().

double QgsLabelAttributes::mYOffset [protected]

Definition at line 207 of file qgslabelattributes.h.

Referenced by setOffset(), and yOffset().

bool QgsLabelAttributes::mOffsetIsSet [protected]

Definition at line 208 of file qgslabelattributes.h.

Referenced by offsetIsSet(), and setOffset().

double QgsLabelAttributes::mAngle [protected]

Angle (degrees).

Definition at line 211 of file qgslabelattributes.h.

Referenced by angle(), and setAngle().

bool QgsLabelAttributes::mAngleIsSet [protected]

Definition at line 212 of file qgslabelattributes.h.

Referenced by angleIsSet(), and setAngle().

bool QgsLabelAttributes::mAngleIsAuto [protected]

Definition at line 213 of file qgslabelattributes.h.

Referenced by angleIsAuto(), and setAutoAngle().

int QgsLabelAttributes::mAlignment [protected]

Alignment.

Definition at line 216 of file qgslabelattributes.h.

Referenced by alignment(), and setAlignment().

bool QgsLabelAttributes::mAlignmentIsSet [protected]

Definition at line 217 of file qgslabelattributes.h.

Referenced by alignmentIsSet(), and setAlignment().

bool QgsLabelAttributes::mBufferEnabledFlag [protected]

Buffer enablement.

Definition at line 220 of file qgslabelattributes.h.

Referenced by bufferEnabled(), and setBufferEnabled().

int QgsLabelAttributes::mBufferSizeType [protected]

Buffer size, size type.

Definition at line 222 of file qgslabelattributes.h.

Referenced by bufferSizeType(), and setBufferSize().

double QgsLabelAttributes::mBufferSize [protected]

Definition at line 223 of file qgslabelattributes.h.

Referenced by bufferSize(), and setBufferSize().

bool QgsLabelAttributes::mBufferSizeIsSet [protected]

Definition at line 224 of file qgslabelattributes.h.

Referenced by bufferSizeIsSet(), and setBufferSize().

QBrush QgsLabelAttributes::mBufferBrush [protected]

Buffer brush (color, style).

Definition at line 227 of file qgslabelattributes.h.

Referenced by bufferColor(), bufferStyle(), setBufferColor(), and setBufferStyle().

bool QgsLabelAttributes::mBufferColorIsSet [protected]

Definition at line 228 of file qgslabelattributes.h.

Referenced by setBufferColor().

bool QgsLabelAttributes::mBufferStyleIsSet [protected]

Definition at line 229 of file qgslabelattributes.h.

Referenced by bufferStyleIsSet(), and setBufferStyle().

QPen QgsLabelAttributes::mBorderPen [protected]

Border pen (color, width, style).

Definition at line 232 of file qgslabelattributes.h.

Referenced by borderColor(), borderStyle(), borderWidth(), setBorderColor(), setBorderStyle(), and setBorderWidth().

bool QgsLabelAttributes::mBorderColorIsSet [protected]

Definition at line 233 of file qgslabelattributes.h.

Referenced by borderColorIsSet(), and setBorderColor().

bool QgsLabelAttributes::mBorderWidthIsSet [protected]

Definition at line 234 of file qgslabelattributes.h.

Referenced by borderWidthIsSet(), and setBorderWidth().