20 #include "qgis_core.h"
53 sipType = sipType_QgsSimpleLineCallout;
57 sipType = sipType_QgsManhattanLineCallout;
89 PoleOfInaccessibility = 0,
122 virtual QString
type()
const = 0;
152 virtual void readProperties(
const QVariantMap &props,
const QgsReadWriteContext &context );
161 virtual bool saveProperties( QDomDocument &doc, QDomElement &element,
const QgsReadWriteContext &context )
const;
170 virtual void restoreProperties(
const QDomElement &element,
const QgsReadWriteContext &context );
199 virtual QSet< QString > referencedFields(
const QgsRenderContext &context )
const;
217 bool allFeaturePartsLabeled =
false;
253 void setEnabled(
bool enabled );
303 static QString encodeAnchorPoint(
AnchorPoint anchor );
338 static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
381 bool mEnabled =
false;
392 static void initPropertyDefinitions();
424 QString type() const override;
427 void readProperties( const QVariantMap &props, const
QgsReadWriteContext &context ) override;
430 QSet< QString > referencedFields( const
QgsRenderContext &context ) const override;
454 double minimumLength()
const {
return mMinCalloutLength; }
606 std::unique_ptr< QgsLineSymbol > mLineSymbol;
607 double mMinCalloutLength = 0;
611 double mOffsetFromAnchorDistance = 0;
615 double mOffsetFromLabelDistance = 0;
619 bool mDrawCalloutToAllParts =
false;
652 QString type() const override;
Abstract base class for callout renderers.
virtual void draw(QgsRenderContext &context, QRectF bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext)=0
Performs the actual rendering of the callout implementation onto the specified render context.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the callout's property collection, used for data defined overrides.
virtual ~QgsCallout()=default
virtual QString type() const =0
Returns a unique string representing the callout type.
AnchorPoint anchorPoint() const
Returns the feature's anchor point position.
LabelAnchorPoint labelAnchorPoint() const
Returns the label's anchor point position.
AnchorPoint
Feature's anchor point position.
@ PointOnExterior
A point on the surface's outline closest to the label is used as anchor for polygon geometries.
@ Centroid
The surface's centroid is used as anchor for polygon geometries.
@ PointOnSurface
A point guaranteed to be on the surface is used as anchor for polygon geometries.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
void setLabelAnchorPoint(LabelAnchorPoint anchor)
Sets the label's anchor point position.
virtual QgsCallout * clone() const =0
Duplicates a callout by creating a deep copy of the callout.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the callout's property collection, used for data defined overrides.
DrawOrder
Options for draw order (stacking) of callouts.
@ OrderBelowIndividualLabels
Render callouts below their individual associated labels, some callouts may be drawn over other label...
@ OrderBelowAllLabels
Render callouts below all labels.
LabelAnchorPoint
Label's anchor point position.
@ LabelPointOnExterior
The point on the label's boundary closest to the feature.
@ LabelBottomLeft
Bottom left corner of the label's boundary.
@ LabelBottomMiddle
Bottom middle of the label's boundary.
@ LabelMiddleLeft
Middle left of the label's boundary.
@ LabelBottomRight
Bottom right corner of the label's boundary.
@ LabelMiddleRight
Middle right of the label's boundary.
@ LabelTopMiddle
Top middle of the label's boundary.
@ LabelTopLeft
Top left corner of the label's boundary.
@ LabelCentroid
The labe's centroid.
@ LabelTopRight
Top right corner of the label's boundary.
Property
Data definable properties.
@ AnchorPointPosition
Feature's anchor point position.
@ LabelAnchorPointPosition
Label's anchor point position.
@ DrawCalloutToAllParts
Whether callout lines should be drawn to all feature parts.
@ OffsetFromAnchor
Distance to offset lines from anchor points.
@ OffsetFromLabel
Distance to offset lines from label area.
@ MinimumCalloutLength
Minimum length of callouts.
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
bool enabled() const
Returns true if the the callout is enabled.
A geometry is the spatial representation of a feature.
A line symbol type, for rendering LineString and MultiLineString geometries.
Draws straight (right angled) lines as callouts.
QgsManhattanLineCallout & operator=(const QgsManhattanLineCallout &)=delete
Struct for storing maximum and minimum scales for measurements in map units.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
A simple direct line callout style.
void setMinimumLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum callout length.
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
QgsUnitTypes::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
~QgsSimpleLineCallout() override
void setMinimumLength(double length)
Sets the minimum length of callout lines.
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
bool drawCalloutToAllParts() const
Returns true if callout lines should be drawn to all feature parts.
void setDrawCalloutToAllParts(bool drawToAllParts)
Sets whether callout lines should be drawn to all feature parts.
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
QgsUnitTypes::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
void setMinimumLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
void setOffsetFromLabelUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from label area distance.
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
RenderUnit
Rendering size units.
@ RenderMillimeters
Millimeters.
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)
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
record about vertex coordinates and index of anchor to which it is snapped
Contains additional contextual information about the context in which a callout is being rendered.