Skip to content

Commit

Permalink
[composer] Scale changes while in atlas fixed scale mode are permanen…
Browse files Browse the repository at this point in the history
…tly applied (fix #9602)
  • Loading branch information
nyalldawson committed Jun 14, 2014
1 parent 5678bed commit f252a96
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/core/composer/qgscomposermap.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f252a96

Please sign in to comment.