40 void QgsLayoutNorthArrowHandler::updateMapRotation()
46 double rotation = mRotationMap->mapRotation() + mRotationMap->rotation();
56 QgsPointXY center = mRotationMap->extent().center();
74 rotation += mNorthOffset;
75 const double oldRotation = mArrowRotation;
76 mArrowRotation = ( rotation > 360.0 ) ? rotation - 360.0 : rotation ;
77 if ( mArrowRotation != oldRotation )
85 disconnectMap( mRotationMap );
90 mRotationMap =
nullptr;
91 if ( mArrowRotation != 0 )
120 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.
const QgsCoordinateReferenceSystem & crs