QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsCurvedLineCallout Class Reference

Draws curved lines as callouts. More...

#include <qgscallout.h>

Inheritance diagram for QgsCurvedLineCallout:
Inheritance graph
[legend]

Public Types

enum  Orientation { Automatic , Clockwise , CounterClockwise }
 Curve orientation. More...
 
- Public Types inherited from QgsCallout
enum  AnchorPoint { PoleOfInaccessibility = 0 , PointOnExterior , PointOnSurface , Centroid }
 Feature's anchor point position. More...
 
enum  DrawOrder { OrderBelowAllLabels , OrderBelowIndividualLabels }
 Options for draw order (stacking) of callouts. More...
 
enum  LabelAnchorPoint {
  LabelPointOnExterior , LabelCentroid , LabelTopLeft , LabelTopMiddle ,
  LabelTopRight , LabelMiddleLeft , LabelMiddleRight , LabelBottomLeft ,
  LabelBottomMiddle , LabelBottomRight
}
 Label's anchor point position. More...
 
enum  Property {
  MinimumCalloutLength , OffsetFromAnchor , OffsetFromLabel , DrawCalloutToAllParts ,
  AnchorPointPosition , LabelAnchorPointPosition , OriginX , OriginY ,
  DestinationX , DestinationY , Curvature , Orientation ,
  Margins , WedgeWidth , CornerRadius , BlendMode
}
 Data definable properties. More...
 

Public Member Functions

 QgsCurvedLineCallout ()
 
 QgsCurvedLineCallout (const QgsCurvedLineCallout &other)
 Copy constructor. More...
 
QgsCurvedLineCalloutclone () const override
 Duplicates a callout by creating a deep copy of the callout. More...
 
double curvature () const
 Returns the callout line's curvature. More...
 
QgsCurvedLineCalloutoperator= (const QgsCurvedLineCallout &)=delete
 
Orientation orientation () const
 Returns the callout line's curve orientation. More...
 
QVariantMap properties (const QgsReadWriteContext &context) const override
 Returns the properties describing the callout encoded in a string format. More...
 
void setCurvature (double curvature)
 Sets the callout line's curvature. More...
 
void setOrientation (Orientation orientation)
 Sets the callout line's curve orientation. More...
 
QString type () const override
 Returns a unique string representing the callout type. More...
 
- Public Member Functions inherited from QgsSimpleLineCallout
 QgsSimpleLineCallout ()
 
 QgsSimpleLineCallout (const QgsSimpleLineCallout &other)
 Copy constructor. More...
 
 ~QgsSimpleLineCallout () override
 
QgsSimpleLineCalloutclone () const override
 Duplicates a callout by creating a deep copy of the callout. More...
 
bool drawCalloutToAllParts () const
 Returns true if callout lines should be drawn to all feature parts. More...
 
QgsLineSymbollineSymbol ()
 Returns the line symbol used to render the callout line. More...
 
double minimumLength () const
 Returns the minimum length of callout lines. More...
 
const QgsMapUnitScaleminimumLengthMapUnitScale () const
 Returns the map unit scale for the minimum callout length. More...
 
Qgis::RenderUnit minimumLengthUnit () const
 Returns the units for the minimum length of callout lines. More...
 
double offsetFromAnchor () const
 Returns the offset distance from the anchor point at which to start the line. More...
 
const QgsMapUnitScaleoffsetFromAnchorMapUnitScale () const
 Returns the map unit scale for the offset from anchor. More...
 
Qgis::RenderUnit offsetFromAnchorUnit () const
 Returns the units for the offset from anchor point. More...
 
double offsetFromLabel () const
 Returns the offset distance from label area at which to end the line. More...
 
const QgsMapUnitScaleoffsetFromLabelMapUnitScale () const
 Returns the map unit scale for the minimum callout length. More...
 
Qgis::RenderUnit offsetFromLabelUnit () const
 Returns the units for the offset from label area. More...
 
QgsSimpleLineCalloutoperator= (const QgsSimpleLineCallout &)=delete
 
QVariantMap properties (const QgsReadWriteContext &context) const override
 Returns the properties describing the callout encoded in a string format. More...
 
void readProperties (const QVariantMap &props, const QgsReadWriteContext &context) override
 Reads a string map of an callout's properties and restores the callout to the state described by the properties map. More...
 
QSet< QString > referencedFields (const QgsRenderContext &context) const override
 Returns the set of attributes referenced by the callout. More...
 
void setDrawCalloutToAllParts (bool drawToAllParts)
 Sets whether callout lines should be drawn to all feature parts. More...
 
void setLineSymbol (QgsLineSymbol *symbol)
 Sets the line symbol used to render the callout line. More...
 
void setMinimumLength (double length)
 Sets the minimum length of callout lines. More...
 
void setMinimumLengthMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for the minimum callout length. More...
 
void setMinimumLengthUnit (Qgis::RenderUnit unit)
 Sets the unit for the minimum length of callout lines. More...
 
void setOffsetFromAnchor (double distance)
 Sets the offset distance from the anchor point at which to start the line. More...
 
void setOffsetFromAnchorMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for the offset from anchor. More...
 
void setOffsetFromAnchorUnit (Qgis::RenderUnit unit)
 Sets the unit for the offset from anchor distance. More...
 
void setOffsetFromLabel (double distance)
 Sets the offset distance from label area at which to end the line. More...
 
void setOffsetFromLabelMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for the offset from label area. More...
 
void setOffsetFromLabelUnit (Qgis::RenderUnit unit)
 Sets the unit for the offset from label area distance. More...
 
void startRender (QgsRenderContext &context) override
 Prepares the callout for rendering on the specified render context. More...
 
void stopRender (QgsRenderContext &context) override
 Finalises the callout after a set of rendering operations on the specified render context. More...
 
QString type () const override
 Returns a unique string representing the callout type. More...
 
- Public Member Functions inherited from QgsCallout
 QgsCallout ()
 Constructor for QgsCallout. More...
 
virtual ~QgsCallout ()=default
 
AnchorPoint anchorPoint () const
 Returns the feature's anchor point position. More...
 
QPainter::CompositionMode blendMode () const
 Returns the blending mode used for drawing callouts. More...
 
virtual QgsCalloutclone () const =0
 Duplicates a callout by creating a deep copy of the callout. More...
 
bool containsAdvancedEffects () const
 Returns true if the callout requires advanced effects such as blend modes, which require output in raster formats to be fully respected. More...
 
QgsPropertyCollectiondataDefinedProperties ()
 Returns a reference to the callout's property collection, used for data defined overrides. More...
 
const QgsPropertyCollectiondataDefinedProperties () const
 Returns a reference to the callout's property collection, used for data defined overrides. More...
 
virtual DrawOrder drawOrder () const
 Returns the desired drawing order (stacking) to use while rendering this callout. More...
 
bool enabled () const
 Returns true if the the callout is enabled. More...
 
LabelAnchorPoint labelAnchorPoint () const
 Returns the label's anchor point position. More...
 
virtual QVariantMap properties (const QgsReadWriteContext &context) const
 Returns the properties describing the callout encoded in a string format. More...
 
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 properties map. More...
 
virtual QSet< QString > referencedFields (const QgsRenderContext &context) const
 Returns the set of attributes referenced by the callout. More...
 
void render (QgsRenderContext &context, const QRectF &rect, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext)
 Renders the callout onto the specified render context. More...
 
virtual void restoreProperties (const QDomElement &element, const QgsReadWriteContext &context)
 Restores the callout's properties from a DOM element. More...
 
virtual bool saveProperties (QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context) const
 Saves the current state of the callout to a DOM element. More...
 
void setAnchorPoint (AnchorPoint anchor)
 Sets the feature's anchor point position. More...
 
void setBlendMode (QPainter::CompositionMode mode)
 Sets the blending mode used for drawing callouts. More...
 
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the callout's property collection, used for data defined overrides. More...
 
void setEnabled (bool enabled)
 Sets whether the callout is enabled. More...
 
void setLabelAnchorPoint (LabelAnchorPoint anchor)
 Sets the label's anchor point position. More...
 
virtual void startRender (QgsRenderContext &context)
 Prepares the callout for rendering on the specified render context. More...
 
virtual void stopRender (QgsRenderContext &context)
 Finalises the callout after a set of rendering operations on the specified render context. More...
 
virtual QString type () const =0
 Returns a unique string representing the callout type. More...
 

Static Public Member Functions

static QgsCalloutcreate (const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
 Creates a new QgsCurvedLineCallout, using the settings serialized in the properties map (corresponding to the output from QgsCurvedLineCallout::properties() ). More...
 
- Static Public Member Functions inherited from QgsSimpleLineCallout
static QgsCalloutcreate (const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
 Creates a new QgsSimpleLineCallout, using the settings serialized in the properties map (corresponding to the output from QgsSimpleLineCallout::properties() ). More...
 
- Static Public Member Functions inherited from QgsCallout
static QgsCallout::AnchorPoint decodeAnchorPoint (const QString &name, bool *ok=nullptr)
 Attempts to decode a string representation of an anchor point name to the corresponding anchor point. More...
 
static QgsCallout::LabelAnchorPoint decodeLabelAnchorPoint (const QString &name, bool *ok=nullptr)
 Attempts to decode a string representation of a label anchor point name to the corresponding anchor point. More...
 
static QString encodeAnchorPoint (AnchorPoint anchor)
 Encodes an anchor point to its string representation. More...
 
static QString encodeLabelAnchorPoint (LabelAnchorPoint anchor)
 Encodes a label anchor point to its string representation. More...
 
static QgsPropertiesDefinition propertyDefinitions ()
 Returns the definitions for data defined properties available for use in callouts. More...
 

Protected Member Functions

QgsCurvecreateCalloutLine (const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext) const override
 Creates a callout line between start and end in the desired style. More...
 
- Protected Member Functions inherited from QgsSimpleLineCallout
virtual QgsCurvecreateCalloutLine (const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext) const
 Creates a callout line between start and end in the desired style. More...
 
void draw (QgsRenderContext &context, const 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. More...
 
- Protected Member Functions inherited from QgsCallout
QgsGeometry calloutLabelPoint (const QRectF &bodyBoundingBox, double angle, LabelAnchorPoint anchor, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned) const
 Returns the anchor point geometry for a label with the given bounding box and anchor point mode. More...
 
QgsGeometry calloutLineToPart (const QgsGeometry &labelGeometry, const QgsAbstractGeometry *partGeometry, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned) const
 Calculates the direct line from a label geometry to an anchor geometry part, respecting the various callout settings which influence how the callout end should be placed in the anchor geometry. More...
 
virtual void draw (QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext)=0
 Performs the actual rendering of the callout implementation onto the specified render context. More...
 
Q_DECL_DEPRECATED QgsGeometry labelAnchorGeometry (const QRectF &bodyBoundingBox, const double angle, LabelAnchorPoint anchor) const
 Returns the anchor point geometry for a label with the given bounding box and anchor point mode. More...
 

Detailed Description

Draws curved lines as callouts.

Since
QGIS 3.20

Definition at line 790 of file qgscallout.h.

Member Enumeration Documentation

◆ Orientation

Curve orientation.

Enumerator
Automatic 

Automatically choose most cartographically pleasing orientation based on label and callout arrangement.

Clockwise 

Curve lines in a clockwise direction.

CounterClockwise 

Curve lines in a counter-clockwise direction.

Definition at line 797 of file qgscallout.h.

Constructor & Destructor Documentation

◆ QgsCurvedLineCallout() [1/2]

QgsCurvedLineCallout::QgsCurvedLineCallout ( )

Definition at line 792 of file qgscallout.cpp.

◆ QgsCurvedLineCallout() [2/2]

QgsCurvedLineCallout::QgsCurvedLineCallout ( const QgsCurvedLineCallout other)

Copy constructor.

Definition at line 796 of file qgscallout.cpp.

Member Function Documentation

◆ clone()

QgsCurvedLineCallout * QgsCurvedLineCallout::clone ( ) const
overridevirtual

Duplicates a callout by creating a deep copy of the callout.

Caller takes ownership of the returned object.

Reimplemented from QgsSimpleLineCallout.

Definition at line 820 of file qgscallout.cpp.

◆ create()

QgsCallout * QgsCurvedLineCallout::create ( const QVariantMap &  properties = QVariantMap(),
const QgsReadWriteContext context = QgsReadWriteContext() 
)
static

Creates a new QgsCurvedLineCallout, using the settings serialized in the properties map (corresponding to the output from QgsCurvedLineCallout::properties() ).

Definition at line 804 of file qgscallout.cpp.

◆ createCalloutLine()

QgsCurve * QgsCurvedLineCallout::createCalloutLine ( const QgsPoint start,
const QgsPoint end,
QgsRenderContext context,
const QRectF &  bodyBoundingBox,
const double  angle,
const QgsGeometry anchor,
QgsCallout::QgsCalloutContext calloutContext 
) const
overrideprotectedvirtual

Creates a callout line between start and end in the desired style.

The base class method returns a straight line.

Since
QGIS 3.20

Reimplemented from QgsSimpleLineCallout.

Definition at line 833 of file qgscallout.cpp.

◆ curvature()

double QgsCurvedLineCallout::curvature ( ) const

Returns the callout line's curvature.

The curvature is a percentage value (with typical ranges between 0.0 and 1.0), representing the overall curvature of the line.

See also
setCurvature()

Definition at line 1019 of file qgscallout.cpp.

◆ operator=()

QgsCurvedLineCallout & QgsCurvedLineCallout::operator= ( const QgsCurvedLineCallout )
delete

◆ orientation()

QgsCurvedLineCallout::Orientation QgsCurvedLineCallout::orientation ( ) const

Returns the callout line's curve orientation.

See also
setOrientation()

Definition at line 1009 of file qgscallout.cpp.

◆ properties()

QVariantMap QgsCurvedLineCallout::properties ( const QgsReadWriteContext context) const
overridevirtual

Returns the properties describing the callout encoded in a string format.

Subclasses must ensure that they include the base class' properties() in their returned value.

See also
readProperties()
saveProperties()

Reimplemented from QgsSimpleLineCallout.

Definition at line 825 of file qgscallout.cpp.

◆ setCurvature()

void QgsCurvedLineCallout::setCurvature ( double  curvature)

Sets the callout line's curvature.

The curvature is a percentage value (with typical ranges between 0.0 and 1.0), representing the overall curvature of the line.

See also
curvature()

Definition at line 1024 of file qgscallout.cpp.

◆ setOrientation()

void QgsCurvedLineCallout::setOrientation ( Orientation  orientation)

Sets the callout line's curve orientation.

See also
orientation()

Definition at line 1014 of file qgscallout.cpp.

◆ type()

QString QgsCurvedLineCallout::type ( ) const
overridevirtual

Returns a unique string representing the callout type.

Reimplemented from QgsSimpleLineCallout.

Definition at line 815 of file qgscallout.cpp.


The documentation for this class was generated from the following files: