QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
QgsPalLayerSettings Class Reference

#include <qgspallabeling.h>

Collaboration diagram for QgsPalLayerSettings:
Collaboration graph
[legend]

Public Types

enum  Placement {
  AroundPoint, OverPoint, Line, Curved,
  Horizontal, Free
}
enum  LinePlacementFlags { OnLine = 1, AboveLine = 2, BelowLine = 4, MapOrientation = 8 }
enum  QuadrantPosition {
  QuadrantAboveLeft, QuadrantAbove, QuadrantAboveRight, QuadrantLeft,
  QuadrantOver, QuadrantRight, QuadrantBelowLeft, QuadrantBelow,
  QuadrantBelowRight
}
enum  UpsideDownLabels { Upright, ShowDefined, ShowAll }
enum  DirectionSymbols { SymbolLeftRight, SymbolAbove, SymbolBelow }
enum  MultiLineAlign { MultiLeft = 0, MultiCenter, MultiRight }
enum  ShapeType {
  ShapeRectangle = 0, ShapeSquare, ShapeEllipse, ShapeCircle,
  ShapeSVG
}
enum  SizeType { SizeBuffer = 0, SizeFixed, SizePercent }
enum  RotationType { RotationSync = 0, RotationOffset, RotationFixed }
enum  SizeUnit { Points = 0, MM, MapUnits, Percent }
 Units used for option sizes, before being converted to rendered sizes. More...
enum  ShadowType { ShadowLowest = 0, ShadowText, ShadowBuffer, ShadowShape }
enum  DataDefinedProperties {
  Size = 0, Bold = 1, Italic = 2, Underline = 3,
  Color = 4, Strikeout = 5, Family = 6, FontStyle = 21,
  FontSizeUnit = 22, FontTransp = 18, FontCase = 27, FontLetterSpacing = 28,
  FontWordSpacing = 29, FontBlendMode = 30, MultiLineWrapChar = 31, MultiLineHeight = 32,
  MultiLineAlignment = 33, DirSymbDraw = 34, DirSymbLeft = 35, DirSymbRight = 36,
  DirSymbPlacement = 37, DirSymbReverse = 38, NumFormat = 39, NumDecimals = 40,
  NumPlusSign = 41, BufferDraw = 42, BufferSize = 7, BufferUnit = 43,
  BufferColor = 8, BufferTransp = 19, BufferJoinStyle = 44, BufferBlendMode = 45,
  ShapeDraw = 46, ShapeKind = 47, ShapeSVGFile = 48, ShapeSizeType = 49,
  ShapeSizeX = 50, ShapeSizeY = 85, ShapeSizeUnits = 51, ShapeRotationType = 52,
  ShapeRotation = 53, ShapeOffset = 54, ShapeOffsetUnits = 55, ShapeRadii = 56,
  ShapeRadiiUnits = 57, ShapeTransparency = 63, ShapeBlendMode = 64, ShapeFillColor = 58,
  ShapeBorderColor = 59, ShapeBorderWidth = 60, ShapeBorderWidthUnits = 61, ShapeJoinStyle = 62,
  ShadowDraw = 65, ShadowUnder = 66, ShadowOffsetAngle = 67, ShadowOffsetDist = 68,
  ShadowOffsetUnits = 69, ShadowRadius = 70, ShadowRadiusUnits = 71, ShadowTransparency = 72,
  ShadowScale = 73, ShadowColor = 74, ShadowBlendMode = 75, CentroidWhole = 76,
  OffsetQuad = 77, OffsetXY = 78, OffsetUnits = 80, LabelDistance = 13,
  DistanceUnits = 81, OffsetRotation = 82, CurvedCharAngleInOut = 83, PositionX = 9,
  PositionY = 10, Hali = 11, Vali = 12, Rotation = 14,
  ScaleVisibility = 23, MinScale = 16, MaxScale = 17, FontLimitPixel = 24,
  FontMinPixel = 25, FontMaxPixel = 26, Show = 15, AlwaysShow = 20
}

Public Member Functions

 QgsPalLayerSettings ()
 QgsPalLayerSettings (const QgsPalLayerSettings &s)
 ~QgsPalLayerSettings ()
QgsExpressiongetLabelExpression ()
 Returns the QgsExpression for this label settings.
void calculateLabelSize (const QFontMetricsF *fm, QString text, double &labelX, double &labelY, QgsFeature *f=0)
void registerFeature (QgsVectorLayer *layer, QgsFeature &f, const QgsRenderContext &context)
void readFromLayer (QgsVectorLayer *layer)
void writeToLayer (QgsVectorLayer *layer)
QgsDataDefineddataDefinedProperty (QgsPalLayerSettings::DataDefinedProperties p)
 Get a data defined property pointer.
void setDataDefinedProperty (QgsPalLayerSettings::DataDefinedProperties p, bool active, bool useExpr, const QString &expr, const QString &field)
 Set a property as data defined.
void removeDataDefinedProperty (QgsPalLayerSettings::DataDefinedProperties p)
 Set a property to static instead data defined.
QString updateDataDefinedString (const QString &value)
 Convert old property value to new one as delimited values.
QMap< QString, QString > dataDefinedMap (QgsPalLayerSettings::DataDefinedProperties p) const
 Get property value as separate values split into Qmap.
QVariant dataDefinedValue (QgsPalLayerSettings::DataDefinedProperties p, QgsFeature &f, const QgsFields &fields) const
 Get data defined property value from expression string or attribute field name.
bool dataDefinedEvaluate (QgsPalLayerSettings::DataDefinedProperties p, QVariant &exprVal) const
 Get data defined property value from expression string or attribute field name.
bool dataDefinedIsActive (QgsPalLayerSettings::DataDefinedProperties p) const
 Whether data definition is active.
bool dataDefinedUseExpression (QgsPalLayerSettings::DataDefinedProperties p) const
 Whether data definition is set to use an expression.
int sizeToPixel (double size, const QgsRenderContext &c, SizeUnit unit, bool rasterfactor=false) const
 Calculates pixel size (considering output size should be in pixel or map units, scale factors and optionally oversampling)
double scaleToPixelContext (double size, const QgsRenderContext &c, SizeUnit unit, bool rasterfactor=false) const
 Calculates size (considering output size should be in pixel or map units, scale factors and optionally oversampling)
QMap
< QgsPalLayerSettings::DataDefinedProperties,
QPair< QString, int > > 
dataDefinedNames () const
 Map of data defined enum to names and old-style indecies The QPair contains a new string for layer property key, and a reference to old-style numeric key (< QGIS 2.0)

Public Attributes

bool enabled
QString fieldName
bool isExpression
 Is this label made from a expression string eg FieldName || 'mm'.
QFont textFont
QString textNamedStyle
bool fontSizeInMapUnits
QColor textColor
int textTransp
QPainter::CompositionMode blendMode
QColor previewBkgrdColor
QString wrapChar
double multilineHeight
MultiLineAlign multilineAlign
bool addDirectionSymbol
QString leftDirectionSymbol
QString rightDirectionSymbol
DirectionSymbols placeDirectionSymbol
bool reverseDirectionSymbol
bool formatNumbers
int decimals
bool plusSign
bool bufferDraw
double bufferSize
bool bufferSizeInMapUnits
QColor bufferColor
bool bufferNoFill
int bufferTransp
Qt::PenJoinStyle bufferJoinStyle
QPainter::CompositionMode bufferBlendMode
bool shapeDraw
ShapeType shapeType
QString shapeSVGFile
SizeType shapeSizeType
QPointF shapeSize
SizeUnit shapeSizeUnits
RotationType shapeRotationType
double shapeRotation
QPointF shapeOffset
SizeUnit shapeOffsetUnits
QPointF shapeRadii
SizeUnit shapeRadiiUnits
int shapeTransparency
QPainter::CompositionMode shapeBlendMode
QColor shapeFillColor
QColor shapeBorderColor
double shapeBorderWidth
SizeUnit shapeBorderWidthUnits
Qt::PenJoinStyle shapeJoinStyle
bool shadowDraw
ShadowType shadowUnder
int shadowOffsetAngle
double shadowOffsetDist
SizeUnit shadowOffsetUnits
bool shadowOffsetGlobal
double shadowRadius
SizeUnit shadowRadiusUnits
bool shadowRadiusAlphaOnly
int shadowTransparency
int shadowScale
QColor shadowColor
QPainter::CompositionMode shadowBlendMode
Placement placement
unsigned int placementFlags
bool centroidWhole
double dist
bool distInMapUnits
QuadrantPosition quadOffset
double xOffset
double yOffset
bool labelOffsetInMapUnits
double angleOffset
bool preserveRotation
double maxCurvedCharAngleIn
double maxCurvedCharAngleOut
int priority
bool scaleVisibility
int scaleMin
int scaleMax
bool fontLimitPixelSize
int fontMinPixelSize
int fontMaxPixelSize
bool displayAll
unsigned int upsidedownLabels
bool labelPerPart
bool mergeLines
bool limitNumLabels
int maxNumLabels
double minFeatureSize
bool obstacle
double vectorScaleFactor
double rasterCompressFactor
QMap
< QgsPalLayerSettings::DataDefinedProperties,
QgsDataDefined * > 
dataDefinedProperties
 Map of current data defined properties.
pal::Layer * palLayer
QgsFeaturemCurFeat
const QgsFieldsmCurFields
int fieldIndex
const QgsMapToPixelxform
const QgsCoordinateTransformct
QgsPoint ptZero
QgsPoint ptOne
QList< QgsPalGeometry * > geometries
QgsGeometryextentGeom
int mFeaturesToLabel
int mFeatsSendingToPal
int mFeatsRegPal
QString mTextFontFamily
bool mTextFontFound
bool showingShadowRects

Private Member Functions

void readDataDefinedPropertyMap (QgsVectorLayer *layer, QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > &propertyMap)
void writeDataDefinedPropertyMap (QgsVectorLayer *layer, const QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > &propertyMap)
void readDataDefinedProperty (QgsVectorLayer *layer, QgsPalLayerSettings::DataDefinedProperties p, QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > &propertyMap)
bool dataDefinedValEval (const QString &valType, QgsPalLayerSettings::DataDefinedProperties p, QVariant &exprVal)
void parseTextStyle (QFont &labelFont, QgsPalLayerSettings::SizeUnit fontunits, const QgsRenderContext &context)
void parseTextBuffer ()
void parseTextFormatting ()
void parseShapeBackground ()
void parseDropShadow ()
bool checkMinimumSizeMM (const QgsRenderContext &ct, QgsGeometry *geom, double minSize) const
 Checks if a feature is larger than a minimum size (in mm)

Private Attributes

QMap< DataDefinedProperties,
QVariant > 
dataDefinedValues
QgsExpressionexpression
QMap
< QgsPalLayerSettings::DataDefinedProperties,
QPair< QString, int > > 
mDataDefinedNames
QFontDatabase mFontDB

Detailed Description

Definition at line 61 of file qgspallabeling.h.

Member Enumeration Documentation

Enumerator:
Size 
Bold 
Italic 
Underline 
Color 
Strikeout 
Family 
FontStyle 
FontSizeUnit 
FontTransp 
FontCase 
FontLetterSpacing 
FontWordSpacing 
FontBlendMode 
MultiLineWrapChar 
MultiLineHeight 
MultiLineAlignment 
DirSymbDraw 
DirSymbLeft 
DirSymbRight 
DirSymbPlacement 
DirSymbReverse 
NumFormat 
NumDecimals 
NumPlusSign 
BufferDraw 
BufferSize 
BufferUnit 
BufferColor 
BufferTransp 
BufferJoinStyle 
BufferBlendMode 
ShapeDraw 
ShapeKind 
ShapeSVGFile 
ShapeSizeType 
ShapeSizeX 
ShapeSizeY 
ShapeSizeUnits 
ShapeRotationType 
ShapeRotation 
ShapeOffset 
ShapeOffsetUnits 
ShapeRadii 
ShapeRadiiUnits 
ShapeTransparency 
ShapeBlendMode 
ShapeFillColor 
ShapeBorderColor 
ShapeBorderWidth 
ShapeBorderWidthUnits 
ShapeJoinStyle 
ShadowDraw 
ShadowUnder 
ShadowOffsetAngle 
ShadowOffsetDist 
ShadowOffsetUnits 
ShadowRadius 
ShadowRadiusUnits 
ShadowTransparency 
ShadowScale 
ShadowColor 
ShadowBlendMode 
CentroidWhole 
OffsetQuad 
OffsetXY 
OffsetUnits 
LabelDistance 
DistanceUnits 
OffsetRotation 
CurvedCharAngleInOut 
PositionX 
PositionY 
Hali 
Vali 
Rotation 
ScaleVisibility 
MinScale 
MaxScale 
FontLimitPixel 
FontMinPixel 
FontMaxPixel 
Show 
AlwaysShow 

Definition at line 161 of file qgspallabeling.h.

Enumerator:
SymbolLeftRight 
SymbolAbove 
SymbolBelow 

Definition at line 106 of file qgspallabeling.h.

Enumerator:
OnLine 
AboveLine 
BelowLine 
MapOrientation 

Definition at line 78 of file qgspallabeling.h.

Enumerator:
MultiLeft 
MultiCenter 
MultiRight 

Definition at line 113 of file qgspallabeling.h.

Enumerator:
AroundPoint 
OverPoint 
Line 
Curved 
Horizontal 
Free 

Definition at line 68 of file qgspallabeling.h.

Enumerator:
QuadrantAboveLeft 
QuadrantAbove 
QuadrantAboveRight 
QuadrantLeft 
QuadrantOver 
QuadrantRight 
QuadrantBelowLeft 
QuadrantBelow 
QuadrantBelowRight 

Definition at line 86 of file qgspallabeling.h.

Enumerator:
RotationSync 
RotationOffset 
RotationFixed 

Definition at line 136 of file qgspallabeling.h.

Enumerator:
ShadowLowest 
ShadowText 
ShadowBuffer 
ShadowShape 

Definition at line 152 of file qgspallabeling.h.

Enumerator:
ShapeRectangle 
ShapeSquare 
ShapeEllipse 
ShapeCircle 
ShapeSVG 

Definition at line 120 of file qgspallabeling.h.

Enumerator:
SizeBuffer 
SizeFixed 
SizePercent 

Definition at line 129 of file qgspallabeling.h.

Units used for option sizes, before being converted to rendered sizes.

Enumerator:
Points 
MM 
MapUnits 
Percent 

Definition at line 144 of file qgspallabeling.h.

Enumerator:
Upright 
ShowDefined 
ShowAll 

Definition at line 99 of file qgspallabeling.h.

Constructor & Destructor Documentation

QgsPalLayerSettings::QgsPalLayerSettings ( )

Definition at line 200 of file qgspallabeling.cpp.

References addDirectionSymbol, AlwaysShow, angleOffset, AroundPoint, blendMode, Bold, BufferBlendMode, bufferBlendMode, BufferColor, bufferColor, BufferDraw, bufferDraw, BufferJoinStyle, bufferJoinStyle, bufferNoFill, BufferSize, bufferSize, bufferSizeInMapUnits, BufferTransp, bufferTransp, BufferUnit, CentroidWhole, centroidWhole, Color, CurvedCharAngleInOut, decimals, DirSymbDraw, DirSymbLeft, DirSymbPlacement, DirSymbReverse, DirSymbRight, displayAll, dist, DistanceUnits, distInMapUnits, enabled, Family, FontBlendMode, FontCase, FontLetterSpacing, FontLimitPixel, fontLimitPixelSize, FontMaxPixel, fontMaxPixelSize, FontMinPixel, fontMinPixelSize, fontSizeInMapUnits, FontSizeUnit, FontStyle, FontTransp, FontWordSpacing, formatNumbers, Hali, Italic, LabelDistance, labelOffsetInMapUnits, labelPerPart, leftDirectionSymbol, limitNumLabels, maxCurvedCharAngleIn, maxCurvedCharAngleOut, maxNumLabels, MaxScale, mDataDefinedNames, mergeLines, minFeatureSize, MinScale, MM, mTextFontFamily, mTextFontFound, MultiLeft, multilineAlign, MultiLineAlignment, MultiLineHeight, multilineHeight, MultiLineWrapChar, NumDecimals, NumFormat, NumPlusSign, obstacle, OffsetQuad, OffsetRotation, OffsetUnits, OffsetXY, placeDirectionSymbol, placement, placementFlags, plusSign, PositionX, PositionY, preserveRotation, previewBkgrdColor, priority, quadOffset, QuadrantOver, rasterCompressFactor, reverseDirectionSymbol, rightDirectionSymbol, Rotation, RotationSync, scaleMax, scaleMin, ScaleVisibility, scaleVisibility, ShadowBlendMode, shadowBlendMode, ShadowColor, shadowColor, ShadowDraw, shadowDraw, ShadowLowest, ShadowOffsetAngle, shadowOffsetAngle, ShadowOffsetDist, shadowOffsetDist, shadowOffsetGlobal, ShadowOffsetUnits, shadowOffsetUnits, ShadowRadius, shadowRadius, shadowRadiusAlphaOnly, ShadowRadiusUnits, shadowRadiusUnits, ShadowScale, shadowScale, ShadowTransparency, shadowTransparency, ShadowUnder, shadowUnder, ShapeBlendMode, shapeBlendMode, ShapeBorderColor, shapeBorderColor, ShapeBorderWidth, shapeBorderWidth, ShapeBorderWidthUnits, shapeBorderWidthUnits, ShapeDraw, shapeDraw, ShapeFillColor, shapeFillColor, ShapeJoinStyle, shapeJoinStyle, ShapeKind, ShapeOffset, shapeOffset, ShapeOffsetUnits, shapeOffsetUnits, ShapeRadii, shapeRadii, ShapeRadiiUnits, shapeRadiiUnits, ShapeRectangle, ShapeRotation, shapeRotation, ShapeRotationType, shapeRotationType, shapeSize, ShapeSizeType, shapeSizeType, ShapeSizeUnits, shapeSizeUnits, ShapeSizeX, ShapeSizeY, ShapeSVGFile, shapeSVGFile, ShapeTransparency, shapeTransparency, shapeType, Show, showingShadowRects, Size, SizeBuffer, Strikeout, SymbolLeftRight, textColor, textFont, textNamedStyle, textTransp, Underline, Upright, upsidedownLabels, Vali, vectorScaleFactor, wrapChar, xOffset, and yOffset.

QgsPalLayerSettings::QgsPalLayerSettings ( const QgsPalLayerSettings s)

Definition at line 428 of file qgspallabeling.cpp.

References addDirectionSymbol, angleOffset, blendMode, bufferBlendMode, bufferColor, bufferDraw, bufferJoinStyle, bufferNoFill, bufferSize, bufferSizeInMapUnits, bufferTransp, centroidWhole, ct, dataDefinedProperties, decimals, displayAll, dist, distInMapUnits, enabled, expression, extentGeom, fieldName, fontLimitPixelSize, fontMaxPixelSize, fontMinPixelSize, fontSizeInMapUnits, formatNumbers, isExpression, labelOffsetInMapUnits, labelPerPart, leftDirectionSymbol, limitNumLabels, maxCurvedCharAngleIn, maxCurvedCharAngleOut, maxNumLabels, mDataDefinedNames, mergeLines, minFeatureSize, mTextFontFamily, mTextFontFound, multilineAlign, multilineHeight, obstacle, placeDirectionSymbol, placement, placementFlags, plusSign, preserveRotation, previewBkgrdColor, priority, quadOffset, rasterCompressFactor, reverseDirectionSymbol, rightDirectionSymbol, scaleMax, scaleMin, scaleVisibility, shadowBlendMode, shadowColor, shadowDraw, shadowOffsetAngle, shadowOffsetDist, shadowOffsetGlobal, shadowOffsetUnits, shadowRadius, shadowRadiusAlphaOnly, shadowRadiusUnits, shadowScale, shadowTransparency, shadowUnder, shapeBlendMode, shapeBorderColor, shapeBorderWidth, shapeBorderWidthUnits, shapeDraw, shapeFillColor, shapeJoinStyle, shapeOffset, shapeOffsetUnits, shapeRadii, shapeRadiiUnits, shapeRotation, shapeRotationType, shapeSize, shapeSizeType, shapeSizeUnits, shapeSVGFile, shapeTransparency, shapeType, textColor, textFont, textNamedStyle, textTransp, upsidedownLabels, vectorScaleFactor, wrapChar, xOffset, and yOffset.

QgsPalLayerSettings::~QgsPalLayerSettings ( )

Definition at line 554 of file qgspallabeling.cpp.

References ct, dataDefinedProperties, expression, and extentGeom.

Member Function Documentation

void QgsPalLayerSettings::calculateLabelSize ( const QFontMetricsF *  fm,
QString  text,
double &  labelX,
double &  labelY,
QgsFeature f = 0 
)
bool QgsPalLayerSettings::checkMinimumSizeMM ( const QgsRenderContext ct,
QgsGeometry geom,
double  minSize 
) const
private

Checks if a feature is larger than a minimum size (in mm)

Returns
true if above size, false if below

Definition at line 1283 of file qgspallabeling.cpp.

References QgsGeometry::area(), QgsGeometry::length(), QGis::Line, QgsRenderContext::mapToPixel(), QgsMapToPixel::mapUnitsPerPixel(), QGis::Point, QGis::Polygon, QgsRenderContext::scaleFactor(), and QgsGeometry::type().

Referenced by registerFeature().

bool QgsPalLayerSettings::dataDefinedEvaluate ( QgsPalLayerSettings::DataDefinedProperties  p,
QVariant &  exprVal 
) const

Get data defined property value from expression string or attribute field name.

Returns
true/false whether result is null or invalid
Note
not available in python bindings; added in 1.9

Definition at line 1241 of file qgspallabeling.cpp.

References dataDefinedValue(), mCurFeat, and mCurFields.

Referenced by dataDefinedValEval(), parseDropShadow(), parseShapeBackground(), parseTextFormatting(), parseTextStyle(), and registerFeature().

bool QgsPalLayerSettings::dataDefinedIsActive ( QgsPalLayerSettings::DataDefinedProperties  p) const

Whether data definition is active.

Definition at line 1259 of file qgspallabeling.cpp.

References dataDefinedProperties.

QMap< QString, QString > QgsPalLayerSettings::dataDefinedMap ( QgsPalLayerSettings::DataDefinedProperties  p) const

Get property value as separate values split into Qmap.

Note
not available in python bindings; added in 1.9

Definition at line 1173 of file qgspallabeling.cpp.

References dataDefinedProperties.

QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > QgsPalLayerSettings::dataDefinedNames ( ) const
inline

Map of data defined enum to names and old-style indecies The QPair contains a new string for layer property key, and a reference to old-style numeric key (< QGIS 2.0)

Note
not available in python bindings; added in 1.9

Definition at line 487 of file qgspallabeling.h.

QgsDataDefined * QgsPalLayerSettings::dataDefinedProperty ( QgsPalLayerSettings::DataDefinedProperties  p)

Get a data defined property pointer.

Note
added in 1.9, helpful for Python access

Definition at line 1163 of file qgspallabeling.cpp.

References dataDefinedProperties.

bool QgsPalLayerSettings::dataDefinedUseExpression ( QgsPalLayerSettings::DataDefinedProperties  p) const

Whether data definition is set to use an expression.

Definition at line 1271 of file qgspallabeling.cpp.

References dataDefinedProperties.

bool QgsPalLayerSettings::dataDefinedValEval ( const QString &  valType,
QgsPalLayerSettings::DataDefinedProperties  p,
QVariant &  exprVal 
)
private
QVariant QgsPalLayerSettings::dataDefinedValue ( QgsPalLayerSettings::DataDefinedProperties  p,
QgsFeature f,
const QgsFields fields 
) const
QgsExpression * QgsPalLayerSettings::getLabelExpression ( )

Returns the QgsExpression for this label settings.

Definition at line 566 of file qgspallabeling.cpp.

References expression, and fieldName.

Referenced by QgsPalLabeling::prepareLayer(), and registerFeature().

void QgsPalLayerSettings::parseDropShadow ( )
private
void QgsPalLayerSettings::parseShapeBackground ( )
private
void QgsPalLayerSettings::parseTextBuffer ( )
private
void QgsPalLayerSettings::parseTextFormatting ( )
private
void QgsPalLayerSettings::parseTextStyle ( QFont &  labelFont,
QgsPalLayerSettings::SizeUnit  fontunits,
const QgsRenderContext context 
)
private
void QgsPalLayerSettings::readDataDefinedProperty ( QgsVectorLayer layer,
QgsPalLayerSettings::DataDefinedProperties  p,
QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > &  propertyMap 
)
private
void QgsPalLayerSettings::readDataDefinedPropertyMap ( QgsVectorLayer layer,
QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > &  propertyMap 
)
private

Definition at line 627 of file qgspallabeling.cpp.

References mDataDefinedNames, and readDataDefinedProperty().

Referenced by readFromLayer().

void QgsPalLayerSettings::readFromLayer ( QgsVectorLayer layer)

Definition at line 800 of file qgspallabeling.cpp.

References _readColor(), addDirectionSymbol, angleOffset, blendMode, QgsMapRenderer::BlendMultiply, QgsMapRenderer::BlendNormal, bufferBlendMode, bufferColor, bufferDraw, bufferJoinStyle, bufferNoFill, bufferSize, bufferSizeInMapUnits, bufferTransp, centroidWhole, QgsMapLayer::customProperty(), dataDefinedProperties, decimals, displayAll, dist, distInMapUnits, enabled, fieldName, QgsFontUtils::fontFamilyMatchOnSystem(), fontLimitPixelSize, fontMaxPixelSize, fontMinPixelSize, fontSizeInMapUnits, formatNumbers, QgsMapRenderer::getCompositionMode(), isExpression, labelOffsetInMapUnits, labelPerPart, leftDirectionSymbol, limitNumLabels, maxCurvedCharAngleIn, maxCurvedCharAngleOut, maxNumLabels, mergeLines, minFeatureSize, MM, mTextFontFamily, mTextFontFound, MultiLeft, multilineAlign, multilineHeight, obstacle, placeDirectionSymbol, placement, placementFlags, plusSign, preserveRotation, previewBkgrdColor, priority, quadOffset, QuadrantOver, readDataDefinedPropertyMap(), reverseDirectionSymbol, rightDirectionSymbol, RotationSync, scaleMax, scaleMin, scaleVisibility, shadowBlendMode, shadowColor, shadowDraw, ShadowLowest, shadowOffsetAngle, shadowOffsetDist, shadowOffsetGlobal, shadowOffsetUnits, shadowRadius, shadowRadiusAlphaOnly, shadowRadiusUnits, shadowScale, shadowTransparency, shadowUnder, shapeBlendMode, shapeBorderColor, shapeBorderWidth, shapeBorderWidthUnits, shapeDraw, shapeFillColor, shapeJoinStyle, shapeOffset, shapeOffsetUnits, shapeRadii, shapeRadiiUnits, ShapeRectangle, shapeRotation, shapeRotationType, shapeSize, shapeSizeType, shapeSizeUnits, shapeSVGFile, shapeTransparency, shapeType, SizeBuffer, SymbolLeftRight, textColor, textFont, textNamedStyle, textTransp, QgsFontUtils::updateFontViaStyle(), Upright, upsidedownLabels, wrapChar, xOffset, and yOffset.

Referenced by QgsPalLabeling::prepareLayer().

void QgsPalLayerSettings::registerFeature ( QgsVectorLayer layer,
QgsFeature f,
const QgsRenderContext context 
)

Definition at line 1478 of file qgspallabeling.cpp.

References _decodeUnits(), QgsPalGeometry::addDataDefinedValue(), AlwaysShow, MathUtils::angle(), angleOffset, AroundPoint, QgsGeometry::asGeos(), QgsFeature::attribute(), calculateLabelSize(), CentroidWhole, centroidWhole, checkMinimumSizeMM(), QgsGeometry::contains(), ct, Curved, CurvedCharAngleInOut, dataDefinedEvaluate(), dataDefinedValues, decimals, QgsSymbolLayerV2Utils::decodePoint(), dist, DistanceUnits, distInMapUnits, QgsExpression::evalErrorString(), QgsExpression::evaluate(), extentGeom, fieldIndex, FontLimitPixel, fontLimitPixelSize, FontMaxPixel, fontMaxPixelSize, FontMinPixel, fontMinPixelSize, fontSizeInMapUnits, FontSizeUnit, formatNumbers, geometries, QgsFeature::geometry(), getLabelExpression(), Hali, QgsExpression::hasEvalError(), QgsExpression::hasParserError(), QgsFeature::id(), QgsPalGeometry::info(), QgsGeometry::intersection(), isExpression, LabelDistance, labelOffsetInMapUnits, limitNumLabels, M_PI, QgsRenderContext::mapToPixel(), MapUnits, QgsMapToPixel::mapUnitsPerPixel(), maxCurvedCharAngleIn, maxCurvedCharAngleOut, maxNumLabels, MaxScale, mCurFeat, mFeatsRegPal, mFeatsSendingToPal, mFeaturesToLabel, minFeatureSize, MinScale, NumDecimals, NumFormat, NumPlusSign, OffsetQuad, OffsetUnits, OffsetXY, OverPoint, palLayer, parseDropShadow(), QgsExpression::parserErrorString(), parseShapeBackground(), parseTextBuffer(), parseTextFormatting(), parseTextStyle(), placement, plusSign, Points, QGis::Polygon, PositionX, PositionY, ptOne, ptZero, QgsDebugMsgLevel, quadOffset, QuadrantAbove, QuadrantAboveLeft, QuadrantAboveRight, QuadrantBelow, QuadrantBelowLeft, QuadrantBelowRight, QuadrantLeft, QuadrantOver, QuadrantRight, rasterCompressFactor, QgsRenderContext::rendererScale(), Rotation, QgsRenderContext::scaleFactor(), scaleMax, scaleMin, ScaleVisibility, scaleVisibility, QgsPalGeometry::setDefinedFont(), QgsPalGeometry::setIsPinned(), QgsExpression::setScale(), Show, size, Size, sizeToPixel(), QgsPalGeometry::strId(), textFont, QgsGeometry::transform(), QgsCoordinateTransform::transformInPlace(), QgsGeometry::type(), Vali, vectorScaleFactor, QgsPoint::x(), xform, xOffset, and yOffset.

Referenced by QgsPalLabeling::registerFeature().

void QgsPalLayerSettings::removeDataDefinedProperty ( QgsPalLayerSettings::DataDefinedProperties  p)

Set a property to static instead data defined.

Definition at line 1136 of file qgspallabeling.cpp.

References dataDefinedProperties.

double QgsPalLayerSettings::scaleToPixelContext ( double  size,
const QgsRenderContext c,
SizeUnit  unit,
bool  rasterfactor = false 
) const

Calculates size (considering output size should be in pixel or map units, scale factors and optionally oversampling)

Parameters
sizesize to convert
crendercontext
unitSizeUnit enum value of size
rasterfactorwhether to consider oversampling
Returns
size that will render, as double
Note
added in 1.9, as a better precision replacement for sizeToPixel

Definition at line 3011 of file qgspallabeling.cpp.

References QgsRenderContext::mapToPixel(), MapUnits, QgsMapToPixel::mapUnitsPerPixel(), Points, QgsRenderContext::rasterScaleFactor(), QgsRenderContext::scaleFactor(), and size.

Referenced by QgsPalLabeling::drawLabelBackground(), QgsPalLabeling::drawLabelBuffer(), QgsPalLabeling::drawLabelShadow(), and sizeToPixel().

void QgsPalLayerSettings::setDataDefinedProperty ( QgsPalLayerSettings::DataDefinedProperties  p,
bool  active,
bool  useExpr,
const QString &  expr,
const QString &  field 
)

Set a property as data defined.

Note
added in 1.9, helpful for Python access

Definition at line 1112 of file qgspallabeling.cpp.

References dataDefinedProperties, QgsDataDefined::setActive(), QgsDataDefined::setExpressionString(), QgsDataDefined::setField(), and QgsDataDefined::setUseExpression().

int QgsPalLayerSettings::sizeToPixel ( double  size,
const QgsRenderContext c,
SizeUnit  unit,
bool  rasterfactor = false 
) const

Calculates pixel size (considering output size should be in pixel or map units, scale factors and optionally oversampling)

Parameters
sizesize to convert
crendercontext
unitSizeUnit enum value of size
rasterfactorwhether to consider oversampling
Returns
font pixel size

Definition at line 3006 of file qgspallabeling.cpp.

References scaleToPixelContext().

Referenced by parseTextStyle(), and registerFeature().

QString QgsPalLayerSettings::updateDataDefinedString ( const QString &  value)

Convert old property value to new one as delimited values.

Note
not available in python bindings; added in 1.9, as temporary solution until refactoring of project settings

Definition at line 1146 of file qgspallabeling.cpp.

Referenced by readDataDefinedProperty().

void QgsPalLayerSettings::writeDataDefinedPropertyMap ( QgsVectorLayer layer,
const QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > &  propertyMap 
)
private
void QgsPalLayerSettings::writeToLayer ( QgsVectorLayer layer)

Definition at line 987 of file qgspallabeling.cpp.

References _writeColor(), addDirectionSymbol, angleOffset, blendMode, bufferBlendMode, bufferColor, bufferDraw, bufferJoinStyle, bufferNoFill, bufferSize, bufferSizeInMapUnits, bufferTransp, centroidWhole, dataDefinedProperties, decimals, displayAll, dist, distInMapUnits, enabled, fieldName, fontLimitPixelSize, fontMaxPixelSize, fontMinPixelSize, fontSizeInMapUnits, formatNumbers, QgsMapRenderer::getBlendModeEnum(), isExpression, labelOffsetInMapUnits, labelPerPart, leftDirectionSymbol, limitNumLabels, maxCurvedCharAngleIn, maxCurvedCharAngleOut, maxNumLabels, mergeLines, minFeatureSize, multilineAlign, multilineHeight, obstacle, placeDirectionSymbol, placement, placementFlags, plusSign, preserveRotation, previewBkgrdColor, priority, quadOffset, reverseDirectionSymbol, rightDirectionSymbol, scaleMax, scaleMin, scaleVisibility, QgsMapLayer::setCustomProperty(), shadowBlendMode, shadowColor, shadowDraw, shadowOffsetAngle, shadowOffsetDist, shadowOffsetGlobal, shadowOffsetUnits, shadowRadius, shadowRadiusAlphaOnly, shadowRadiusUnits, shadowScale, shadowTransparency, shadowUnder, shapeBlendMode, shapeBorderColor, shapeBorderWidth, shapeBorderWidthUnits, shapeDraw, shapeFillColor, shapeJoinStyle, shapeOffset, shapeOffsetUnits, shapeRadii, shapeRadiiUnits, shapeRotation, shapeRotationType, shapeSize, shapeSizeType, shapeSizeUnits, shapeSVGFile, shapeTransparency, shapeType, textColor, textFont, textNamedStyle, textTransp, upsidedownLabels, wrapChar, writeDataDefinedPropertyMap(), xOffset, and yOffset.

Member Data Documentation

bool QgsPalLayerSettings::addDirectionSymbol
double QgsPalLayerSettings::angleOffset
QPainter::CompositionMode QgsPalLayerSettings::blendMode
QPainter::CompositionMode QgsPalLayerSettings::bufferBlendMode
QColor QgsPalLayerSettings::bufferColor
bool QgsPalLayerSettings::bufferDraw
Qt::PenJoinStyle QgsPalLayerSettings::bufferJoinStyle
bool QgsPalLayerSettings::bufferNoFill
double QgsPalLayerSettings::bufferSize
bool QgsPalLayerSettings::bufferSizeInMapUnits
int QgsPalLayerSettings::bufferTransp
bool QgsPalLayerSettings::centroidWhole
const QgsCoordinateTransform* QgsPalLayerSettings::ct
QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* > QgsPalLayerSettings::dataDefinedProperties
QMap<DataDefinedProperties, QVariant> QgsPalLayerSettings::dataDefinedValues
private
int QgsPalLayerSettings::decimals
bool QgsPalLayerSettings::displayAll
double QgsPalLayerSettings::dist
bool QgsPalLayerSettings::distInMapUnits
bool QgsPalLayerSettings::enabled

Definition at line 266 of file qgspallabeling.h.

Referenced by QgsPalLayerSettings(), readFromLayer(), and writeToLayer().

QgsExpression* QgsPalLayerSettings::expression
private

Definition at line 544 of file qgspallabeling.h.

Referenced by getLabelExpression(), QgsPalLayerSettings(), and ~QgsPalLayerSettings().

QgsGeometry* QgsPalLayerSettings::extentGeom
int QgsPalLayerSettings::fieldIndex

Definition at line 494 of file qgspallabeling.h.

Referenced by QgsPalLabeling::prepareLayer(), and registerFeature().

QString QgsPalLayerSettings::fieldName
bool QgsPalLayerSettings::fontLimitPixelSize
int QgsPalLayerSettings::fontMaxPixelSize
int QgsPalLayerSettings::fontMinPixelSize
bool QgsPalLayerSettings::fontSizeInMapUnits
bool QgsPalLayerSettings::formatNumbers
QList<QgsPalGeometry*> QgsPalLayerSettings::geometries

Definition at line 498 of file qgspallabeling.h.

Referenced by QgsPalLabeling::drawLabeling(), and registerFeature().

bool QgsPalLayerSettings::isExpression

Is this label made from a expression string eg FieldName || 'mm'.

Definition at line 274 of file qgspallabeling.h.

Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), registerFeature(), and writeToLayer().

bool QgsPalLayerSettings::labelOffsetInMapUnits
bool QgsPalLayerSettings::labelPerPart
QString QgsPalLayerSettings::leftDirectionSymbol
bool QgsPalLayerSettings::limitNumLabels
double QgsPalLayerSettings::maxCurvedCharAngleIn
double QgsPalLayerSettings::maxCurvedCharAngleOut
int QgsPalLayerSettings::maxNumLabels
QgsFeature* QgsPalLayerSettings::mCurFeat

Definition at line 492 of file qgspallabeling.h.

Referenced by calculateLabelSize(), dataDefinedEvaluate(), and registerFeature().

const QgsFields* QgsPalLayerSettings::mCurFields
QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > QgsPalLayerSettings::mDataDefinedNames
private
bool QgsPalLayerSettings::mergeLines
int QgsPalLayerSettings::mFeatsRegPal

Definition at line 502 of file qgspallabeling.h.

Referenced by registerFeature().

int QgsPalLayerSettings::mFeatsSendingToPal
int QgsPalLayerSettings::mFeaturesToLabel
QFontDatabase QgsPalLayerSettings::mFontDB
private

Definition at line 547 of file qgspallabeling.h.

Referenced by parseTextStyle().

double QgsPalLayerSettings::minFeatureSize
QString QgsPalLayerSettings::mTextFontFamily
bool QgsPalLayerSettings::mTextFontFound
MultiLineAlign QgsPalLayerSettings::multilineAlign
double QgsPalLayerSettings::multilineHeight
bool QgsPalLayerSettings::obstacle
pal::Layer* QgsPalLayerSettings::palLayer

Definition at line 491 of file qgspallabeling.h.

Referenced by QgsPalLabeling::prepareLayer(), and registerFeature().

DirectionSymbols QgsPalLayerSettings::placeDirectionSymbol
Placement QgsPalLayerSettings::placement
unsigned int QgsPalLayerSettings::placementFlags
bool QgsPalLayerSettings::plusSign
bool QgsPalLayerSettings::preserveRotation

Definition at line 373 of file qgspallabeling.h.

Referenced by QgsPalLayerSettings(), readFromLayer(), and writeToLayer().

QColor QgsPalLayerSettings::previewBkgrdColor

Definition at line 286 of file qgspallabeling.h.

Referenced by QgsPalLayerSettings(), readFromLayer(), and writeToLayer().

int QgsPalLayerSettings::priority
QgsPoint QgsPalLayerSettings::ptOne

Definition at line 497 of file qgspallabeling.h.

Referenced by QgsPalLabeling::prepareLayer(), and registerFeature().

QgsPoint QgsPalLayerSettings::ptZero
QuadrantPosition QgsPalLayerSettings::quadOffset
double QgsPalLayerSettings::rasterCompressFactor
bool QgsPalLayerSettings::reverseDirectionSymbol
QString QgsPalLayerSettings::rightDirectionSymbol
int QgsPalLayerSettings::scaleMax
int QgsPalLayerSettings::scaleMin
bool QgsPalLayerSettings::scaleVisibility
QPainter::CompositionMode QgsPalLayerSettings::shadowBlendMode
QColor QgsPalLayerSettings::shadowColor
bool QgsPalLayerSettings::shadowDraw
int QgsPalLayerSettings::shadowOffsetAngle
double QgsPalLayerSettings::shadowOffsetDist
bool QgsPalLayerSettings::shadowOffsetGlobal
SizeUnit QgsPalLayerSettings::shadowOffsetUnits
double QgsPalLayerSettings::shadowRadius
bool QgsPalLayerSettings::shadowRadiusAlphaOnly
SizeUnit QgsPalLayerSettings::shadowRadiusUnits
int QgsPalLayerSettings::shadowScale
int QgsPalLayerSettings::shadowTransparency
ShadowType QgsPalLayerSettings::shadowUnder
QPainter::CompositionMode QgsPalLayerSettings::shapeBlendMode
QColor QgsPalLayerSettings::shapeBorderColor
double QgsPalLayerSettings::shapeBorderWidth
SizeUnit QgsPalLayerSettings::shapeBorderWidthUnits
bool QgsPalLayerSettings::shapeDraw
QColor QgsPalLayerSettings::shapeFillColor
Qt::PenJoinStyle QgsPalLayerSettings::shapeJoinStyle
QPointF QgsPalLayerSettings::shapeOffset
SizeUnit QgsPalLayerSettings::shapeOffsetUnits
QPointF QgsPalLayerSettings::shapeRadii
SizeUnit QgsPalLayerSettings::shapeRadiiUnits
double QgsPalLayerSettings::shapeRotation
RotationType QgsPalLayerSettings::shapeRotationType
QPointF QgsPalLayerSettings::shapeSize
SizeType QgsPalLayerSettings::shapeSizeType
SizeUnit QgsPalLayerSettings::shapeSizeUnits
QString QgsPalLayerSettings::shapeSVGFile
int QgsPalLayerSettings::shapeTransparency
ShapeType QgsPalLayerSettings::shapeType
bool QgsPalLayerSettings::showingShadowRects
QColor QgsPalLayerSettings::textColor
QFont QgsPalLayerSettings::textFont
QString QgsPalLayerSettings::textNamedStyle

Definition at line 281 of file qgspallabeling.h.

Referenced by parseTextStyle(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().

int QgsPalLayerSettings::textTransp
unsigned int QgsPalLayerSettings::upsidedownLabels
double QgsPalLayerSettings::vectorScaleFactor
QString QgsPalLayerSettings::wrapChar
const QgsMapToPixel* QgsPalLayerSettings::xform
double QgsPalLayerSettings::xOffset
double QgsPalLayerSettings::yOffset

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