20 #include "qgis_core.h"
58 sipType = sipType_QgsSimpleLineCallout;
62 sipType = sipType_QgsManhattanLineCallout;
66 sipType = sipType_QgsCurvedLineCallout;
68 else if ( sipCpp->type() ==
"balloon" &&
dynamic_cast<QgsBalloonCallout *
>( sipCpp ) != NULL )
70 sipType = sipType_QgsBalloonCallout;
112 PoleOfInaccessibility = 0,
145 virtual QString
type()
const = 0;
175 virtual void readProperties(
const QVariantMap &props,
const QgsReadWriteContext &context );
184 virtual bool saveProperties( QDomDocument &doc, QDomElement &element,
const QgsReadWriteContext &context )
const;
193 virtual void restoreProperties(
const QDomElement &element,
const QgsReadWriteContext &context );
200 bool containsAdvancedEffects()
const;
229 virtual QSet< QString > referencedFields(
const QgsRenderContext &context )
const;
248 bool allFeaturePartsLabeled =
false;
282 QList< QgsCalloutPosition >
positions()
const {
return mPositions; }
288 QList< QgsCalloutPosition > mPositions;
324 void setEnabled(
bool enabled );
374 static QString encodeAnchorPoint(
AnchorPoint anchor );
409 static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
427 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
434 void setBlendMode( QPainter::CompositionMode mode ) { mBlendMode = mode; }
487 bool mEnabled =
false;
492 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
500 static void initPropertyDefinitions();
532 QString type() const override;
535 void readProperties( const QVariantMap &props, const
QgsReadWriteContext &context ) override;
538 QSet< QString > referencedFields( const
QgsRenderContext &context ) const override;
562 double minimumLength()
const {
return mMinCalloutLength; }
723 std::unique_ptr< QgsLineSymbol > mLineSymbol;
724 double mMinCalloutLength = 0;
728 double mOffsetFromAnchorDistance = 0;
732 double mOffsetFromLabelDistance = 0;
736 bool mDrawCalloutToAllParts =
false;
769 QString type() const override;
822 QString type() const override;
833 double curvature() const;
842 void setCurvature(
double curvature );
870 static Orientation decodeOrientation(
const QString &
string );
875 static QString encodeOrientation(
Orientation orientation );
879 double mCurvature = 0.1;
912 QString type() const override;
915 void readProperties( const QVariantMap &props, const
QgsReadWriteContext &context ) override;
918 QSet< QString > referencedFields( const
QgsRenderContext &context ) const override;
942 double offsetFromAnchor()
const {
return mOffsetFromAnchorDistance; }
1142 std::unique_ptr< QgsFillSymbol > mFillSymbol;
1144 double mOffsetFromAnchorDistance = 0;
1151 double mWedgeWidth = 2.64;
1155 double mCornerRadius = 0.0;
Abstract base class for all geometries.
A cartoon talking bubble callout style.
void setCornerRadius(double radius)
Sets the radius of the corners for the balloon shapes.
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.
double wedgeWidth() const
Returns the width of the wedge shape at the side it connects with the label.
double cornerRadius() const
Returns the corner radius of the balloon shapes.
const QgsMapUnitScale & cornerRadiusMapUnitScale() const
Returns the map unit scale for the corner radius.
void setCornerRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the corner radius.
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
const QgsMapUnitScale & wedgeWidthMapUnitScale() const
Returns the map unit scale for the wedge width.
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
void setWedgeWidth(double width)
Sets the width of the wedge shape at the side it connects with the label.
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
QgsUnitTypes::RenderUnit wedgeWidthUnit() const
Returns the units for the wedge width.
void setCornerRadiusUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the corner radius.
QgsUnitTypes::RenderUnit marginsUnit() const
Returns the units for the margins between the outside of the callout frame and the label's bounding r...
QgsBalloonCallout & operator=(const QgsBalloonCallout &)=delete
QgsUnitTypes::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 setMarginsUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the margins between the outside of the callout frame and the label's bounding recta...
void setWedgeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the wedge width.
~QgsBalloonCallout() override
void setWedgeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the wedge width.
Represents the calculated placement of a map label callout line.
Contains additional contextual information about the context in which a callout is being rendered.
void addCalloutPosition(const QgsCalloutPosition &position)
Adds a rendered callout position.
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.
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 QString type() const =0
Returns a unique string representing the callout type.
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.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
void setLabelAnchorPoint(LabelAnchorPoint anchor)
Sets the label's anchor point position.
virtual QgsCallout * clone() const =0
Duplicates a callout by creating a deep copy of the callout.
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.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the callout's property collection, used for data defined overrides.
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.
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.
Property
Data definable properties.
@ DestinationX
X-coordinate of callout destination (feature anchor) (since QGIS 3.20)
@ Curvature
Curvature of curved line callouts (since QGIS 3.20)
@ BlendMode
Callout blend mode (since QGIS 3.20)
@ DestinationY
Y-coordinate of callout destination (feature anchor) (since QGIS 3.20)
@ CornerRadius
Balloon callout corner radius (since QGIS 3.20)
@ AnchorPointPosition
Feature's anchor point position.
@ LabelAnchorPointPosition
Label's anchor point position.
@ DrawCalloutToAllParts
Whether callout lines should be drawn to all feature parts.
@ OffsetFromAnchor
Distance to offset lines from anchor points.
@ WedgeWidth
Balloon callout wedge width (since QGIS 3.20)
@ OriginY
Y-coordinate of callout origin (label anchor) (since QGIS 3.20)
@ OffsetFromLabel
Distance to offset lines from label area.
@ Orientation
Orientation of curved line callouts (since QGIS 3.20)
@ OriginX
X-coordinate of callout origin (label anchor) (since QGIS 3.20)
@ MinimumCalloutLength
Minimum length of callouts.
@ Margins
Margin from text (since QGIS 3.20)
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
bool enabled() const
Returns true if the the callout is enabled.
This class represents a coordinate reference system (CRS).
Abstract base class for curved geometry type.
Draws curved lines as callouts.
QgsCurvedLineCallout & operator=(const QgsCurvedLineCallout &)=delete
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...
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 & operator=(const QgsManhattanLineCallout &)=delete
Struct for storing maximum and minimum scales for measurements in map units.
The QgsMargins class defines the four margins of a rectangle.
A class to represent a 2D point.
Point geometry type, with support for z-dimension and m-values.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
The class is used as a container of context for various read/write operations on other 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.
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
QgsUnitTypes::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
~QgsSimpleLineCallout() override
void setMinimumLength(double length)
Sets the minimum length of callout lines.
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
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.
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
QgsUnitTypes::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
void setMinimumLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
void setOffsetFromLabelUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from label area distance.
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
RenderUnit
Rendering size units.
@ RenderMillimeters
Millimeters.
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)
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
record about vertex coordinates and index of anchor to which it is snapped