Quantum GIS API Documentation
1.8
|
#include <qgspallabeling.h>
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 () | |
QgsExpression * | getLabelExpression () |
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 QgsMapToPixel * | xform |
const QgsCoordinateTransform * | ct |
QgsPoint | ptZero |
QgsPoint | ptOne |
QList< QgsPalGeometry * > | geometries |
QgsGeometry * | extentGeom |
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 | |
QgsExpression * | expression |
Definition at line 57 of file qgspallabeling.h.
Size | |
Bold | |
Italic | |
Underline | |
Color | |
Strikeout | |
Family | |
BufferSize | |
BufferColor | |
PositionX | |
PositionY | |
Hali | |
Vali | |
LabelDistance | |
Rotation |
Definition at line 82 of file qgspallabeling.h.
Definition at line 74 of file qgspallabeling.h.
Definition at line 64 of file qgspallabeling.h.
Definition at line 134 of file qgspallabeling.cpp.
References addDirectionSymbol, AroundPoint, bufferColor, bufferSize, decimals, dist, distInMapUnits, enabled, fontSizeInMapUnits, formatNumbers, labelPerPart, mergeLines, minFeatureSize, obstacle, placement, placementFlags, plusSign, priority, rasterCompressFactor, scaleMax, scaleMin, textColor, vectorScaleFactor, and wrapChar.
Definition at line 163 of file qgspallabeling.cpp.
References addDirectionSymbol, bufferColor, bufferSize, ct, dataDefinedProperties, decimals, dist, distInMapUnits, enabled, expression, extentGeom, fieldName, fontMetrics, fontSizeInMapUnits, formatNumbers, isExpression, labelPerPart, mergeLines, minFeatureSize, obstacle, placement, placementFlags, plusSign, priority, rasterCompressFactor, scaleMax, scaleMin, textColor, textFont, vectorScaleFactor, and wrapChar.
Definition at line 201 of file qgspallabeling.cpp.
References ct, expression, extentGeom, and fontMetrics.
void QgsPalLayerSettings::calculateLabelSize | ( | const QFontMetricsF * | fm, |
QString | text, | ||
double & | labelX, | ||
double & | labelY | ||
) |
Definition at line 425 of file qgspallabeling.cpp.
References addDirectionSymbol, Line, placement, ptZero, rasterCompressFactor, QgsMapToPixel::toMapCoordinatesF(), wrapChar, QgsPoint::x(), xform, and QgsPoint::y().
Referenced by registerFeature().
bool QgsPalLayerSettings::checkMinimumSizeMM | ( | const QgsRenderContext & | ct, |
QgsGeometry * | geom, | ||
double | minSize | ||
) | const [private] |
Checks if a feature is larger than a minimum size (in mm)
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::readFromLayer | ( | QgsVectorLayer * | layer | ) |
Definition at line 299 of file qgspallabeling.cpp.
References _readColor(), _readDataDefinedPropertyMap(), addDirectionSymbol, bufferColor, bufferSize, QgsMapLayer::customProperty(), dataDefinedProperties, decimals, dist, distInMapUnits, enabled, fieldName, fontSizeInMapUnits, formatNumbers, isExpression, labelPerPart, mergeLines, minFeatureSize, obstacle, placement, placementFlags, plusSign, priority, scaleMax, scaleMin, textColor, textFont, and wrapChar.
Referenced by QgsPalLabeling::prepareLayer(), and QgsPalLabeling::willUseLayer().
void QgsPalLayerSettings::registerFeature | ( | QgsVectorLayer * | layer, |
QgsFeature & | f, | ||
const QgsRenderContext & | context | ||
) |
Definition at line 462 of file qgspallabeling.cpp.
References QgsPalGeometry::addDataDefinedValue(), MathUtils::angle(), QgsGeometry::asGeos(), QgsFeature::attributeMap(), calculateLabelSize(), checkMinimumSizeMM(), QgsGeometry::contains(), ct, dataDefinedProperties, decimals, dist, distInMapUnits, QgsExpression::evalErrorString(), QgsExpression::evaluate(), extentGeom, fieldIndex, fontMetrics, formatNumbers, geometries, QgsFeature::geometry(), getLabelExpression(), Hali, QgsExpression::hasEvalError(), QgsExpression::hasParserError(), QgsFeature::id(), QgsPalGeometry::info(), QgsGeometry::intersection(), isExpression, LabelDistance, M_PI, QgsRenderContext::mapToPixel(), QgsMapToPixel::mapUnitsPerPixel(), minFeatureSize, palLayer, QgsExpression::parserErrorString(), QgsVectorLayer::pendingFields(), plusSign, PositionX, PositionY, ptOne, ptZero, QgsDebugMsg, rasterCompressFactor, Rotation, size, Size, sizeToPixel(), QgsPalGeometry::strId(), textFont, QgsGeometry::transform(), QgsCoordinateTransform::transformInPlace(), Vali, vectorScaleFactor, QgsPoint::x(), and xform.
Referenced by QgsPalLabeling::registerFeature().
Set a property to static instead data defined.
Definition at line 382 of file qgspallabeling.cpp.
References dataDefinedProperties.
void QgsPalLayerSettings::setDataDefinedProperty | ( | DataDefinedProperties | p, |
int | attributeIndex | ||
) |
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)
size | size to convert |
c | rendercontext |
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().
void QgsPalLayerSettings::writeToLayer | ( | QgsVectorLayer * | layer | ) |
Definition at line 338 of file qgspallabeling.cpp.
References _writeColor(), _writeDataDefinedPropertyMap(), addDirectionSymbol, bufferColor, bufferSize, dataDefinedProperties, decimals, dist, distInMapUnits, enabled, fieldName, fontSizeInMapUnits, formatNumbers, isExpression, labelPerPart, mergeLines, minFeatureSize, obstacle, placement, placementFlags, plusSign, priority, scaleMax, scaleMin, QgsMapLayer::setCustomProperty(), textColor, textFont, and wrapChar.
Definition at line 132 of file qgspallabeling.h.
Referenced by calculateLabelSize(), QgsPalLabeling::drawLabel(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 123 of file qgspallabeling.h.
Referenced by QgsPalLabeling::drawLabeling(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 122 of file qgspallabeling.h.
Referenced by QgsPalLabeling::drawLabeling(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 155 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), registerFeature(), and ~QgsPalLayerSettings().
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 125 of file qgspallabeling.h.
Referenced by QgsPalLayerSettings(), readFromLayer(), registerFeature(), and writeToLayer().
double QgsPalLayerSettings::dist |
Definition at line 118 of file qgspallabeling.h.
Referenced by QgsPalLayerSettings(), readFromLayer(), registerFeature(), and writeToLayer().
Definition at line 134 of file qgspallabeling.h.
Referenced by QgsPalLayerSettings(), readFromLayer(), registerFeature(), and writeToLayer().
Definition at line 115 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), QgsPalLabeling::willUseLayer(), and writeToLayer().
QgsExpression* QgsPalLayerSettings::expression [private] |
Definition at line 173 of file qgspallabeling.h.
Referenced by getLabelExpression(), QgsPalLayerSettings(), and ~QgsPalLayerSettings().
Definition at line 158 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), registerFeature(), and ~QgsPalLayerSettings().
Definition at line 152 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), and registerFeature().
QString QgsPalLayerSettings::fieldName |
Definition at line 101 of file qgspallabeling.h.
Referenced by getLabelExpression(), QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
QFontMetricsF* QgsPalLayerSettings::fontMetrics |
Definition at line 153 of file qgspallabeling.h.
Referenced by QgsPalLabeling::drawLabel(), QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), registerFeature(), and ~QgsPalLayerSettings().
Definition at line 133 of file qgspallabeling.h.
Referenced by QgsPalLayerSettings(), readFromLayer(), sizeToPixel(), and writeToLayer().
Definition at line 124 of file qgspallabeling.h.
Referenced by QgsPalLayerSettings(), readFromLayer(), registerFeature(), 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 127 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 128 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 129 of file qgspallabeling.h.
Referenced by QgsPalLayerSettings(), readFromLayer(), registerFeature(), and writeToLayer().
Definition at line 117 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
pal::Layer* QgsPalLayerSettings::palLayer |
Definition at line 151 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), and registerFeature().
Definition at line 111 of file qgspallabeling.h.
Referenced by calculateLabelSize(), QgsPalLabeling::drawLabel(), QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
unsigned int QgsPalLayerSettings::placementFlags |
Definition at line 112 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 126 of file qgspallabeling.h.
Referenced by QgsPalLayerSettings(), readFromLayer(), registerFeature(), and writeToLayer().
Definition at line 116 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 156 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), and registerFeature().
Definition at line 156 of file qgspallabeling.h.
Referenced by calculateLabelSize(), QgsPalLabeling::prepareLayer(), and registerFeature().
Definition at line 120 of file qgspallabeling.h.
Referenced by calculateLabelSize(), QgsPalLabeling::drawLabel(), QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), and registerFeature().
Definition at line 121 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 121 of file qgspallabeling.h.
Referenced by QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 114 of file qgspallabeling.h.
Referenced by QgsPalLabeling::drawLabeling(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 113 of file qgspallabeling.h.
Referenced by QgsPalLabeling::drawLabeling(), QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), readFromLayer(), registerFeature(), and writeToLayer().
Definition at line 119 of file qgspallabeling.h.
Referenced by QgsPalLabeling::drawLabel(), QgsPalLabeling::prepareLayer(), QgsPalLayerSettings(), and registerFeature().
QString QgsPalLayerSettings::wrapChar |
Definition at line 135 of file qgspallabeling.h.
Referenced by calculateLabelSize(), QgsPalLabeling::drawLabel(), QgsPalLayerSettings(), readFromLayer(), and writeToLayer().
Definition at line 154 of file qgspallabeling.h.
Referenced by calculateLabelSize(), QgsPalLabeling::prepareLayer(), and registerFeature().