QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
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
Layout graphical items for displaying a map.
An object which handles north-arrow type behavior for layout items.
NorthMode northMode() const
Returns the mode used to calculate the arrow rotation.
double arrowRotation() const
Returns the rotation to be used for the arrow, in degrees clockwise.
void arrowRotationChanged(double newRotation)
Emitted on arrow rotation change.
NorthMode
Method for syncing rotation to a map's North direction.
double northOffset() const
Returns the offset added to the arrows's rotation from a map's North.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53