QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsrendercontext.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrendercontext.cpp
3  --------------------
4  begin : March 16, 2008
5  copyright : (C) 2008 by Marco Hugentobler
6  email : marco dot hugentobler at karto dot baug dot ethz dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 
19 #include "qgsrendercontext.h"
20 
21 #include "qgsmapsettings.h"
22 
24  : mPainter( 0 ),
25  mCoordTransform( 0 ),
26  mDrawEditingInformation( true ),
27  mForceVectorOutput( false ),
28  mUseAdvancedEffects( true ),
29  mRenderingStopped( false ),
30  mScaleFactor( 1.0 ),
31  mRasterScaleFactor( 1.0 ),
32  mRendererScale( 1.0 ),
33  mLabelingEngine( NULL ),
34  mShowSelection( true ),
35  mUseRenderingOptimization( true )
36 {
38 }
39 
41 {
42 }
43 
45 {
46  QgsRenderContext ctx;
47  ctx.setMapToPixel( mapSettings.mapToPixel() );
48  ctx.setExtent( mapSettings.visibleExtent() );
53  ctx.setCoordinateTransform( 0 );
54  ctx.setSelectionColor( mapSettings.selectionColor() );
56  ctx.setRasterScaleFactor( 1.0 );
57  ctx.setScaleFactor( mapSettings.outputDpi() / 25.4 ); // = pixels per mm
58  ctx.setRendererScale( mapSettings.scale() );
59 
60  //this flag is only for stopping during the current rendering progress,
61  //so must be false at every new render operation
62  ctx.setRenderingStopped( false );
63 
64  return ctx;
65 }
66 
68 {
69  mCoordTransform = t;
70 }