QGIS API Documentation
2.12.0-Lyon
|
The QgsLabelFeature class describes a feature that should be used within the labeling engine. More...
#include <qgslabelingenginev2.h>
Public Member Functions | |
QgsLabelFeature (QgsFeatureId id, GEOSGeometry *geometry, const 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::LabelInfo * | curvedLabelInfo () 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::Layer * | layer () 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... | |
QgsPoint | positionOffset () const |
Applies only to "offset from point" placement strategy. More... | |
double | priority () const |
Returns the feature's labeling priority. More... | |
QgsAbstractLabelProvider * | provider () 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 | setPositionOffset (const QgsPoint &offset) |
Applies only to "offset from point" placement strategy. More... | |
void | setPriority (double priority) |
Sets the priority for labeling the feature. More... | |
void | setQuadOffset (const 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... | |
QSizeF | size () const |
Size of the label (in map units) More... | |
Protected Attributes | |
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::LabelInfo * | mInfo |
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::Layer * | mLayer |
Pointer to PAL layer (assigned when registered to PAL) More... | |
double | mObstacleFactor |
how strong is the geometry acting as obstacle More... | |
QgsPoint | mPositionOffset |
offset of label from the feature (only for "offset from point" 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... | |
The QgsLabelFeature class describes a feature that should be used within the labeling engine.
Those may be the usual textual labels, diagrams, or any other custom type of map annotations (generated by custom label providers).
Instances only contain data relevant to the labeling engine (geometry, label size etc.) necessary for the layout. Rendering of labels is done by label providers.
Individual label providers may create subclasses of QgsLabelFeature in order to add more data to the instances that will be later used for drawing of labels.
Definition at line 51 of file qgslabelingenginev2.h.
QgsLabelFeature::QgsLabelFeature | ( | QgsFeatureId | id, |
GEOSGeometry * | geometry, | ||
const QSizeF & | size | ||
) |
Create label feature, takes ownership of the geometry instance.
Definition at line 348 of file qgslabelingenginev2.cpp.
|
virtual |
Clean up geometry and curved label info (if present)
Definition at line 367 of file qgslabelingenginev2.cpp.
|
inline |
Whether label should be always shown (sets very high label priority)
Definition at line 141 of file qgslabelingenginev2.h.
|
inline |
Get additional infor required for curved label placement. Returns null if not set.
Definition at line 179 of file qgslabelingenginev2.h.
|
inline |
Applies to "around point" placement strategy or linestring features.
Distance of the label from the feature (in map units)
Definition at line 128 of file qgslabelingenginev2.h.
|
inline |
Angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns true)
Definition at line 96 of file qgslabelingenginev2.h.
|
inline |
Coordinates of the fixed position (relevant only if hasFixedPosition() returns true)
Definition at line 87 of file qgslabelingenginev2.h.
|
inline |
Get access to the associated geometry.
Definition at line 63 of file qgslabelingenginev2.h.
|
inline |
Whether the label should use a fixed angle instead of using angle from automatic placement.
Definition at line 92 of file qgslabelingenginev2.h.
|
inline |
Whether the label should use a fixed position instead of being automatically placed.
Definition at line 83 of file qgslabelingenginev2.h.
|
inline |
Returns whether the quadrant for the label is fixed.
Applies to "around point" placement strategy.
Definition at line 105 of file qgslabelingenginev2.h.
|
inline |
Identifier of the label (unique within the parent label provider)
Definition at line 60 of file qgslabelingenginev2.h.
|
inline |
Returns whether the feature will act as an obstacle for labels.
Definition at line 149 of file qgslabelingenginev2.h.
|
inline |
Text of the label.
Used also if "merge connected lines to avoid duplicate labels" is enabled to identify which features may be merged.
Definition at line 174 of file qgslabelingenginev2.h.
|
inline |
Get PAL layer of the label feature. Should be only used internally in PAL.
Definition at line 184 of file qgslabelingenginev2.h.
|
inline |
Returns the obstacle factor for the feature.
The factor controls the penalty for labels overlapping this feature.
Definition at line 159 of file qgslabelingenginev2.h.
|
inline |
Applies only to "offset from point" placement strategy.
What offset (in map units) to use from the point
Definition at line 122 of file qgslabelingenginev2.h.
|
inline |
Returns the feature's labeling priority.
Definition at line 73 of file qgslabelingenginev2.h.
QgsAbstractLabelProvider * QgsLabelFeature::provider | ( | ) | const |
Return provider of this instance.
Definition at line 375 of file qgslabelingenginev2.cpp.
|
inline |
Applies to "offset from point" placement strategy and "around point" (in case hasFixedQuadrant() returns true).
Determines which side of the point to use. For X coordinate, values -1, 0, 1 mean left, center, right. For Y coordinate, values -1, 0, 1 mean above, center, below.
Definition at line 116 of file qgslabelingenginev2.h.
|
inline |
Applies only to linestring features - after what distance (in map units) the labels should be repeated (0 = no repetitions)
Definition at line 135 of file qgslabelingenginev2.h.
|
inline |
Set whether label should be always shown (sets very high label priority)
Definition at line 143 of file qgslabelingenginev2.h.
|
inline |
takes ownership of the instance
Definition at line 181 of file qgslabelingenginev2.h.
|
inline |
Applies to "around point" placement strategy or linestring features.
Set distance of the label from the feature (in map units)
Definition at line 131 of file qgslabelingenginev2.h.
|
inline |
Set angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns true)
Definition at line 98 of file qgslabelingenginev2.h.
|
inline |
Set coordinates of the fixed position (relevant only if hasFixedPosition() returns true)
Definition at line 89 of file qgslabelingenginev2.h.
|
inline |
Set whether the label should use a fixed angle instead of using angle from automatic placement.
Definition at line 94 of file qgslabelingenginev2.h.
|
inline |
Set whether the label should use a fixed position instead of being automatically placed.
Definition at line 85 of file qgslabelingenginev2.h.
|
inline |
Sets whether the quadrant for the label must be respected.
This can be used to fix the quadrant for specific features when using an "around point" placement.
Definition at line 111 of file qgslabelingenginev2.h.
|
inline |
Sets whether the feature will act as an obstacle for labels.
enabled | whether feature will act as an obstacle |
Definition at line 154 of file qgslabelingenginev2.h.
|
inline |
Set text of the label.
Definition at line 176 of file qgslabelingenginev2.h.
|
inline |
Assign PAL layer to the label feature. Should be only used internally in PAL.
Definition at line 186 of file qgslabelingenginev2.h.
|
inline |
Sets the obstacle factor for the feature.
The factor controls the penalty for labels overlapping this feature.
factor | larger factors ( > 1.0 ) will result in labels which are less likely to cover this feature, smaller factors ( < 1.0 ) mean labels are more likely to cover this feature (where required) |
Definition at line 167 of file qgslabelingenginev2.h.
|
inline |
Applies only to "offset from point" placement strategy.
Set what offset (in map units) to use from the point
Definition at line 125 of file qgslabelingenginev2.h.
|
inline |
Sets the priority for labeling the feature.
priority | feature's priority, as a value between 0 (highest priority) and 1 (lowest priority). Set to -1.0 to use the layer's default priority for this feature. |
Definition at line 80 of file qgslabelingenginev2.h.
|
inline |
Set which side of the point to use.
Definition at line 119 of file qgslabelingenginev2.h.
|
inline |
Applies only to linestring features - set after what distance (in map units) the labels should be repeated (0 = no repetitions)
Definition at line 138 of file qgslabelingenginev2.h.
|
inline |
Size of the label (in map units)
Definition at line 66 of file qgslabelingenginev2.h.
|
protected |
whether to always show label - even in case of collisions
Definition at line 222 of file qgslabelingenginev2.h.
|
protected |
distance of label from the feature (only for "around point" placement or linestrings)
Definition at line 218 of file qgslabelingenginev2.h.
|
protected |
fixed rotation for the label (instead of automatic choice)
Definition at line 210 of file qgslabelingenginev2.h.
|
protected |
fixed position for the label (instead of automatic placement)
Definition at line 206 of file qgslabelingenginev2.h.
|
protected |
Geometry of the feature to be labelled.
Definition at line 198 of file qgslabelingenginev2.h.
|
protected |
whether mFixedAngle should be respected
Definition at line 208 of file qgslabelingenginev2.h.
|
protected |
whether mFixedPosition should be respected
Definition at line 204 of file qgslabelingenginev2.h.
|
protected |
whether mQuadOffset should be respected (only for "around point" placement)
Definition at line 212 of file qgslabelingenginev2.h.
|
protected |
Associated ID unique within the parent label provider.
Definition at line 196 of file qgslabelingenginev2.h.
|
protected |
extra information for curved labels (may be null)
Definition at line 230 of file qgslabelingenginev2.h.
|
protected |
whether the feature geometry acts as an obstacle for labels
Definition at line 224 of file qgslabelingenginev2.h.
|
protected |
text of the label
Definition at line 228 of file qgslabelingenginev2.h.
|
protected |
Pointer to PAL layer (assigned when registered to PAL)
Definition at line 193 of file qgslabelingenginev2.h.
|
protected |
how strong is the geometry acting as obstacle
Definition at line 226 of file qgslabelingenginev2.h.
|
protected |
offset of label from the feature (only for "offset from point" placement)
Definition at line 216 of file qgslabelingenginev2.h.
|
protected |
Priority of the label.
Definition at line 202 of file qgslabelingenginev2.h.
|
protected |
whether the side of the label is fixed (only for "around point" placement)
Definition at line 214 of file qgslabelingenginev2.h.
|
protected |
distance after which label should be repeated (only for linestrings)
Definition at line 220 of file qgslabelingenginev2.h.
|
protected |
Width and height of the label.
Definition at line 200 of file qgslabelingenginev2.h.