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's Guide: qwt_plot_item.cpp Source File</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
<link href="tabs.css" rel="stylesheet" type="text/css">
7
<!-- Generated by Doxygen 1.5.0 -->
10
<li><a href="index.html"><span>Main 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 Pages</span></a></li>
17
<li><a href="files.html"><span>File List</span></a></li>
18
<li><a href="globals.html"><span>File Members</span></a></li>
20
<h1>qwt_plot_item.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 "qwt_text.h"</span>
30
<a name="l00011"></a>00011 <span class="preprocessor">#include "qwt_plot.h"</span>
31
<a name="l00012"></a>00012 <span class="preprocessor">#include "qwt_legend.h"</span>
32
<a name="l00013"></a>00013 <span class="preprocessor">#include "qwt_legend_item.h"</span>
33
<a name="l00014"></a>00014 <span class="preprocessor">#include "qwt_plot_item.h"</span>
34
<a name="l00015"></a>00015
35
<a name="l00016"></a>00016 <span class="keyword">class </span>QwtPlotItem::PrivateData
36
<a name="l00017"></a>00017 {
37
<a name="l00018"></a>00018 <span class="keyword">public</span>:
38
<a name="l00019"></a>00019 PrivateData():
39
<a name="l00020"></a>00020 <a class="code" href="class_qwt_plot_item.html#68dc5c562bdec6ee764ddedae6acd3bf">plot</a>(NULL),
40
<a name="l00021"></a>00021 <a class="code" href="class_qwt_plot_item.html#1f9e938bef95ccc7b3e026da277ea8f3">isVisible</a>(true),
41
<a name="l00022"></a>00022 attributes(0),
42
<a name="l00023"></a>00023 #if QT_VERSION >= 0x040000
43
<a name="l00024"></a>00024 renderHints(0),
44
<a name="l00025"></a>00025 #endif
45
<a name="l00026"></a>00026 <a class="code" href="class_qwt_plot_item.html#717c27fba94fd761a2d4ec06e9dbfa21">z</a>(0.0),
46
<a name="l00027"></a>00027 <a class="code" href="class_qwt_plot_item.html#27a3f3e5c9983d276b071da508776481">xAxis</a>(<a class="code" href="class_qwt_plot.html">QwtPlot</a>::xBottom),
47
<a name="l00028"></a>00028 <a class="code" href="class_qwt_plot_item.html#20418c1371cdb3d807a8088d6768792b">yAxis</a>(<a class="code" href="class_qwt_plot.html">QwtPlot</a>::yLeft)
48
<a name="l00029"></a>00029 {
49
<a name="l00030"></a>00030 }
50
<a name="l00031"></a>00031
51
<a name="l00032"></a>00032 <span class="keyword">mutable</span> <a class="code" href="class_qwt_plot.html">QwtPlot</a> *<a class="code" href="class_qwt_plot_item.html#68dc5c562bdec6ee764ddedae6acd3bf">plot</a>;
52
<a name="l00033"></a>00033
53
<a name="l00034"></a>00034 <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot_item.html#1f9e938bef95ccc7b3e026da277ea8f3">isVisible</a>;
54
<a name="l00035"></a>00035 <span class="keywordtype">int</span> attributes;
55
<a name="l00036"></a>00036 <span class="preprocessor">#if QT_VERSION >= 0x040000</span>
56
<a name="l00037"></a>00037 <span class="preprocessor"></span> <span class="keywordtype">int</span> renderHints;
57
<a name="l00038"></a>00038 <span class="preprocessor">#endif</span>
58
<a name="l00039"></a>00039 <span class="preprocessor"></span> <span class="keywordtype">double</span> <a class="code" href="class_qwt_plot_item.html#717c27fba94fd761a2d4ec06e9dbfa21">z</a>;
59
<a name="l00040"></a>00040
60
<a name="l00041"></a>00041 <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot_item.html#27a3f3e5c9983d276b071da508776481">xAxis</a>;
61
<a name="l00042"></a>00042 <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot_item.html#20418c1371cdb3d807a8088d6768792b">yAxis</a>;
62
<a name="l00043"></a>00043
63
<a name="l00044"></a>00044 <a class="code" href="class_qwt_text.html">QwtText</a> <a class="code" href="class_qwt_plot_item.html#3abdb947d71e457de120851922de3197">title</a>;
64
<a name="l00045"></a>00045 };
65
<a name="l00046"></a>00046
66
<a name="l00048"></a><a class="code" href="class_qwt_plot_item.html#5d892ac856fb9176515c5f2d806161dc">00048</a> <a class="code" href="class_qwt_plot_item.html#5d892ac856fb9176515c5f2d806161dc">QwtPlotItem::QwtPlotItem</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_text.html">QwtText</a> &<a class="code" href="class_qwt_plot_item.html#3abdb947d71e457de120851922de3197">title</a>)
67
<a name="l00049"></a>00049 {
68
<a name="l00050"></a>00050 d_data = <span class="keyword">new</span> PrivateData;
69
<a name="l00051"></a>00051 d_data->title = <a class="code" href="class_qwt_plot_item.html#3abdb947d71e457de120851922de3197">title</a>;
70
<a name="l00052"></a>00052 }
71
<a name="l00053"></a>00053
72
<a name="l00055"></a><a class="code" href="class_qwt_plot_item.html#282a1d0424a06737f80e1fe83ccf7a0c">00055</a> <a class="code" href="class_qwt_plot_item.html#282a1d0424a06737f80e1fe83ccf7a0c">QwtPlotItem::~QwtPlotItem</a>()
73
<a name="l00056"></a>00056 {
74
<a name="l00057"></a>00057 <a class="code" href="class_qwt_plot_item.html#eb2f676533ccae3436bf578824e2165e">attach</a>(NULL);
75
<a name="l00058"></a>00058 <span class="keyword">delete</span> d_data;
76
<a name="l00059"></a>00059 }
77
<a name="l00060"></a>00060
78
<a name="l00071"></a><a class="code" href="class_qwt_plot_item.html#eb2f676533ccae3436bf578824e2165e">00071</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#eb2f676533ccae3436bf578824e2165e">QwtPlotItem::attach</a>(<a class="code" href="class_qwt_plot.html">QwtPlot</a> *plot)
79
<a name="l00072"></a>00072 {
80
<a name="l00073"></a>00073 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_plot_item.html#68dc5c562bdec6ee764ddedae6acd3bf">plot</a> == d_data->plot )
81
<a name="l00074"></a>00074 <span class="keywordflow">return</span>;
82
<a name="l00075"></a>00075
83
<a name="l00076"></a>00076 <span class="comment">// remove the item from the previous plot</span>
84
<a name="l00077"></a>00077
85
<a name="l00078"></a>00078 <span class="keywordflow">if</span> ( d_data->plot )
86
<a name="l00079"></a>00079 {
87
<a name="l00080"></a>00080 <span class="keywordflow">if</span> ( d_data->plot->legend() )
88
<a name="l00081"></a>00081 {
89
<a name="l00082"></a>00082 QWidget *<a class="code" href="class_qwt_plot_item.html#a2de7753f3f5c22a5d81e90a6412dfca">legendItem</a> = d_data->plot->legend()->find(<span class="keyword">this</span>);
90
<a name="l00083"></a>00083 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_plot_item.html#a2de7753f3f5c22a5d81e90a6412dfca">legendItem</a> )
91
<a name="l00084"></a>00084 <span class="keyword">delete</span> <a class="code" href="class_qwt_plot_item.html#a2de7753f3f5c22a5d81e90a6412dfca">legendItem</a>;
92
<a name="l00085"></a>00085 }
93
<a name="l00086"></a>00086
94
<a name="l00087"></a>00087 d_data->plot->attachItem(<span class="keyword">this</span>, <span class="keyword">false</span>);
95
<a name="l00088"></a>00088
96
<a name="l00089"></a>00089 <span class="keywordflow">if</span> ( d_data->plot->autoReplot() )
97
<a name="l00090"></a>00090 d_data->plot->update();
98
<a name="l00091"></a>00091 }
99
<a name="l00092"></a>00092
100
<a name="l00093"></a>00093 d_data->plot = <a class="code" href="class_qwt_plot_item.html#68dc5c562bdec6ee764ddedae6acd3bf">plot</a>;
101
<a name="l00094"></a>00094
102
<a name="l00095"></a>00095 <span class="keywordflow">if</span> ( d_data->plot )
103
<a name="l00096"></a>00096 {
104
<a name="l00097"></a>00097 <span class="comment">// insert the item into the current plot</span>
105
<a name="l00098"></a>00098
106
<a name="l00099"></a>00099 d_data->plot->attachItem(<span class="keyword">this</span>, <span class="keyword">true</span>);
107
<a name="l00100"></a>00100 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
108
<a name="l00101"></a>00101 }
109
<a name="l00102"></a>00102 }
110
<a name="l00103"></a>00103
111
<a name="l00116"></a><a class="code" href="class_qwt_plot_item.html#803613b24e745834b2115ee574dda610">00116</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot_item.html#803613b24e745834b2115ee574dda610">QwtPlotItem::rtti</a>()<span class="keyword"> const</span>
112
<a name="l00117"></a>00117 <span class="keyword"></span>{
113
<a name="l00118"></a>00118 <span class="keywordflow">return</span> Rtti_PlotItem;
114
<a name="l00119"></a>00119 }
115
<a name="l00120"></a>00120
116
<a name="l00122"></a><a class="code" href="class_qwt_plot_item.html#68dc5c562bdec6ee764ddedae6acd3bf">00122</a> <a class="code" href="class_qwt_plot.html">QwtPlot</a> *<a class="code" href="class_qwt_plot_item.html#68dc5c562bdec6ee764ddedae6acd3bf">QwtPlotItem::plot</a>()<span class="keyword"> const </span>
117
<a name="l00123"></a>00123 <span class="keyword"></span>{
118
<a name="l00124"></a>00124 <span class="keywordflow">return</span> d_data->plot;
119
<a name="l00125"></a>00125 }
120
<a name="l00126"></a>00126
121
<a name="l00132"></a><a class="code" href="class_qwt_plot_item.html#717c27fba94fd761a2d4ec06e9dbfa21">00132</a> <span class="keywordtype">double</span> <a class="code" href="class_qwt_plot_item.html#717c27fba94fd761a2d4ec06e9dbfa21">QwtPlotItem::z</a>()<span class="keyword"> const </span>
122
<a name="l00133"></a>00133 <span class="keyword"></span>{
123
<a name="l00134"></a>00134 <span class="keywordflow">return</span> d_data->z;
124
<a name="l00135"></a>00135 }
125
<a name="l00136"></a>00136
126
<a name="l00145"></a><a class="code" href="class_qwt_plot_item.html#57d90e4146133b59d589c71b3a643e82">00145</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#57d90e4146133b59d589c71b3a643e82">QwtPlotItem::setZ</a>(<span class="keywordtype">double</span> z)
127
<a name="l00146"></a>00146 {
128
<a name="l00147"></a>00147 <span class="keywordflow">if</span> ( d_data->z != z )
129
<a name="l00148"></a>00148 {
130
<a name="l00149"></a>00149 d_data->z = z;
131
<a name="l00150"></a>00150 <span class="keywordflow">if</span> ( d_data->plot )
132
<a name="l00151"></a>00151 {
133
<a name="l00152"></a>00152 <span class="comment">// update the z order</span>
134
<a name="l00153"></a>00153 d_data->plot->attachItem(<span class="keyword">this</span>, <span class="keyword">false</span>);
135
<a name="l00154"></a>00154 d_data->plot->attachItem(<span class="keyword">this</span>, <span class="keyword">true</span>);
136
<a name="l00155"></a>00155 }
137
<a name="l00156"></a>00156 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
138
<a name="l00157"></a>00157 }
139
<a name="l00158"></a>00158 }
140
<a name="l00159"></a>00159
141
<a name="l00166"></a><a class="code" href="class_qwt_plot_item.html#1b74686181ab6dd5033917123c7db30f">00166</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#1b74686181ab6dd5033917123c7db30f">QwtPlotItem::setTitle</a>(<span class="keyword">const</span> QString &title)
142
<a name="l00167"></a>00167 {
143
<a name="l00168"></a>00168 <a class="code" href="class_qwt_plot_item.html#1b74686181ab6dd5033917123c7db30f">setTitle</a>(<a class="code" href="class_qwt_text.html">QwtText</a>(title));
144
<a name="l00169"></a>00169 }
145
<a name="l00170"></a>00170
146
<a name="l00177"></a><a class="code" href="class_qwt_plot_item.html#2db3214b23b78274fa6f8c0321a76839">00177</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#1b74686181ab6dd5033917123c7db30f">QwtPlotItem::setTitle</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_text.html">QwtText</a> &title)
147
<a name="l00178"></a>00178 {
148
<a name="l00179"></a>00179 <span class="keywordflow">if</span> ( d_data->title != <a class="code" href="class_qwt_plot_item.html#3abdb947d71e457de120851922de3197">title</a> )
149
<a name="l00180"></a>00180 {
150
<a name="l00181"></a>00181 d_data->title = <a class="code" href="class_qwt_plot_item.html#3abdb947d71e457de120851922de3197">title</a>;
151
<a name="l00182"></a>00182 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
152
<a name="l00183"></a>00183 }
153
<a name="l00184"></a>00184 }
154
<a name="l00185"></a>00185
155
<a name="l00190"></a><a class="code" href="class_qwt_plot_item.html#3abdb947d71e457de120851922de3197">00190</a> <span class="keyword">const</span> <a class="code" href="class_qwt_text.html">QwtText</a> &<a class="code" href="class_qwt_plot_item.html#3abdb947d71e457de120851922de3197">QwtPlotItem::title</a>()<span class="keyword"> const</span>
156
<a name="l00191"></a>00191 <span class="keyword"></span>{
157
<a name="l00192"></a>00192 <span class="keywordflow">return</span> d_data->title;
158
<a name="l00193"></a>00193 }
159
<a name="l00194"></a>00194
160
<a name="l00203"></a><a class="code" href="class_qwt_plot_item.html#5a335be8ff488809a2cf7f4b734ad1b6">00203</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#5a335be8ff488809a2cf7f4b734ad1b6">QwtPlotItem::setItemAttribute</a>(<a class="code" href="class_qwt_plot_item.html#e0fabcdd35f4818ce5bbe019b0eed062">ItemAttribute</a> attribute, <span class="keywordtype">bool</span> on)
161
<a name="l00204"></a>00204 {
162
<a name="l00205"></a>00205 <span class="keywordflow">if</span> ( <span class="keywordtype">bool</span>(d_data->attributes & attribute) != on )
163
<a name="l00206"></a>00206 {
164
<a name="l00207"></a>00207 <span class="keywordflow">if</span> ( on )
165
<a name="l00208"></a>00208 d_data->attributes |= attribute;
166
<a name="l00209"></a>00209 <span class="keywordflow">else</span>
167
<a name="l00210"></a>00210 d_data->attributes &= ~attribute;
168
<a name="l00211"></a>00211
169
<a name="l00212"></a>00212 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
170
<a name="l00213"></a>00213 }
171
<a name="l00214"></a>00214 }
172
<a name="l00215"></a>00215
173
<a name="l00223"></a><a class="code" href="class_qwt_plot_item.html#ef70936d34ef661876692e6a06d4a464">00223</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot_item.html#ef70936d34ef661876692e6a06d4a464">QwtPlotItem::testItemAttribute</a>(<a class="code" href="class_qwt_plot_item.html#e0fabcdd35f4818ce5bbe019b0eed062">ItemAttribute</a> attribute)<span class="keyword"> const</span>
174
<a name="l00224"></a>00224 <span class="keyword"></span>{
175
<a name="l00225"></a>00225 <span class="keywordflow">return</span> d_data->attributes & attribute;
176
<a name="l00226"></a>00226 }
177
<a name="l00227"></a>00227
178
<a name="l00228"></a>00228 <span class="preprocessor">#if QT_VERSION >= 0x040000</span>
179
<a name="l00229"></a>00229 <span class="preprocessor"></span>
180
<a name="l00238"></a><a class="code" href="class_qwt_plot_item.html#cd023c40f659c304ded324942865edc8">00238</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#cd023c40f659c304ded324942865edc8">QwtPlotItem::setRenderHint</a>(<a class="code" href="class_qwt_plot_item.html#be0e8a39aceef9a600b73e02550a9704">RenderHint</a> hint, <span class="keywordtype">bool</span> on)
181
<a name="l00239"></a>00239 {
182
<a name="l00240"></a>00240 <span class="keywordflow">if</span> ( ((d_data->renderHints & hint) != 0) != on )
183
<a name="l00241"></a>00241 {
184
<a name="l00242"></a>00242 <span class="keywordflow">if</span> ( on )
185
<a name="l00243"></a>00243 d_data->renderHints |= hint;
186
<a name="l00244"></a>00244 <span class="keywordflow">else</span>
187
<a name="l00245"></a>00245 d_data->renderHints &= ~hint;
188
<a name="l00246"></a>00246
189
<a name="l00247"></a>00247 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
190
<a name="l00248"></a>00248 }
191
<a name="l00249"></a>00249 }
192
<a name="l00250"></a>00250
193
<a name="l00258"></a><a class="code" href="class_qwt_plot_item.html#ca66d2161c8a6caf5ebef82f59770d15">00258</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot_item.html#ca66d2161c8a6caf5ebef82f59770d15">QwtPlotItem::testRenderHint</a>(<a class="code" href="class_qwt_plot_item.html#be0e8a39aceef9a600b73e02550a9704">RenderHint</a> hint)<span class="keyword"> const</span>
194
<a name="l00259"></a>00259 <span class="keyword"></span>{
195
<a name="l00260"></a>00260 <span class="keywordflow">return</span> (d_data->renderHints & hint);
196
<a name="l00261"></a>00261 }
197
<a name="l00262"></a>00262
198
<a name="l00263"></a>00263 <span class="preprocessor">#endif</span>
199
<a name="l00264"></a>00264 <span class="preprocessor"></span>
200
<a name="l00266"></a><a class="code" href="class_qwt_plot_item.html#93a50fb9c86bc66617e28315e02281c3">00266</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#93a50fb9c86bc66617e28315e02281c3">QwtPlotItem::show</a>()
201
<a name="l00267"></a>00267 {
202
<a name="l00268"></a>00268 <a class="code" href="class_qwt_plot_item.html#5f0eeb2b72207fd8d33a95b0565657a1">setVisible</a>(<span class="keyword">true</span>);
203
<a name="l00269"></a>00269 }
204
<a name="l00270"></a>00270
205
<a name="l00272"></a><a class="code" href="class_qwt_plot_item.html#1faea017baa2492416a13e6bc3c144aa">00272</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#1faea017baa2492416a13e6bc3c144aa">QwtPlotItem::hide</a>()
206
<a name="l00273"></a>00273 {
207
<a name="l00274"></a>00274 <a class="code" href="class_qwt_plot_item.html#5f0eeb2b72207fd8d33a95b0565657a1">setVisible</a>(<span class="keyword">false</span>);
208
<a name="l00275"></a>00275 }
209
<a name="l00276"></a>00276
210
<a name="l00283"></a><a class="code" href="class_qwt_plot_item.html#5f0eeb2b72207fd8d33a95b0565657a1">00283</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#5f0eeb2b72207fd8d33a95b0565657a1">QwtPlotItem::setVisible</a>(<span class="keywordtype">bool</span> on)
211
<a name="l00284"></a>00284 {
212
<a name="l00285"></a>00285 <span class="keywordflow">if</span> ( on != d_data->isVisible )
213
<a name="l00286"></a>00286 {
214
<a name="l00287"></a>00287 d_data->isVisible = on;
215
<a name="l00288"></a>00288 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
216
<a name="l00289"></a>00289 }
217
<a name="l00290"></a>00290 }
218
<a name="l00291"></a>00291
219
<a name="l00296"></a><a class="code" href="class_qwt_plot_item.html#1f9e938bef95ccc7b3e026da277ea8f3">00296</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot_item.html#1f9e938bef95ccc7b3e026da277ea8f3">QwtPlotItem::isVisible</a>()<span class="keyword"> const</span>
220
<a name="l00297"></a>00297 <span class="keyword"></span>{
221
<a name="l00298"></a>00298 <span class="keywordflow">return</span> d_data->isVisible;
222
<a name="l00299"></a>00299 }
223
<a name="l00300"></a>00300
224
<a name="l00307"></a><a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">00307</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">QwtPlotItem::itemChanged</a>()
225
<a name="l00308"></a>00308 {
226
<a name="l00309"></a>00309 <span class="keywordflow">if</span> ( d_data->plot )
227
<a name="l00310"></a>00310 {
228
<a name="l00311"></a>00311 <span class="keywordflow">if</span> ( d_data->plot->legend() )
229
<a name="l00312"></a>00312 <a class="code" href="class_qwt_plot_item.html#193770cd20609a368c5130de59cb782e">updateLegend</a>(d_data->plot->legend());
230
<a name="l00313"></a>00313
231
<a name="l00314"></a>00314 d_data->plot->autoRefresh();
232
<a name="l00315"></a>00315 }
233
<a name="l00316"></a>00316 }
234
<a name="l00317"></a>00317
235
<a name="l00328"></a><a class="code" href="class_qwt_plot_item.html#aef9628d6194ae7bb53ac85a5950635a">00328</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#aef9628d6194ae7bb53ac85a5950635a">QwtPlotItem::setAxis</a>(<span class="keywordtype">int</span> xAxis, <span class="keywordtype">int</span> yAxis)
236
<a name="l00329"></a>00329 {
237
<a name="l00330"></a>00330 <span class="keywordflow">if</span> (xAxis == QwtPlot::xBottom || xAxis == QwtPlot::xTop )
238
<a name="l00331"></a>00331 d_data->xAxis = xAxis;
239
<a name="l00332"></a>00332
240
<a name="l00333"></a>00333 <span class="keywordflow">if</span> (yAxis == QwtPlot::yLeft || yAxis == QwtPlot::yRight )
241
<a name="l00334"></a>00334 d_data->yAxis = yAxis;
242
<a name="l00335"></a>00335
243
<a name="l00336"></a>00336 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
244
<a name="l00337"></a>00337 }
245
<a name="l00338"></a>00338
246
<a name="l00347"></a><a class="code" href="class_qwt_plot_item.html#81d3dd7feaadda4b0dbb8c13642046cf">00347</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#81d3dd7feaadda4b0dbb8c13642046cf">QwtPlotItem::setXAxis</a>(<span class="keywordtype">int</span> axis)
247
<a name="l00348"></a>00348 {
248
<a name="l00349"></a>00349 <span class="keywordflow">if</span> (axis == QwtPlot::xBottom || axis == QwtPlot::xTop )
249
<a name="l00350"></a>00350 {
250
<a name="l00351"></a>00351 d_data->xAxis = axis;
251
<a name="l00352"></a>00352 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
252
<a name="l00353"></a>00353 }
253
<a name="l00354"></a>00354 }
254
<a name="l00355"></a>00355
255
<a name="l00364"></a><a class="code" href="class_qwt_plot_item.html#a92dad876d76ce136925d5ae8f01db9a">00364</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#a92dad876d76ce136925d5ae8f01db9a">QwtPlotItem::setYAxis</a>(<span class="keywordtype">int</span> axis)
256
<a name="l00365"></a>00365 {
257
<a name="l00366"></a>00366 <span class="keywordflow">if</span> (axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
258
<a name="l00367"></a>00367 {
259
<a name="l00368"></a>00368 d_data->yAxis = axis;
260
<a name="l00369"></a>00369 <a class="code" href="class_qwt_plot_item.html#d956fdbce5b0721abccce6d09fe4d5ce">itemChanged</a>();
261
<a name="l00370"></a>00370 }
262
<a name="l00371"></a>00371 }
263
<a name="l00372"></a>00372
264
<a name="l00374"></a><a class="code" href="class_qwt_plot_item.html#27a3f3e5c9983d276b071da508776481">00374</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot_item.html#27a3f3e5c9983d276b071da508776481">QwtPlotItem::xAxis</a>()<span class="keyword"> const </span>
265
<a name="l00375"></a>00375 <span class="keyword"></span>{
266
<a name="l00376"></a>00376 <span class="keywordflow">return</span> d_data->xAxis;
267
<a name="l00377"></a>00377 }
268
<a name="l00378"></a>00378
269
<a name="l00380"></a><a class="code" href="class_qwt_plot_item.html#20418c1371cdb3d807a8088d6768792b">00380</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot_item.html#20418c1371cdb3d807a8088d6768792b">QwtPlotItem::yAxis</a>()<span class="keyword"> const </span>
270
<a name="l00381"></a>00381 <span class="keyword"></span>{
271
<a name="l00382"></a>00382 <span class="keywordflow">return</span> d_data->yAxis;
272
<a name="l00383"></a>00383 }
273
<a name="l00384"></a>00384
274
<a name="l00388"></a><a class="code" href="class_qwt_plot_item.html#aa0d61c721363671e1a1912cd4b8d4a7">00388</a> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> <a class="code" href="class_qwt_plot_item.html#aa0d61c721363671e1a1912cd4b8d4a7">QwtPlotItem::boundingRect</a>()<span class="keyword"> const</span>
275
<a name="l00389"></a>00389 <span class="keyword"></span>{
276
<a name="l00390"></a>00390 <span class="keywordflow">return</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a>(1.0, 1.0, -2.0, -2.0); <span class="comment">// invalid</span>
277
<a name="l00391"></a>00391 }
278
<a name="l00392"></a>00392
279
<a name="l00403"></a><a class="code" href="class_qwt_plot_item.html#a2de7753f3f5c22a5d81e90a6412dfca">00403</a> QWidget *<a class="code" href="class_qwt_plot_item.html#a2de7753f3f5c22a5d81e90a6412dfca">QwtPlotItem::legendItem</a>()<span class="keyword"> const</span>
280
<a name="l00404"></a>00404 <span class="keyword"></span>{
281
<a name="l00405"></a>00405 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a>;
282
<a name="l00406"></a>00406 }
283
<a name="l00407"></a>00407
284
<a name="l00420"></a><a class="code" href="class_qwt_plot_item.html#193770cd20609a368c5130de59cb782e">00420</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#193770cd20609a368c5130de59cb782e">QwtPlotItem::updateLegend</a>(<a class="code" href="class_qwt_legend.html">QwtLegend</a> *legend)<span class="keyword"> const</span>
285
<a name="l00421"></a>00421 <span class="keyword"></span>{
286
<a name="l00422"></a>00422 <span class="keywordflow">if</span> ( !legend )
287
<a name="l00423"></a>00423 <span class="keywordflow">return</span>;
288
<a name="l00424"></a>00424
289
<a name="l00425"></a>00425 QWidget *lgdItem = legend-><a class="code" href="class_qwt_legend.html#ac522d61f5b3e6864d3e0083da52b83c">find</a>(<span class="keyword">this</span>);
290
<a name="l00426"></a>00426 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_plot_item.html#ef70936d34ef661876692e6a06d4a464">testItemAttribute</a>(QwtPlotItem::Legend) )
291
<a name="l00427"></a>00427 {
292
<a name="l00428"></a>00428 <span class="keywordflow">if</span> ( lgdItem == NULL )
293
<a name="l00429"></a>00429 {
294
<a name="l00430"></a>00430 lgdItem = <a class="code" href="class_qwt_plot_item.html#a2de7753f3f5c22a5d81e90a6412dfca">legendItem</a>();
295
<a name="l00431"></a>00431 <span class="keywordflow">if</span> ( lgdItem )
296
<a name="l00432"></a>00432 {
297
<a name="l00433"></a>00433 <span class="keywordflow">if</span> ( lgdItem->inherits(<span class="stringliteral">"QwtLegendItem"</span>) )
298
<a name="l00434"></a>00434 {
299
<a name="l00435"></a>00435 <a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a> *label = (<a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a> *)lgdItem;
300
<a name="l00436"></a>00436 label->setItemMode(legend-><a class="code" href="class_qwt_legend.html#f3c8c317c6233654b99ed6d4243a55a5">itemMode</a>());
301
<a name="l00437"></a>00437
302
<a name="l00438"></a>00438 <span class="keywordflow">if</span> ( d_data->plot )
303
<a name="l00439"></a>00439 {
304
<a name="l00440"></a>00440 QObject::connect(label, SIGNAL(clicked()),
305
<a name="l00441"></a>00441 d_data->plot, SLOT(legendItemClicked()));
306
<a name="l00442"></a>00442 QObject::connect(label, SIGNAL(checked(<span class="keywordtype">bool</span>)),
307
<a name="l00443"></a>00443 d_data->plot, SLOT(legendItemChecked(<span class="keywordtype">bool</span>)));
308
<a name="l00444"></a>00444 }
309
<a name="l00445"></a>00445 }
310
<a name="l00446"></a>00446 legend-><a class="code" href="class_qwt_legend.html#f736d6053c6e891ad4579aa83b1a705d">insert</a>(<span class="keyword">this</span>, lgdItem);
311
<a name="l00447"></a>00447 }
312
<a name="l00448"></a>00448 }
313
<a name="l00449"></a>00449 <span class="keywordflow">if</span> ( lgdItem && lgdItem->inherits(<span class="stringliteral">"QwtLegendItem"</span>) )
314
<a name="l00450"></a>00450 {
315
<a name="l00451"></a>00451 <a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a>* label = (<a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a>*)lgdItem;
316
<a name="l00452"></a>00452 <span class="keywordflow">if</span> ( label )
317
<a name="l00453"></a>00453 label->setText(d_data->title);
318
<a name="l00454"></a>00454 }
319
<a name="l00455"></a>00455 }
320
<a name="l00456"></a>00456 <span class="keywordflow">else</span>
321
<a name="l00457"></a>00457 {
322
<a name="l00458"></a>00458 <span class="keyword">delete</span> lgdItem;
323
<a name="l00459"></a>00459 }
324
<a name="l00460"></a>00460 }
325
<a name="l00461"></a>00461
326
<a name="l00475"></a><a class="code" href="class_qwt_plot_item.html#bf6a70847d3db952161ca4d4a952eea0">00475</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_item.html#bf6a70847d3db952161ca4d4a952eea0">QwtPlotItem::updateScaleDiv</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_scale_div.html">QwtScaleDiv</a> &,
327
<a name="l00476"></a>00476 <span class="keyword">const</span> <a class="code" href="class_qwt_scale_div.html">QwtScaleDiv</a> &)
328
<a name="l00477"></a>00477 {
329
<a name="l00478"></a>00478 }
330
<a name="l00479"></a>00479
331
<a name="l00488"></a><a class="code" href="class_qwt_plot_item.html#e235017052a465a42948ff64b5e5413d">00488</a> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> <a class="code" href="class_qwt_plot_item.html#e235017052a465a42948ff64b5e5413d">QwtPlotItem::scaleRect</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &xMap,
332
<a name="l00489"></a>00489 <span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &yMap)<span class="keyword"> const</span>
333
<a name="l00490"></a>00490 <span class="keyword"></span>{
334
<a name="l00491"></a>00491 <span class="keywordflow">return</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a>(xMap.<a class="code" href="class_qwt_scale_map.html#64b15c76aa63a521447215018c75bf37">s1</a>(), yMap.<a class="code" href="class_qwt_scale_map.html#64b15c76aa63a521447215018c75bf37">s1</a>(),
335
<a name="l00492"></a>00492 xMap.<a class="code" href="class_qwt_scale_map.html#953eb3e6584d8a6ca4d5fff98a9a0aa0">sDist</a>(), yMap.<a class="code" href="class_qwt_scale_map.html#953eb3e6584d8a6ca4d5fff98a9a0aa0">sDist</a>() );
336
<a name="l00493"></a>00493 }
337
<a name="l00494"></a>00494
338
<a name="l00503"></a><a class="code" href="class_qwt_plot_item.html#d0b1c45a2c0a6807a85e2201b99737f2">00503</a> QRect <a class="code" href="class_qwt_plot_item.html#d0b1c45a2c0a6807a85e2201b99737f2">QwtPlotItem::paintRect</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &xMap,
339
<a name="l00504"></a>00504 <span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &yMap)<span class="keyword"> const</span>
340
<a name="l00505"></a>00505 <span class="keyword"></span>{
341
<a name="l00506"></a>00506 <span class="keyword">const</span> QRect rect( qRound(xMap.<a class="code" href="class_qwt_scale_map.html#4d03a9fea3bd9b66a0b882b8b1a58f4b">p1</a>()), qRound(yMap.<a class="code" href="class_qwt_scale_map.html#4d03a9fea3bd9b66a0b882b8b1a58f4b">p1</a>()),
342
<a name="l00507"></a>00507 qRound(xMap.<a class="code" href="class_qwt_scale_map.html#456d76a849af8c465692c0481bdd12ad">pDist</a>()), qRound(yMap.<a class="code" href="class_qwt_scale_map.html#456d76a849af8c465692c0481bdd12ad">pDist</a>()) );
343
<a name="l00508"></a>00508
344
<a name="l00509"></a>00509 <span class="keywordflow">return</span> rect;
345
<a name="l00510"></a>00510 }
346
<a name="l00511"></a>00511
347
<a name="l00522"></a><a class="code" href="class_qwt_plot_item.html#9adba4c37682d216740c714d23e97b53">00522</a> QRect <a class="code" href="class_qwt_plot_item.html#9adba4c37682d216740c714d23e97b53">QwtPlotItem::transform</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &xMap,
348
<a name="l00523"></a>00523 <span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &yMap, <span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a>& rect)<span class="keyword"> const</span>
349
<a name="l00524"></a>00524 <span class="keyword"></span>{
350
<a name="l00525"></a>00525 <span class="keywordtype">int</span> x1 = qRound(xMap.<a class="code" href="class_qwt_scale_map.html#f35bfdc44bad4b6932ab02e60e8e6e29">transform</a>(rect.left()));
351
<a name="l00526"></a>00526 <span class="keywordtype">int</span> x2 = qRound(xMap.<a class="code" href="class_qwt_scale_map.html#f35bfdc44bad4b6932ab02e60e8e6e29">transform</a>(rect.right()));
352
<a name="l00527"></a>00527 <span class="keywordtype">int</span> y1 = qRound(yMap.<a class="code" href="class_qwt_scale_map.html#f35bfdc44bad4b6932ab02e60e8e6e29">transform</a>(rect.top()));
353
<a name="l00528"></a>00528 <span class="keywordtype">int</span> y2 = qRound(yMap.<a class="code" href="class_qwt_scale_map.html#f35bfdc44bad4b6932ab02e60e8e6e29">transform</a>(rect.bottom()));
354
<a name="l00529"></a>00529
355
<a name="l00530"></a>00530 <span class="keywordflow">if</span> ( x2 < x1 )
356
<a name="l00531"></a>00531 qSwap(x1, x2);
357
<a name="l00532"></a>00532 <span class="keywordflow">if</span> ( y2 < y1 )
358
<a name="l00533"></a>00533 qSwap(y1, y2);
359
<a name="l00534"></a>00534
360
<a name="l00535"></a>00535 <span class="keywordflow">return</span> QRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
361
<a name="l00536"></a>00536 }
362
<a name="l00537"></a>00537
363
<a name="l00547"></a><a class="code" href="class_qwt_plot_item.html#01bc8299a1e06eac29907d717dede51a">00547</a> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> <a class="code" href="class_qwt_plot_item.html#01bc8299a1e06eac29907d717dede51a">QwtPlotItem::invTransform</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &xMap,
364
<a name="l00548"></a>00548 <span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> &yMap, <span class="keyword">const</span> QRect& rect)<span class="keyword"> const</span>
365
<a name="l00549"></a>00549 <span class="keyword"></span>{
366
<a name="l00550"></a>00550 <span class="keyword">const</span> <span class="keywordtype">double</span> x1 = xMap.<a class="code" href="class_qwt_scale_map.html#00d883935e40cba917512e7567b3dab3">invTransform</a>(rect.left());
367
<a name="l00551"></a>00551 <span class="keyword">const</span> <span class="keywordtype">double</span> x2 = xMap.<a class="code" href="class_qwt_scale_map.html#00d883935e40cba917512e7567b3dab3">invTransform</a>(rect.right());
368
<a name="l00552"></a>00552 <span class="keyword">const</span> <span class="keywordtype">double</span> y1 = yMap.<a class="code" href="class_qwt_scale_map.html#00d883935e40cba917512e7567b3dab3">invTransform</a>(rect.top());
369
<a name="l00553"></a>00553 <span class="keyword">const</span> <span class="keywordtype">double</span> y2 = yMap.<a class="code" href="class_qwt_scale_map.html#00d883935e40cba917512e7567b3dab3">invTransform</a>(rect.bottom());
370
<a name="l00554"></a>00554
371
<a name="l00555"></a>00555 <span class="keyword">const</span> <a class="code" href="qwt__double__rect_8h.html#0c0dc4d33592fac4ad94734d8e9c4152">QwtDoubleRect</a> r(x1, y1, x2 - x1, y2 - y1);
372
<a name="l00556"></a>00556
373
<a name="l00557"></a>00557 <span class="keywordflow">return</span> r.normalized();
374
<a name="l00558"></a>00558 }
375
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu May 1 15:44:09 2008 for Qwt User's Guide by
376
<a href="http://www.doxygen.org/index.html">
377
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.0 </small></address>