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.

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)