QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgscallout.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscallout.h
3 ----------------
4 begin : July 2019
5 copyright : (C) 2019 Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSCALLOUT_H
18#define QGSCALLOUT_H
19
20#include "qgis_core.h"
21#include "qgis_sip.h"
22#include "qgis.h"
23#include "qgsreadwritecontext.h"
25#include "qgsmapunitscale.h"
26#include "qgscalloutposition.h"
27#include "qgsmargins.h"
29
30#include <QPainter>
31#include <QString>
32#include <QRectF>
33#include <memory>
34
35class QgsLineSymbol;
36class QgsFillSymbol;
37class QgsGeometry;
39
40class QgsCalloutWidget; //stop sip breaking
41
52class CORE_EXPORT QgsCallout
53{
54
55#ifdef SIP_RUN
57 if ( sipCpp->type() == "simple" && dynamic_cast<QgsSimpleLineCallout *>( sipCpp ) != NULL )
58 {
59 sipType = sipType_QgsSimpleLineCallout;
60 }
61 else if ( sipCpp->type() == "manhattan" && dynamic_cast<QgsManhattanLineCallout *>( sipCpp ) != NULL )
62 {
63 sipType = sipType_QgsManhattanLineCallout;
64 }
65 else if ( sipCpp->type() == "curved" && dynamic_cast<QgsCurvedLineCallout *>( sipCpp ) != NULL )
66 {
67 sipType = sipType_QgsCurvedLineCallout;
68 }
69 else if ( sipCpp->type() == "balloon" && dynamic_cast<QgsBalloonCallout *>( sipCpp ) != NULL )
70 {
71 sipType = sipType_QgsBalloonCallout;
72 }
73 else
74 {
75 sipType = 0;
76 }
78#endif
79
80 public:
81
82 // *INDENT-OFF*
85 {
86 MinimumCalloutLength,
87 OffsetFromAnchor,
88 OffsetFromLabel,
89 DrawCalloutToAllParts,
90 AnchorPointPosition,
91 LabelAnchorPointPosition,
92 OriginX,
93 OriginY,
94 DestinationX,
95 DestinationY,
96 Curvature,
97 Orientation,
98 Margins,
99 WedgeWidth,
100 CornerRadius,
101 BlendMode,
102 };
103 // *INDENT-ON*
104
107 {
110 };
111
114 {
115 PoleOfInaccessibility = 0,
119 };
120
126 {
137 };
138
142 QgsCallout();
143 virtual ~QgsCallout() = default;
144
148 virtual QString type() const = 0;
149
155 virtual QgsCallout *clone() const = 0 SIP_FACTORY;
156
167 virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
168
178 virtual void readProperties( const QVariantMap &props, const QgsReadWriteContext &context );
179
187 virtual bool saveProperties( QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context ) const;
188
196 virtual void restoreProperties( const QDomElement &element, const QgsReadWriteContext &context );
197
203 bool containsAdvancedEffects() const;
204
213 virtual void startRender( QgsRenderContext &context );
214
223 virtual void stopRender( QgsRenderContext &context );
224
232 virtual QSet< QString > referencedFields( const QgsRenderContext &context ) const;
233
239 virtual DrawOrder drawOrder() const;
240
247 class CORE_EXPORT QgsCalloutContext
248 {
249 public:
251 bool allFeaturePartsLabeled = false;
252
259
266 QgsCoordinateTransform originalFeatureToMapTransform( const QgsRenderContext &renderContext ) const;
267
278 void addCalloutPosition( const QgsCalloutPosition &position ) { return mPositions.push_back( position ); }
279
285 QList< QgsCalloutPosition > positions() const { return mPositions; }
286
287 private:
289 mutable QgsCoordinateTransform mOriginalFeatureToMapTransform;
290
291 QList< QgsCalloutPosition > mPositions;
292 };
293
315 void render( QgsRenderContext &context, const QRectF &rect, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext );
316
321 bool enabled() const { return mEnabled; }
322
327 void setEnabled( bool enabled );
328
333 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
334
341 const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
342
351 void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
352
356 static QgsPropertiesDefinition propertyDefinitions();
357
363 AnchorPoint anchorPoint() const { return mAnchorPoint; }
364
370 void setAnchorPoint( AnchorPoint anchor ) { mAnchorPoint = anchor; }
371
377 static QString encodeAnchorPoint( AnchorPoint anchor );
378
387 static QgsCallout::AnchorPoint decodeAnchorPoint( const QString &name, bool *ok = nullptr );
388
389
396 LabelAnchorPoint labelAnchorPoint() const { return mLabelAnchorPoint; }
397
404 void setLabelAnchorPoint( LabelAnchorPoint anchor ) { mLabelAnchorPoint = anchor; }
405
412 static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
413
423 static QgsCallout::LabelAnchorPoint decodeLabelAnchorPoint( const QString &name, bool *ok = nullptr );
424
430 QPainter::CompositionMode blendMode() const { return mBlendMode; }
431
437 void setBlendMode( QPainter::CompositionMode mode ) { mBlendMode = mode; }
438
439 protected:
440
459 virtual void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext ) = 0;
460
465 Q_DECL_DEPRECATED QgsGeometry labelAnchorGeometry( const QRectF &bodyBoundingBox, const double angle, LabelAnchorPoint anchor ) const SIP_DEPRECATED;
466
474 QgsGeometry calloutLabelPoint( const QRectF &bodyBoundingBox, double angle, LabelAnchorPoint anchor, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned ) const;
475
486 QgsGeometry calloutLineToPart( const QgsGeometry &labelGeometry, const QgsAbstractGeometry *partGeometry, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned ) const;
487
488 private:
489
490 bool mEnabled = false;
491
492 AnchorPoint mAnchorPoint = PoleOfInaccessibility;
493 LabelAnchorPoint mLabelAnchorPoint = LabelPointOnExterior;
494
495 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
496
498 QgsPropertyCollection mDataDefinedProperties;
499
501 static QgsPropertiesDefinition sPropertyDefinitions;
502
503 static void initPropertyDefinitions();
504};
505
512class CORE_EXPORT QgsSimpleLineCallout : public QgsCallout
513{
514 public:
515
518
519#ifndef SIP_RUN
520
526#endif
527
533 static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
534
535 QString type() const override;
536 QgsSimpleLineCallout *clone() const override;
537 QVariantMap properties( const QgsReadWriteContext &context ) const override;
538 void readProperties( const QVariantMap &props, const QgsReadWriteContext &context ) override;
539 void startRender( QgsRenderContext &context ) override;
540 void stopRender( QgsRenderContext &context ) override;
541 QSet< QString > referencedFields( const QgsRenderContext &context ) const override;
542
550 QgsLineSymbol *lineSymbol();
551
558 void setLineSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
559
565 double minimumLength() const { return mMinCalloutLength; }
566
572 void setMinimumLength( double length ) { mMinCalloutLength = length; }
573
579 void setMinimumLengthUnit( Qgis::RenderUnit unit ) { mMinCalloutLengthUnit = unit; }
580
586 Qgis::RenderUnit minimumLengthUnit() const { return mMinCalloutLengthUnit; }
587
594 void setMinimumLengthMapUnitScale( const QgsMapUnitScale &scale ) { mMinCalloutLengthScale = scale; }
595
602 const QgsMapUnitScale &minimumLengthMapUnitScale() const { return mMinCalloutLengthScale; }
603
604
610 double offsetFromAnchor() const { return mOffsetFromAnchorDistance; }
611
617 void setOffsetFromAnchor( double distance ) { mOffsetFromAnchorDistance = distance; }
618
624 void setOffsetFromAnchorUnit( Qgis::RenderUnit unit ) { mOffsetFromAnchorUnit = unit; }
625
631 Qgis::RenderUnit offsetFromAnchorUnit() const { return mOffsetFromAnchorUnit; }
632
639 void setOffsetFromAnchorMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromAnchorScale = scale; }
640
647 const QgsMapUnitScale &offsetFromAnchorMapUnitScale() const { return mOffsetFromAnchorScale; }
648
654 double offsetFromLabel() const { return mOffsetFromLabelDistance; }
655
661 void setOffsetFromLabel( double distance ) { mOffsetFromLabelDistance = distance; }
662
668 void setOffsetFromLabelUnit( Qgis::RenderUnit unit ) { mOffsetFromLabelUnit = unit; }
669
675 Qgis::RenderUnit offsetFromLabelUnit() const { return mOffsetFromLabelUnit; }
676
683 void setOffsetFromLabelMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromLabelScale = scale; }
684
691 const QgsMapUnitScale &offsetFromLabelMapUnitScale() const { return mOffsetFromLabelScale; }
692
698 bool drawCalloutToAllParts() const { return mDrawCalloutToAllParts; }
699
705 void setDrawCalloutToAllParts( bool drawToAllParts ) { mDrawCalloutToAllParts = drawToAllParts; }
706
707 protected:
708 void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) override;
709
717 virtual QgsCurve *createCalloutLine( const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) const SIP_FACTORY;
718
719 private:
720
721#ifdef SIP_RUN
723 QgsSimpleLineCallout &operator=( const QgsSimpleLineCallout & );
724#endif
725
726 std::unique_ptr< QgsLineSymbol > mLineSymbol;
727 double mMinCalloutLength = 0;
728 Qgis::RenderUnit mMinCalloutLengthUnit = Qgis::RenderUnit::Millimeters;
729 QgsMapUnitScale mMinCalloutLengthScale;
730
731 double mOffsetFromAnchorDistance = 0;
732 Qgis::RenderUnit mOffsetFromAnchorUnit = Qgis::RenderUnit::Millimeters;
733 QgsMapUnitScale mOffsetFromAnchorScale;
734
735 double mOffsetFromLabelDistance = 0;
736 Qgis::RenderUnit mOffsetFromLabelUnit = Qgis::RenderUnit::Millimeters;
737 QgsMapUnitScale mOffsetFromLabelScale;
738
739 bool mDrawCalloutToAllParts = false;
740};
741
742
750{
751 public:
752
754
755#ifndef SIP_RUN
756
761
763#endif
764
770 static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
771
772 QString type() const override;
773 QgsManhattanLineCallout *clone() const override;
774
775 protected:
776 QgsCurve *createCalloutLine( const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) const override SIP_FACTORY;
777
778 private:
779#ifdef SIP_RUN
782#endif
783};
784
785
793{
794 public:
795
800 {
804 };
805
807
808#ifndef SIP_RUN
809
814
816#endif
817
823 static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
824
825 QString type() const override;
826 QgsCurvedLineCallout *clone() const override;
827 QVariantMap properties( const QgsReadWriteContext &context ) const override;
828
836 double curvature() const;
837
845 void setCurvature( double curvature );
846
852 Orientation orientation() const;
853
859 void setOrientation( Orientation orientation );
860
861 protected:
862 QgsCurve *createCalloutLine( const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext ) const override SIP_FACTORY;
863
864 private:
865#ifdef SIP_RUN
867 QgsCurvedLineCallout &operator=( const QgsCurvedLineCallout & );
868#endif
869
873 static Orientation decodeOrientation( const QString &string );
874
878 static QString encodeOrientation( Orientation orientation );
879
880
881 Orientation mOrientation = Automatic;
882 double mCurvature = 0.1;
883};
884
885
892class CORE_EXPORT QgsBalloonCallout : public QgsCallout
893{
894 public:
895
898
899#ifndef SIP_RUN
900
904 QgsBalloonCallout( const QgsBalloonCallout &other );
906#endif
907
913 static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
914
915 QString type() const override;
916 QgsBalloonCallout *clone() const override;
917 QVariantMap properties( const QgsReadWriteContext &context ) const override;
918 void readProperties( const QVariantMap &props, const QgsReadWriteContext &context ) override;
919 void startRender( QgsRenderContext &context ) override;
920 void stopRender( QgsRenderContext &context ) override;
921 QSet< QString > referencedFields( const QgsRenderContext &context ) const override;
922
930 QgsFillSymbol *fillSymbol();
931
938 void setFillSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
939
945 double offsetFromAnchor() const { return mOffsetFromAnchorDistance; }
946
952 void setOffsetFromAnchor( double distance ) { mOffsetFromAnchorDistance = distance; }
953
959 void setOffsetFromAnchorUnit( Qgis::RenderUnit unit ) { mOffsetFromAnchorUnit = unit; }
960
966 Qgis::RenderUnit offsetFromAnchorUnit() const { return mOffsetFromAnchorUnit; }
967
974 void setOffsetFromAnchorMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromAnchorScale = scale; }
975
982 const QgsMapUnitScale &offsetFromAnchorMapUnitScale() const { return mOffsetFromAnchorScale; }
983
994 const QgsMargins &margins() const { return mMargins; }
995
1006 void setMargins( const QgsMargins &margins ) { mMargins = margins; }
1007
1014 void setMarginsUnit( Qgis::RenderUnit unit ) { mMarginUnit = unit; }
1015
1022 Qgis::RenderUnit marginsUnit() const { return mMarginUnit; }
1023
1032 double wedgeWidth() const { return mWedgeWidth; }
1033
1042 void setWedgeWidth( double width ) { mWedgeWidth = width; }
1043
1050 void setWedgeWidthUnit( Qgis::RenderUnit unit ) { mWedgeWidthUnit = unit; }
1051
1058 Qgis::RenderUnit wedgeWidthUnit() const { return mWedgeWidthUnit; }
1059
1067 void setWedgeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mWedgeWidthScale = scale; }
1068
1076 const QgsMapUnitScale &wedgeWidthMapUnitScale() const { return mWedgeWidthScale; }
1077
1086 double cornerRadius() const { return mCornerRadius; }
1087
1096 void setCornerRadius( double radius ) { mCornerRadius = radius; }
1097
1104 void setCornerRadiusUnit( Qgis::RenderUnit unit ) { mCornerRadiusUnit = unit; }
1105
1112 Qgis::RenderUnit cornerRadiusUnit() const { return mCornerRadiusUnit; }
1113
1121 void setCornerRadiusMapUnitScale( const QgsMapUnitScale &scale ) { mCornerRadiusScale = scale; }
1122
1130 const QgsMapUnitScale &cornerRadiusMapUnitScale() const { return mCornerRadiusScale; }
1131
1132
1133 protected:
1134 void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) override;
1135
1136 private:
1137
1138 QPolygonF getPoints( QgsRenderContext &context, QgsPointXY origin, QRectF rect ) const;
1139
1140#ifdef SIP_RUN
1141 QgsBalloonCallout( const QgsBalloonCallout &other );
1142 QgsBalloonCallout &operator=( const QgsBalloonCallout & );
1143#endif
1144
1145 std::unique_ptr< QgsFillSymbol > mFillSymbol;
1146
1147 double mOffsetFromAnchorDistance = 0;
1148 Qgis::RenderUnit mOffsetFromAnchorUnit = Qgis::RenderUnit::Millimeters;
1149 QgsMapUnitScale mOffsetFromAnchorScale;
1150
1151 QgsMargins mMargins;
1153
1154 double mWedgeWidth = 2.64;
1156 QgsMapUnitScale mWedgeWidthScale;
1157
1158 double mCornerRadius = 0.0;
1160 QgsMapUnitScale mCornerRadiusScale;
1161
1162};
1163
1164
1165
1166#endif // QGSCALLOUT_H
1167
RenderUnit
Rendering size units.
Definition: qgis.h:4255
@ Millimeters
Millimeters.
Abstract base class for all geometries.
A cartoon talking bubble callout style.
Definition: qgscallout.h:893
void setCornerRadius(double radius)
Sets the radius of the corners for the balloon shapes.
Definition: qgscallout.h:1096
double wedgeWidth() const
Returns the width of the wedge shape at the side it connects with the label.
Definition: qgscallout.h:1032
const QgsMapUnitScale & wedgeWidthMapUnitScale() const
Returns the map unit scale for the wedge width.
Definition: qgscallout.h:1076
QgsBalloonCallout & operator=(const QgsBalloonCallout &)=delete
double cornerRadius() const
Returns the corner radius of the balloon shapes.
Definition: qgscallout.h:1086
void setCornerRadiusUnit(Qgis::RenderUnit unit)
Sets the unit for the corner radius.
Definition: qgscallout.h:1104
Qgis::RenderUnit wedgeWidthUnit() const
Returns the units for the wedge width.
Definition: qgscallout.h:1058
void setOffsetFromAnchorUnit(Qgis::RenderUnit unit)
Sets the unit for the offset from anchor distance.
Definition: qgscallout.h:959
void setMarginsUnit(Qgis::RenderUnit unit)
Sets the unit for the margins between the outside of the callout frame and the label's bounding recta...
Definition: qgscallout.h:1014
void setCornerRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the corner radius.
Definition: qgscallout.h:1121
Qgis::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
Definition: qgscallout.h:966
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
Definition: qgscallout.h:982
const QgsMargins & margins() const
Returns the margins between the outside of the callout frame and the label's bounding rectangle.
Definition: qgscallout.h:994
void setWedgeWidthUnit(Qgis::RenderUnit unit)
Sets the unit for the wedge width.
Definition: qgscallout.h:1050
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:952
Qgis::RenderUnit marginsUnit() const
Returns the units for the margins between the outside of the callout frame and the label's bounding r...
Definition: qgscallout.h:1022
void setWedgeWidth(double width)
Sets the width of the wedge shape at the side it connects with the label.
Definition: qgscallout.h:1042
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
Definition: qgscallout.h:974
const QgsMapUnitScale & cornerRadiusMapUnitScale() const
Returns the map unit scale for the corner radius.
Definition: qgscallout.h:1130
Qgis::RenderUnit cornerRadiusUnit() const
Returns the units for the corner radius.
Definition: qgscallout.h:1112
void setMargins(const QgsMargins &margins)
Sets the margins between the outside of the callout frame and the label's bounding rectangle.
Definition: qgscallout.h:1006
void setWedgeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the wedge width.
Definition: qgscallout.h:1067
~QgsBalloonCallout() override
Represents the calculated placement of a map label callout line.
Base class for widgets which allow control over the properties of callouts.
Contains additional contextual information about the context in which a callout is being rendered.
Definition: qgscallout.h:248
void addCalloutPosition(const QgsCalloutPosition &position)
Adds a rendered callout position.
Definition: qgscallout.h:278
QList< QgsCalloutPosition > positions() const
Returns the list of rendered callout positions.
Definition: qgscallout.h:285
QgsCoordinateReferenceSystem originalFeatureCrs
Contains the CRS of the original feature associated with this callout.
Definition: qgscallout.h:258
Abstract base class for callout renderers.
Definition: qgscallout.h:53
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the callout's property collection, used for data defined overrides.
Definition: qgscallout.h:351
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing callouts.
Definition: qgscallout.h:437
virtual ~QgsCallout()=default
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.
Definition: qgscallout.h:333
AnchorPoint anchorPoint() const
Returns the feature's anchor point position.
Definition: qgscallout.h:363
LabelAnchorPoint labelAnchorPoint() const
Returns the label's anchor point position.
Definition: qgscallout.h:396
AnchorPoint
Feature's anchor point position.
Definition: qgscallout.h:114
@ PointOnExterior
A point on the surface's outline closest to the label is used as anchor for polygon geometries.
Definition: qgscallout.h:116
@ Centroid
The surface's centroid is used as anchor for polygon geometries.
Definition: qgscallout.h:118
@ PointOnSurface
A point guaranteed to be on the surface is used as anchor for polygon geometries.
Definition: qgscallout.h:117
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
Definition: qgscallout.h:341
void setLabelAnchorPoint(LabelAnchorPoint anchor)
Sets the label's anchor point position.
Definition: qgscallout.h:404
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.
DrawOrder
Options for draw order (stacking) of callouts.
Definition: qgscallout.h:107
@ OrderBelowIndividualLabels
Render callouts below their individual associated labels, some callouts may be drawn over other label...
Definition: qgscallout.h:109
@ OrderBelowAllLabels
Render callouts below all labels.
Definition: qgscallout.h:108
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing callouts.
Definition: qgscallout.h:430
LabelAnchorPoint
Label's anchor point position.
Definition: qgscallout.h:126
@ LabelPointOnExterior
The point on the label's boundary closest to the feature.
Definition: qgscallout.h:127
@ LabelBottomLeft
Bottom left corner of the label's boundary.
Definition: qgscallout.h:134
@ LabelBottomMiddle
Bottom middle of the label's boundary.
Definition: qgscallout.h:135
@ LabelMiddleLeft
Middle left of the label's boundary.
Definition: qgscallout.h:132
@ LabelBottomRight
Bottom right corner of the label's boundary.
Definition: qgscallout.h:136
@ LabelMiddleRight
Middle right of the label's boundary.
Definition: qgscallout.h:133
@ LabelTopMiddle
Top middle of the label's boundary.
Definition: qgscallout.h:130
@ LabelTopLeft
Top left corner of the label's boundary.
Definition: qgscallout.h:129
@ LabelCentroid
The labe's centroid.
Definition: qgscallout.h:128
@ LabelTopRight
Top right corner of the label's boundary.
Definition: qgscallout.h:131
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
Definition: qgscallout.h:370
Property
Data definable properties.
Definition: qgscallout.h:85
bool enabled() const
Returns true if the the callout is enabled.
Definition: qgscallout.h:321
This class represents a coordinate reference system (CRS).
Class for doing transforms between two map coordinate systems.
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
Draws curved lines as callouts.
Definition: qgscallout.h:793
QgsCurvedLineCallout & operator=(const QgsCurvedLineCallout &)=delete
Orientation
Curve orientation.
Definition: qgscallout.h:800
@ Clockwise
Curve lines in a clockwise direction.
Definition: qgscallout.h:802
@ CounterClockwise
Curve lines in a counter-clockwise direction.
Definition: qgscallout.h:803
@ Automatic
Automatically choose most cartographically pleasing orientation based on label and callout arrangemen...
Definition: qgscallout.h:801
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Definition: qgsfillsymbol.h:30
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:162
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgslinesymbol.h:30
Draws straight (right angled) lines as callouts.
Definition: qgscallout.h:750
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.
Definition: qgsmargins.h:37
A class to represent a 2D point.
Definition: qgspointxy.h:60
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
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.
Definition: qgscallout.h:513
void setMinimumLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum callout length.
Definition: qgscallout.h:594
Qgis::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
Definition: qgscallout.h:631
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
void setOffsetFromLabelUnit(Qgis::RenderUnit unit)
Sets the unit for the offset from label area distance.
Definition: qgscallout.h:668
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
Definition: qgscallout.h:654
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
Definition: qgscallout.h:639
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:610
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
Definition: qgscallout.h:647
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:617
~QgsSimpleLineCallout() override
void setOffsetFromAnchorUnit(Qgis::RenderUnit unit)
Sets the unit for the offset from anchor distance.
Definition: qgscallout.h:624
void setMinimumLength(double length)
Sets the minimum length of callout lines.
Definition: qgscallout.h:572
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
Definition: qgscallout.h:602
bool drawCalloutToAllParts() const
Returns true if callout lines should be drawn to all feature parts.
Definition: qgscallout.h:698
void setDrawCalloutToAllParts(bool drawToAllParts)
Sets whether callout lines should be drawn to all feature parts.
Definition: qgscallout.h:705
Qgis::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
Definition: qgscallout.h:675
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
Definition: qgscallout.h:683
void setMinimumLengthUnit(Qgis::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
Definition: qgscallout.h:579
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
Definition: qgscallout.h:661
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
Definition: qgscallout.h:691
Qgis::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
Definition: qgscallout.h:586
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)
Definition: MathUtils.cpp:716
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:191
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition: qgis_sip.h:271
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:208
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
record about vertex coordinates and index of anchor to which it is snapped