Class: QgsSimpleLineCallout

A simple direct line callout style.

Added in version 3.10.

Class Hierarchy

Inheritance diagram of qgis.core.QgsSimpleLineCallout

Base classes

QgsCallout

Abstract base class for callout renderers.

Subclasses

QgsCurvedLineCallout

Draws curved lines as callouts.

QgsManhattanLineCallout

Draws straight (right angled) lines as callouts.

Methods

drawCalloutToAllParts

Returns True if callout lines should be drawn to all feature parts.

lineSymbol

Returns the line symbol used to render the callout line.

minimumLength

Returns the minimum length of callout lines.

minimumLengthMapUnitScale

Returns the map unit scale for the minimum callout length.

minimumLengthUnit

Returns the units for the minimum length of callout lines.

offsetFromAnchor

Returns the offset distance from the anchor point at which to start the line.

offsetFromAnchorMapUnitScale

Returns the map unit scale for the offset from anchor.

offsetFromAnchorUnit

Returns the units for the offset from anchor point.

offsetFromLabel

Returns the offset distance from label area at which to end the line.

offsetFromLabelMapUnitScale

Returns the map unit scale for the minimum callout length.

offsetFromLabelUnit

Returns the units for the offset from label area.

setDrawCalloutToAllParts

Sets whether callout lines should be drawn to all feature parts.

setLineSymbol

Sets the line symbol used to render the callout line.

setMinimumLength

Sets the minimum length of callout lines.

setMinimumLengthMapUnitScale

Sets the map unit scale for the minimum callout length.

setMinimumLengthUnit

Sets the unit for the minimum length of callout lines.

setOffsetFromAnchor

Sets the offset distance from the anchor point at which to start the line.

setOffsetFromAnchorMapUnitScale

Sets the map unit scale for the offset from anchor.

setOffsetFromAnchorUnit

Sets the unit for the offset from anchor distance.

setOffsetFromLabel

Sets the offset distance from label area at which to end the line.

setOffsetFromLabelMapUnitScale

Sets the map unit scale for the offset from label area.

setOffsetFromLabelUnit

Sets the unit for the offset from label area distance.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsSimpleLineCallout. See the FAQ for more details.

createCalloutLine

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

Static Methods

create

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

class qgis.core.QgsSimpleLineCallout[source]

Bases: QgsCallout

static create(properties: Dict[str, Any] = {}, context: QgsReadWriteContext = QgsReadWriteContext()) QgsCallout | None[source]

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

Parameters:
Return type:

Optional[QgsCallout]

virtual createCalloutLine(self, start: QgsPoint, end: QgsPoint, context: QgsRenderContext, bodyBoundingBox: QRectF, angle: float, anchor: QgsGeometry, calloutContext: QgsCallout.QgsCalloutContext) QgsCurve | None[source]

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

The base class method returns a straight line.

Added in version 3.20.

Parameters:
Return type:

Optional[QgsCurve]

drawCalloutToAllParts(self) bool[source]

Returns True if callout lines should be drawn to all feature parts.

Return type:

bool

lineSymbol(self) QgsLineSymbol | None[source]

Returns the line symbol used to render the callout line.

Ownership is not transferred.

See also

setLineSymbol()

Return type:

Optional[QgsLineSymbol]

minimumLength(self) float[source]

Returns the minimum length of callout lines. Units are specified through minimumLengthUnits().

Return type:

float

minimumLengthMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the minimum callout length.

See also

minimumLength()

Return type:

QgsMapUnitScale

minimumLengthUnit(self) Qgis.RenderUnit[source]

Returns the units for the minimum length of callout lines.

See also

minimumLength()

Return type:

Qgis.RenderUnit

offsetFromAnchor(self) float[source]

Returns the offset distance from the anchor point at which to start the line. Units are specified through offsetFromAnchorUnit().

Return type:

float

offsetFromAnchorMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the offset from anchor.

Return type:

QgsMapUnitScale

offsetFromAnchorUnit(self) Qgis.RenderUnit[source]

Returns the units for the offset from anchor point.

Return type:

Qgis.RenderUnit

offsetFromLabel(self) float[source]

Returns the offset distance from label area at which to end the line. Units are specified through offsetFromLabelUnit().

Return type:

float

offsetFromLabelMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the minimum callout length.

Return type:

QgsMapUnitScale

offsetFromLabelUnit(self) Qgis.RenderUnit[source]

Returns the units for the offset from label area.

Return type:

Qgis.RenderUnit

setDrawCalloutToAllParts(self, drawToAllParts: bool)[source]

Sets whether callout lines should be drawn to all feature parts.

Parameters:

drawToAllParts (bool)

setLineSymbol(self, symbol: QgsLineSymbol | None)[source]

Sets the line symbol used to render the callout line. Ownership of symbol is transferred to the callout.

See also

lineSymbol()

Parameters:

symbol (Optional[QgsLineSymbol])

setMinimumLength(self, length: float)[source]

Sets the minimum length of callout lines. Units are specified through setMinimumLengthUnit().

See also

minimumLength()

Parameters:

length (float)

setMinimumLengthMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale for the minimum callout length.

Parameters:

scale (QgsMapUnitScale)

setMinimumLengthUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit for the minimum length of callout lines.

Parameters:

unit (Qgis.RenderUnit)

setOffsetFromAnchor(self, distance: float)[source]

Sets the offset distance from the anchor point at which to start the line. Units are specified through setOffsetFromAnchorUnit().

Parameters:

distance (float)

setOffsetFromAnchorMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale for the offset from anchor.

Parameters:

scale (QgsMapUnitScale)

setOffsetFromAnchorUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit for the offset from anchor distance.

Parameters:

unit (Qgis.RenderUnit)

setOffsetFromLabel(self, distance: float)[source]

Sets the offset distance from label area at which to end the line. Units are specified through setOffsetFromLabelUnit().

Parameters:

distance (float)

setOffsetFromLabelMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale for the offset from label area.

Parameters:

scale (QgsMapUnitScale)

setOffsetFromLabelUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit for the offset from label area distance.

Parameters:

unit (Qgis.RenderUnit)