~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/core/qgsrendercontext.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 "qgscoordinatetransform.h"
 
22
#include "qgsmaptopixel.h"
 
23
#include "qgsrectangle.h"
 
24
 
 
25
class QPainter;
 
26
 
 
27
class QgsLabelingEngineInterface;
 
28
 
 
29
/** \ingroup core
 
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.
 
34
 **/
 
35
class CORE_EXPORT QgsRenderContext
 
36
{
 
37
  public:
 
38
    QgsRenderContext();
 
39
    ~QgsRenderContext();
 
40
 
 
41
    //getters
 
42
 
 
43
    QPainter* painter() {return mPainter;}
 
44
 
 
45
    const QgsCoordinateTransform* coordinateTransform() const {return mCoordTransform;}
 
46
 
 
47
    const QgsRectangle& extent() const {return mExtent;}
 
48
 
 
49
    const QgsMapToPixel& mapToPixel() const {return mMapToPixel;}
 
50
 
 
51
    double scaleFactor() const {return mScaleFactor;}
 
52
 
 
53
    double rasterScaleFactor() const {return mRasterScaleFactor;}
 
54
 
 
55
    bool renderingStopped() const {return mRenderingStopped;}
 
56
 
 
57
    bool forceVectorOutput() const {return mForceVectorOutput;}
 
58
 
 
59
    bool drawEditingInformation() const {return mDrawEditingInformation;}
 
60
 
 
61
    double rendererScale() const {return mRendererScale;}
 
62
 
 
63
    //! Added in QGIS v1.4
 
64
    QgsLabelingEngineInterface* labelingEngine() const { return mLabelingEngine; }
 
65
 
 
66
    //setters
 
67
 
 
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; }
 
80
 
 
81
  private:
 
82
 
 
83
    /**Painter for rendering operations*/
 
84
    QPainter* mPainter;
 
85
 
 
86
    /**For transformation between coordinate systems. Can be 0 if on-the-fly reprojection is not used*/
 
87
    QgsCoordinateTransform* mCoordTransform;
 
88
 
 
89
    /**True if vertex markers for editing should be drawn*/
 
90
    bool mDrawEditingInformation;
 
91
 
 
92
    QgsRectangle mExtent;
 
93
 
 
94
    /**If true then no rendered vector elements should be cached as image*/
 
95
    bool mForceVectorOutput;
 
96
 
 
97
    QgsMapToPixel mMapToPixel;
 
98
 
 
99
    /**True if the rendering has been canceled*/
 
100
    bool mRenderingStopped;
 
101
 
 
102
    /**Factor to scale line widths and point marker sizes*/
 
103
    double mScaleFactor;
 
104
 
 
105
    /**Factor to scale rasters*/
 
106
    double mRasterScaleFactor;
 
107
 
 
108
    /**Map scale*/
 
109
    double mRendererScale;
 
110
 
 
111
    /**Labeling engine (can be NULL)*/
 
112
    QgsLabelingEngineInterface* mLabelingEngine;
 
113
};
 
114
 
 
115
#endif