source: ntrip/trunk/BNC/qwt/qwt_plot_renderer.h@ 9603

Last change on this file since 9603 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 4.4 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_PLOT_RENDERER_H
11#define QWT_PLOT_RENDERER_H
12
13#include "qwt_global.h"
14#include <qobject.h>
15#include <qsize.h>
16
17class QwtPlot;
18class QwtScaleMap;
19class QRectF;
20class QPainter;
21class QPaintDevice;
22
23#ifndef QT_NO_PRINTER
24class QPrinter;
25#endif
26
27#ifndef QWT_NO_SVG
28#ifdef QT_SVG_LIB
29class QSvgGenerator;
30#endif
31#endif
32
33/*!
34 \brief Renderer for exporting a plot to a document, a printer
35 or anything else, that is supported by QPainter/QPaintDevice
36*/
37class QWT_EXPORT QwtPlotRenderer: public QObject
38{
39 Q_OBJECT
40
41public:
42 //! Disard flags
43 enum DiscardFlag
44 {
45 //! Render all components of the plot
46 DiscardNone = 0x00,
47
48 //! Don't render the background of the plot
49 DiscardBackground = 0x01,
50
51 //! Don't render the title of the plot
52 DiscardTitle = 0x02,
53
54 //! Don't render the legend of the plot
55 DiscardLegend = 0x04,
56
57 //! Don't render the background of the canvas
58 DiscardCanvasBackground = 0x08,
59
60 //! Don't render the footer of the plot
61 DiscardFooter = 0x10,
62
63 /*!
64 Don't render the frame of the canvas
65
66 \note This flag has no effect when using
67 style sheets, where the frame is part
68 of the background
69 */
70 DiscardCanvasFrame = 0x20
71
72 };
73
74 //! Disard flags
75 typedef QFlags<DiscardFlag> DiscardFlags;
76
77 /*!
78 \brief Layout flags
79 \sa setLayoutFlag(), testLayoutFlag()
80 */
81 enum LayoutFlag
82 {
83 //! Use the default layout as on screen
84 DefaultLayout = 0x00,
85
86 /*!
87 Instead of the scales a box is painted around the plot canvas,
88 where the scale ticks are aligned to.
89 */
90 FrameWithScales = 0x01
91 };
92
93 //! Layout flags
94 typedef QFlags<LayoutFlag> LayoutFlags;
95
96 explicit QwtPlotRenderer( QObject * = NULL );
97 virtual ~QwtPlotRenderer();
98
99 void setDiscardFlag( DiscardFlag flag, bool on = true );
100 bool testDiscardFlag( DiscardFlag flag ) const;
101
102 void setDiscardFlags( DiscardFlags flags );
103 DiscardFlags discardFlags() const;
104
105 void setLayoutFlag( LayoutFlag flag, bool on = true );
106 bool testLayoutFlag( LayoutFlag flag ) const;
107
108 void setLayoutFlags( LayoutFlags flags );
109 LayoutFlags layoutFlags() const;
110
111 void renderDocument( QwtPlot *, const QString &fileName,
112 const QSizeF &sizeMM, int resolution = 85 );
113
114 void renderDocument( QwtPlot *,
115 const QString &fileName, const QString &format,
116 const QSizeF &sizeMM, int resolution = 85 );
117
118#ifndef QWT_NO_SVG
119#ifdef QT_SVG_LIB
120#if QT_VERSION >= 0x040500
121 void renderTo( QwtPlot *, QSvgGenerator & ) const;
122#endif
123#endif
124#endif
125
126#ifndef QT_NO_PRINTER
127 void renderTo( QwtPlot *, QPrinter & ) const;
128#endif
129
130 void renderTo( QwtPlot *, QPaintDevice & ) const;
131
132 virtual void render( QwtPlot *,
133 QPainter *, const QRectF &plotRect ) const;
134
135 virtual void renderTitle( const QwtPlot *,
136 QPainter *, const QRectF &titleRect ) const;
137
138 virtual void renderFooter( const QwtPlot *,
139 QPainter *, const QRectF &footerRect ) const;
140
141 virtual void renderScale( const QwtPlot *, QPainter *,
142 int axisId, int startDist, int endDist,
143 int baseDist, const QRectF &scaleRect ) const;
144
145 virtual void renderCanvas( const QwtPlot *,
146 QPainter *, const QRectF &canvasRect,
147 const QwtScaleMap* maps ) const;
148
149 virtual void renderLegend(
150 const QwtPlot *, QPainter *, const QRectF &legendRect ) const;
151
152 bool exportTo( QwtPlot *, const QString &documentName,
153 const QSizeF &sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
154
155private:
156 void buildCanvasMaps( const QwtPlot *,
157 const QRectF &, QwtScaleMap maps[] ) const;
158
159 bool updateCanvasMargins( QwtPlot *,
160 const QRectF &, const QwtScaleMap maps[] ) const;
161
162private:
163 class PrivateData;
164 PrivateData *d_data;
165};
166
167Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
168Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
169
170#endif
Note: See TracBrowser for help on using the repository browser.