QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgslayoutnortharrowhandler.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutnortharrowhandler.h
3  -------------------
4 begin : April 2020
5 copyright : (C) 2020 by 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 QGSLAYOUTNORTHARROWHANDLER_H
18 #define QGSLAYOUTNORTHARROWHANDLER_H
19 
20 #include "qgis_core.h"
21 #include "qgis_sip.h"
22 #include <QObject>
23 #include <QPointer>
24 
25 class QgsLayoutItemMap;
26 
32 class CORE_EXPORT QgsLayoutNorthArrowHandler: public QObject
33 {
34  Q_OBJECT
35  public:
36 
38  enum NorthMode
39  {
40  GridNorth = 0,
42  };
43 
48 
52  double arrowRotation() const { return mArrowRotation; }
53 
59  void setLinkedMap( QgsLayoutItemMap *map );
60 
67  QgsLayoutItemMap *linkedMap() const;
68 
74  NorthMode northMode() const { return mNorthMode; }
75 
81  void setNorthMode( NorthMode mode );
82 
88  double northOffset() const { return mNorthOffset; }
89 
95  void setNorthOffset( double offset );
96 
97  signals:
99  void arrowRotationChanged( double newRotation );
100 
101  private:
102 
104  double mArrowRotation = 0;
105 
106  QString mRotationMapUuid;
108  QPointer< QgsLayoutItemMap > mRotationMap;
109 
111  NorthMode mNorthMode = GridNorth;
113  double mNorthOffset = 0.0;
114 
115  void disconnectMap( QgsLayoutItemMap *map );
116 
117  private slots:
118 
119  void updateMapRotation();
120 
121 
122 };
123 
124 #endif // QGSLAYOUTNORTHARROWHANDLER_H
QgsLayoutNorthArrowHandler::TrueNorth
@ TrueNorth
Align to true north.
Definition: qgslayoutnortharrowhandler.h:41
QgsLayoutNorthArrowHandler::arrowRotation
double arrowRotation() const
Returns the rotation to be used for the arrow, in degrees clockwise.
Definition: qgslayoutnortharrowhandler.h:52
QgsLayoutNorthArrowHandler::northMode
NorthMode northMode() const
Returns the mode used to calculate the arrow rotation.
Definition: qgslayoutnortharrowhandler.h:74
qgis_sip.h
QgsLayoutNorthArrowHandler
An object which handles north-arrow type behavior for layout items.
Definition: qgslayoutnortharrowhandler.h:32
QgsLayoutNorthArrowHandler::NorthMode
NorthMode
Method for syncing rotation to a map's North direction.
Definition: qgslayoutnortharrowhandler.h:38
QgsLayoutItemMap
Layout graphical items for displaying a map.
Definition: qgslayoutitemmap.h:317
QgsLayoutNorthArrowHandler::northOffset
double northOffset() const
Returns the offset added to the arrows's rotation from a map's North.
Definition: qgslayoutnortharrowhandler.h:88
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53