Class: QgsBalloonCallout¶
- class qgis.core.QgsBalloonCallout¶
Bases:
QgsCallout
A cartoon talking bubble callout style.
New in version 3.20:
Methods
Returns the anchor point geometry for a label with the given bounding box and
anchor
point mode.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.
- rtype
QgsBalloonCallout
Returns the corner radius of the balloon shapes.
Returns the map unit scale for the corner radius.
Returns the units for the corner radius.
Creates a new
QgsBalloonCallout
, using the settings serialized in theproperties
map (corresponding to the output fromQgsBalloonCallout.properties()
).- param context
Returns the fill symbol used to render the callout.
Returns the anchor point geometry for a label with the given bounding box and
anchor
point mode.Returns the margins between the outside of the callout frame and the label's bounding rectangle.
Returns the units for the margins between the outside of the callout frame and the label's bounding rectangle.
Returns the offset distance from the anchor point at which to start the line.
Returns the map unit scale for the offset from anchor.
Returns the units for the offset from anchor point.
- param context
- param props
- param context
Sets the
radius
of the corners for the balloon shapes.Sets the map unit
scale
for the corner radius.Sets the
unit
for the corner radius.Sets the fill
symbol
used to render the callout.Sets the
margins
between the outside of the callout frame and the label's bounding rectangle.Sets the
unit
for the margins between the outside of the callout frame and the label's bounding rectangle.Sets the offset
distance
from the anchor point at which to start the line.Sets the map unit
scale
for the offset from anchor.Sets the
unit
for the offset from anchor distance.Sets the
width
of the wedge shape at the side it connects with the label.Sets the map unit
scale
for the wedge width.Sets the
unit
for the wedge width.- param context
- param context
- rtype
str
Returns the width of the wedge shape at the side it connects with the label.
Returns the map unit scale for the wedge width.
Returns the units for the wedge width.
- 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 toTrue
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 toTrue
if the callout anchor point is pinned (manually placed).New in version 3.20.
- clone(self) QgsBalloonCallout ¶
- Return type
- cornerRadius(self) float ¶
Returns the corner radius of the balloon shapes.
Units are specified through
wedgeWidthUnit()
.See also
See also
- Return type
float
- cornerRadiusMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the corner radius.
See also
See also
See also
- Return type
- cornerRadiusUnit(self) QgsUnitTypes.RenderUnit ¶
Returns the units for the corner radius.
See also
See also
- Return type
- create(properties: Dict[str, Any] = {}, context: QgsReadWriteContext = QgsReadWriteContext()) QgsCallout ¶
Creates a new
QgsBalloonCallout
, using the settings serialized in theproperties
map (corresponding to the output fromQgsBalloonCallout.properties()
).- Parameters
properties (Dict[str) –
context (
QgsReadWriteContext
= QgsReadWriteContext()) –
- Return type
- draw(self, context: QgsRenderContext, bodyBoundingBox: QRectF, angle: float, anchor: QgsGeometry, calloutContext: QgsCallout.QgsCalloutContext)¶
- Parameters
context (QgsRenderContext) –
bodyBoundingBox (QRectF) –
angle (float) –
anchor (QgsGeometry) –
calloutContext (QgsCallout.QgsCalloutContext) –
- fillSymbol(self) QgsFillSymbol ¶
Returns the fill symbol used to render the callout.
Ownership is not transferred.
See also
- Return type
- 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
- margins(self) QgsMargins ¶
Returns the margins between the outside of the callout frame and the label’s bounding rectangle.
Units are retrieved via
marginsUnit()
Note
Negative margins are acceptable.
See also
See also
- Return type
- marginsUnit(self) QgsUnitTypes.RenderUnit ¶
Returns the units for the margins between the outside of the callout frame and the label’s bounding rectangle.
See also
See also
- Return type
- offsetFromAnchor(self) float ¶
Returns the offset distance from the anchor point at which to start the line. Units are specified through
offsetFromAnchorUnit()
.See also
See also
- Return type
float
- offsetFromAnchorMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the offset from anchor.
See also
See also
See also
- Return type
- offsetFromAnchorUnit(self) QgsUnitTypes.RenderUnit ¶
Returns the units for the offset from anchor point.
See also
See also
- Return type
- properties(self, context: QgsReadWriteContext) Dict[str, Any] ¶
- Parameters
context (QgsReadWriteContext) –
- Return type
Dict[str, Any]
- readProperties(self, props: Dict[str, Any], context: QgsReadWriteContext)¶
- Parameters
props (Dict[str) –
context (QgsReadWriteContext) –
- referencedFields(self, context: QgsRenderContext) Set[str] ¶
- Parameters
context (QgsRenderContext) –
- Return type
Set[str]
- setCornerRadius(self, radius: float)¶
Sets the
radius
of the corners for the balloon shapes.Units are specified through
setCornerRadiusUnit()
.See also
See also
- Parameters
radius (float) –
- setCornerRadiusMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
for the corner radius.See also
See also
See also
- Parameters
scale (QgsMapUnitScale) –
- setCornerRadiusUnit(self, unit: QgsUnitTypes.RenderUnit)¶
Sets the
unit
for the corner radius.See also
See also
- Parameters
unit (QgsUnitTypes.RenderUnit) –
- setFillSymbol(self, symbol: QgsFillSymbol)¶
Sets the fill
symbol
used to render the callout. Ownership ofsymbol
is transferred to the callout.See also
- Parameters
symbol (QgsFillSymbol) –
- setMargins(self, margins: QgsMargins)¶
Sets the
margins
between the outside of the callout frame and the label’s bounding rectangle.Units are set via
setMarginsUnit()
Note
Negative margins are acceptable.
See also
See also
- Parameters
margins (QgsMargins) –
- setMarginsUnit(self, unit: QgsUnitTypes.RenderUnit)¶
Sets the
unit
for the margins between the outside of the callout frame and the label’s bounding rectangle.See also
See also
- 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 throughsetOffsetFromAnchorUnit()
.See also
See also
- Parameters
distance (float) –
- setOffsetFromAnchorMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
for the offset from anchor.See also
See also
See also
- Parameters
scale (QgsMapUnitScale) –
- setOffsetFromAnchorUnit(self, unit: QgsUnitTypes.RenderUnit)¶
Sets the
unit
for the offset from anchor distance.See also
See also
- Parameters
unit (QgsUnitTypes.RenderUnit) –
- setWedgeWidth(self, width: float)¶
Sets the
width
of the wedge shape at the side it connects with the label.Units are specified through
setWedgeWidthUnit()
.See also
See also
- Parameters
width (float) –
- setWedgeWidthMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
for the wedge width.See also
See also
See also
- Parameters
scale (QgsMapUnitScale) –
- setWedgeWidthUnit(self, unit: QgsUnitTypes.RenderUnit)¶
Sets the
unit
for the wedge width.See also
See also
- Parameters
unit (QgsUnitTypes.RenderUnit) –
- startRender(self, context: QgsRenderContext)¶
- Parameters
context (QgsRenderContext) –
- stopRender(self, context: QgsRenderContext)¶
- Parameters
context (QgsRenderContext) –
- type(self) str ¶
- Return type
str
- wedgeWidth(self) float ¶
Returns the width of the wedge shape at the side it connects with the label.
Units are specified through
wedgeWidthUnit()
.See also
See also
- Return type
float
- wedgeWidthMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the wedge width.
See also
See also
See also
- Return type
- wedgeWidthUnit(self) QgsUnitTypes.RenderUnit ¶
Returns the units for the wedge width.
See also
See also
- Return type