QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
15 #ifndef QGSLABELFEATURE_H
16 #define QGSLABELFEATURE_H
20 #include "qgis_core.h"
70 GEOSGeometry *
geometry()
const {
return mGeometry.get(); }
81 void setPermissibleZone(
const QgsGeometry &geometry );
102 QSizeF size(
double angle = 0.0 )
const;
162 double zIndex()
const {
return mZIndex; }
197 void setAnchorPosition(
const QgsPointXY &anchorPosition );
397 double overrunDistance()
const;
407 void setOverrunDistance(
double distance );
417 double overrunSmoothDistance()
const;
427 void setOverrunSmoothDistance(
double distance );
625 double mPriority = -1;
629 bool mHasFixedPosition =
false;
633 bool mHasFixedAngle =
false;
635 double mFixedAngle = 0;
637 bool mHasFixedQuadrant =
false;
643 double mDistLabel = 0;
649 double mRepeatDistance = 0;
651 bool mAlwaysShow =
false;
656 double mOverrunDistance = 0;
658 double mOverrunSmoothDistance = 0;
660 QgsLabeling::LinePlacementFlags mArrangementFlags = QgsLabeling::LinePlacementFlags();
661 QgsLabeling::PolygonPlacementFlags mPolygonPlacementFlags = QgsLabeling::PolygonPlacementFlag::AllowPlacementInsideOfPolygon;
675 bool mLabelAllParts =
false;
681 double mLineAnchorPercent = 0.5;
686 bool mAllowDegradedPlacement =
false;
690 double mMinimumSize = 0.0;
694 #endif // QGSLABELFEATURE_H
QgsFeatureId id() const
Identifier of the label (unique within the parent label provider)
double minimumSize() const
Returns the minimum size (in map unit) for a feature to be labelled.
QgsPointXY positionOffset() const
Applies only to "offset from point" placement strategy.
Qgis::LabelOffsetType offsetType() const
Returns the offset type, which determines how offsets and distance to label behaves.
void setRotatedSize(QSizeF size)
Sets an alternate label size to be used when a label rotation angle is between 45 to 135 and 235 to 3...
double priority() const
Returns the feature's labeling priority.
QVector< Qgis::LabelPredefinedPointPosition > predefinedPositionOrder() const
Returns the priority ordered list of predefined positions for label candidates.
double fixedAngle() const
Angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns true)
void setLineAnchorTextPoint(QgsLabelLineSettings::AnchorTextPoint point)
Sets the line anchor text point, which dictates which part of the label text should be placed at the ...
void setDistLabel(double dist)
Applies to "around point" placement strategy or linestring features.
void setPriority(double priority)
Sets the priority for labeling the feature.
const QgsSymbol * symbol() const
Returns the feature symbol associated with this label.
void setPositionOffset(const QgsPointXY &offset)
Applies only to "offset from point" placement strategy.
void setMinimumSize(double size)
Sets the minimum size (in map unit) for a feature to be labelled.
const QgsCoordinateReferenceSystem & crs
const QSizeF & symbolSize() const
Returns the size of the rendered symbol associated with this feature, if applicable.
void setOffsetType(Qgis::LabelOffsetType type)
Sets the offset type, which determines how offsets and distance to label behaves.
QgsFeatureId mId
Associated ID unique within the parent label provider.
const QgsMargins & visualMargin() const
Returns the visual margin for the label feature.
Contains information about the context of a rendering operation.
Contains settings related to how the label engine treats features as obstacles.
Abstract base class for all rendered symbols.
const GEOSPreparedGeometry * permissibleZonePrepared() const
Returns a GEOS prepared geometry representing the label's permissibleZone().
QgsLabeling::LinePlacementFlags arrangementFlags() const
Returns the feature's arrangement flags.
QPointF mQuadOffset
whether the side of the label is fixed (only for "around point" placement)
double repeatDistance() const
Applies only to linestring features - after what distance (in map units) the labels should be repeate...
bool hasFixedQuadrant() const
Returns whether the quadrant for the label is fixed.
LabelOffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
void setSymbolSize(QSizeF size)
Sets the size of the rendered symbol associated with this feature.
QgsGeometry mPermissibleZone
Optional geometry to use for label's permissible zone.
bool allowDegradedPlacement() const
Returns true if the label can be placed in inferior fallback positions if it cannot otherwise be plac...
bool hasFixedPosition() const
Whether the label should use a fixed position instead of being automatically placed.
The QgsAbstractLabelProvider class is an interface class. Implementations return list of labels and t...
QSizeF mSize
Width and height of the label.
bool labelAllParts() const
Returns true if all parts of the feature should be labeled.
bool hasFixedAngle() const
Whether the label should use a fixed angle instead of using angle from automatic placement.
double lineAnchorPercent() const
Returns the percent along the line at which labels should be placed, for line labels only.
QString mLabelText
text of the label
void setZIndex(double zIndex)
Sets the label's z-index.
void setHasFixedAngle(bool enabled)
Sets whether the label should use a fixed angle instead of using angle from automatic placement.
void setRepeatDistance(double dist)
Applies only to linestring features - set after what distance (in map units) the labels should be rep...
QgsLabelLineSettings::AnchorType lineAnchorType() const
Returns the line anchor type, which dictates how the lineAnchorPercent() setting is handled.
void setHasFixedQuadrant(bool enabled)
Sets whether the quadrant for the label must be respected.
void setLineAnchorType(QgsLabelLineSettings::AnchorType type)
Sets the line anchor type, which dictates how the lineAnchorPercent() setting is handled.
@ CenterOfText
Anchor using center of text.
The QgsMargins class defines the four margins of a rectangle.
void setFixedPosition(const QgsPointXY &point)
Sets coordinates of the fixed position (relevant only if hasFixedPosition() returns true)
QgsLabeling::PolygonPlacementFlags polygonPlacementFlags() const
Returns the polygon placement flags, which dictate how polygon labels can be placed.
AnchorTextPoint
Anchor point of label text.
void setLabelText(const QString &text)
Sets text of the label.
void setHasFixedPosition(bool enabled)
Sets whether the label should use a fixed position instead of being automatically placed.
void setPredefinedPositionOrder(const QVector< Qgis::LabelPredefinedPointPosition > &order)
Sets the priority ordered list of predefined positions for label candidates.
void setLabelAllParts(bool labelAllParts)
Sets whether all parts of the feature should be labeled.
pal::Layer * layer() const
Gets PAL layer of the label feature. Should be only used internally in PAL.
@ HintOnly
Line anchor is a hint for preferred placement only, but other placements close to the hint are permit...
@ FromPoint
Offset distance applies from point geometry.
This class represents a coordinate reference system (CRS).
AnchorType
Line anchor types.
bool alwaysShow() const
Whether label should be always shown (sets very high label priority)
A class to represent a 2D point.
void setLineAnchorPercent(double percent)
Sets the percent along the line at which labels should be placed, for line labels only.
@ PreventOverlap
Do not allow labels to overlap other labels.
double zIndex() const
Returns the label's z-index.
void setSymbol(const QgsSymbol *symbol)
Sets the feature symbol associated with this label.
void setQuadOffset(QPointF quadOffset)
Set which side of the point to use.
GEOSGeometry * geometry() const
Gets access to the associated geometry.
void setOverlapHandling(Qgis::LabelOverlapHandling handling)
Sets the technique to use for handling overlapping labels for the feature.
QPointF quadOffset() const
Applies to "offset from point" placement strategy and "around point" (in case hasFixedQuadrant() retu...
A geometry is the spatial representation of a feature.
QSizeF mSymbolSize
Size of associated rendered symbol, if applicable.
void setPolygonPlacementFlags(QgsLabeling::PolygonPlacementFlags flags)
Sets the polygon placement flags, which dictate how polygon labels can be placed.
Qgis::LabelOverlapHandling overlapHandling() const
Returns the technique to use for handling overlapping labels for the feature.
double distLabel() const
Applies to "around point" placement strategy or linestring features.
void setLayer(pal::Layer *layer)
Assign PAL layer to the label feature. Should be only used internally in PAL.
QVector< Qgis::LabelPredefinedPointPosition > mPredefinedPositionOrder
Ordered list of predefined positions for label (only for OrderedPositionsAroundPoint placement)
QgsPointXY mFixedPosition
fixed position for the label (instead of automatic placement)
void setFixedAngle(double angle)
Sets angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns true)
QgsPointXY fixedPosition() const
Coordinates of the fixed position (relevant only if hasFixedPosition() returns true)
A set of features which influence the labeling process.
std::unique_ptr< const GEOSPreparedGeometry, GeosDeleter > prepared_unique_ptr
Scoped GEOS prepared geometry pointer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void setVisualMargin(const QgsMargins &margin)
Sets the visual margin for the label feature.
The QgsLabelFeature class describes a feature that should be used within the labeling engine....
void setArrangementFlags(QgsLabeling::LinePlacementFlags flags)
Sets the feature's arrangement flags.
QgsMargins mVisualMargin
Visual margin of label contents.
QgsPointXY mPositionOffset
offset of label from the feature (only for "offset from point" placement)
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
QgsGeometry permissibleZone() const
Returns the label's permissible zone geometry.
QSizeF mRotatedSize
Width and height of the label when rotated between 45 to 135 and 235 to 315 degrees;.
LabelOverlapHandling
Label overlap handling.
QString labelText() const
Text of the label.
geos::unique_ptr mGeometry
Geometry of the feature to be labelled.
void setAlwaysShow(bool enabled)
Sets whether label should be always shown (sets very high label priority)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
void setAllowDegradedPlacement(bool allow)
Sets whether the label can be placed in inferior fallback positions if it cannot otherwise be placed.