QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
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;
206 virtual DrawOrder drawOrder()
const;
217 bool allFeaturePartsLabeled =
false;
253 void setEnabled(
bool enabled );
303 static QString encodeAnchorPoint(
AnchorPoint anchor );
338 static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
371 virtual void draw(
QgsRenderContext &context, QRectF bodyBoundingBox,
const double angle,
const QgsGeometry &anchor, QgsCalloutContext &calloutContext ) = 0;
377 QgsGeometry labelAnchorGeometry( QRectF bodyBoundingBox,
const double angle, LabelAnchorPoint anchor )
const;
381 bool mEnabled =
false;
384 LabelAnchorPoint mLabelAnchorPoint = LabelPointOnExterior;
392 static void initPropertyDefinitions();
424 QString
type()
const override;
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;
666 #endif // QGSCALLOUT_H
QgsUnitTypes::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
void setMinimumLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum callout length.
@ LabelPointOnExterior
The point on the label's boundary closest to the feature.
@ OffsetFromAnchor
Distance to offset lines from anchor points.
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
RenderUnit
Rendering size units.
AnchorPoint
Feature's anchor point position.
Abstract base class for callout renderers.
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
AnchorPoint anchorPoint() const
Returns the feature's anchor point position.
@ RenderMillimeters
Millimeters.
@ LabelCentroid
The labe's centroid.
static QgsCallout * create(const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
Creates a new QgsSimpleLineCallout, using the settings serialized in the properties map (correspondin...
@ LabelBottomMiddle
Bottom middle of the label's boundary.
QgsSimpleLineCallout * clone() const override
Duplicates a callout by creating a deep copy of the callout.
virtual QString type() const =0
Returns a unique string representing the callout type.
@ AnchorPointPosition
Feature's anchor point position.
@ PointOnExterior
A point on the surface's outline closest to the label is used as anchor for polygon geometries.
@ LabelMiddleRight
Middle right of the label's boundary.
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
@ LabelTopLeft
Top left corner of the label's boundary.
void setMinimumLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
double minimumLength() const
Returns the minimum length of callout lines.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
record about vertex coordinates and index of anchor to which it is snapped
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
@ LabelAnchorPointPosition
Label's anchor point position.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the callout's property collection, used for data defined overrides.
LabelAnchorPoint labelAnchorPoint() const
Returns the label's anchor point position.
@ DrawCalloutToAllParts
Whether callout lines should be drawn to all feature parts.
@ Centroid
The surface's centroid is used as anchor for polygon geometries.
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
void setMinimumLength(double length)
Sets the minimum length of callout lines.
void setLabelAnchorPoint(LabelAnchorPoint anchor)
Sets the label's anchor point position.
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
Struct for storing maximum and minimum scales for measurements in map units.
A simple direct line callout style.
void draw(QgsRenderContext &context, QRectF bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext) override
Performs the actual rendering of the callout implementation onto the specified render context.
virtual void readProperties(const QVariantMap &props, const QgsReadWriteContext &context)
Reads a string map of an callout's properties and restores the callout to the state described by the ...
void setDrawCalloutToAllParts(bool drawToAllParts)
Sets whether callout lines should be drawn to all feature parts.
void setOffsetFromLabelUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from label area distance.
DrawOrder
Options for draw order (stacking) of callouts.
virtual QVariantMap properties(const QgsReadWriteContext &context) const
Returns the properties describing the callout encoded in a string format.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
@ LabelBottomLeft
Bottom left corner of the label's boundary.
Draws straight (right angled) lines as callouts.
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
QgsUnitTypes::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
virtual QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns the set of attributes referenced by the callout.
@ MinimumCalloutLength
Minimum length of callouts.
Contains additional contextual information about the context in which a callout is being rendered.
@ LabelMiddleLeft
Middle left of the label's boundary.
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.
@ LabelBottomRight
Bottom right corner of the label's boundary.
@ LabelTopMiddle
Top middle of the label's boundary.
QString type() const override
Returns a unique string representing the callout type.
virtual void startRender(QgsRenderContext &context)
Prepares the callout for rendering on the specified render context.
virtual void stopRender(QgsRenderContext &context)
Finalises the callout after a set of rendering operations on the specified render context.
Property
Data definable properties.
bool drawCalloutToAllParts() const
Returns true if callout lines should be drawn to all feature parts.
@ OrderBelowAllLabels
Render callouts below all labels.
@ OrderBelowIndividualLabels
Render callouts below their individual associated labels, some callouts may be drawn over other label...
virtual QgsCallout * clone() const =0
Duplicates a callout by creating a deep copy of the callout.
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)
LabelAnchorPoint
Label's anchor point position.
@ OffsetFromLabel
Distance to offset lines from label area.
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the callout's property collection, used for data defined overrides.
bool enabled() const
Returns true if the the callout is enabled.
@ PointOnSurface
A point guaranteed to be on the surface is used as anchor for polygon geometries.
@ LabelTopRight
Top right corner of the label's boundary.