1
/***************************************************************************
5
copyright : (C) 2008 by Marco Hugentobler
6
email : marco dot hugentobler at karto dot baug dot ethz dot ch
7
***************************************************************************/
9
/***************************************************************************
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. *
16
***************************************************************************/
18
#ifndef QGSRENDERCONTEXT_H
19
#define QGSRENDERCONTEXT_H
21
#include "qgscoordinatetransform.h"
22
#include "qgsmaptopixel.h"
23
#include "qgsrectangle.h"
27
class QgsLabelingEngineInterface;
30
* Contains information about the context of a rendering operation.
31
* The context of a rendering operation defines properties such as
32
* the conversion ratio between screen and map units, the extents /
33
* bounding box to be rendered etc.
35
class CORE_EXPORT QgsRenderContext
43
QPainter* painter() {return mPainter;}
45
const QgsCoordinateTransform* coordinateTransform() const {return mCoordTransform;}
47
const QgsRectangle& extent() const {return mExtent;}
49
const QgsMapToPixel& mapToPixel() const {return mMapToPixel;}
51
double scaleFactor() const {return mScaleFactor;}
53
double rasterScaleFactor() const {return mRasterScaleFactor;}
55
bool renderingStopped() const {return mRenderingStopped;}
57
bool forceVectorOutput() const {return mForceVectorOutput;}
59
bool drawEditingInformation() const {return mDrawEditingInformation;}
61
double rendererScale() const {return mRendererScale;}
63
//! Added in QGIS v1.4
64
QgsLabelingEngineInterface* labelingEngine() const { return mLabelingEngine; }
68
/**Sets coordinate transformation. QgsRenderContext takes ownership and deletes if necessary*/
69
void setCoordinateTransform( QgsCoordinateTransform* t );
70
void setMapToPixel( const QgsMapToPixel& mtp ) {mMapToPixel = mtp;}
71
void setExtent( const QgsRectangle& extent ) {mExtent = extent;}
72
void setDrawEditingInformation( bool b ) {mDrawEditingInformation = b;}
73
void setRenderingStopped( bool stopped ) {mRenderingStopped = stopped;}
74
void setScaleFactor( double factor ) {mScaleFactor = factor;}
75
void setRasterScaleFactor( double factor ) {mRasterScaleFactor = factor;}
76
void setRendererScale( double scale ) {mRendererScale = scale;}
77
void setPainter( QPainter* p ) {mPainter = p;}
78
//! Added in QGIS v1.4
79
void setLabelingEngine( QgsLabelingEngineInterface* iface ) { mLabelingEngine = iface; }
83
/**Painter for rendering operations*/
86
/**For transformation between coordinate systems. Can be 0 if on-the-fly reprojection is not used*/
87
QgsCoordinateTransform* mCoordTransform;
89
/**True if vertex markers for editing should be drawn*/
90
bool mDrawEditingInformation;
94
/**If true then no rendered vector elements should be cached as image*/
95
bool mForceVectorOutput;
97
QgsMapToPixel mMapToPixel;
99
/**True if the rendering has been canceled*/
100
bool mRenderingStopped;
102
/**Factor to scale line widths and point marker sizes*/
105
/**Factor to scale rasters*/
106
double mRasterScaleFactor;
109
double mRendererScale;
111
/**Labeling engine (can be NULL)*/
112
QgsLabelingEngineInterface* mLabelingEngine;