Skip to content

Commit

Permalink
Remove some more QgsComposition::mapSettings use
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 17, 2017
1 parent e3ad5b1 commit 308fc56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
8 changes: 1 addition & 7 deletions src/core/composer/qgscomposermapgrid.cpp
Expand Up @@ -636,14 +636,8 @@ void QgsComposerMapGrid::draw( QPainter* p )
p->scale( 1 / dotsPerMM, 1 / dotsPerMM ); //scale painter from mm to dots

//setup render context
QgsMapSettings ms = mComposerMap->composition()->mapSettings();
//context units should be in dots
ms.setOutputSize( QSizeF( mComposerMap->rect().width() * dotsPerMM, mComposerMap->rect().height() * dotsPerMM ).toSize() );
ms.setExtent( *mComposerMap->currentMapExtent() );
ms.setOutputDpi( p->device()->logicalDpiX() );
QgsRenderContext context = QgsRenderContext::fromMapSettings( ms );
QgsRenderContext context = QgsComposerUtils::createRenderContext( mComposition, *p );
context.setForceVectorOutput( true );
context.setPainter( p );
QgsExpressionContext expressionContext = createExpressionContext();
context.setExpressionContext( expressionContext );

Expand Down
9 changes: 2 additions & 7 deletions src/core/composer/qgscomposermapoverview.cpp
Expand Up @@ -22,6 +22,7 @@
#include "qgssymbol.h"
#include "qgsmapsettings.h"
#include "qgspainting.h"
#include "qgscomposerutils.h"

#include <QPainter>

Expand Down Expand Up @@ -91,14 +92,8 @@ void QgsComposerMapOverview::draw( QPainter *painter )
double dotsPerMM = painter->device()->logicalDpiX() / 25.4;

//setup render context
QgsMapSettings ms = mComposerMap->composition()->mapSettings();
//context units should be in dots
ms.setOutputSize( QSizeF( mComposerMap->rect().width() * dotsPerMM, mComposerMap->rect().height() * dotsPerMM ).toSize() );
ms.setExtent( *mComposerMap->currentMapExtent() );
ms.setOutputDpi( painter->device()->logicalDpiX() );
QgsRenderContext context = QgsRenderContext::fromMapSettings( ms );
QgsRenderContext context = QgsComposerUtils::createRenderContext( mComposition, *painter );
context.setForceVectorOutput( true );
context.setPainter( painter );
QgsExpressionContext expressionContext = createExpressionContext();
context.setExpressionContext( expressionContext );

Expand Down

0 comments on commit 308fc56

Please sign in to comment.