QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 
29 #include <QPainter>
30 #include <QString>
31 #include <QRectF>
32 #include <memory>
33 
34 class QgsLineSymbol;
35 class QgsFillSymbol;
36 class QgsGeometry;
37 class QgsRenderContext;
38 
39 class QgsCalloutWidget; //stop sip breaking
40 
51 class CORE_EXPORT QgsCallout
52 {
53 
54 #ifdef SIP_RUN
56  if ( sipCpp->type() == "simple" && dynamic_cast<QgsSimpleLineCallout *>( sipCpp ) != NULL )
57  {
58  sipType = sipType_QgsSimpleLineCallout;
59  }
60  else if ( sipCpp->type() == "manhattan" && dynamic_cast<QgsManhattanLineCallout *>( sipCpp ) != NULL )
61  {
62  sipType = sipType_QgsManhattanLineCallout;
63  }
64  else if ( sipCpp->type() == "curved" && dynamic_cast<QgsCurvedLineCallout *>( sipCpp ) != NULL )
65  {
66  sipType = sipType_QgsCurvedLineCallout;
67  }
68  else if ( sipCpp->type() == "balloon" && dynamic_cast<QgsBalloonCallout *>( sipCpp ) != NULL )
69  {
70  sipType = sipType_QgsBalloonCallout;
71  }
72  else
73  {
74  sipType = 0;
75  }
76  SIP_END
77 #endif
78 
79  public:
80 
82  enum Property
83  {
100  };
101 
104  {
107  };
108 
111  {
112  PoleOfInaccessibility = 0,
116  };
117 
123  {
134  };
135 
139  QgsCallout();
140  virtual ~QgsCallout() = default;
141 
145  virtual QString type() const = 0;
146 
152  virtual QgsCallout *clone() const = 0 SIP_FACTORY;
153 
164  virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
165 
175  virtual void readProperties( const QVariantMap &props, const QgsReadWriteContext &context );
176 
184  virtual bool saveProperties( QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context ) const;
185 
193  virtual void restoreProperties( const QDomElement &element, const QgsReadWriteContext &context );
194 
200  bool containsAdvancedEffects() const;
201 
210  virtual void startRender( QgsRenderContext &context );
211 
220  virtual void stopRender( QgsRenderContext &context );
221 
229  virtual QSet< QString > referencedFields( const QgsRenderContext &context ) const;
230 
236  virtual DrawOrder drawOrder() const;
237 
244  class CORE_EXPORT QgsCalloutContext
245  {
246  public:
248  bool allFeaturePartsLabeled = false;
249 
256 
263  QgsCoordinateTransform originalFeatureToMapTransform( const QgsRenderContext &renderContext ) const;
264 
275  void addCalloutPosition( const QgsCalloutPosition &position ) { return mPositions.push_back( position ); }
276 
282  QList< QgsCalloutPosition > positions() const { return mPositions; }
283 
284  private:
286  mutable QgsCoordinateTransform mOriginalFeatureToMapTransform;
287 
288  QList< QgsCalloutPosition > mPositions;
289  };
290 
312  void render( QgsRenderContext &context, const QRectF &rect, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext );
313 
318  bool enabled() const { return mEnabled; }
319 
324  void setEnabled( bool enabled );
325 
330  QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
331 
338  const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
339 
348  void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
349 
353  static QgsPropertiesDefinition propertyDefinitions();
354 
360  AnchorPoint anchorPoint() const { return mAnchorPoint; }
361 
367  void setAnchorPoint( AnchorPoint anchor ) { mAnchorPoint = anchor; }
368 
374  static QString encodeAnchorPoint( AnchorPoint anchor );
375 
384  static QgsCallout::AnchorPoint decodeAnchorPoint( const QString &name, bool *ok = nullptr );
385 
386 
393  LabelAnchorPoint labelAnchorPoint() const { return mLabelAnchorPoint; }
394 
401  void setLabelAnchorPoint( LabelAnchorPoint anchor ) { mLabelAnchorPoint = anchor; }
402 
409  static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
410 
420  static QgsCallout::LabelAnchorPoint decodeLabelAnchorPoint( const QString &name, bool *ok = nullptr );
421 
427  QPainter::CompositionMode blendMode() const { return mBlendMode; }
428 
434  void setBlendMode( QPainter::CompositionMode mode ) { mBlendMode = mode; }
435 
436  protected:
437 
456  virtual void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext ) = 0;
457 
462  Q_DECL_DEPRECATED QgsGeometry labelAnchorGeometry( const QRectF &bodyBoundingBox, const double angle, LabelAnchorPoint anchor ) const SIP_DEPRECATED;
463 
471  QgsGeometry calloutLabelPoint( const QRectF &bodyBoundingBox, double angle, LabelAnchorPoint anchor, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned ) const;
472 
483  QgsGeometry calloutLineToPart( const QgsGeometry &labelGeometry, const QgsAbstractGeometry *partGeometry, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned ) const;
484 
485  private:
486 
487  bool mEnabled = false;
488 
489  AnchorPoint mAnchorPoint = PoleOfInaccessibility;
490  LabelAnchorPoint mLabelAnchorPoint = LabelPointOnExterior;
491 
492  QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
493 
495  QgsPropertyCollection mDataDefinedProperties;
496 
498  static QgsPropertiesDefinition sPropertyDefinitions;
499 
500  static void initPropertyDefinitions();
501 };
502 
509 class CORE_EXPORT QgsSimpleLineCallout : public QgsCallout
510 {
511  public:
512 
515 
516 #ifndef SIP_RUN
517 
523 #endif
524 
530  static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
531 
532  QString type() const override;
533  QgsSimpleLineCallout *clone() const override;
534  QVariantMap properties( const QgsReadWriteContext &context ) const override;
535  void readProperties( const QVariantMap &props, const QgsReadWriteContext &context ) override;
536  void startRender( QgsRenderContext &context ) override;
537  void stopRender( QgsRenderContext &context ) override;
538  QSet< QString > referencedFields( const QgsRenderContext &context ) const override;
539 
547  QgsLineSymbol *lineSymbol();
548 
555  void setLineSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
556 
562  double minimumLength() const { return mMinCalloutLength; }
563 
569  void setMinimumLength( double length ) { mMinCalloutLength = length; }
570 
576  void setMinimumLengthUnit( QgsUnitTypes::RenderUnit unit ) { mMinCalloutLengthUnit = unit; }
577 
583  QgsUnitTypes::RenderUnit minimumLengthUnit() const { return mMinCalloutLengthUnit; }
584 
591  void setMinimumLengthMapUnitScale( const QgsMapUnitScale &scale ) { mMinCalloutLengthScale = scale; }
592 
599  const QgsMapUnitScale &minimumLengthMapUnitScale() const { return mMinCalloutLengthScale; }
600 
601 
607  double offsetFromAnchor() const { return mOffsetFromAnchorDistance; }
608 
614  void setOffsetFromAnchor( double distance ) { mOffsetFromAnchorDistance = distance; }
615 
621  void setOffsetFromAnchorUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetFromAnchorUnit = unit; }
622 
628  QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const { return mOffsetFromAnchorUnit; }
629 
636  void setOffsetFromAnchorMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromAnchorScale = scale; }
637 
644  const QgsMapUnitScale &offsetFromAnchorMapUnitScale() const { return mOffsetFromAnchorScale; }
645 
651  double offsetFromLabel() const { return mOffsetFromLabelDistance; }
652 
658  void setOffsetFromLabel( double distance ) { mOffsetFromLabelDistance = distance; }
659 
665  void setOffsetFromLabelUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetFromLabelUnit = unit; }
666 
672  QgsUnitTypes::RenderUnit offsetFromLabelUnit() const { return mOffsetFromLabelUnit; }
673 
680  void setOffsetFromLabelMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromLabelScale = scale; }
681 
688  const QgsMapUnitScale &offsetFromLabelMapUnitScale() const { return mOffsetFromLabelScale; }
689 
695  bool drawCalloutToAllParts() const { return mDrawCalloutToAllParts; }
696 
702  void setDrawCalloutToAllParts( bool drawToAllParts ) { mDrawCalloutToAllParts = drawToAllParts; }
703 
704  protected:
705  void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) override;
706 
714  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;
715 
716  private:
717 
718 #ifdef SIP_RUN
720  QgsSimpleLineCallout &operator=( const QgsSimpleLineCallout & );
721 #endif
722 
723  std::unique_ptr< QgsLineSymbol > mLineSymbol;
724  double mMinCalloutLength = 0;
726  QgsMapUnitScale mMinCalloutLengthScale;
727 
728  double mOffsetFromAnchorDistance = 0;
730  QgsMapUnitScale mOffsetFromAnchorScale;
731 
732  double mOffsetFromLabelDistance = 0;
734  QgsMapUnitScale mOffsetFromLabelScale;
735 
736  bool mDrawCalloutToAllParts = false;
737 };
738 
739 
747 {
748  public:
749 
751 
752 #ifndef SIP_RUN
753 
758 
760 #endif
761 
767  static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
768 
769  QString type() const override;
770  QgsManhattanLineCallout *clone() const override;
771 
772  protected:
773  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;
774 
775  private:
776 #ifdef SIP_RUN
778  QgsManhattanLineCallout &operator=( const QgsManhattanLineCallout & );
779 #endif
780 };
781 
782 
789 class CORE_EXPORT QgsCurvedLineCallout : public QgsSimpleLineCallout
790 {
791  public:
792 
797  {
801  };
802 
804 
805 #ifndef SIP_RUN
806 
811 
813 #endif
814 
820  static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
821 
822  QString type() const override;
823  QgsCurvedLineCallout *clone() const override;
824  QVariantMap properties( const QgsReadWriteContext &context ) const override;
825 
833  double curvature() const;
834 
842  void setCurvature( double curvature );
843 
849  Orientation orientation() const;
850 
856  void setOrientation( Orientation orientation );
857 
858  protected:
859  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;
860 
861  private:
862 #ifdef SIP_RUN
864  QgsCurvedLineCallout &operator=( const QgsCurvedLineCallout & );
865 #endif
866 
870  static Orientation decodeOrientation( const QString &string );
871 
875  static QString encodeOrientation( Orientation orientation );
876 
877 
878  Orientation mOrientation = Automatic;
879  double mCurvature = 0.1;
880 };
881 
882 
889 class CORE_EXPORT QgsBalloonCallout : public QgsCallout
890 {
891  public:
892 
894  ~QgsBalloonCallout() override;
895 
896 #ifndef SIP_RUN
897 
901  QgsBalloonCallout( const QgsBalloonCallout &other );
903 #endif
904 
910  static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) SIP_FACTORY;
911 
912  QString type() const override;
913  QgsBalloonCallout *clone() const override;
914  QVariantMap properties( const QgsReadWriteContext &context ) const override;
915  void readProperties( const QVariantMap &props, const QgsReadWriteContext &context ) override;
916  void startRender( QgsRenderContext &context ) override;
917  void stopRender( QgsRenderContext &context ) override;
918  QSet< QString > referencedFields( const QgsRenderContext &context ) const override;
919 
927  QgsFillSymbol *fillSymbol();
928 
935  void setFillSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
936 
942  double offsetFromAnchor() const { return mOffsetFromAnchorDistance; }
943 
949  void setOffsetFromAnchor( double distance ) { mOffsetFromAnchorDistance = distance; }
950 
956  void setOffsetFromAnchorUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetFromAnchorUnit = unit; }
957 
963  QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const { return mOffsetFromAnchorUnit; }
964 
971  void setOffsetFromAnchorMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetFromAnchorScale = scale; }
972 
979  const QgsMapUnitScale &offsetFromAnchorMapUnitScale() const { return mOffsetFromAnchorScale; }
980 
991  const QgsMargins &margins() const { return mMargins; }
992 
1003  void setMargins( const QgsMargins &margins ) { mMargins = margins; }
1004 
1011  void setMarginsUnit( QgsUnitTypes::RenderUnit unit ) { mMarginUnit = unit; }
1012 
1019  QgsUnitTypes::RenderUnit marginsUnit() const { return mMarginUnit; }
1020 
1029  double wedgeWidth() const { return mWedgeWidth; }
1030 
1039  void setWedgeWidth( double width ) { mWedgeWidth = width; }
1040 
1047  void setWedgeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mWedgeWidthUnit = unit; }
1048 
1055  QgsUnitTypes::RenderUnit wedgeWidthUnit() const { return mWedgeWidthUnit; }
1056 
1064  void setWedgeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mWedgeWidthScale = scale; }
1065 
1073  const QgsMapUnitScale &wedgeWidthMapUnitScale() const { return mWedgeWidthScale; }
1074 
1083  double cornerRadius() const { return mCornerRadius; }
1084 
1093  void setCornerRadius( double radius ) { mCornerRadius = radius; }
1094 
1101  void setCornerRadiusUnit( QgsUnitTypes::RenderUnit unit ) { mCornerRadiusUnit = unit; }
1102 
1109  QgsUnitTypes::RenderUnit cornerRadiusUnit() const { return mCornerRadiusUnit; }
1110 
1118  void setCornerRadiusMapUnitScale( const QgsMapUnitScale &scale ) { mCornerRadiusScale = scale; }
1119 
1127  const QgsMapUnitScale &cornerRadiusMapUnitScale() const { return mCornerRadiusScale; }
1128 
1129 
1130  protected:
1131  void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) override;
1132 
1133  private:
1134 
1135  QPolygonF getPoints( QgsRenderContext &context, QgsPointXY origin, QRectF rect ) const;
1136 
1137 #ifdef SIP_RUN
1138  QgsBalloonCallout( const QgsBalloonCallout &other );
1139  QgsBalloonCallout &operator=( const QgsBalloonCallout & );
1140 #endif
1141 
1142  std::unique_ptr< QgsFillSymbol > mFillSymbol;
1143 
1144  double mOffsetFromAnchorDistance = 0;
1146  QgsMapUnitScale mOffsetFromAnchorScale;
1147 
1148  QgsMargins mMargins;
1150 
1151  double mWedgeWidth = 2.64;
1153  QgsMapUnitScale mWedgeWidthScale;
1154 
1155  double mCornerRadius = 0.0;
1157  QgsMapUnitScale mCornerRadiusScale;
1158 
1159 };
1160 
1161 
1162 
1163 #endif // QGSCALLOUT_H
1164 
Abstract base class for all geometries.
A cartoon talking bubble callout style.
Definition: qgscallout.h:890
void setCornerRadius(double radius)
Sets the radius of the corners for the balloon shapes.
Definition: qgscallout.h:1093
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
Definition: qgscallout.h:979
const QgsMargins & margins() const
Returns the margins between the outside of the callout frame and the label's bounding rectangle.
Definition: qgscallout.h:991
double wedgeWidth() const
Returns the width of the wedge shape at the side it connects with the label.
Definition: qgscallout.h:1029
double cornerRadius() const
Returns the corner radius of the balloon shapes.
Definition: qgscallout.h:1083
const QgsMapUnitScale & cornerRadiusMapUnitScale() const
Returns the map unit scale for the corner radius.
Definition: qgscallout.h:1127
void setCornerRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the corner radius.
Definition: qgscallout.h:1118
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:949
const QgsMapUnitScale & wedgeWidthMapUnitScale() const
Returns the map unit scale for the wedge width.
Definition: qgscallout.h:1073
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
Definition: qgscallout.h:963
void setWedgeWidth(double width)
Sets the width of the wedge shape at the side it connects with the label.
Definition: qgscallout.h:1039
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
Definition: qgscallout.h:956
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
Definition: qgscallout.h:971
QgsUnitTypes::RenderUnit wedgeWidthUnit() const
Returns the units for the wedge width.
Definition: qgscallout.h:1055
void setCornerRadiusUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the corner radius.
Definition: qgscallout.h:1101
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:1019
QgsBalloonCallout & operator=(const QgsBalloonCallout &)=delete
QgsUnitTypes::RenderUnit cornerRadiusUnit() const
Returns the units for the corner radius.
Definition: qgscallout.h:1109
void setMargins(const QgsMargins &margins)
Sets the margins between the outside of the callout frame and the label's bounding rectangle.
Definition: qgscallout.h:1003
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:1011
void setWedgeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the wedge width.
Definition: qgscallout.h:1064
~QgsBalloonCallout() override
void setWedgeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the wedge width.
Definition: qgscallout.h:1047
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:245
void addCalloutPosition(const QgsCalloutPosition &position)
Adds a rendered callout position.
Definition: qgscallout.h:275
QList< QgsCalloutPosition > positions() const
Returns the list of rendered callout positions.
Definition: qgscallout.h:282
QgsCoordinateReferenceSystem originalFeatureCrs
Contains the CRS of the original feature associated with this callout.
Definition: qgscallout.h:255
Abstract base class for callout renderers.
Definition: qgscallout.h:52
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the callout's property collection, used for data defined overrides.
Definition: qgscallout.h:348
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing callouts.
Definition: qgscallout.h:434
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:360
LabelAnchorPoint labelAnchorPoint() const
Returns the label's anchor point position.
Definition: qgscallout.h:393
AnchorPoint
Feature's anchor point position.
Definition: qgscallout.h:111
@ PointOnExterior
A point on the surface's outline closest to the label is used as anchor for polygon geometries.
Definition: qgscallout.h:113
@ Centroid
The surface's centroid is used as anchor for polygon geometries.
Definition: qgscallout.h:115
@ PointOnSurface
A point guaranteed to be on the surface is used as anchor for polygon geometries.
Definition: qgscallout.h:114
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
Definition: qgscallout.h:338
void setLabelAnchorPoint(LabelAnchorPoint anchor)
Sets the label's anchor point position.
Definition: qgscallout.h:401
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:330
DrawOrder
Options for draw order (stacking) of callouts.
Definition: qgscallout.h:104
@ OrderBelowIndividualLabels
Render callouts below their individual associated labels, some callouts may be drawn over other label...
Definition: qgscallout.h:106
@ OrderBelowAllLabels
Render callouts below all labels.
Definition: qgscallout.h:105
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing callouts.
Definition: qgscallout.h:427
LabelAnchorPoint
Label's anchor point position.
Definition: qgscallout.h:123
@ LabelPointOnExterior
The point on the label's boundary closest to the feature.
Definition: qgscallout.h:124
@ LabelBottomLeft
Bottom left corner of the label's boundary.
Definition: qgscallout.h:131
@ LabelBottomMiddle
Bottom middle of the label's boundary.
Definition: qgscallout.h:132
@ LabelMiddleLeft
Middle left of the label's boundary.
Definition: qgscallout.h:129
@ LabelBottomRight
Bottom right corner of the label's boundary.
Definition: qgscallout.h:133
@ LabelMiddleRight
Middle right of the label's boundary.
Definition: qgscallout.h:130
@ LabelTopMiddle
Top middle of the label's boundary.
Definition: qgscallout.h:127
@ LabelTopLeft
Top left corner of the label's boundary.
Definition: qgscallout.h:126
@ LabelCentroid
The labe's centroid.
Definition: qgscallout.h:125
@ LabelTopRight
Top right corner of the label's boundary.
Definition: qgscallout.h:128
Property
Data definable properties.
Definition: qgscallout.h:83
@ DestinationX
X-coordinate of callout destination (feature anchor) (since QGIS 3.20)
Definition: qgscallout.h:92
@ Curvature
Curvature of curved line callouts (since QGIS 3.20)
Definition: qgscallout.h:94
@ BlendMode
Callout blend mode (since QGIS 3.20)
Definition: qgscallout.h:99
@ DestinationY
Y-coordinate of callout destination (feature anchor) (since QGIS 3.20)
Definition: qgscallout.h:93
@ CornerRadius
Balloon callout corner radius (since QGIS 3.20)
Definition: qgscallout.h:98
@ AnchorPointPosition
Feature's anchor point position.
Definition: qgscallout.h:88
@ LabelAnchorPointPosition
Label's anchor point position.
Definition: qgscallout.h:89
@ DrawCalloutToAllParts
Whether callout lines should be drawn to all feature parts.
Definition: qgscallout.h:87
@ OffsetFromAnchor
Distance to offset lines from anchor points.
Definition: qgscallout.h:85
@ WedgeWidth
Balloon callout wedge width (since QGIS 3.20)
Definition: qgscallout.h:97
@ OriginY
Y-coordinate of callout origin (label anchor) (since QGIS 3.20)
Definition: qgscallout.h:91
@ OffsetFromLabel
Distance to offset lines from label area.
Definition: qgscallout.h:86
@ Orientation
Orientation of curved line callouts (since QGIS 3.20)
Definition: qgscallout.h:95
@ OriginX
X-coordinate of callout origin (label anchor) (since QGIS 3.20)
Definition: qgscallout.h:90
@ MinimumCalloutLength
Minimum length of callouts.
Definition: qgscallout.h:84
@ Margins
Margin from text (since QGIS 3.20)
Definition: qgscallout.h:96
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
Definition: qgscallout.h:367
bool enabled() const
Returns true if the the callout is enabled.
Definition: qgscallout.h:318
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:790
QgsCurvedLineCallout & operator=(const QgsCurvedLineCallout &)=delete
Orientation
Curve orientation.
Definition: qgscallout.h:797
@ Clockwise
Curve lines in a clockwise direction.
Definition: qgscallout.h:799
@ CounterClockwise
Curve lines in a counter-clockwise direction.
Definition: qgscallout.h:800
@ Automatic
Automatically choose most cartographically pleasing orientation based on label and callout arrangemen...
Definition: qgscallout.h:798
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:747
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:510
void setMinimumLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum callout length.
Definition: qgscallout.h:591
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
Definition: qgscallout.h:621
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
Definition: qgscallout.h:688
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
Definition: qgscallout.h:651
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
Definition: qgscallout.h:636
QgsUnitTypes::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
Definition: qgscallout.h:583
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:607
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
Definition: qgscallout.h:614
~QgsSimpleLineCallout() override
void setMinimumLength(double length)
Sets the minimum length of callout lines.
Definition: qgscallout.h:569
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
Definition: qgscallout.h:644
bool drawCalloutToAllParts() const
Returns true if callout lines should be drawn to all feature parts.
Definition: qgscallout.h:695
void setDrawCalloutToAllParts(bool drawToAllParts)
Sets whether callout lines should be drawn to all feature parts.
Definition: qgscallout.h:702
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
Definition: qgscallout.h:599
QgsUnitTypes::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
Definition: qgscallout.h:672
void setMinimumLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
Definition: qgscallout.h:576
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
Definition: qgscallout.h:680
void setOffsetFromLabelUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from label area distance.
Definition: qgscallout.h:665
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
Definition: qgscallout.h:658
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
Definition: qgscallout.h:628
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