QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
20 #include "qgis_core.h"
59 sipType = sipType_QgsSimpleLineCallout;
63 sipType = sipType_QgsManhattanLineCallout;
67 sipType = sipType_QgsCurvedLineCallout;
69 else if ( sipCpp->type() ==
"balloon" &&
dynamic_cast<QgsBalloonCallout *
>( sipCpp ) != NULL )
71 sipType = sipType_QgsBalloonCallout;
113 PoleOfInaccessibility = 0,
146 virtual QString type()
const = 0;
176 virtual void readProperties(
const QVariantMap &props,
const QgsReadWriteContext &context );
185 virtual bool saveProperties( QDomDocument &doc, QDomElement &element,
const QgsReadWriteContext &context )
const;
194 virtual void restoreProperties(
const QDomElement &element,
const QgsReadWriteContext &context );
201 bool containsAdvancedEffects()
const;
230 virtual QSet< QString > referencedFields(
const QgsRenderContext &context )
const;
237 virtual DrawOrder drawOrder()
const;
249 bool allFeaturePartsLabeled =
false;
283 QList< QgsCalloutPosition >
positions()
const {
return mPositions; }
289 QList< QgsCalloutPosition > mPositions;
325 void setEnabled(
bool enabled );
375 static QString encodeAnchorPoint(
AnchorPoint anchor );
410 static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
428 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
435 void setBlendMode( QPainter::CompositionMode mode ) { mBlendMode = mode; }
457 virtual void draw(
QgsRenderContext &context,
const QRectF &bodyBoundingBox,
const double angle,
const QgsGeometry &anchor, QgsCalloutContext &calloutContext ) = 0;
463 Q_DECL_DEPRECATED
QgsGeometry labelAnchorGeometry(
const QRectF &bodyBoundingBox,
const double angle, LabelAnchorPoint anchor )
const SIP_DEPRECATED;
472 QgsGeometry calloutLabelPoint(
const QRectF &bodyBoundingBox,
double angle, LabelAnchorPoint anchor,
QgsRenderContext &context,
const QgsCalloutContext &calloutContext,
bool &pinned )
const;
488 bool mEnabled =
false;
491 LabelAnchorPoint mLabelAnchorPoint = LabelPointOnExterior;
493 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
501 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;
770 QString
type()
const override;
823 QString type() const override;
834 double curvature() const;
843 void setCurvature(
double curvature );
850 Orientation orientation() const;
857 void setOrientation( Orientation orientation );
871 static Orientation decodeOrientation(
const QString &
string );
876 static QString encodeOrientation( Orientation orientation );
879 Orientation mOrientation = Automatic;
880 double mCurvature = 0.1;
913 QString
type()
const override;
1143 std::unique_ptr< QgsFillSymbol > mFillSymbol;
1145 double mOffsetFromAnchorDistance = 0;
1152 double mWedgeWidth = 2.64;
1156 double mCornerRadius = 0.0;
1164 #endif // QGSCALLOUT_H
Abstract base class for curved geometry type.
void setMargins(const QgsMargins &margins)
Sets the margins between the outside of the callout frame and the label's bounding rectangle.
QgsUnitTypes::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
void setMinimumLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum callout length.
@ LabelPointOnExterior
The point on the label's boundary closest to the feature.
@ Clockwise
Curve lines in a clockwise direction.
@ BlendMode
Callout blend mode (since QGIS 3.20)
QgsUnitTypes::RenderUnit cornerRadiusUnit() const
Returns the units for the corner radius.
@ OffsetFromAnchor
Distance to offset lines from anchor points.
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
QgsCoordinateReferenceSystem originalFeatureCrs
Contains the CRS of the original feature associated with this callout.
const QgsMapUnitScale & wedgeWidthMapUnitScale() const
Returns the map unit scale for the wedge width.
RenderUnit
Rendering size units.
AnchorPoint
Feature's anchor point position.
The class is used as a container of context for various read/write operations on other objects.
Abstract base class for callout renderers.
@ CornerRadius
Balloon callout corner radius (since QGIS 3.20)
@ Curvature
Curvature of curved line callouts (since QGIS 3.20)
Point geometry type, with support for z-dimension and m-values.
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
double wedgeWidth() const
Returns the width of the wedge shape at the side it connects with the label.
@ WedgeWidth
Balloon callout wedge width (since QGIS 3.20)
Contains information about the context of a rendering operation.
QList< QgsCalloutPosition > positions() const
Returns the list of rendered callout positions.
@ OriginY
Y-coordinate of callout origin (label anchor) (since QGIS 3.20)
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
AnchorPoint anchorPoint() const
Returns the feature's anchor point position.
@ RenderMillimeters
Millimeters.
@ LabelCentroid
The labe's centroid.
static QgsCallout * create(const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
Creates a new QgsSimpleLineCallout, using the settings serialized in the properties map (correspondin...
@ LabelBottomMiddle
Bottom middle of the label's boundary.
@ Margins
Margin from text (since QGIS 3.20)
void setWedgeWidth(double width)
Sets the width of the wedge shape at the side it connects with the label.
QgsSimpleLineCallout * clone() const override
Duplicates a callout by creating a deep copy of the callout.
virtual QString type() const =0
Returns a unique string representing the callout type.
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing callouts.
@ CounterClockwise
Curve lines in a counter-clockwise direction.
@ AnchorPointPosition
Feature's anchor point position.
@ PointOnExterior
A point on the surface's outline closest to the label is used as anchor for polygon geometries.
@ LabelMiddleRight
Middle right of the label's boundary.
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
@ LabelTopLeft
Top left corner of the label's boundary.
virtual QgsCurve * createCalloutLine(const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext) const
Creates a callout line between start and end in the desired style.
void setMinimumLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
double minimumLength() const
Returns the minimum length of callout lines.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
record about vertex coordinates and index of anchor to which it is snapped
void setCornerRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the corner radius.
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
double cornerRadius() const
Returns the corner radius of the balloon shapes.
@ DestinationX
X-coordinate of callout destination (feature anchor) (since QGIS 3.20)
@ LabelAnchorPointPosition
Label's anchor point position.
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.
Represents the calculated placement of a map label callout line.
void setMarginsUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the margins between the outside of the callout frame and the label's bounding recta...
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
LabelAnchorPoint labelAnchorPoint() const
Returns the label's anchor point position.
A line symbol type, for rendering LineString and MultiLineString geometries.
@ DrawCalloutToAllParts
Whether callout lines should be drawn to all feature parts.
The QgsMargins class defines the four margins of a rectangle.
@ Centroid
The surface's centroid is used as anchor for polygon geometries.
void setWedgeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the wedge width.
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
void setMinimumLength(double length)
Sets the minimum length of callout lines.
void setLabelAnchorPoint(LabelAnchorPoint anchor)
Sets the label's anchor point position.
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
Struct for storing maximum and minimum scales for measurements in map units.
A simple direct line callout style.
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
void addCalloutPosition(const QgsCalloutPosition &position)
Adds a rendered callout position.
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 ...
void setDrawCalloutToAllParts(bool drawToAllParts)
Sets whether callout lines should be drawn to all feature parts.
This class represents a coordinate reference system (CRS).
@ OriginX
X-coordinate of callout origin (label anchor) (since QGIS 3.20)
Abstract base class for all geometries.
void setOffsetFromLabelUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from label area distance.
QgsUnitTypes::RenderUnit marginsUnit() const
Returns the units for the margins between the outside of the callout frame and the label's bounding r...
@ Orientation
Orientation of curved line callouts (since QGIS 3.20)
DrawOrder
Options for draw order (stacking) of callouts.
A class to represent a 2D point.
virtual QVariantMap properties(const QgsReadWriteContext &context) const
Returns the properties describing the callout encoded in a string format.
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
void setCornerRadius(double radius)
Sets the radius of the corners for the balloon shapes.
@ LabelBottomLeft
Bottom left corner of the label's boundary.
Draws straight (right angled) lines as callouts.
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
A geometry is the spatial representation of a feature.
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.
QgsUnitTypes::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
Draws curved lines as callouts.
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
virtual QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns the set of attributes referenced by the callout.
A cartoon talking bubble callout style.
@ MinimumCalloutLength
Minimum length of callouts.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
@ LabelMiddleLeft
Middle left of the label's boundary.
const QgsMargins & margins() const
Returns the margins between the outside of the callout frame and the label's bounding rectangle.
@ LabelBottomRight
Bottom right corner of the label's boundary.
@ DestinationY
Y-coordinate of callout destination (feature anchor) (since QGIS 3.20)
Contains additional contextual information about the context in which a callout is being rendered.
@ LabelTopMiddle
Top middle of the label's boundary.
QString type() const override
Returns a unique string representing the callout type.
virtual void startRender(QgsRenderContext &context)
Prepares the callout for rendering on the specified render context.
virtual void stopRender(QgsRenderContext &context)
Finalises the callout after a set of rendering operations on the specified render context.
QgsUnitTypes::RenderUnit wedgeWidthUnit() const
Returns the units for the wedge width.
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
Property
Data definable properties.
bool drawCalloutToAllParts() const
Returns true if callout lines should be drawn to all feature parts.
void setCornerRadiusUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the corner radius.
@ OrderBelowAllLabels
Render callouts below all labels.
@ OrderBelowIndividualLabels
Render callouts below their individual associated labels, some callouts may be drawn over other label...
const QgsMapUnitScale & cornerRadiusMapUnitScale() const
Returns the map unit scale for the corner radius.
virtual QgsCallout * clone() const =0
Duplicates a callout by creating a deep copy of the callout.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
LabelAnchorPoint
Label's anchor point position.
void setWedgeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the wedge width.
@ OffsetFromLabel
Distance to offset lines from label area.
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the callout's property collection, used for data defined overrides.
bool enabled() const
Returns true if the the callout is enabled.
@ PointOnSurface
A point guaranteed to be on the surface is used as anchor for polygon geometries.
Orientation
Curve orientation.
@ LabelTopRight
Top right corner of the label's boundary.
@ Automatic
Automatically choose most cartographically pleasing orientation based on label and callout arrangemen...