15 #ifndef QGSLABELFEATURE_H 16 #define QGSLABELFEATURE_H 20 #include "qgis_core.h" 69 GEOSGeometry *
geometry()
const {
return mGeometry.get(); }
80 void setPermissibleZone(
const QgsGeometry &geometry );
101 QSizeF size(
double angle = 0.0 )
const;
161 double zIndex()
const {
return mZIndex; }
196 void setAnchorPosition(
const QgsPointXY &anchorPosition );
289 void setPredefinedPositionOrder(
const QVector< QgsPalLayerSettings::PredefinedPointPosition > &order ) { mPredefinedPositionOrder = order; }
386 double overrunDistance()
const;
396 void setOverrunDistance(
double distance );
406 double overrunSmoothDistance()
const;
416 void setOverrunSmoothDistance(
double distance );
474 double mPriority = -1;
478 bool mHasFixedPosition =
false;
482 bool mHasFixedAngle =
false;
484 double mFixedAngle = 0;
486 bool mHasFixedQuadrant =
false;
492 double mDistLabel = 0;
498 double mRepeatDistance = 0;
500 bool mAlwaysShow =
false;
507 double mOverrunDistance = 0;
509 double mOverrunSmoothDistance = 0;
511 QgsLabeling::LinePlacementFlags mArrangementFlags =
nullptr;
525 bool mLabelAllParts =
false;
532 #endif // QGSLABELFEATURE_H void setSymbol(const QgsSymbol *symbol)
Sets the feature symbol associated with this label.
QgsLabeling::LinePlacementFlags arrangementFlags() const
Returns the feature's arrangement flags.
QString labelText() const
Text of the label.
double distLabel() const
Applies to "around point" placement strategy or linestring features.
QgsFeatureId id() const
Identifier of the label (unique within the parent label provider)
void setSymbolSize(QSizeF size)
Sets the size of the rendered symbol associated with this feature.
Abstract base class for all rendered symbols.
QgsPointXY mFixedPosition
fixed position for the label (instead of automatic placement)
void setLabelAllParts(bool labelAllParts)
Sets whether all parts of the feature should be labeled.
double priority() const
Returns the feature's labeling priority.
void setVisualMargin(const QgsMargins &margin)
Sets the visual margin for the label feature.
bool alwaysShow() const
Whether label should be always shown (sets very high label priority)
std::unique_ptr< const GEOSPreparedGeometry, GeosDeleter > prepared_unique_ptr
Scoped GEOS prepared geometry pointer.
A set of features which influence the labeling process.
A class to represent a 2D point.
QString mLabelText
text of the label
const QgsSymbol * symbol()
Returns the feature symbol associated with this label.
QgsMargins mVisualMargin
Visual margin of label contents.
const GEOSPreparedGeometry * permissibleZonePrepared() const
Returns a GEOS prepared geometry representing the label's permissibleZone().
GEOSGeometry * geometry() const
Gets access to the associated geometry.
A geometry is the spatial representation of a feature.
const QSizeF & symbolSize() const
Returns the size of the rendered symbol associated with this feature, if applicable.
void setCurvedLabelInfo(pal::LabelInfo *info)
takes ownership of the instance
QgsFeatureId mId
Associated ID unique within the parent label provider.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
const QgsMargins & visualMargin() const
Returns the visual margin for the label feature.
void setAlwaysShow(bool enabled)
Sets whether label should be always shown (sets very high label priority)
void setLabelText(const QString &text)
Sets text of the label.
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)
Contains settings related to how the label engine treats features as obstacles.
QgsPointXY positionOffset() const
Applies only to "offset from point" placement strategy.
void setHasFixedPosition(bool enabled)
Sets whether the label should use a fixed position instead of being automatically placed...
void setPositionOffset(const QgsPointXY &offset)
Applies only to "offset from point" placement strategy.
QSizeF mSize
Width and height of the label.
void setArrangementFlags(QgsLabeling::LinePlacementFlags flags)
Sets the feature's arrangement flags.
double zIndex() const
Returns the label's z-index.
pal::LabelInfo * curvedLabelInfo() const
Gets additional info required for curved label placement. Returns nullptr if not set.
void setZIndex(double zIndex)
Sets the label's z-index.
bool hasFixedQuadrant() const
Returns whether the quadrant for the label is fixed.
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;.
Offset distance applies from point geometry.
QSizeF mSymbolSize
Size of associated rendered symbol, if applicable.
QVector< QgsPalLayerSettings::PredefinedPointPosition > mPredefinedPositionOrder
Ordered list of predefined positions for label (only for OrderedPositionsAroundPoint placement) ...
void setLayer(pal::Layer *layer)
Assign PAL layer to the label feature. Should be only used internally in PAL.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Optional additional info about label (for curved labels)
void setFixedAngle(double angle)
Sets angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns true) ...
bool hasFixedAngle() const
Whether the label should use a fixed angle instead of using angle from automatic placement.
pal::Layer * layer() const
Gets PAL layer of the label feature. Should be only used internally in PAL.
OffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes...
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 fixedAngle() const
Angle in degrees of the fixed angle (relevant only if hasFixedAngle() returns true) ...
void setPredefinedPositionOrder(const QVector< QgsPalLayerSettings::PredefinedPointPosition > &order)
Sets the priority ordered list of predefined positions for label candidates.
void setOffsetType(QgsPalLayerSettings::OffsetType type)
Sets the offset type, which determines how offsets and distance to label behaves. ...
void setDistLabel(double dist)
Applies to "around point" placement strategy or linestring features.
The QgsAbstractLabelProvider class is an interface class.
double repeatDistance() const
Applies only to linestring features - after what distance (in map units) the labels should be repeate...
QgsPointXY mPositionOffset
offset of label from the feature (only for "offset from point" placement)
void setFixedPosition(const QgsPointXY &point)
Sets coordinates of the fixed position (relevant only if hasFixedPosition() returns true) ...
QPointF quadOffset() const
Applies to "offset from point" placement strategy and "around point" (in case hasFixedQuadrant() retu...
Contains information about the context of a rendering operation.
bool hasFixedPosition() const
Whether the label should use a fixed position instead of being automatically placed.
geos::unique_ptr mGeometry
Geometry of the feature to be labelled.
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
QgsPalLayerSettings::OffsetType offsetType() const
Returns the offset type, which determines how offsets and distance to label behaves.
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...
void setHasFixedQuadrant(bool enabled)
Sets whether the quadrant for the label must be respected.
QgsGeometry mPermissibleZone
Optional geometry to use for label's permissible zone.
QgsPointXY fixedPosition() const
Coordinates of the fixed position (relevant only if hasFixedPosition() returns true) ...
QVector< QgsPalLayerSettings::PredefinedPointPosition > predefinedPositionOrder() const
Returns the priority ordered list of predefined positions for label candidates.
bool labelAllParts() const
Returns true if all parts of the feature should be labeled.
The QgsMargins class defines the four margins of a rectangle.
void setQuadOffset(QPointF quadOffset)
Set which side of the point to use.
void setPriority(double priority)
Sets the priority for labeling the feature.
QPointF mQuadOffset
whether the side of the label is fixed (only for "around point" placement)