QGIS API Documentation  2.3.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsrendercontext.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrendercontext.h
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 #ifndef QGSRENDERCONTEXT_H
19 #define QGSRENDERCONTEXT_H
20 
21 #include <QColor>
22 
23 #include "qgscoordinatetransform.h"
24 #include "qgsmaptopixel.h"
25 #include "qgsrectangle.h"
26 
27 class QPainter;
28 
30 class QgsMapSettings;
31 
38 class CORE_EXPORT QgsRenderContext
39 {
40  public:
43 
46  static QgsRenderContext fromMapSettings( const QgsMapSettings& mapSettings );
47 
48  //getters
49 
50  QPainter* painter() {return mPainter;}
51  const QPainter* constPainter() const { return mPainter; }
52 
53  const QgsCoordinateTransform* coordinateTransform() const {return mCoordTransform;}
54 
55  const QgsRectangle& extent() const {return mExtent;}
56 
57  const QgsMapToPixel& mapToPixel() const {return mMapToPixel;}
58 
59  double scaleFactor() const {return mScaleFactor;}
60 
61  double rasterScaleFactor() const {return mRasterScaleFactor;}
62 
63  bool renderingStopped() const {return mRenderingStopped;}
64 
65  bool forceVectorOutput() const {return mForceVectorOutput;}
66 
69  bool useAdvancedEffects() const {return mUseAdvancedEffects;}
72  void setUseAdvancedEffects( bool enabled ) { mUseAdvancedEffects = enabled; }
73 
74  bool drawEditingInformation() const {return mDrawEditingInformation;}
75 
76  double rendererScale() const {return mRendererScale;}
77 
79  QgsLabelingEngineInterface* labelingEngine() const { return mLabelingEngine; }
80 
82  QColor selectionColor() const { return mSelectionColor; }
83 
84  //setters
85 
87  void setCoordinateTransform( const QgsCoordinateTransform* t );
88  void setMapToPixel( const QgsMapToPixel& mtp ) {mMapToPixel = mtp;}
89  void setExtent( const QgsRectangle& extent ) {mExtent = extent;}
90  void setDrawEditingInformation( bool b ) {mDrawEditingInformation = b;}
91  void setRenderingStopped( bool stopped ) {mRenderingStopped = stopped;}
92  void setScaleFactor( double factor ) {mScaleFactor = factor;}
93  void setRasterScaleFactor( double factor ) {mRasterScaleFactor = factor;}
94  void setRendererScale( double scale ) {mRendererScale = scale;}
95  void setPainter( QPainter* p ) {mPainter = p;}
97  void setForceVectorOutput( bool force ) {mForceVectorOutput = force;}
99  void setLabelingEngine( QgsLabelingEngineInterface* iface ) { mLabelingEngine = iface; }
101  void setSelectionColor( const QColor& color ) { mSelectionColor = color; }
102 
104  bool useRenderingOptimization() const { return mUseRenderingOptimization; }
105  void setUseRenderingOptimization( bool enabled ) { mUseRenderingOptimization = enabled; }
106 
107  private:
108 
110  QPainter* mPainter;
111 
114 
117 
119 
122 
125 
127 
130 
132  double mScaleFactor;
133 
136 
139 
142 
145 
148 };
149 
150 #endif
void setForceVectorOutput(bool force)
Added in QGIS v1.5.
QPainter * mPainter
Painter for rendering operations.
void setRenderingStopped(bool stopped)
A rectangle specified with double values.
Definition: qgsrectangle.h:35
bool mDrawEditingInformation
True if vertex markers for editing should be drawn.
QgsLabelingEngineInterface * mLabelingEngine
Labeling engine (can be NULL)
QColor selectionColor() const
Added in QGIS v2.0.
double rendererScale() const
void setRendererScale(double scale)
const QgsRectangle & extent() const
bool mUseRenderingOptimization
True if the rendering optimization (geometry simplification) can be executed.
double scaleFactor() const
QgsRectangle mExtent
const QgsCoordinateTransform * coordinateTransform() const
const QPainter * constPainter() const
void setExtent(const QgsRectangle &extent)
bool useAdvancedEffects() const
Returns true if advanced effects such as blend modes such be used.
double mRendererScale
Map scale.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:33
void setSelectionColor(const QColor &color)
Added in QGIS v2.0.
void setUseAdvancedEffects(bool enabled)
Used to enable or disable advanced effects such as blend modes.
void setScaleFactor(double factor)
bool renderingStopped() const
void setDrawEditingInformation(bool b)
bool mUseAdvancedEffects
Flag if advanced visual effects such as blend modes should be used.
bool forceVectorOutput() const
void setPainter(QPainter *p)
double rasterScaleFactor() const
bool useRenderingOptimization() const
Returns true if the rendering optimization (geometry simplification) can be executed.
double mScaleFactor
Factor to scale line widths and point marker sizes.
bool drawEditingInformation() const
const QgsCoordinateTransform * mCoordTransform
For transformation between coordinate systems.
QgsMapToPixel mMapToPixel
Contains information about the context of a rendering operation.
QPainter * painter()
bool mRenderingStopped
True if the rendering has been canceled.
void setLabelingEngine(QgsLabelingEngineInterface *iface)
Added in QGIS v1.4.
void setMapToPixel(const QgsMapToPixel &mtp)
Class for doing transforms between two map coordinate systems.
void setUseRenderingOptimization(bool enabled)
const QgsMapToPixel & mapToPixel() const
double mRasterScaleFactor
Factor to scale rasters.
void setRasterScaleFactor(double factor)
QColor mSelectionColor
Color used for features that are marked as selected.
Labeling engine interface.
QgsLabelingEngineInterface * labelingEngine() const
Added in QGIS v1.4.
bool mForceVectorOutput
If true then no rendered vector elements should be cached as image.