30 if ( mPermissibleZoneGeosPrepared )
32 mPermissibleZoneGeosPrepared.reset();
33 mPermissibleZoneGeos.reset();
41 if ( mPermissibleZoneGeosPrepared )
43 mPermissibleZoneGeosPrepared.reset();
44 mPermissibleZoneGeos.reset();
45 mPermissibleZoneGeosPrepared =
nullptr;
52 if ( !mPermissibleZoneGeos )
55 mPermissibleZoneGeosPrepared.reset( GEOSPrepare_r(
QgsGeosContext::get(), mPermissibleZoneGeos.get() ) );
69 return ( angle >= 0.785398 && angle <= 2.35619 ) || ( angle >= 3.92699 && angle <= 5.49779 ) ?
mRotatedSize :
mSize;
74 return mAnchorPosition;
106 if ( mLineAnchorPercent < 0.25 )
108 else if ( mLineAnchorPercent > 0.75 )
115 return mAnchorTextPoint;
121 return mObstacleSettings;
126 mObstacleSettings = settings;
131 return mOriginalFeatureCrs;
Represents a coordinate reference system (CRS).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A geometry is the spatial representation of a feature.
static GEOSContextHandle_t get()
Returns a thread local instance of a GEOS context, safe for use in the current thread.
static geos::unique_ptr asGeos(const QgsGeometry &geometry, double precision=0, Qgis::GeosCreationFlags flags=Qgis::GeosCreationFlags())
Returns a geos geometry - caller takes ownership of the object (should be deleted with GEOSGeom_destr...
void setOriginalFeatureCrs(const QgsCoordinateReferenceSystem &crs)
Sets the original layer crs of the feature associated with the label.
QSizeF mRotatedSize
Width and height of the label when rotated between 45 to 135 and 235 to 315 degrees;.
double overrunSmoothDistance() const
Returns the distance (in map units) with which the ends of linear features are averaged over when cal...
const QgsLabelObstacleSettings & obstacleSettings() const
Returns the label's obstacle settings.
QgsLabelFeature(QgsFeatureId id, geos::unique_ptr geometry, QSizeF size)
Constructor for QgsLabelFeature.
QSizeF size(double angle=0.0) const
Size of the label (in map units).
QgsFeatureId mId
Associated ID unique within the parent label provider.
QgsPointXY anchorPosition() const
In case of quadrand or aligned positioning, this is set to the anchor point.
virtual ~QgsLabelFeature()
void setFeature(const QgsFeature &feature)
Sets the original feature associated with this label.
void setPermissibleZone(const QgsGeometry &geometry)
Sets the label's permissible zone geometry.
QgsCoordinateReferenceSystem originalFeatureCrs() const
Returns the original layer CRS of the feature associated with the label.
GEOSGeometry * geometry() const
Gets access to the associated geometry.
void setObstacleSettings(const QgsLabelObstacleSettings &settings)
Sets the label's obstacle settings.
QgsGeometry mPermissibleZone
Optional geometry to use for label's permissible zone.
double mOverrunSmoothDistance
Distance to smooth angle of line start and end when calculating overruns.
void setAnchorPosition(const QgsPointXY &anchorPosition)
In case of quadrand or aligned positioning, this is set to the anchor point.
QgsFeature feature() const
Returns the original feature associated with this label.
QgsFeatureId id() const
Identifier of the label (unique within the parent label provider).
double overrunDistance() const
Returns the permissible distance (in map units) which labels are allowed to overrun the start or end ...
QSizeF mSize
Width and height of the label.
void setOverrunDistance(double distance)
Sets the permissible distance (in map units) which labels are allowed to overrun the start or end of ...
QgsLabelLineSettings::AnchorTextPoint lineAnchorTextPoint() const
Returns the line anchor text point, which dictates which part of the label text should be placed at t...
geos::unique_ptr mGeometry
Geometry of the feature to be labelled.
void setOverrunSmoothDistance(double distance)
Sets the distance (in map units) with which the ends of linear features are averaged over when calcul...
double mOverrunDistance
Distance to allow label to overrun linear features.
AnchorTextPoint
Anchor point of label text.
@ EndOfText
Anchor using end of text.
@ StartOfText
Anchor using start of text.
@ CenterOfText
Anchor using center of text.
@ FollowPlacement
Automatically set the anchor point based on the lineAnchorPercent() value. Values <25% will use the s...
Contains settings related to how the label engine treats features as obstacles.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features