~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

Viewing changes to qwt-5.1.1/doc/html/qwt__plot__svgitem_8cpp-source.html

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2008-05-26 10:26:31 UTC
  • mfrom: (1.1.3 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526102631-bp95mfccnrb957nx
Tags: 5.1.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 
3
<title>Qwt User&apos;s Guide: qwt_plot_svgitem.cpp Source File</title>
 
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
 
5
<link href="tabs.css" rel="stylesheet" type="text/css">
 
6
</head><body>
 
7
<!-- Generated by Doxygen 1.5.0 -->
 
8
<div class="tabs">
 
9
  <ul>
 
10
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
 
11
    <li><a href="classes.html"><span>Classes</span></a></li>
 
12
    <li id="current"><a href="files.html"><span>Files</span></a></li>
 
13
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
 
14
  </ul></div>
 
15
<div class="tabs">
 
16
  <ul>
 
17
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
 
18
    <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
 
19
  </ul></div>
 
20
<h1>qwt_plot_svgitem.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span>
 
21
<a name="l00002"></a>00002 <span class="comment"> * Qwt Widget Library</span>
 
22
<a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 1997   Josef Wilgen</span>
 
23
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002   Uwe Rathmann</span>
 
24
<a name="l00005"></a>00005 <span class="comment"> *</span>
 
25
<a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
 
26
<a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span>
 
27
<a name="l00008"></a>00008 <span class="comment"> *****************************************************************************/</span>
 
28
<a name="l00009"></a>00009 
 
29
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;qglobal.h&gt;</span>
 
30
<a name="l00011"></a>00011 
 
31
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;qpainter.h&gt;</span>
 
32
<a name="l00013"></a>00013 <span class="preprocessor">#if QT_VERSION &gt;= 0x040100</span>
 
33
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#include &lt;qsvgrenderer.h&gt;</span>
 
34
<a name="l00015"></a>00015 <span class="preprocessor">#else</span>
 
35
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#include &lt;qbuffer.h&gt;</span>
 
36
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;qpicture.h&gt;</span>
 
37
<a name="l00018"></a>00018 <span class="preprocessor">#endif</span>
 
38
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#if QT_VERSION &lt; 0x040000</span>
 
39
<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#include &lt;qpaintdevicemetrics.h&gt;</span>
 
40
<a name="l00021"></a>00021 <span class="preprocessor">#endif</span>
 
41
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#include "qwt_scale_map.h"</span>
 
42
<a name="l00023"></a>00023 <span class="preprocessor">#include "qwt_legend.h"</span>
 
43
<a name="l00024"></a>00024 <span class="preprocessor">#include "qwt_legend_item.h"</span>
 
44
<a name="l00025"></a>00025 <span class="preprocessor">#include "qwt_plot_svgitem.h"</span>
 
45
<a name="l00026"></a>00026 
 
46
<a name="l00027"></a>00027 <span class="keyword">class </span>QwtPlotSvgItem::PrivateData
 
47
<a name="l00028"></a>00028 {
 
48
<a name="l00029"></a>00029 <span class="keyword">public</span>:
 
49
<a name="l00030"></a>00030     PrivateData()
 
50
<a name="l00031"></a>00031     {
 
51
<a name="l00032"></a>00032     }
 
52
<a name="l00033"></a>00033 
 
53
<a name="l00034"></a>00034     <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> <a class="code" href="class_qwt_plot_svg_item.html#ce858f2eb34fa461589be75168e7009e">boundingRect</a>;
 
54
<a name="l00035"></a>00035 <span class="preprocessor">#if QT_VERSION &gt;= 0x040100</span>
 
55
<a name="l00036"></a>00036 <span class="preprocessor"></span>    QSvgRenderer renderer;
 
56
<a name="l00037"></a>00037 <span class="preprocessor">#else</span>
 
57
<a name="l00038"></a>00038 <span class="preprocessor"></span>    QPicture picture;
 
58
<a name="l00039"></a>00039 <span class="preprocessor">#endif</span>
 
59
<a name="l00040"></a>00040 <span class="preprocessor"></span>};
 
60
<a name="l00041"></a>00041 
 
61
<a name="l00051"></a><a class="code" href="class_qwt_plot_svg_item.html#3b6e505f0ef1d9e40030db2a8b60762e">00051</a> <a class="code" href="class_qwt_plot_svg_item.html#3b6e505f0ef1d9e40030db2a8b60762e">QwtPlotSvgItem::QwtPlotSvgItem</a>(<span class="keyword">const</span> QString&amp; <a class="code" href="class_qwt_plot_item.html#3abdb947d71e457de120851922de3197">title</a>):
 
62
<a name="l00052"></a>00052     <a class="code" href="class_qwt_plot_item.html">QwtPlotItem</a>(<a class="code" href="class_qwt_text.html">QwtText</a>(title))
 
63
<a name="l00053"></a>00053 {
 
64
<a name="l00054"></a>00054     init();
 
65
<a name="l00055"></a>00055 }
 
66
<a name="l00056"></a>00056 
 
67
<a name="l00066"></a><a class="code" href="class_qwt_plot_svg_item.html#c750a4ff902302ab485971fcea6bee38">00066</a> <a class="code" href="class_qwt_plot_svg_item.html#3b6e505f0ef1d9e40030db2a8b60762e">QwtPlotSvgItem::QwtPlotSvgItem</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_text.html">QwtText</a>&amp; title):
 
68
<a name="l00067"></a>00067     <a class="code" href="class_qwt_plot_item.html">QwtPlotItem</a>(title)
 
69
<a name="l00068"></a>00068 {
 
70
<a name="l00069"></a>00069     init();
 
71
<a name="l00070"></a>00070 }
 
72
<a name="l00071"></a>00071 
 
73
<a name="l00073"></a><a class="code" href="class_qwt_plot_svg_item.html#4509baf861772124c71abd1b6514b319">00073</a> <a class="code" href="class_qwt_plot_svg_item.html#4509baf861772124c71abd1b6514b319">QwtPlotSvgItem::~QwtPlotSvgItem</a>()
 
74
<a name="l00074"></a>00074 {
 
75
<a name="l00075"></a>00075     <span class="keyword">delete</span> d_data;
 
76
<a name="l00076"></a>00076 }
 
77
<a name="l00077"></a>00077 
 
78
<a name="l00078"></a>00078 <span class="keywordtype">void</span> QwtPlotSvgItem::init()
 
79
<a name="l00079"></a>00079 {
 
80
<a name="l00080"></a>00080     d_data = <span class="keyword">new</span> PrivateData();
 
81
<a name="l00081"></a>00081 
 
82
<a name="l00082"></a>00082     <a class="code" href="class_qwt_plot_item.html#5a335be8ff488809a2cf7f4b734ad1b6">setItemAttribute</a>(QwtPlotItem::AutoScale, <span class="keyword">true</span>);
 
83
<a name="l00083"></a>00083     <a class="code" href="class_qwt_plot_item.html#5a335be8ff488809a2cf7f4b734ad1b6">setItemAttribute</a>(QwtPlotItem::Legend, <span class="keyword">false</span>);
 
84
<a name="l00084"></a>00084 
 
85
<a name="l00085"></a>00085     <a class="code" href="class_qwt_plot_item.html#57d90e4146133b59d589c71b3a643e82">setZ</a>(8.0);
 
86
<a name="l00086"></a>00086 }
 
87
<a name="l00087"></a>00087 
 
88
<a name="l00089"></a><a class="code" href="class_qwt_plot_svg_item.html#55cbae2059a056004995e3d3cc304123">00089</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot_svg_item.html#55cbae2059a056004995e3d3cc304123">QwtPlotSvgItem::rtti</a>()<span class="keyword"> const</span>
 
89
<a name="l00090"></a>00090 <span class="keyword"></span>{
 
90
<a name="l00091"></a>00091     <span class="keywordflow">return</span> QwtPlotItem::Rtti_PlotSVG;
 
91
<a name="l00092"></a>00092 }
 
92
<a name="l00093"></a>00093 
 
93
<a name="l00102"></a><a class="code" href="class_qwt_plot_svg_item.html#b85890e7f1d89616c99fe34fa29f5d8f">00102</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot_svg_item.html#b85890e7f1d89616c99fe34fa29f5d8f">QwtPlotSvgItem::loadFile</a>(<span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> &amp;rect, 
 
94
<a name="l00103"></a>00103     <span class="keyword">const</span> QString &amp;fileName)
 
95
<a name="l00104"></a>00104 {
 
96
<a name="l00105"></a>00105     d_data-&gt;boundingRect = rect;
 
97
<a name="l00106"></a>00106 <span class="preprocessor">#if QT_VERSION &gt;= 0x040100</span>
 
98
<a name="l00107"></a>00107 <span class="preprocessor"></span>    <span class="keyword">const</span> <span class="keywordtype">bool</span> ok = d_data-&gt;renderer.load(fileName);
 
99
<a name="l00108"></a>00108 <span class="preprocessor">#else</span>
 
100
<a name="l00109"></a>00109 <span class="preprocessor"></span>    <span class="keyword">const</span> <span class="keywordtype">bool</span> ok = d_data-&gt;picture.load(fileName, <span class="stringliteral">"svg"</span>);
 
101
<a name="l00110"></a>00110 <span class="preprocessor">#endif</span>
 
102
<a name="l00111"></a>00111 <span class="preprocessor"></span>    <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
 
103
<a name="l00112"></a>00112     <span class="keywordflow">return</span> ok;
 
104
<a name="l00113"></a>00113 }
 
105
<a name="l00114"></a>00114 
 
106
<a name="l00123"></a><a class="code" href="class_qwt_plot_svg_item.html#f40a77332482f79aa4d5254a9123508d">00123</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot_svg_item.html#f40a77332482f79aa4d5254a9123508d">QwtPlotSvgItem::loadData</a>(<span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> &amp;rect, 
 
107
<a name="l00124"></a>00124     <span class="keyword">const</span> QByteArray &amp;data)
 
108
<a name="l00125"></a>00125 {
 
109
<a name="l00126"></a>00126     d_data-&gt;boundingRect = rect;
 
110
<a name="l00127"></a>00127 <span class="preprocessor">#if QT_VERSION &gt;= 0x040100</span>
 
111
<a name="l00128"></a>00128 <span class="preprocessor"></span>    <span class="keyword">const</span> <span class="keywordtype">bool</span> ok = d_data-&gt;renderer.load(data);
 
112
<a name="l00129"></a>00129 <span class="preprocessor">#else</span>
 
113
<a name="l00130"></a>00130 <span class="preprocessor"></span><span class="preprocessor">#if QT_VERSION &gt;= 0x040000</span>
 
114
<a name="l00131"></a>00131 <span class="preprocessor"></span>    QBuffer buffer(&amp;(QByteArray&amp;)data);
 
115
<a name="l00132"></a>00132 <span class="preprocessor">#else</span>
 
116
<a name="l00133"></a>00133 <span class="preprocessor"></span>    QBuffer buffer(data);
 
117
<a name="l00134"></a>00134 <span class="preprocessor">#endif</span>
 
118
<a name="l00135"></a>00135 <span class="preprocessor"></span>    <span class="keyword">const</span> <span class="keywordtype">bool</span> ok = d_data-&gt;picture.load(&amp;buffer, <span class="stringliteral">"svg"</span>);
 
119
<a name="l00136"></a>00136 <span class="preprocessor">#endif</span>
 
120
<a name="l00137"></a>00137 <span class="preprocessor"></span>    <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
 
121
<a name="l00138"></a>00138     <span class="keywordflow">return</span> ok;
 
122
<a name="l00139"></a>00139 }
 
123
<a name="l00140"></a>00140 
 
124
<a name="l00142"></a><a class="code" href="class_qwt_plot_svg_item.html#ce858f2eb34fa461589be75168e7009e">00142</a> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> <a class="code" href="class_qwt_plot_svg_item.html#ce858f2eb34fa461589be75168e7009e">QwtPlotSvgItem::boundingRect</a>()<span class="keyword"> const</span>
 
125
<a name="l00143"></a>00143 <span class="keyword"></span>{
 
126
<a name="l00144"></a>00144     <span class="keywordflow">return</span> d_data-&gt;boundingRect;
 
127
<a name="l00145"></a>00145 }
 
128
<a name="l00146"></a>00146 
 
129
<a name="l00147"></a>00147 <span class="preprocessor">#if QT_VERSION &gt;= 0x040100</span>
 
130
<a name="l00148"></a>00148 <span class="preprocessor"></span>
 
131
<a name="l00150"></a>00150 <span class="keyword">const</span> QSvgRenderer &amp;QwtPlotSvgItem::renderer()<span class="keyword"> const</span>
 
132
<a name="l00151"></a>00151 <span class="keyword"></span>{
 
133
<a name="l00152"></a>00152     <span class="keywordflow">return</span> d_data-&gt;renderer;
 
134
<a name="l00153"></a>00153 }
 
135
<a name="l00154"></a>00154 
 
136
<a name="l00156"></a>00156 QSvgRenderer &amp;QwtPlotSvgItem::renderer()
 
137
<a name="l00157"></a>00157 {
 
138
<a name="l00158"></a>00158     <span class="keywordflow">return</span> d_data-&gt;renderer;
 
139
<a name="l00159"></a>00159 }
 
140
<a name="l00160"></a>00160 <span class="preprocessor">#endif</span>
 
141
<a name="l00161"></a>00161 <span class="preprocessor"></span>
 
142
<a name="l00170"></a><a class="code" href="class_qwt_plot_svg_item.html#ffe92d45c85a371a67d6b566b17a73f6">00170</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_svg_item.html#ffe92d45c85a371a67d6b566b17a73f6">QwtPlotSvgItem::draw</a>(QPainter *painter,
 
143
<a name="l00171"></a>00171     <span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &amp;xMap, <span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &amp;yMap,
 
144
<a name="l00172"></a>00172     <span class="keyword">const</span> QRect &amp;canvasRect)<span class="keyword"> const</span>
 
145
<a name="l00173"></a>00173 <span class="keyword"></span>{
 
146
<a name="l00174"></a>00174     <span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> cRect = <a class="code" href="class_qwt_plot_item.html#01bc8299a1e06eac29907d717dede51a">invTransform</a>(xMap, yMap, canvasRect);
 
147
<a name="l00175"></a>00175     <span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> bRect = <a class="code" href="class_qwt_plot_svg_item.html#ce858f2eb34fa461589be75168e7009e">boundingRect</a>();
 
148
<a name="l00176"></a>00176     <span class="keywordflow">if</span> ( bRect.isValid() &amp;&amp; cRect.isValid() )
 
149
<a name="l00177"></a>00177     {
 
150
<a name="l00178"></a>00178         <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> rect = bRect;
 
151
<a name="l00179"></a>00179         <span class="keywordflow">if</span> ( bRect.contains(cRect) )
 
152
<a name="l00180"></a>00180             rect = cRect;
 
153
<a name="l00181"></a>00181 
 
154
<a name="l00182"></a>00182         <span class="keyword">const</span> QRect r = <a class="code" href="class_qwt_plot_item.html#9adba4c37682d216740c714d23e97b53">transform</a>(xMap, yMap, rect);
 
155
<a name="l00183"></a>00183         <a class="code" href="class_qwt_plot_svg_item.html#349f60550ef301b1d8e408943a6f8fc3">render</a>(painter, <a class="code" href="class_qwt_plot_svg_item.html#15fc577e45c4a6204292cdacc060acd8">viewBox</a>(rect), r);
 
156
<a name="l00184"></a>00184     }
 
157
<a name="l00185"></a>00185 }
 
158
<a name="l00186"></a>00186 
 
159
<a name="l00194"></a><a class="code" href="class_qwt_plot_svg_item.html#349f60550ef301b1d8e408943a6f8fc3">00194</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_svg_item.html#349f60550ef301b1d8e408943a6f8fc3">QwtPlotSvgItem::render</a>(QPainter *painter,
 
160
<a name="l00195"></a>00195         <span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> &amp;viewBox, <span class="keyword">const</span> QRect &amp;rect)<span class="keyword"> const</span>
 
161
<a name="l00196"></a>00196 <span class="keyword"></span>{
 
162
<a name="l00197"></a>00197     <span class="keywordflow">if</span> ( !viewBox.isValid() )
 
163
<a name="l00198"></a>00198         <span class="keywordflow">return</span>;
 
164
<a name="l00199"></a>00199 
 
165
<a name="l00200"></a>00200 <span class="preprocessor">#if QT_VERSION &gt;= 0x040200</span>
 
166
<a name="l00201"></a>00201 <span class="preprocessor"></span>    d_data-&gt;renderer.setViewBox(viewBox);
 
167
<a name="l00202"></a>00202     d_data-&gt;renderer.render(painter, rect);
 
168
<a name="l00203"></a>00203     <span class="keywordflow">return</span>;
 
169
<a name="l00204"></a>00204 <span class="preprocessor">#else</span>
 
170
<a name="l00205"></a>00205 <span class="preprocessor"></span>
 
171
<a name="l00206"></a>00206 <span class="preprocessor">#if QT_VERSION &gt;= 0x040100</span>
 
172
<a name="l00207"></a>00207 <span class="preprocessor"></span>    <span class="keyword">const</span> QSize paintSize(painter-&gt;window().width(),
 
173
<a name="l00208"></a>00208         painter-&gt;window().height());
 
174
<a name="l00209"></a>00209     <span class="keywordflow">if</span> ( !paintSize.isValid() )
 
175
<a name="l00210"></a>00210         <span class="keywordflow">return</span>;
 
176
<a name="l00211"></a>00211 
 
177
<a name="l00212"></a>00212     <span class="keyword">const</span> <span class="keywordtype">double</span> xRatio = paintSize.width() / viewBox.width();
 
178
<a name="l00213"></a>00213     <span class="keyword">const</span> <span class="keywordtype">double</span> yRatio = paintSize.height() / viewBox.height();
 
179
<a name="l00214"></a>00214 
 
180
<a name="l00215"></a>00215     <span class="keyword">const</span> <span class="keywordtype">double</span> dx = rect.left() / xRatio + 1.0;
 
181
<a name="l00216"></a>00216     <span class="keyword">const</span> <span class="keywordtype">double</span> dy = rect.top() / yRatio + 1.0;
 
182
<a name="l00217"></a>00217 
 
183
<a name="l00218"></a>00218     <span class="keyword">const</span> <span class="keywordtype">double</span> mx = double(rect.width()) / paintSize.width();
 
184
<a name="l00219"></a>00219     <span class="keyword">const</span> <span class="keywordtype">double</span> my = double(rect.height()) / paintSize.height();
 
185
<a name="l00220"></a>00220 
 
186
<a name="l00221"></a>00221     painter-&gt;save();
 
187
<a name="l00222"></a>00222 
 
188
<a name="l00223"></a>00223     painter-&gt;translate(dx, dy);
 
189
<a name="l00224"></a>00224     painter-&gt;scale(mx, my);
 
190
<a name="l00225"></a>00225 
 
191
<a name="l00226"></a>00226     d_data-&gt;renderer.setViewBox(viewBox.toRect());
 
192
<a name="l00227"></a>00227     d_data-&gt;renderer.render(painter);
 
193
<a name="l00228"></a>00228 
 
194
<a name="l00229"></a>00229     painter-&gt;restore();
 
195
<a name="l00230"></a>00230 <span class="preprocessor">#else</span>
 
196
<a name="l00231"></a>00231 <span class="preprocessor"></span>    <span class="keyword">const</span> <span class="keywordtype">double</span> mx = rect.width() / viewBox.width();
 
197
<a name="l00232"></a>00232     <span class="keyword">const</span> <span class="keywordtype">double</span> my = rect.height() / viewBox.height();
 
198
<a name="l00233"></a>00233     <span class="keyword">const</span> <span class="keywordtype">double</span> dx = rect.x() - mx * viewBox.x();
 
199
<a name="l00234"></a>00234     <span class="keyword">const</span> <span class="keywordtype">double</span> dy = rect.y() - my * viewBox.y();
 
200
<a name="l00235"></a>00235 
 
201
<a name="l00236"></a>00236     painter-&gt;save();
 
202
<a name="l00237"></a>00237 
 
203
<a name="l00238"></a>00238     painter-&gt;translate(dx, dy);
 
204
<a name="l00239"></a>00239     painter-&gt;scale(mx, my);
 
205
<a name="l00240"></a>00240     
 
206
<a name="l00241"></a>00241     d_data-&gt;picture.play(painter);
 
207
<a name="l00242"></a>00242 
 
208
<a name="l00243"></a>00243     painter-&gt;restore();
 
209
<a name="l00244"></a>00244 <span class="preprocessor">#endif // &lt; 0x040100</span>
 
210
<a name="l00245"></a>00245 <span class="preprocessor"></span><span class="preprocessor">#endif // &lt; 0x040200</span>
 
211
<a name="l00246"></a>00246 <span class="preprocessor"></span>}
 
212
<a name="l00247"></a>00247 
 
213
<a name="l00254"></a><a class="code" href="class_qwt_plot_svg_item.html#15fc577e45c4a6204292cdacc060acd8">00254</a> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> <a class="code" href="class_qwt_plot_svg_item.html#15fc577e45c4a6204292cdacc060acd8">QwtPlotSvgItem::viewBox</a>(<span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> &amp;rect)<span class="keyword"> const</span>
 
214
<a name="l00255"></a>00255 <span class="keyword"></span>{
 
215
<a name="l00256"></a>00256 <span class="preprocessor">#if QT_VERSION &gt;= 0x040100</span>
 
216
<a name="l00257"></a>00257 <span class="preprocessor"></span>    <span class="keyword">const</span> QSize sz = d_data-&gt;renderer.defaultSize();
 
217
<a name="l00258"></a>00258 <span class="preprocessor">#else</span>
 
218
<a name="l00259"></a>00259 <span class="preprocessor"></span><span class="preprocessor">#if QT_VERSION &gt; 0x040000</span>
 
219
<a name="l00260"></a>00260 <span class="preprocessor"></span>    <span class="keyword">const</span> QSize sz(d_data-&gt;picture.width(), 
 
220
<a name="l00261"></a>00261         d_data-&gt;picture.height());
 
221
<a name="l00262"></a>00262 <span class="preprocessor">#else</span>
 
222
<a name="l00263"></a>00263 <span class="preprocessor"></span>    QPaintDeviceMetrics metrics(&amp;d_data-&gt;picture);
 
223
<a name="l00264"></a>00264     <span class="keyword">const</span> QSize sz(metrics.width(), metrics.height());
 
224
<a name="l00265"></a>00265 <span class="preprocessor">#endif</span>
 
225
<a name="l00266"></a>00266 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
 
226
<a name="l00267"></a>00267 <span class="preprocessor"></span>    <span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> br = <a class="code" href="class_qwt_plot_svg_item.html#ce858f2eb34fa461589be75168e7009e">boundingRect</a>();
 
227
<a name="l00268"></a>00268 
 
228
<a name="l00269"></a>00269     <span class="keywordflow">if</span> ( !rect.isValid() || !br.isValid() || sz.isNull() )
 
229
<a name="l00270"></a>00270         <span class="keywordflow">return</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a>();
 
230
<a name="l00271"></a>00271 
 
231
<a name="l00272"></a>00272     <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> xMap;
 
232
<a name="l00273"></a>00273     xMap.<a class="code" href="class_qwt_scale_map.html#aa33bc8e1aed7aa17d345053194e7094">setScaleInterval</a>(br.left(), br.right());
 
233
<a name="l00274"></a>00274     xMap.<a class="code" href="class_qwt_scale_map.html#a9a63a0b2e4ff81b1df23d9f968cd5b8">setPaintInterval</a>(0, sz.width());
 
234
<a name="l00275"></a>00275 
 
235
<a name="l00276"></a>00276     <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> yMap;
 
236
<a name="l00277"></a>00277     yMap.<a class="code" href="class_qwt_scale_map.html#aa33bc8e1aed7aa17d345053194e7094">setScaleInterval</a>(br.top(), br.bottom());
 
237
<a name="l00278"></a>00278     yMap.<a class="code" href="class_qwt_scale_map.html#a9a63a0b2e4ff81b1df23d9f968cd5b8">setPaintInterval</a>(sz.height(), 0);
 
238
<a name="l00279"></a>00279 
 
239
<a name="l00280"></a>00280     <span class="keyword">const</span> <span class="keywordtype">double</span> x1 = xMap.<a class="code" href="class_qwt_scale_map.html#109a9289413291e2621fb95c1afb72af">xTransform</a>(rect.left());
 
240
<a name="l00281"></a>00281     <span class="keyword">const</span> <span class="keywordtype">double</span> x2 = xMap.<a class="code" href="class_qwt_scale_map.html#109a9289413291e2621fb95c1afb72af">xTransform</a>(rect.right());
 
241
<a name="l00282"></a>00282     <span class="keyword">const</span> <span class="keywordtype">double</span> y1 = yMap.<a class="code" href="class_qwt_scale_map.html#109a9289413291e2621fb95c1afb72af">xTransform</a>(rect.bottom());
 
242
<a name="l00283"></a>00283     <span class="keyword">const</span> <span class="keywordtype">double</span> y2 = yMap.<a class="code" href="class_qwt_scale_map.html#109a9289413291e2621fb95c1afb72af">xTransform</a>(rect.top());
 
243
<a name="l00284"></a>00284 
 
244
<a name="l00285"></a>00285     <span class="keywordflow">return</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a>(x1, y1, x2 - x1, y2 - y1);
 
245
<a name="l00286"></a>00286 }
 
246
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sat May 24 18:47:40 2008 for Qwt User's Guide by&nbsp;
 
247
<a href="http://www.doxygen.org/index.html">
 
248
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.0 </small></address>
 
249
</body>
 
250
</html>