Quantum GIS API Documentation  1.8
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
QgsPalLayerSettings Class Reference

#include <qgspallabeling.h>

Collaboration diagram for QgsPalLayerSettings:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Placement {
  AroundPoint, OverPoint, Line, Curved,
  Horizontal, Free
}
enum  LinePlacementFlags { OnLine = 1, AboveLine = 2, BelowLine = 4, MapOrientation = 8 }
enum  DataDefinedProperties {
  Size = 0, Bold, Italic, Underline,
  Color, Strikeout, Family, BufferSize,
  BufferColor, PositionX, PositionY, Hali,
  Vali, LabelDistance, Rotation
}

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)
void registerFeature (QgsVectorLayer *layer, QgsFeature &f, const QgsRenderContext &context)
void readFromLayer (QgsVectorLayer *layer)
void writeToLayer (QgsVectorLayer *layer)
void setDataDefinedProperty (DataDefinedProperties p, int attributeIndex)
 Set a property as data defined.
void removeDataDefinedProperty (DataDefinedProperties p)
 Set a property to static instead data defined.
int sizeToPixel (double size, const QgsRenderContext &c) const
 Calculates pixel size (considering output size should be in pixel or map units, scale factors and oversampling)

Public Attributes

QString fieldName
bool isExpression
 Is this label made from a expression string eg FieldName || 'mm'.
Placement placement
unsigned int placementFlags
QFont textFont
QColor textColor
bool enabled
int priority
bool obstacle
double dist
double vectorScaleFactor
double rasterCompressFactor
int scaleMin
int scaleMax
double bufferSize
QColor bufferColor
bool formatNumbers
int decimals
bool plusSign
bool labelPerPart
bool mergeLines
double minFeatureSize
bool addDirectionSymbol
bool fontSizeInMapUnits
bool distInMapUnits
QString wrapChar
pal::Layer * palLayer
int fieldIndex
QFontMetricsF * fontMetrics
const QgsMapToPixelxform
const QgsCoordinateTransformct
QgsPoint ptZero
QgsPoint ptOne
QList< QgsPalGeometry * > geometries
QgsGeometryextentGeom
QMap< DataDefinedProperties, int > dataDefinedProperties
 Stores field indices for data defined layer properties.

Private Member Functions

bool checkMinimumSizeMM (const QgsRenderContext &ct, QgsGeometry *geom, double minSize) const
 Checks if a feature is larger than a minimum size (in mm)

Private Attributes

QgsExpressionexpression

Detailed Description

Definition at line 57 of file qgspallabeling.h.


Member Enumeration Documentation

Enumerator:
Size 
Bold 
Italic 
Underline 
Color 
Strikeout 
Family 
BufferSize 
BufferColor 
PositionX 
PositionY 
Hali 
Vali 
LabelDistance 
Rotation 

Definition at line 82 of file qgspallabeling.h.

Enumerator:
OnLine 
AboveLine 
BelowLine 
MapOrientation 

Definition at line 74 of file qgspallabeling.h.

Enumerator:
AroundPoint 
OverPoint 
Line 
Curved 
Horizontal 
Free 

Definition at line 64 of file qgspallabeling.h.


Constructor & Destructor Documentation

Definition at line 201 of file qgspallabeling.cpp.

References ct, expression, extentGeom, and fontMetrics.


Member Function Documentation

void QgsPalLayerSettings::calculateLabelSize ( const QFontMetricsF *  fm,
QString  text,
double &  labelX,
double &  labelY 
)
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 387 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().

Returns the QgsExpression for this label settings.

Definition at line 211 of file qgspallabeling.cpp.

References expression, and fieldName.

Referenced by registerFeature().

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

Set a property to static instead data defined.

Definition at line 382 of file qgspallabeling.cpp.

References dataDefinedProperties.

Set a property as data defined.

Definition at line 377 of file qgspallabeling.cpp.

References dataDefinedProperties.

int QgsPalLayerSettings::sizeToPixel ( double  size,
const QgsRenderContext c 
) const

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

Parameters:
sizesize to convert
crendercontext
Returns:
font pixel size

Definition at line 711 of file qgspallabeling.cpp.

References fontSizeInMapUnits, QgsRenderContext::mapToPixel(), QgsMapToPixel::mapUnitsPerPixel(), QgsRenderContext::rasterScaleFactor(), and QgsRenderContext::scaleFactor().

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


Member Data Documentation

Stores field indices for data defined layer properties.

Definition at line 161 of file qgspallabeling.h.

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

Definition at line 173 of file qgspallabeling.h.

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

Definition at line 152 of file qgspallabeling.h.

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

Definition at line 133 of file qgspallabeling.h.

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

Definition at line 157 of file qgspallabeling.h.

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

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

Definition at line 105 of file qgspallabeling.h.

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

Definition at line 151 of file qgspallabeling.h.

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

Definition at line 156 of file qgspallabeling.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines