Skip to content
Permalink
Browse files

[composer] Scale changes while in atlas fixed scale mode are permanen…

…tly applied (fix #9602)
  • Loading branch information
nyalldawson committed Jun 14, 2014
1 parent 5678bed commit f252a965e91c7165d7269802f0f0cdbed1f2a7ab
Showing with 25 additions and 0 deletions.
  1. +25 −0 src/core/composer/qgscomposermap.cpp
@@ -655,6 +655,18 @@ void QgsComposerMap::zoomContent( int delta, double x, double y )
currentMapExtent()->setYMaximum( centerY + newIntervalY / 2 );
currentMapExtent()->setYMinimum( centerY - newIntervalY / 2 );

if ( mAtlasDriven && mAtlasScalingMode == Fixed && mComposition->atlasMode() != QgsComposition::AtlasOff )
{
//if map is atlas controlled and set to fixed scaling mode, then scale changes should be treated as permanant
//and also apply to the map's original extent (see #9602)
//we can't use the scaleRatio calculated earlier, as the scale can vary depending on extent for geographic coordinate systems
QgsScaleCalculator calculator;
calculator.setMapUnits( mComposition->mapSettings().mapUnits() );
calculator.setDpi( 25.4 ); //QGraphicsView units are mm
double scaleRatio = scale() / calculator.calculate( mExtent, rect().width() );
mExtent.scale( scaleRatio );
}

cache();
update();
emit itemChanged();
@@ -789,6 +801,19 @@ void QgsComposerMap::setNewScale( double scaleDenominator )

double scaleRatio = scaleDenominator / currentScaleDenominator;
currentMapExtent()->scale( scaleRatio );

if ( mAtlasDriven && mAtlasScalingMode == Fixed && mComposition->atlasMode() != QgsComposition::AtlasOff )
{
//if map is atlas controlled and set to fixed scaling mode, then scale changes should be treated as permanant
//and also apply to the map's original extent (see #9602)
//we can't use the scaleRatio calculated earlier, as the scale can vary depending on extent for geographic coordinate systems
QgsScaleCalculator calculator;
calculator.setMapUnits( mComposition->mapSettings().mapUnits() );
calculator.setDpi( 25.4 ); //QGraphicsView units are mm
scaleRatio = scaleDenominator / calculator.calculate( mExtent, rect().width() );
mExtent.scale( scaleRatio );
}

mCacheUpdated = false;
cache();
update();

0 comments on commit f252a96

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