19#include "moc_qgslayoutnortharrowhandler.cpp"
41void QgsLayoutNorthArrowHandler::updateMapRotation()
47 double rotation = mRotationMap->mapRotation() + mRotationMap->rotation();
57 const QgsPointXY center = mRotationMap->extent().center();
75 rotation += mNorthOffset;
76 const double oldRotation = mArrowRotation;
77 mArrowRotation = ( rotation > 360.0 ) ? rotation - 360.0 : rotation ;
78 if ( mArrowRotation != oldRotation )
86 disconnectMap( mRotationMap );
91 mRotationMap =
nullptr;
92 if ( mArrowRotation != 0 )
121 mNorthOffset = offset;
static Q_INVOKABLE double bearingTrueNorth(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext, const QgsPointXY &point)
Returns the direction to true north from a specified point and for a specified coordinate reference s...
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Defines a QGIS exception class.
Layout graphical items for displaying a map.
void extentChanged()
Emitted when the map's extent changes.
void mapRotationChanged(double newRotation)
Emitted when the map's rotation changes.
void rotationChanged(double newRotation)
Emitted on item rotation change.
void setNorthOffset(double offset)
Sets the offset added to the arrows's rotation from a map's North.
QgsLayoutItemMap * linkedMap() const
Returns the linked rotation map, if set.
void arrowRotationChanged(double newRotation)
Emitted on arrow rotation change.
NorthMode
Method for syncing rotation to a map's North direction.
@ GridNorth
Align to grid north.
@ TrueNorth
Align to true north.
void setNorthMode(NorthMode mode)
Sets the mode used to calculate the arrow rotation.
void setLinkedMap(QgsLayoutItemMap *map)
Sets the linked map item.
QgsLayoutNorthArrowHandler(QObject *parent)
Constructor for QgsLayoutNorthArrowHandler, with the specified parent object.
A class to represent a 2D point.
#define QgsDebugError(str)
const QgsCoordinateReferenceSystem & crs