61 sipType = sipType_QgsSimpleLineCallout;
65 sipType = sipType_QgsManhattanLineCallout;
69 sipType = sipType_QgsCurvedLineCallout;
71 else if ( sipCpp->type() ==
"balloon" &&
dynamic_cast<QgsBalloonCallout *
>( sipCpp ) != NULL )
73 sipType = sipType_QgsBalloonCallout;
91 DrawCalloutToAllParts,
93 LabelAnchorPointPosition,
150 virtual QString
type()
const = 0;
287 QList< QgsCalloutPosition >
positions()
const {
return mPositions; }
293 QList< QgsCalloutPosition > mPositions;
317 void render(
QgsRenderContext &context,
const QRectF &rect,
const double angle,
const QgsGeometry &anchor, QgsCalloutContext &calloutContext );
329 void setEnabled(
bool enabled );
379 static QString encodeAnchorPoint(
AnchorPoint anchor );
414 static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
432 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
439 void setBlendMode( QPainter::CompositionMode mode ) { mBlendMode = mode; }
492 bool mEnabled =
false;
497 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
505 static void initPropertyDefinitions();
533 QString
type() const override;
724 std::unique_ptr< QgsLineSymbol > mLineSymbol;
725 double mMinCalloutLength = 0;
729 double mOffsetFromAnchorDistance = 0;
733 double mOffsetFromLabelDistance = 0;
737 bool mDrawCalloutToAllParts =
false;
765 QString
type() const override;
813 QString
type() const override;
861 static Orientation decodeOrientation(
const QString &
string );
870 double mCurvature = 0.1;
899 QString
type() const override;
1156 std::unique_ptr< QgsFillSymbol > mFillSymbol;
1157 std::unique_ptr< QgsMarkerSymbol > mMarkerSymbol;
1159 double mOffsetFromAnchorDistance = 0;
1166 double mWedgeWidth = 2.64;
1170 double mCornerRadius = 0.0;
RenderUnit
Rendering size units.
@ Millimeters
Millimeters.
Abstract base class for all geometries.
A cartoon talking bubble callout style.
QgsFillSymbol * fillSymbol()
Returns the fill symbol used to render the callout.
void setCornerRadius(double radius)
Sets the radius of the corners for the balloon shapes.
double wedgeWidth() const
Returns the width of the wedge shape at the side it connects with the label.
const QgsMapUnitScale & wedgeWidthMapUnitScale() const
Returns the map unit scale for the wedge width.
QgsBalloonCallout & operator=(const QgsBalloonCallout &)=delete
double cornerRadius() const
Returns the corner radius of the balloon shapes.
void setCornerRadiusUnit(Qgis::RenderUnit unit)
Sets the unit for the corner radius.
Qgis::RenderUnit wedgeWidthUnit() const
Returns the units for the wedge width.
void setOffsetFromAnchorUnit(Qgis::RenderUnit unit)
Sets the unit for the offset from anchor distance.
QString type() const override
Returns a unique string representing the callout type.
void setMarginsUnit(Qgis::RenderUnit unit)
Sets the unit for the margins between the outside of the callout frame and the label's bounding recta...
void setCornerRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the corner radius.
QgsMarkerSymbol * markerSymbol()
Returns the marker symbol used to render the callout endpoint.
void startRender(QgsRenderContext &context) override
Prepares the callout for rendering on the specified render context.
QSet< QString > referencedFields(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the callout.
Qgis::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
void stopRender(QgsRenderContext &context) override
Finalises the callout after a set of rendering operations on the specified render context.
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
const QgsMargins & margins() const
Returns the margins between the outside of the callout frame and the label's bounding rectangle.
QVariantMap properties(const QgsReadWriteContext &context) const override
Returns the properties describing the callout encoded in a string format.
void setWedgeWidthUnit(Qgis::RenderUnit unit)
Sets the unit for the wedge width.
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
void setFillSymbol(QgsFillSymbol *symbol)
Sets the fill symbol used to render the callout.
Qgis::RenderUnit marginsUnit() const
Returns the units for the margins between the outside of the callout frame and the label's bounding r...
void setWedgeWidth(double width)
Sets the width of the wedge shape at the side it connects with the label.
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
const QgsMapUnitScale & cornerRadiusMapUnitScale() const
Returns the map unit scale for the corner radius.
Qgis::RenderUnit cornerRadiusUnit() const
Returns the units for the corner radius.
void setMargins(const QgsMargins &margins)
Sets the margins between the outside of the callout frame and the label's bounding rectangle.
void setMarkerSymbol(QgsMarkerSymbol *symbol)
Sets the marker symbol used to render the callout endpoint.
void setWedgeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the wedge width.
~QgsBalloonCallout() override
QgsBalloonCallout * clone() const override
Duplicates a callout by creating a deep copy of the callout.
static QgsCallout * create(const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
Creates a new QgsBalloonCallout, using the settings serialized in the properties map (corresponding t...
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
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 ...
Represents the calculated placement of a map label callout line.
Contains additional contextual information about the context in which a callout is being rendered.
QgsCoordinateTransform originalFeatureToMapTransform(const QgsRenderContext &renderContext) const
Returns the coordinate transform to convert from the original layer associated with the callout to th...
void addCalloutPosition(const QgsCalloutPosition &position)
Adds a rendered callout position.
bool allFeaturePartsLabeled
true if all parts of associated feature were labeled
QList< QgsCalloutPosition > positions() const
Returns the list of rendered callout positions.
QgsCoordinateReferenceSystem originalFeatureCrs
Contains the CRS of the original feature associated with this callout.
Abstract base class for callout renderers.
bool containsAdvancedEffects() const
Returns true if the callout requires advanced effects such as blend modes, which require output in ra...
virtual bool saveProperties(QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context) const
Saves the current state of the callout to a DOM element.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the callout's property collection, used for data defined overrides.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing callouts.
virtual ~QgsCallout()=default
virtual void stopRender(QgsRenderContext &context)
Finalises the callout after a set of rendering operations on the specified render context.
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 c...
virtual QString type() const =0
Returns a unique string representing the callout type.
virtual QgsCallout * clone() const =0
Duplicates a callout by creating a deep copy of the callout.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the callout's property collection, used for data defined overrides.
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.
AnchorPoint anchorPoint() const
Returns the feature's anchor point position.
LabelAnchorPoint labelAnchorPoint() const
Returns the label's anchor point position.
AnchorPoint
Feature's anchor point position.
@ PointOnExterior
A point on the surface's outline closest to the label is used as anchor for polygon geometries.
@ Centroid
The surface's centroid is used as anchor for polygon geometries.
@ PointOnSurface
A point guaranteed to be on the surface is used as anchor for polygon geometries.
@ PoleOfInaccessibility
The surface's pole of inaccessibility used as anchor for polygon geometries.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
virtual void restoreProperties(const QDomElement &element, const QgsReadWriteContext &context)
Restores the callout's properties from a DOM element.
void setLabelAnchorPoint(LabelAnchorPoint anchor)
Sets the label's anchor point position.
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.
virtual void startRender(QgsRenderContext &context)
Prepares the callout for rendering on the specified render context.
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.
QgsCallout()
Constructor for QgsCallout.
DrawOrder
Options for draw order (stacking) of callouts.
@ OrderBelowIndividualLabels
Render callouts below their individual associated labels, some callouts may be drawn over other label...
@ OrderBelowAllLabels
Render callouts below all labels.
virtual DrawOrder drawOrder() const
Returns the desired drawing order (stacking) to use while rendering this callout.
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing callouts.
LabelAnchorPoint
Label's anchor point position.
@ LabelPointOnExterior
The point on the label's boundary closest to the feature.
@ LabelBottomLeft
Bottom left corner of the label's boundary.
@ LabelBottomMiddle
Bottom middle of the label's boundary.
@ LabelMiddleLeft
Middle left of the label's boundary.
@ LabelBottomRight
Bottom right corner of the label's boundary.
@ LabelMiddleRight
Middle right of the label's boundary.
@ LabelTopMiddle
Top middle of the label's boundary.
@ LabelTopLeft
Top left corner of the label's boundary.
@ LabelCentroid
The labe's centroid.
@ LabelTopRight
Top right corner of the label's boundary.
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 ...
virtual QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns the set of attributes referenced by the callout.
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
Property
Data definable properties.
virtual QVariantMap properties(const QgsReadWriteContext &context) const
Returns the properties describing the callout encoded in a string format.
bool enabled() const
Returns true if the the callout is enabled.
Represents a coordinate reference system (CRS).
Abstract base class for curved geometry type.
Draws curved lines as callouts.
QgsCurvedLineCallout & operator=(const QgsCurvedLineCallout &)=delete
QgsCurvedLineCallout * clone() const override
Duplicates a callout by creating a deep copy of the callout.
QgsCurve * createCalloutLine(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.
QVariantMap properties(const QgsReadWriteContext &context) const override
Returns the properties describing the callout encoded in a string format.
void setOrientation(Orientation orientation)
Sets the callout line's curve orientation.
void setCurvature(double curvature)
Sets the callout line's curvature.
static QgsCallout * create(const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
Creates a new QgsCurvedLineCallout, using the settings serialized in the properties map (correspondin...
QString type() const override
Returns a unique string representing the callout type.
double curvature() const
Returns the callout line's curvature.
Orientation
Curve orientation.
@ Clockwise
Curve lines in a clockwise direction.
@ CounterClockwise
Curve lines in a counter-clockwise direction.
@ Automatic
Automatically choose most cartographically pleasing orientation based on label and callout arrangemen...
Orientation orientation() const
Returns the callout line's curve orientation.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A geometry is the spatial representation of a feature.
A line symbol type, for rendering LineString and MultiLineString geometries.
Draws straight (right angled) lines as callouts.
QgsManhattanLineCallout()
QString type() const override
Returns a unique string representing the callout type.
QgsCurve * createCalloutLine(const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext) const override
Creates a callout line between start and end in the desired style.
QgsManhattanLineCallout & operator=(const QgsManhattanLineCallout &)=delete
static QgsCallout * create(const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
Creates a new QgsManhattanLineCallout, using the settings serialized in the properties map (correspon...
QgsManhattanLineCallout * clone() const override
Duplicates a callout by creating a deep copy of the callout.
Struct for storing maximum and minimum scales for measurements in map units.
Defines the four margins of a rectangle.
A marker symbol type, for rendering Point and MultiPoint geometries.
Point geometry type, with support for z-dimension and m-values.
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
A simple direct line callout style.
void setMinimumLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum callout length.
Qgis::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
void startRender(QgsRenderContext &context) override
Prepares the callout for rendering on the specified render context.
double minimumLength() const
Returns the minimum length of callout lines.
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
void setLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the callout line.
void stopRender(QgsRenderContext &context) override
Finalises the callout after a set of rendering operations on the specified render context.
void setOffsetFromLabelUnit(Qgis::RenderUnit unit)
Sets the unit for the offset from label area distance.
QSet< QString > referencedFields(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the callout.
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
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 ...
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
QString type() const override
Returns a unique string representing the callout type.
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
~QgsSimpleLineCallout() override
void setOffsetFromAnchorUnit(Qgis::RenderUnit unit)
Sets the unit for the offset from anchor distance.
void setMinimumLength(double length)
Sets the minimum length of callout lines.
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
bool drawCalloutToAllParts() const
Returns true if callout lines should be drawn to all feature parts.
void setDrawCalloutToAllParts(bool drawToAllParts)
Sets whether callout lines should be drawn to all feature parts.
static QgsCallout * create(const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
Creates a new QgsSimpleLineCallout, using the settings serialized in the properties map (correspondin...
Qgis::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
QVariantMap properties(const QgsReadWriteContext &context) const override
Returns the properties describing the callout encoded in a string format.
QgsSimpleLineCallout * clone() const override
Duplicates a callout by creating a deep copy of the callout.
QgsLineSymbol * lineSymbol()
Returns the line symbol used to render the callout line.
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
void setMinimumLengthUnit(Qgis::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
Qgis::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
record about vertex coordinates and index of anchor to which it is snapped