Skip to content
Permalink
Browse files

[Bugfix] North arrow / image should account for item rotation too.

  • Loading branch information
github-actions authored and nyalldawson committed Dec 31, 2019
1 parent 201e0c4 commit 85cc185ccc9b9b9d6a50ca2b2b44722be22dce65
Showing with 6 additions and 2 deletions.
  1. +1 −0 src/core/layout/qgslayoutitemmap.cpp
  2. +5 −2 src/core/layout/qgslayoutitempicture.cpp
@@ -2526,3 +2526,4 @@ void QgsLayoutItemMap::createStagedRenderJob( const QgsRectangle &extent, const
mStagedRendererJob->start();
}


@@ -444,6 +444,7 @@ void QgsLayoutItemPicture::disconnectMap( QgsLayoutItemMap *map )
if ( map )
{
disconnect( map, &QgsLayoutItemMap::mapRotationChanged, this, &QgsLayoutItemPicture::updateMapRotation );
disconnect( map, &QgsLayoutItemMap::rotationChanged, this, &QgsLayoutItemPicture::updateMapRotation );
disconnect( map, &QgsLayoutItemMap::extentChanged, this, &QgsLayoutItemPicture::updateMapRotation );
}
}
@@ -454,7 +455,7 @@ void QgsLayoutItemPicture::updateMapRotation()
return;

// take map rotation
double rotation = mRotationMap->mapRotation();
double rotation = mRotationMap->mapRotation() + mRotationMap->rotation();

// handle true north
switch ( mNorthMode )
@@ -483,7 +484,7 @@ void QgsLayoutItemPicture::updateMapRotation()
}

rotation += mNorthOffset;
setPictureRotation( rotation );
setPictureRotation( ( rotation > 360.0 ) ? rotation - 360.0 : rotation );
}

void QgsLayoutItemPicture::loadPicture( const QVariant &data )
@@ -661,6 +662,7 @@ void QgsLayoutItemPicture::setLinkedMap( QgsLayoutItemMap *map )
{
mPictureRotation = map->mapRotation();
connect( map, &QgsLayoutItemMap::mapRotationChanged, this, &QgsLayoutItemPicture::updateMapRotation );
connect( map, &QgsLayoutItemMap::rotationChanged, this, &QgsLayoutItemPicture::updateMapRotation );
connect( map, &QgsLayoutItemMap::extentChanged, this, &QgsLayoutItemPicture::updateMapRotation );
mRotationMap = map;
updateMapRotation();
@@ -867,6 +869,7 @@ void QgsLayoutItemPicture::finalizeRestoreFromXml()
if ( ( mRotationMap = qobject_cast< QgsLayoutItemMap * >( mLayout->itemByUuid( mRotationMapUuid, true ) ) ) )
{
connect( mRotationMap, &QgsLayoutItemMap::mapRotationChanged, this, &QgsLayoutItemPicture::updateMapRotation );
connect( mRotationMap, &QgsLayoutItemMap::rotationChanged, this, &QgsLayoutItemPicture::updateMapRotation );
connect( mRotationMap, &QgsLayoutItemMap::extentChanged, this, &QgsLayoutItemPicture::updateMapRotation );
}
}

0 comments on commit 85cc185

Please sign in to comment.
You can’t perform that action at this time.