QGIS API Documentation  3.21.0-Master (56b4176581)
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 "qgsexpressioncontext.h"
23 #include "qgsreadwritecontext.h"
24 #include "qgspropertycollection.h"
25 #include "qgsmapunitscale.h"
26 #include "qgscalloutposition.h"
27 #include "qgsmargins.h"
28 #include "qgscoordinatetransform.h"
29 
30 #include <QPainter>
31 #include <QString>
32 #include <QRectF>
33 #include <memory>
34 
35 class QgsLineSymbol;
36 class QgsFillSymbol;
37 class QgsGeometry;
38 class QgsRenderContext;
39 
40 class QgsCalloutWidget; //stop sip breaking
41 
52 class 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  }
77  SIP_END
78 #endif
79 
80  public:
81 
83  enum Property
84  {
101  };
102 
105  {
108  };
109 
112  {
113  PoleOfInaccessibility = 0,
117  };
118 
124  {
135  };
136 
140  QgsCallout();
141  virtual ~QgsCallout() = default;
142 
146  virtual QString type() const = 0;
147 
153  virtual QgsCallout *clone() const = 0 SIP_FACTORY;
154 
165  virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
166 
176  virtual void readProperties( const QVariantMap &props, const QgsReadWriteContext &context );
177 
185  virtual bool saveProperties( QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context ) const;
186 
194  virtual void restoreProperties( const QDomElement &element, const QgsReadWriteContext &context );
195 
201  bool containsAdvancedEffects() const;
202 
211  virtual void startRender( QgsRenderContext &context );
212 
221  virtual void stopRender( QgsRenderContext &context );
222 
230  virtual QSet< QString > referencedFields( const QgsRenderContext &context ) const;
231 
237  virtual DrawOrder drawOrder() const;
238 
245  class CORE_EXPORT QgsCalloutContext
246  {
247  public:
249  bool allFeaturePartsLabeled = false;
250 
257 
264  QgsCoordinateTransform originalFeatureToMapTransform( const QgsRenderContext &renderContext ) const;
265 
276  void addCalloutPosition( const QgsCalloutPosition &position ) { return mPositions.push_back( position ); }
277 
283  QList< QgsCalloutPosition > positions() const { return mPositions; }
284 
285  private:
287  mutable QgsCoordinateTransform mOriginalFeatureToMapTransform;
288 
289  QList< QgsCalloutPosition > mPositions;
290  };
291 
313  void render( QgsRenderContext &context, const QRectF &rect, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext );
314 
319  bool enabled() const { return mEnabled; }
320 
325  void setEnabled( bool enabled );
326 
331  QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
332 
339  const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
340 
349  void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
350 
354  static QgsPropertiesDefinition propertyDefinitions();
355 
361  AnchorPoint anchorPoint() const { return mAnchorPoint; }
362 
368  void setAnchorPoint( AnchorPoint anchor ) { mAnchorPoint = anchor; }
369 
375  static QString encodeAnchorPoint( AnchorPoint anchor );
376 
385  static QgsCallout::AnchorPoint decodeAnchorPoint( const QString &name, bool *ok = nullptr );
386 
387 
394  LabelAnchorPoint labelAnchorPoint() const { return mLabelAnchorPoint; }
395 
402  void setLabelAnchorPoint( LabelAnchorPoint anchor ) { mLabelAnchorPoint = anchor; }
403 
410  static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
411 
421  static QgsCallout::LabelAnchorPoint decodeLabelAnchorPoint( const QString &name, bool *ok = nullptr );
422 
428  QPainter::CompositionMode blendMode() const { return mBlendMode; }
429 
435  void setBlendMode( QPainter::CompositionMode mode ) { mBlendMode = mode; }
436 
437  protected:
438 
457  virtual void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext ) = 0;
458 
463  Q_DECL_DEPRECATED QgsGeometry labelAnchorGeometry( const QRectF &bodyBoundingBox, const double angle, LabelAnchorPoint anchor ) const SIP_DEPRECATED;
464 
472  QgsGeometry calloutLabelPoint( const QRectF &bodyBoundingBox, double angle, LabelAnchorPoint anchor, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned ) const;
473 
484  QgsGeometry calloutLineToPart( const QgsGeometry &labelGeometry, const QgsAbstractGeometry *partGeometry, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned ) const;
485 
486  private:
487 
488  bool mEnabled = false;
489 
490  AnchorPoint mAnchorPoint = PoleOfInaccessibility;
491  LabelAnchorPoint mLabelAnchorPoint = LabelPointOnExterior;
492 
493  QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
494 
496  QgsPropertyCollection mDataDefinedProperties;
497 
499  static QgsPropertiesDefinition sPropertyDefinitions;
500 
501  static void initPropertyDefinitions();
502 };
503 
510 class CORE_EXPORT QgsSimpleLineCallout : public QgsCallout
511 {
512  public:
513 
516 
517 #ifndef SIP_RUN
518 
524 #endif
525 
531  static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
532 
533  QString type() const override;
534  QgsSimpleLineCallout *clone() const override;
535  QVariantMap properties( const QgsReadWriteContext &context ) const override;
536  void readProperties( const QVariantMap &props, const QgsReadWriteContext &context ) override;
537  void startRender( QgsRenderContext &context ) override;
538  void stopRender( QgsRenderContext &context ) override;
539  QSet< QString > referencedFields( const QgsRenderContext &context ) const override;
540 
548  QgsLineSymbol *lineSymbol();
549 
556  void setLineSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
557 
563  double minimumLength() const { return mMinCalloutLength; }
564 
570  void setMinimumLength( double length ) { mMinCalloutLength = length; }
571 
577  void setMinimumLengthUnit( QgsUnitTypes::RenderUnit unit ) { mMinCalloutLengthUnit = unit; }
578 
584  QgsUnitTypes::RenderUnit minimumLengthUnit() const { return mMinCalloutLengthUnit; }
585 
592  void setMinimumLengthMapUnitScale( const QgsMapUnitScale &scale ) { mMinCalloutLengthScale = scale; }
593 
600  const QgsMapUnitScale &minimumLengthMapUnitScale() const { return mMinCalloutLengthScale; }
601 
602 
608  double offsetFromAnchor() const { return mOffsetFromAnchorDistance; }
609 
615  void setOffsetFromAnchor( double distance ) { mOffsetFromAnchorDistance = distance; }
616 
622  void setOffsetFromAnchorUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetFromAnchorUnit = unit; }
623 
629  QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const { return mOffsetFromAnchorUnit; }
630 
637  void setOffsetFromAnchorMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromAnchorScale = scale; }
638 
645  const QgsMapUnitScale &offsetFromAnchorMapUnitScale() const { return mOffsetFromAnchorScale; }
646 
652  double offsetFromLabel() const { return mOffsetFromLabelDistance; }
653 
659  void setOffsetFromLabel( double distance ) { mOffsetFromLabelDistance = distance; }
660 
666  void setOffsetFromLabelUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetFromLabelUnit = unit; }
667 
673  QgsUnitTypes::RenderUnit offsetFromLabelUnit() const { return mOffsetFromLabelUnit; }
674 
681  void setOffsetFromLabelMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromLabelScale = scale; }
682 
689  const QgsMapUnitScale &offsetFromLabelMapUnitScale() const { return mOffsetFromLabelScale; }
690 
696  bool drawCalloutToAllParts() const { return mDrawCalloutToAllParts; }
697 
703  void setDrawCalloutToAllParts( bool drawToAllParts ) { mDrawCalloutToAllParts = drawToAllParts; }
704 
705  protected:
706  void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) override;
707 
715  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;
716 
717  private:
718 
719 #ifdef SIP_RUN
721  QgsSimpleLineCallout &operator=( const QgsSimpleLineCallout & );
722 #endif
723 
724  std::unique_ptr< QgsLineSymbol > mLineSymbol;
725  double mMinCalloutLength = 0;
727  QgsMapUnitScale mMinCalloutLengthScale;
728 
729  double mOffsetFromAnchorDistance = 0;
731  QgsMapUnitScale mOffsetFromAnchorScale;
732 
733  double mOffsetFromLabelDistance = 0;
735  QgsMapUnitScale mOffsetFromLabelScale;
736 
737  bool mDrawCalloutToAllParts = false;
738 };
739 
740 
748 {
749  public:
750 
752 
753 #ifndef SIP_RUN
754 
759 
761 #endif
762 
768  static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
769 
770  QString type() const override;
771  QgsManhattanLineCallout *clone() const override;
772 
773  protected:
774  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;
775 
776  private:
777 #ifdef SIP_RUN
779  QgsManhattanLineCallout &operator=( const QgsManhattanLineCallout & );
780 #endif
781 };
782 
783 
790 class CORE_EXPORT QgsCurvedLineCallout : public QgsSimpleLineCallout
791 {
792  public:
793 
798  {
802  };
803 
805 
806 #ifndef SIP_RUN
807 
812 
814 #endif
815 
821  static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
822 
823  QString type() const override;
824  QgsCurvedLineCallout *clone() const override;
825  QVariantMap properties( const QgsReadWriteContext &context ) const override;
826 
834  double curvature() const;
835 
843  void setCurvature( double curvature );
844 
850  Orientation orientation() const;
851 
857  void setOrientation( Orientation orientation );
858 
859  protected:
860  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;
861 
862  private:
863 #ifdef SIP_RUN
865  QgsCurvedLineCallout &operator=( const QgsCurvedLineCallout & );
866 #endif
867 
871  static Orientation decodeOrientation( const QString &string );
872 
876  static QString encodeOrientation( Orientation orientation );
877 
878 
879  Orientation mOrientation = Automatic;
880  double mCurvature = 0.1;
881 };
882 
883 
890 class CORE_EXPORT QgsBalloonCallout : public QgsCallout
891 {
892  public:
893 
895  ~QgsBalloonCallout() override;
896 
897 #ifndef SIP_RUN
898 
902  QgsBalloonCallout( const QgsBalloonCallout &other );
904 #endif
905 
911  static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
912 
913  QString type() const override;
914  QgsBalloonCallout *clone() const override;
915  QVariantMap properties( const QgsReadWriteContext &context ) const override;
916  void readProperties( const QVariantMap &props, const QgsReadWriteContext &context ) override;
917  void startRender( QgsRenderContext &context ) override;
918  void stopRender( QgsRenderContext &context ) override;
919  QSet< QString > referencedFields( const QgsRenderContext &context ) const override;
920 
928  QgsFillSymbol *fillSymbol();
929 
936  void setFillSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
937 
943  double offsetFromAnchor() const { return mOffsetFromAnchorDistance; }
944 
950  void setOffsetFromAnchor( double distance ) { mOffsetFromAnchorDistance = distance; }
951 
957  void setOffsetFromAnchorUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetFromAnchorUnit = unit; }
958 
964  QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const { return mOffsetFromAnchorUnit; }
965 
972  void setOffsetFromAnchorMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromAnchorScale = scale; }
973 
980  const QgsMapUnitScale &offsetFromAnchorMapUnitScale() const { return mOffsetFromAnchorScale; }
981 
992  const QgsMargins &margins() const { return mMargins; }
993 
1004  void setMargins( const QgsMargins &margins ) { mMargins = margins; }
1005 
1012  void setMarginsUnit( QgsUnitTypes::RenderUnit unit ) { mMarginUnit = unit; }
1013 
1020  QgsUnitTypes::RenderUnit marginsUnit() const { return mMarginUnit; }
1021 
1030  double wedgeWidth() const { return mWedgeWidth; }
1031 
1040  void setWedgeWidth( double width ) { mWedgeWidth = width; }
1041 
1048  void setWedgeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mWedgeWidthUnit = unit; }
1049 
1056  QgsUnitTypes::RenderUnit wedgeWidthUnit() const { return mWedgeWidthUnit; }
1057 
1065  void setWedgeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mWedgeWidthScale = scale; }
1066 
1074  const QgsMapUnitScale &wedgeWidthMapUnitScale() const { return mWedgeWidthScale; }
1075 
1084  double cornerRadius() const { return mCornerRadius; }
1085 
1094  void setCornerRadius( double radius ) { mCornerRadius = radius; }
1095 
1102  void setCornerRadiusUnit( QgsUnitTypes::RenderUnit unit ) { mCornerRadiusUnit = unit; }
1103 
1110  QgsUnitTypes::RenderUnit cornerRadiusUnit() const { return mCornerRadiusUnit; }
1111 
1119  void setCornerRadiusMapUnitScale( const QgsMapUnitScale &scale ) { mCornerRadiusScale = scale; }
1120 
1128  const QgsMapUnitScale &cornerRadiusMapUnitScale() const { return mCornerRadiusScale; }
1129 
1130 
1131  protected:
1132  void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) override;
1133 
1134  private:
1135 
1136  QPolygonF getPoints( QgsRenderContext &context, QgsPointXY origin, QRectF rect ) const;
1137 
1138 #ifdef SIP_RUN
1139  QgsBalloonCallout( const QgsBalloonCallout &other );
1140  QgsBalloonCallout &operator=( const QgsBalloonCallout & );
1141 #endif
1142 
1143  std::unique_ptr< QgsFillSymbol > mFillSymbol;
1144 
1145  double mOffsetFromAnchorDistance = 0;
1147  QgsMapUnitScale mOffsetFromAnchorScale;
1148 
1149  QgsMargins mMargins;
1151 
1152  double mWedgeWidth = 2.64;
1154  QgsMapUnitScale mWedgeWidthScale;
1155 
1156  double mCornerRadius = 0.0;
1158  QgsMapUnitScale mCornerRadiusScale;
1159 
1160 };
1161 
1162 
1163 
1164 #endif // QGSCALLOUT_H
1165 
Abstract base class for all geometries.
A cartoon talking bubble callout style.
Definition: qgscallout.h:891
void setCornerRadius(double radius)
Sets the radius of the corners for the balloon shapes.
Definition: qgscallout.h:1094
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
Definition: qgscallout.h:980
const QgsMargins & margins() const
Returns the margins between the outside of the callout frame and the label's bounding rectangle.
Definition: qgscallout.h:992
double wedgeWidth() const
Returns the width of the wedge shape at the side it connects with the label.
Definition: qgscallout.h:1030
double cornerRadius() const
Returns the corner radius of the balloon shapes.
Definition: qgscallout.h:1084
const QgsMapUnitScale & cornerRadiusMapUnitScale() const
Returns the map unit scale for the corner radius.
Definition: qgscallout.h:1128
void setCornerRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the corner radius.
Definition: qgscallout.h:1119
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:950
const QgsMapUnitScale & wedgeWidthMapUnitScale() const
Returns the map unit scale for the wedge width.
Definition: qgscallout.h:1074
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
Definition: qgscallout.h:964
void setWedgeWidth(double width)
Sets the width of the wedge shape at the side it connects with the label.
Definition: qgscallout.h:1040
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
Definition: qgscallout.h:957
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
Definition: qgscallout.h:972
QgsUnitTypes::RenderUnit wedgeWidthUnit() const
Returns the units for the wedge width.
Definition: qgscallout.h:1056
void setCornerRadiusUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the corner radius.
Definition: qgscallout.h:1102
QgsUnitTypes::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:1020
QgsBalloonCallout & operator=(const QgsBalloonCallout &)=delete
QgsUnitTypes::RenderUnit cornerRadiusUnit() const
Returns the units for the corner radius.
Definition: qgscallout.h:1110
void setMargins(const QgsMargins &margins)
Sets the margins between the outside of the callout frame and the label's bounding rectangle.
Definition: qgscallout.h:1004
void setMarginsUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the margins between the outside of the callout frame and the label's bounding recta...
Definition: qgscallout.h:1012
void setWedgeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the wedge width.
Definition: qgscallout.h:1065
~QgsBalloonCallout() override
void setWedgeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the wedge width.
Definition: qgscallout.h:1048
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:246
void addCalloutPosition(const QgsCalloutPosition &position)
Adds a rendered callout position.
Definition: qgscallout.h:276
QList< QgsCalloutPosition > positions() const
Returns the list of rendered callout positions.
Definition: qgscallout.h:283
QgsCoordinateReferenceSystem originalFeatureCrs
Contains the CRS of the original feature associated with this callout.
Definition: qgscallout.h:256
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:349
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing callouts.
Definition: qgscallout.h:435
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.
Definition: qgscallout.h:361
LabelAnchorPoint labelAnchorPoint() const
Returns the label's anchor point position.
Definition: qgscallout.h:394
AnchorPoint
Feature's anchor point position.
Definition: qgscallout.h:112
@ PointOnExterior
A point on the surface's outline closest to the label is used as anchor for polygon geometries.
Definition: qgscallout.h:114
@ Centroid
The surface's centroid is used as anchor for polygon geometries.
Definition: qgscallout.h:116
@ PointOnSurface
A point guaranteed to be on the surface is used as anchor for polygon geometries.
Definition: qgscallout.h:115
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
Definition: qgscallout.h:339
void setLabelAnchorPoint(LabelAnchorPoint anchor)
Sets the label's anchor point position.
Definition: qgscallout.h:402
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.
Definition: qgscallout.h:331
DrawOrder
Options for draw order (stacking) of callouts.
Definition: qgscallout.h:105
@ OrderBelowIndividualLabels
Render callouts below their individual associated labels, some callouts may be drawn over other label...
Definition: qgscallout.h:107
@ OrderBelowAllLabels
Render callouts below all labels.
Definition: qgscallout.h:106
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing callouts.
Definition: qgscallout.h:428
LabelAnchorPoint
Label's anchor point position.
Definition: qgscallout.h:124
@ LabelPointOnExterior
The point on the label's boundary closest to the feature.
Definition: qgscallout.h:125
@ LabelBottomLeft
Bottom left corner of the label's boundary.
Definition: qgscallout.h:132
@ LabelBottomMiddle
Bottom middle of the label's boundary.
Definition: qgscallout.h:133
@ LabelMiddleLeft
Middle left of the label's boundary.
Definition: qgscallout.h:130
@ LabelBottomRight
Bottom right corner of the label's boundary.
Definition: qgscallout.h:134
@ LabelMiddleRight
Middle right of the label's boundary.
Definition: qgscallout.h:131
@ LabelTopMiddle
Top middle of the label's boundary.
Definition: qgscallout.h:128
@ LabelTopLeft
Top left corner of the label's boundary.
Definition: qgscallout.h:127
@ LabelCentroid
The labe's centroid.
Definition: qgscallout.h:126
@ LabelTopRight
Top right corner of the label's boundary.
Definition: qgscallout.h:129
Property
Data definable properties.
Definition: qgscallout.h:84
@ DestinationX
X-coordinate of callout destination (feature anchor) (since QGIS 3.20)
Definition: qgscallout.h:93
@ Curvature
Curvature of curved line callouts (since QGIS 3.20)
Definition: qgscallout.h:95
@ BlendMode
Callout blend mode (since QGIS 3.20)
Definition: qgscallout.h:100
@ DestinationY
Y-coordinate of callout destination (feature anchor) (since QGIS 3.20)
Definition: qgscallout.h:94
@ CornerRadius
Balloon callout corner radius (since QGIS 3.20)
Definition: qgscallout.h:99
@ AnchorPointPosition
Feature's anchor point position.
Definition: qgscallout.h:89
@ LabelAnchorPointPosition
Label's anchor point position.
Definition: qgscallout.h:90
@ DrawCalloutToAllParts
Whether callout lines should be drawn to all feature parts.
Definition: qgscallout.h:88
@ OffsetFromAnchor
Distance to offset lines from anchor points.
Definition: qgscallout.h:86
@ WedgeWidth
Balloon callout wedge width (since QGIS 3.20)
Definition: qgscallout.h:98
@ OriginY
Y-coordinate of callout origin (label anchor) (since QGIS 3.20)
Definition: qgscallout.h:92
@ OffsetFromLabel
Distance to offset lines from label area.
Definition: qgscallout.h:87
@ Orientation
Orientation of curved line callouts (since QGIS 3.20)
Definition: qgscallout.h:96
@ OriginX
X-coordinate of callout origin (label anchor) (since QGIS 3.20)
Definition: qgscallout.h:91
@ MinimumCalloutLength
Minimum length of callouts.
Definition: qgscallout.h:85
@ Margins
Margin from text (since QGIS 3.20)
Definition: qgscallout.h:97
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
Definition: qgscallout.h:368
bool enabled() const
Returns true if the the callout is enabled.
Definition: qgscallout.h:319
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:36
Draws curved lines as callouts.
Definition: qgscallout.h:791
QgsCurvedLineCallout & operator=(const QgsCurvedLineCallout &)=delete
Orientation
Curve orientation.
Definition: qgscallout.h:798
@ Clockwise
Curve lines in a clockwise direction.
Definition: qgscallout.h:800
@ CounterClockwise
Curve lines in a counter-clockwise direction.
Definition: qgscallout.h:801
@ Automatic
Automatically choose most cartographically pleasing orientation based on label and callout arrangemen...
Definition: qgscallout.h:799
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:124
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgslinesymbol.h:30
Draws straight (right angled) lines as callouts.
Definition: qgscallout.h:748
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:38
A class to represent a 2D point.
Definition: qgspointxy.h:59
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:511
void setMinimumLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum callout length.
Definition: qgscallout.h:592
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
Definition: qgscallout.h:622
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
Definition: qgscallout.h:689
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
Definition: qgscallout.h:652
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
Definition: qgscallout.h:637
QgsUnitTypes::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
Definition: qgscallout.h:584
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:608
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:615
~QgsSimpleLineCallout() override
void setMinimumLength(double length)
Sets the minimum length of callout lines.
Definition: qgscallout.h:570
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
Definition: qgscallout.h:645
bool drawCalloutToAllParts() const
Returns true if callout lines should be drawn to all feature parts.
Definition: qgscallout.h:696
void setDrawCalloutToAllParts(bool drawToAllParts)
Sets whether callout lines should be drawn to all feature parts.
Definition: qgscallout.h:703
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
Definition: qgscallout.h:600
QgsUnitTypes::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
Definition: qgscallout.h:673
void setMinimumLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
Definition: qgscallout.h:577
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
Definition: qgscallout.h:681
void setOffsetFromLabelUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from label area distance.
Definition: qgscallout.h:666
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
Definition: qgscallout.h:659
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
Definition: qgscallout.h:629
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:168
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:169
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:786
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:177
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:194
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
record about vertex coordinates and index of anchor to which it is snapped