QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
Public Member Functions | Protected Attributes | List of all members
QgsTextLabelFeature Class Reference

Class that adds extra information to QgsLabelFeature for text labels. More...

#include <qgspalgeometry.h>

Inheritance diagram for QgsTextLabelFeature:
Inheritance graph
[legend]

Public Member Functions

 QgsTextLabelFeature (QgsFeatureId id, GEOSGeometry *geometry, QSizeF size)
 Construct text label feature. More...
 
 QgsTextLabelFeature (QgsFeatureId id, GEOSGeometry *geometry, const QSizeF &size)
 Construct text label feature. More...
 
 ~QgsTextLabelFeature ()
 Clean up. More...
 
 ~QgsTextLabelFeature ()
 Clean up. More...
 
void calculateInfo (bool curvedLabeling, QFontMetricsF *fm, const QgsMapToPixel *xform, double fontScale, double maxinangle, double maxoutangle)
 calculate data for info(). setDefinedFont() must have been called already. More...
 
void calculateInfo (bool curvedLabeling, QFontMetricsF *fm, const QgsMapToPixel *xform, double fontScale, double maxinangle, double maxoutangle)
 calculate data for info(). setDefinedFont() must have been called already. More...
 
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > & dataDefinedValues () const
 Get data-defined values. More...
 
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > & dataDefinedValues () const
 Get data-defined values. More...
 
QFont definedFont ()
 Font to be used for rendering. More...
 
QFont definedFont ()
 Font to be used for rendering. More...
 
QFontMetricsFlabelFontMetrics ()
 Metrics of the font for rendering. More...
 
QFontMetricsFlabelFontMetrics ()
 Metrics of the font for rendering. More...
 
void setDataDefinedValues (const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &values)
 Set data-defined values. More...
 
void setDataDefinedValues (const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &values)
 Set data-defined values. More...
 
void setDefinedFont (const QFont &f)
 Set font to be used for rendering. More...
 
void setDefinedFont (const QFont &f)
 Set font to be used for rendering. More...
 
QString text (int partId) const
 Returns the text component corresponding to a specified label part. More...
 
QString text (int partId) const
 Returns the text component corresponding to a specified label part. More...
 
- Public Member Functions inherited from QgsLabelFeature
 QgsLabelFeature (QgsFeatureId id, GEOSGeometry *geometry, QSizeF size)
 Create label feature, takes ownership of the geometry instance. More...
 
virtual ~QgsLabelFeature ()
 Clean up geometry and curved label info (if present) More...
 
bool alwaysShow () const
 Whether label should be always shown (sets very high label priority) More...
 
pal::LabelInfocurvedLabelInfo () const
 Get additional infor required for curved label placement. Returns null if not set. More...
 
double distLabel () const
 Applies to "around point" placement strategy or linestring features. More...
 
double fixedAngle () const
 Angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns true) More...
 
QgsPoint fixedPosition () const
 Coordinates of the fixed position (relevant only if hasFixedPosition() returns true) More...
 
GEOSGeometry * geometry () const
 Get access to the associated geometry. More...
 
bool hasFixedAngle () const
 Whether the label should use a fixed angle instead of using angle from automatic placement. More...
 
bool hasFixedPosition () const
 Whether the label should use a fixed position instead of being automatically placed. More...
 
bool hasFixedQuadrant () const
 Returns whether the quadrant for the label is fixed. More...
 
QgsFeatureId id () const
 Identifier of the label (unique within the parent label provider) More...
 
bool isObstacle () const
 Returns whether the feature will act as an obstacle for labels. More...
 
QString labelText () const
 Text of the label. More...
 
pal::Layerlayer () const
 Get PAL layer of the label feature. Should be only used internally in PAL. More...
 
double obstacleFactor () const
 Returns the obstacle factor for the feature. More...
 
GEOSGeometry * obstacleGeometry () const
 Returns the label's obstacle geometry, if different to the feature geometry. More...
 
QgsPalLayerSettings::OffsetType offsetType () const
 Returns the offset type, which determines how offsets and distance to label behaves. More...
 
QgsGeometry permissibleZone () const
 Returns the label's permissible zone geometry. More...
 
const GEOSPreparedGeometry * permissibleZonePrepared () const
 Returns a GEOS prepared geometry representing the label's permissibleZone(). More...
 
QgsPoint positionOffset () const
 Applies only to "offset from point" placement strategy. More...
 
QVector< QgsPalLayerSettings::PredefinedPointPositionpredefinedPositionOrder () const
 Returns the priority ordered list of predefined positions for label candidates. More...
 
double priority () const
 Returns the feature's labeling priority. More...
 
QgsAbstractLabelProviderprovider () const
 Return provider of this instance. More...
 
QPointF quadOffset () const
 Applies to "offset from point" placement strategy and "around point" (in case hasFixedQuadrant() returns true). More...
 
double repeatDistance () const
 Applies only to linestring features - after what distance (in map units) the labels should be repeated (0 = no repetitions) More...
 
void setAlwaysShow (bool enabled)
 Set whether label should be always shown (sets very high label priority) More...
 
void setCurvedLabelInfo (pal::LabelInfo *info)
 takes ownership of the instance More...
 
void setDistLabel (double dist)
 Applies to "around point" placement strategy or linestring features. More...
 
void setFixedAngle (double angle)
 Set angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns true) More...
 
void setFixedPosition (const QgsPoint &point)
 Set coordinates of the fixed position (relevant only if hasFixedPosition() returns true) More...
 
void setHasFixedAngle (bool enabled)
 Set whether the label should use a fixed angle instead of using angle from automatic placement. More...
 
void setHasFixedPosition (bool enabled)
 Set whether the label should use a fixed position instead of being automatically placed. More...
 
void setHasFixedQuadrant (bool enabled)
 Sets whether the quadrant for the label must be respected. More...
 
void setIsObstacle (bool enabled)
 Sets whether the feature will act as an obstacle for labels. More...
 
void setLabelText (const QString &text)
 Set text of the label. More...
 
void setLayer (pal::Layer *layer)
 Assign PAL layer to the label feature. Should be only used internally in PAL. More...
 
void setObstacleFactor (double factor)
 Sets the obstacle factor for the feature. More...
 
void setObstacleGeometry (GEOSGeometry *obstacleGeom)
 Sets the label's obstacle geometry, if different to the feature geometry. More...
 
void setOffsetType (QgsPalLayerSettings::OffsetType type)
 Sets the offset type, which determines how offsets and distance to label behaves. More...
 
void setPermissibleZone (const QgsGeometry &geometry)
 Sets the label's permissible zone geometry. More...
 
void setPositionOffset (const QgsPoint &offset)
 Applies only to "offset from point" placement strategy. More...
 
void setPredefinedPositionOrder (const QVector< QgsPalLayerSettings::PredefinedPointPosition > &order)
 Sets the priority ordered list of predefined positions for label candidates. More...
 
void setPriority (double priority)
 Sets the priority for labeling the feature. More...
 
void setQuadOffset (QPointF quadOffset)
 Set which side of the point to use. More...
 
void setRepeatDistance (double dist)
 Applies only to linestring features - set after what distance (in map units) the labels should be repeated (0 = no repetitions) More...
 
void setSymbolSize (QSizeF size)
 Sets the size of the rendered symbol associated with this feature. More...
 
void setVisualMargin (const VisualMargin &margin)
 Sets the visual margin for the label feature. More...
 
void setZIndex (double zIndex)
 Sets the label's z-index. More...
 
QSizeF size () const
 Size of the label (in map units) More...
 
const QSizeFsymbolSize () const
 Returns the size of the rendered symbol associated with this feature, if applicable. More...
 
const VisualMarginvisualMargin () const
 Returns the visual margin for the label feature. More...
 
double zIndex () const
 Returns the label's z-index. More...
 

Protected Attributes

QStringList mClusters
 List of graphemes (used for curved labels) More...
 
QMap< QgsPalLayerSettings::DataDefinedProperties, QVariantmDataDefinedValues
 Stores attribute values for data defined properties. More...
 
QFont mDefinedFont
 Font for rendering. More...
 
QFontMetricsFmFontMetrics
 Metrics of the font for rendering. More...
 
- Protected Attributes inherited from QgsLabelFeature
bool mAlwaysShow
 whether to always show label - even in case of collisions More...
 
double mDistLabel
 distance of label from the feature (only for "around point" placement or linestrings) More...
 
double mFixedAngle
 fixed rotation for the label (instead of automatic choice) More...
 
QgsPoint mFixedPosition
 fixed position for the label (instead of automatic placement) More...
 
GEOSGeometry * mGeometry
 Geometry of the feature to be labelled. More...
 
bool mHasFixedAngle
 whether mFixedAngle should be respected More...
 
bool mHasFixedPosition
 whether mFixedPosition should be respected More...
 
bool mHasFixedQuadrant
 whether mQuadOffset should be respected (only for "around point" placement) More...
 
QgsFeatureId mId
 Associated ID unique within the parent label provider. More...
 
pal::LabelInfomInfo
 extra information for curved labels (may be null) More...
 
bool mIsObstacle
 whether the feature geometry acts as an obstacle for labels More...
 
QString mLabelText
 text of the label More...
 
pal::LayermLayer
 Pointer to PAL layer (assigned when registered to PAL) More...
 
double mObstacleFactor
 how strong is the geometry acting as obstacle More...
 
GEOSGeometry * mObstacleGeometry
 Optional geometry to use for label obstacles, if different to mGeometry. More...
 
QgsPalLayerSettings::OffsetType mOffsetType
 Offset type for certain placement modes. More...
 
QgsGeometry mPermissibleZone
 Optional geometry to use for label's permissible zone. More...
 
QgsPoint mPositionOffset
 offset of label from the feature (only for "offset from point" placement) More...
 
QVector< QgsPalLayerSettings::PredefinedPointPositionmPredefinedPositionOrder
 Ordered list of predefined positions for label (only for OrderedPositionsAroundPoint placement) More...
 
double mPriority
 Priority of the label. More...
 
QPointF mQuadOffset
 whether the side of the label is fixed (only for "around point" placement) More...
 
double mRepeatDistance
 distance after which label should be repeated (only for linestrings) More...
 
QSizeF mSize
 Width and height of the label. More...
 
QSizeF mSymbolSize
 Size of associated rendered symbol, if applicable. More...
 
VisualMargin mVisualMargin
 Visual margin of label contents. More...
 
double mZIndex
 Z-index of label (higher z-index labels are rendered on top of lower z-index labels) More...
 

Detailed Description

Class that adds extra information to QgsLabelFeature for text labels.

Note
not part of public API
not available in Python bindings
not part of public API

Definition at line 30 of file qgspalgeometry.h.

Constructor & Destructor Documentation

QgsTextLabelFeature::QgsTextLabelFeature ( QgsFeatureId  id,
GEOSGeometry *  geometry,
const QSizeF size 
)
inline

Construct text label feature.

Definition at line 34 of file qgspalgeometry.h.

QgsTextLabelFeature::~QgsTextLabelFeature ( )
inline

Clean up.

Definition at line 42 of file qgspalgeometry.h.

QgsTextLabelFeature::QgsTextLabelFeature ( QgsFeatureId  id,
GEOSGeometry *  geometry,
QSizeF  size 
)

Construct text label feature.

Definition at line 23 of file qgstextlabelfeature.cpp.

QgsTextLabelFeature::~QgsTextLabelFeature ( )

Clean up.

Member Function Documentation

void QgsTextLabelFeature::calculateInfo ( bool  curvedLabeling,
QFontMetricsF fm,
const QgsMapToPixel xform,
double  fontScale,
double  maxinangle,
double  maxoutangle 
)

calculate data for info(). setDefinedFont() must have been called already.

void QgsTextLabelFeature::calculateInfo ( bool  curvedLabeling,
QFontMetricsF fm,
const QgsMapToPixel xform,
double  fontScale,
double  maxinangle,
double  maxoutangle 
)
inline

calculate data for info(). setDefinedFont() must have been called already.

Definition at line 61 of file qgspalgeometry.h.

const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& QgsTextLabelFeature::dataDefinedValues ( ) const
inline

Get data-defined values.

Definition at line 45 of file qgstextlabelfeature.h.

const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& QgsTextLabelFeature::dataDefinedValues ( ) const
inline

Get data-defined values.

Definition at line 126 of file qgspalgeometry.h.

QFont QgsTextLabelFeature::definedFont ( )
inline

Font to be used for rendering.

Definition at line 52 of file qgstextlabelfeature.h.

QFont QgsTextLabelFeature::definedFont ( )
inline

Font to be used for rendering.

Definition at line 133 of file qgspalgeometry.h.

QFontMetricsF* QgsTextLabelFeature::labelFontMetrics ( )
inline

Metrics of the font for rendering.

Definition at line 55 of file qgstextlabelfeature.h.

QFontMetricsF* QgsTextLabelFeature::labelFontMetrics ( )
inline

Metrics of the font for rendering.

Definition at line 136 of file qgspalgeometry.h.

void QgsTextLabelFeature::setDataDefinedValues ( const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  values)
inline

Set data-defined values.

Definition at line 47 of file qgstextlabelfeature.h.

void QgsTextLabelFeature::setDataDefinedValues ( const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &  values)
inline

Set data-defined values.

Definition at line 128 of file qgspalgeometry.h.

void QgsTextLabelFeature::setDefinedFont ( const QFont f)
inline

Set font to be used for rendering.

Definition at line 50 of file qgstextlabelfeature.h.

void QgsTextLabelFeature::setDefinedFont ( const QFont f)
inline

Set font to be used for rendering.

Definition at line 131 of file qgspalgeometry.h.

QString QgsTextLabelFeature::text ( int  partId) const

Returns the text component corresponding to a specified label part.

Parameters
partIdSet to -1 for labels which are not broken into parts (eg, non-curved labels), or the required part index for labels which are broken into parts (curved labels)
Note
added in QGIS 2.10
QString QgsTextLabelFeature::text ( int  partId) const
inline

Returns the text component corresponding to a specified label part.

Parameters
partIdSet to -1 for labels which are not broken into parts (eg, non-curved labels), or the required part index for labels which are broken into parts (curved labels)
Note
added in QGIS 2.10

Definition at line 52 of file qgspalgeometry.h.

Member Data Documentation

QStringList QgsTextLabelFeature::mClusters
protected

List of graphemes (used for curved labels)

Definition at line 140 of file qgspalgeometry.h.

QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > QgsTextLabelFeature::mDataDefinedValues
protected

Stores attribute values for data defined properties.

Definition at line 146 of file qgspalgeometry.h.

QFont QgsTextLabelFeature::mDefinedFont
protected

Font for rendering.

Definition at line 142 of file qgspalgeometry.h.

QFontMetricsF * QgsTextLabelFeature::mFontMetrics
protected

Metrics of the font for rendering.

Definition at line 144 of file qgspalgeometry.h.


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