Class: QgsSimpleLineCallout

class qgis.core.QgsSimpleLineCallout

Bases: QgsCallout

A simple direct line callout style.

New in version 3.10:

Methods

calloutLabelPoint

Returns the anchor point geometry for a label with the given bounding box and anchor point mode.

calloutLineToPart

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.

clone

rtype

QgsSimpleLineCallout

create

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

createCalloutLine

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

draw

param context

drawCalloutToAllParts

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

labelAnchorGeometry

Returns the anchor point geometry for a label with the given bounding box and anchor point mode.

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.

properties

param context

readProperties

param props

referencedFields

param context

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.

startRender

param context

stopRender

param context

type

rtype

str

calloutLabelPoint(self, bodyBoundingBox: QRectF, angle: float, anchor: QgsCallout.LabelAnchorPoint, context: QgsRenderContext, calloutContext: QgsCallout.QgsCalloutContext) Tuple[QgsGeometry, bool]

Returns the anchor point geometry for a label with the given bounding box and anchor point mode.

The pinned argument will be set to True if the callout label point is pinned (manually placed).

New in version 3.20.

calloutLineToPart(self, labelGeometry: QgsGeometry, partGeometry: QgsAbstractGeometry, context: QgsRenderContext, calloutContext: QgsCallout.QgsCalloutContext) Tuple[QgsGeometry, bool]

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.

Returns a null geometry if the callout line cannot be calculated.

The pinned argument will be set to True if the callout anchor point is pinned (manually placed).

New in version 3.20.

clone(self) QgsSimpleLineCallout
Return type

QgsSimpleLineCallout

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

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

Parameters
Return type

QgsCallout

createCalloutLine(self, start: QgsPoint, end: QgsPoint, context: QgsRenderContext, bodyBoundingBox: QRectF, angle: float, anchor: QgsGeometry, calloutContext: QgsCallout.QgsCalloutContext) QgsCurve

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

The base class method returns a straight line.

New in version 3.20.

Parameters
Return type

QgsCurve

draw(self, context: QgsRenderContext, bodyBoundingBox: QRectF, angle: float, anchor: QgsGeometry, calloutContext: QgsCallout.QgsCalloutContext)
Parameters
drawCalloutToAllParts(self) bool

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

Return type

bool

labelAnchorGeometry(self, bodyBoundingBox: QRectF, angle: float, anchor: QgsCallout.LabelAnchorPoint) QgsGeometry

Returns the anchor point geometry for a label with the given bounding box and anchor point mode.

Deprecated since version QGIS: 3.20 use calloutLabelPoint() instead

lineSymbol(self) QgsLineSymbol

Returns the line symbol used to render the callout line.

Ownership is not transferred.

See also

setLineSymbol()

Return type

QgsLineSymbol

minimumLength(self) float

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) QgsUnitTypes.RenderUnit

Returns the units for the minimum length of callout lines.

See also

minimumLength()

Return type

QgsUnitTypes.RenderUnit

offsetFromAnchor(self) float

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) QgsUnitTypes.RenderUnit

Returns the units for the offset from anchor point.

Return type

QgsUnitTypes.RenderUnit

offsetFromLabel(self) float

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) QgsUnitTypes.RenderUnit

Returns the units for the offset from label area.

Return type

QgsUnitTypes.RenderUnit

properties(self, context: QgsReadWriteContext) Dict[str, Any]
Parameters

context (QgsReadWriteContext) –

Return type

Dict[str, Any]

readProperties(self, props: Dict[str, Any], context: QgsReadWriteContext)
Parameters
referencedFields(self, context: QgsRenderContext) Set[str]
Parameters

context (QgsRenderContext) –

Return type

Set[str]

setDrawCalloutToAllParts(self, drawToAllParts: bool)

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

Parameters

drawToAllParts (bool) –

setLineSymbol(self, symbol: QgsLineSymbol)

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

See also

lineSymbol()

Parameters

symbol (QgsLineSymbol) –

setMinimumLength(self, length: float)

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

See also

minimumLength()

Parameters

length (float) –

setMinimumLengthMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the minimum callout length.

Parameters

scale (QgsMapUnitScale) –

setMinimumLengthUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the unit for the minimum length of callout lines.

Parameters

unit (QgsUnitTypes.RenderUnit) –

setOffsetFromAnchor(self, distance: float)

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)

Sets the map unit scale for the offset from anchor.

Parameters

scale (QgsMapUnitScale) –

setOffsetFromAnchorUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the unit for the offset from anchor distance.

Parameters

unit (QgsUnitTypes.RenderUnit) –

setOffsetFromLabel(self, distance: float)

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)

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

Parameters

scale (QgsMapUnitScale) –

setOffsetFromLabelUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the unit for the offset from label area distance.

Parameters

unit (QgsUnitTypes.RenderUnit) –

startRender(self, context: QgsRenderContext)
Parameters

context (QgsRenderContext) –

stopRender(self, context: QgsRenderContext)
Parameters

context (QgsRenderContext) –

type(self) str
Return type

str