File: qwt__double__rect_8cpp-source.html

package info (click to toggle)
libqwt 4.2.0-4.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 9,832 kB
  • ctags: 5,512
  • sloc: cpp: 22,973; ansic: 244; makefile: 66
file content (439 lines) | stat: -rw-r--r-- 35,449 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Qwt User&apos;s Guide: qwt_double_rect.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.8 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>qwt_double_rect.cpp</h1><pre class="fragment"><div>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span>
00002 <span class="comment"> * Qwt Widget Library</span>
00003 <span class="comment"> * Copyright (C) 1997   Josef Wilgen</span>
00004 <span class="comment"> * Copyright (C) 2002   Uwe Rathmann</span>
00005 <span class="comment"> *</span>
00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span>
00008 <span class="comment"> *****************************************************************************/</span>
00009 
00010 <span class="preprocessor">#include "qwt_double_rect.h"</span>
00011 
00013 
<a name="l00014"></a><a class="code" href="class_qwt_double_point.html#a0">00014</a> <a class="code" href="class_qwt_double_point.html#a0">QwtDoublePoint::QwtDoublePoint</a>():
00015     d_x(0.0),
00016     d_y(0.0)
00017 {
00018 }
00019 
00021 
<a name="l00022"></a><a class="code" href="class_qwt_double_point.html#a1">00022</a> <a class="code" href="class_qwt_double_point.html#a0">QwtDoublePoint::QwtDoublePoint</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y ):
00023     d_x(x),
00024     d_y(y)
00025 {
00026 }
00027 
<a name="l00029"></a><a class="code" href="class_qwt_double_point.html#a2">00029</a> <a class="code" href="class_qwt_double_point.html#a0">QwtDoublePoint::QwtDoublePoint</a>(<span class="keyword">const</span> QPoint &amp;p):
00030     d_x(double(p.x())),
00031     d_y(double(p.y()))
00032 {
00033 }
00034 
<a name="l00036"></a><a class="code" href="class_qwt_double_point.html#a10">00036</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_point.html#a10">QwtDoublePoint::operator==</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;other)<span class="keyword"> const</span>
00037 <span class="keyword"></span>{
00038     <span class="keywordflow">return</span> (d_x == other.<a class="code" href="class_qwt_double_point.html#r0">d_x</a>) &amp;&amp; (d_y == other.<a class="code" href="class_qwt_double_point.html#r1">d_y</a>);
00039 }
00040 
<a name="l00042"></a><a class="code" href="class_qwt_double_point.html#a11">00042</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_point.html#a11">QwtDoublePoint::operator!=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;other)<span class="keyword"> const</span>
00043 <span class="keyword"></span>{
00044     <span class="keywordflow">return</span> !<a class="code" href="class_qwt_double_point.html#a10">operator==</a>(other);
00045 }
00046 
<a name="l00052"></a><a class="code" href="class_qwt_double_point.html#a12">00052</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> <a class="code" href="class_qwt_double_point.html#a12">QwtDoublePoint::operator-</a>()<span class="keyword"> const</span>
00053 <span class="keyword"></span>{
00054     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_point.html#a0">QwtDoublePoint</a>(-d_x, -d_y);
00055 }
00056 
<a name="l00062"></a><a class="code" href="class_qwt_double_point.html#a13">00062</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> <a class="code" href="class_qwt_double_point.html#a13">QwtDoublePoint::operator+</a>(
00063     <span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;other)<span class="keyword"> const</span>
00064 <span class="keyword"></span>{
00065     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_point.html#a0">QwtDoublePoint</a>(d_x + other.<a class="code" href="class_qwt_double_point.html#r0">d_x</a>, d_y + other.<a class="code" href="class_qwt_double_point.html#r1">d_y</a>);
00066 }
00067 
<a name="l00073"></a><a class="code" href="class_qwt_double_point.html#a14">00073</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> <a class="code" href="class_qwt_double_point.html#a12">QwtDoublePoint::operator-</a>(
00074     <span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;other)<span class="keyword"> const</span>
00075 <span class="keyword"></span>{
00076     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_point.html#a0">QwtDoublePoint</a>(d_x - other.<a class="code" href="class_qwt_double_point.html#r0">d_x</a>, d_y - other.<a class="code" href="class_qwt_double_point.html#r1">d_y</a>);
00077 }
00078 
00080 
<a name="l00081"></a><a class="code" href="class_qwt_double_point.html#a15">00081</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> <a class="code" href="class_qwt_double_point.html#a15">QwtDoublePoint::operator*</a>(<span class="keywordtype">double</span> c)<span class="keyword"> const</span>
00082 <span class="keyword"></span>{
00083     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_point.html#a0">QwtDoublePoint</a>(d_x * c, d_y * c);
00084 }
00085 
00087 
<a name="l00088"></a><a class="code" href="class_qwt_double_point.html#a16">00088</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> <a class="code" href="class_qwt_double_point.html#a16">QwtDoublePoint::operator/</a>(<span class="keywordtype">double</span> c)<span class="keyword"> const</span>
00089 <span class="keyword"></span>{
00090     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_point.html#a0">QwtDoublePoint</a>(d_x / c, d_y / c);
00091 }
00092 
00094   
<a name="l00095"></a><a class="code" href="class_qwt_double_point.html#a17">00095</a> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;<a class="code" href="class_qwt_double_point.html#a17">QwtDoublePoint::operator+=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;other)
00096 {
00097     d_x += other.<a class="code" href="class_qwt_double_point.html#r0">d_x</a>;
00098     d_y += other.<a class="code" href="class_qwt_double_point.html#r1">d_y</a>;
00099     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00100 }
00101 
00103 
<a name="l00104"></a><a class="code" href="class_qwt_double_point.html#a18">00104</a> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;<a class="code" href="class_qwt_double_point.html#a18">QwtDoublePoint::operator-=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;other)
00105 {
00106     d_x -= other.<a class="code" href="class_qwt_double_point.html#r0">d_x</a>;
00107     d_y -= other.<a class="code" href="class_qwt_double_point.html#r1">d_y</a>;
00108     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00109 }
00110 
00112 
<a name="l00113"></a><a class="code" href="class_qwt_double_point.html#a19">00113</a> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;<a class="code" href="class_qwt_double_point.html#a19">QwtDoublePoint::operator*=</a>(<span class="keywordtype">double</span> c)
00114 {
00115     d_x *= c;
00116     d_y *= c;
00117     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00118 }
00119 
00121 
<a name="l00122"></a><a class="code" href="class_qwt_double_point.html#a20">00122</a> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;<a class="code" href="class_qwt_double_point.html#a20">QwtDoublePoint::operator/=</a>(<span class="keywordtype">double</span> c)
00123 {
00124     d_x /= c;
00125     d_y /= c;
00126     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00127 }
00128 
00130 
<a name="l00131"></a><a class="code" href="class_qwt_double_size.html#a0">00131</a> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize::QwtDoubleSize</a>():
00132     d_width(0.0),
00133     d_height(0.0)
00134 {   
00135 }   
00136 
00138 
<a name="l00139"></a><a class="code" href="class_qwt_double_size.html#a1">00139</a> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize::QwtDoubleSize</a>( <span class="keywordtype">double</span> w, <span class="keywordtype">double</span> h ):
00140     d_width(w),
00141     d_height(h)
00142 {   
00143 }   
00144 
00146 
<a name="l00147"></a><a class="code" href="class_qwt_double_size.html#a2">00147</a> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize::QwtDoubleSize</a>(<span class="keyword">const</span> QSize &amp;sz):
00148     d_width(double(sz.width())),
00149     d_height(double(sz.height()))
00150 {   
00151 }   
00152 
00154 
<a name="l00155"></a><a class="code" href="class_qwt_double_size.html#a10">00155</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_size.html#a10">QwtDoubleSize::transpose</a>()
00156 {   
00157     <span class="keywordtype">double</span> tmp = d_width;
00158     d_width = d_height;
00159     d_height = tmp;
00160 }
00161 
<a name="l00167"></a><a class="code" href="class_qwt_double_size.html#a11">00167</a> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> <a class="code" href="class_qwt_double_size.html#a11">QwtDoubleSize::expandedTo</a>(
00168     <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;other)<span class="keyword"> const</span>
00169 <span class="keyword"></span>{   
00170     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize</a>(
00171         QMAX(d_width, other.<a class="code" href="class_qwt_double_size.html#r0">d_width</a>),
00172         QMAX(d_height, other.<a class="code" href="class_qwt_double_size.html#r1">d_height</a>)
00173     );  
00174 }   
00175 
<a name="l00181"></a><a class="code" href="class_qwt_double_size.html#a12">00181</a> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> <a class="code" href="class_qwt_double_size.html#a12">QwtDoubleSize::boundedTo</a>(
00182     <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;other)<span class="keyword"> const</span>
00183 <span class="keyword"></span>{   
00184     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize</a>(
00185         QMIN(d_width, other.<a class="code" href="class_qwt_double_size.html#r0">d_width</a>),
00186         QMIN(d_height, other.<a class="code" href="class_qwt_double_size.html#r1">d_height</a>)
00187     );  
00188 }   
00189 
00191 
<a name="l00192"></a><a class="code" href="class_qwt_double_size.html#a15">00192</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_size.html#a15">QwtDoubleSize::operator==</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;other)<span class="keyword"> const</span>
00193 <span class="keyword"></span>{ 
00194     <span class="keywordflow">return</span> d_width == other.<a class="code" href="class_qwt_double_size.html#r0">d_width</a> &amp;&amp; d_height == other.<a class="code" href="class_qwt_double_size.html#r1">d_height</a>;
00195 }   
00196 
00198 
<a name="l00199"></a><a class="code" href="class_qwt_double_size.html#a16">00199</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_size.html#a16">QwtDoubleSize::operator!=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;other)<span class="keyword"> const</span>
00200 <span class="keyword"></span>{ 
00201     <span class="keywordflow">return</span> !<a class="code" href="class_qwt_double_size.html#a15">operator==</a>(other);
00202 }   
00203 
<a name="l00209"></a><a class="code" href="class_qwt_double_size.html#a17">00209</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> <a class="code" href="class_qwt_double_size.html#a17">QwtDoubleSize::operator-</a>()<span class="keyword"> const</span>
00210 <span class="keyword"></span>{
00211     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize</a>(-d_width, -d_height);
00212 }
00213 
<a name="l00219"></a><a class="code" href="class_qwt_double_size.html#a18">00219</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> <a class="code" href="class_qwt_double_size.html#a18">QwtDoubleSize::operator+</a>(
00220     <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;other)<span class="keyword"> const</span>
00221 <span class="keyword"></span>{   
00222     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize</a>(d_width + other.<a class="code" href="class_qwt_double_size.html#r0">d_width</a>,
00223         d_height + other.<a class="code" href="class_qwt_double_size.html#r1">d_height</a>); 
00224 }       
00225 
<a name="l00231"></a><a class="code" href="class_qwt_double_size.html#a19">00231</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> <a class="code" href="class_qwt_double_size.html#a17">QwtDoubleSize::operator-</a>(
00232     <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;other)<span class="keyword"> const</span>
00233 <span class="keyword"></span>{   
00234     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize</a>(d_width - other.<a class="code" href="class_qwt_double_size.html#r0">d_width</a>,
00235         d_height - other.<a class="code" href="class_qwt_double_size.html#r1">d_height</a>); 
00236 }       
00237 
00239 
<a name="l00240"></a><a class="code" href="class_qwt_double_size.html#a20">00240</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> <a class="code" href="class_qwt_double_size.html#a20">QwtDoubleSize::operator*</a>(<span class="keywordtype">double</span> c)<span class="keyword"> const</span>
00241 <span class="keyword"></span>{ 
00242     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize</a>(d_width * c, d_height * c);
00243 }   
00244 
00246 
<a name="l00247"></a><a class="code" href="class_qwt_double_size.html#a21">00247</a> <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> <a class="code" href="class_qwt_double_size.html#a21">QwtDoubleSize::operator/</a>(<span class="keywordtype">double</span> c)<span class="keyword"> const</span>
00248 <span class="keyword"></span>{ 
00249     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_size.html#a0">QwtDoubleSize</a>(d_width / c, d_height / c);
00250 }   
00251 
00253 
<a name="l00254"></a><a class="code" href="class_qwt_double_size.html#a22">00254</a> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;<a class="code" href="class_qwt_double_size.html#a22">QwtDoubleSize::operator+=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;other)
00255 {   
00256     d_width += other.<a class="code" href="class_qwt_double_size.html#r0">d_width</a>; 
00257     d_height += other.<a class="code" href="class_qwt_double_size.html#r1">d_height</a>;
00258     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00259 }
00260 
00262 
<a name="l00263"></a><a class="code" href="class_qwt_double_size.html#a23">00263</a> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;<a class="code" href="class_qwt_double_size.html#a23">QwtDoubleSize::operator-=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;other)
00264 {   
00265     d_width -= other.<a class="code" href="class_qwt_double_size.html#r0">d_width</a>; 
00266     d_height -= other.<a class="code" href="class_qwt_double_size.html#r1">d_height</a>;
00267     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00268 }
00269 
00270 <span class="comment">/* </span>
00271 <span class="comment">  Multiplies this size's width and height by c, </span>
00272 <span class="comment">  and returns a reference to this size.</span>
00273 <span class="comment">*/</span>
00274 
00275 <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;QwtDoubleSize::operator*=(<span class="keywordtype">double</span> c)
00276 {   
00277     d_width *= c; 
00278     d_height *= c;
00279     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00280 }
00281 
00282 <span class="comment">/* </span>
00283 <span class="comment">  Devides this size's width and height by c, </span>
00284 <span class="comment">  and returns a reference to this size.</span>
00285 <span class="comment">*/</span>
00286 
00287 <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;QwtDoubleSize::operator/=(<span class="keywordtype">double</span> c)
00288 {
00289     d_width /= c;
00290     d_height /= c;
00291     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00292 }   
00293 
<a name="l00295"></a><a class="code" href="class_qwt_double_rect.html#a0">00295</a> <a class="code" href="class_qwt_double_rect.html#a0">QwtDoubleRect::QwtDoubleRect</a>():
00296     d_x1(0.0),
00297     d_x2(0.0),
00298     d_y1(0.0),
00299     d_y2(0.0)
00300 {
00301 }
00302 
<a name="l00308"></a><a class="code" href="class_qwt_double_rect.html#a1">00308</a> <a class="code" href="class_qwt_double_rect.html#a0">QwtDoubleRect::QwtDoubleRect</a>(<span class="keywordtype">double</span> x1, <span class="keywordtype">double</span> x2,
00309         <span class="keywordtype">double</span> y1, <span class="keywordtype">double</span> y2):
00310     d_x1(x1),
00311     d_x2(x2),
00312     d_y1(y1),
00313     d_y2(y2)
00314 {
00315 }
00316 
<a name="l00322"></a><a class="code" href="class_qwt_double_rect.html#a2">00322</a> <a class="code" href="class_qwt_double_rect.html#a0">QwtDoubleRect::QwtDoubleRect</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;size):
00323     d_x1(x),
00324     d_x2(x + size.width()),
00325     d_y1(y),
00326     d_y2(y + size.height())
00327 {
00328 }
00329 
<a name="l00333"></a><a class="code" href="class_qwt_double_rect.html#a26">00333</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_rect.html#a26">QwtDoubleRect::setRect</a>(<span class="keywordtype">double</span> x1, <span class="keywordtype">double</span> x2, <span class="keywordtype">double</span> y1, <span class="keywordtype">double</span> y2)
00334 {
00335     d_x1 = x1;
00336     d_x2 = x2;
00337     d_y1 = y1;
00338     d_y2 = y2;
00339 }
00340 
<a name="l00346"></a><a class="code" href="class_qwt_double_rect.html#a32">00346</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_rect.html#a32">QwtDoubleRect::setSize</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_size.html">QwtDoubleSize</a> &amp;size)
00347 {
00348     <a class="code" href="class_qwt_double_rect.html#a30">setWidth</a>(size.<a class="code" href="class_qwt_double_size.html#a6">width</a>());
00349     <a class="code" href="class_qwt_double_rect.html#a31">setHeight</a>(size.<a class="code" href="class_qwt_double_size.html#a7">height</a>());
00350 }
00351 
<a name="l00359"></a><a class="code" href="class_qwt_double_rect.html#a6">00359</a> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> <a class="code" href="class_qwt_double_rect.html#a6">QwtDoubleRect::normalize</a>()<span class="keyword"> const</span>
00360 <span class="keyword"></span>{
00361     <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> r;
00362     <span class="keywordflow">if</span> ( d_x2 &lt; d_x1 ) 
00363     {
00364         r.<a class="code" href="class_qwt_double_rect.html#r0">d_x1</a> = d_x2;
00365         r.<a class="code" href="class_qwt_double_rect.html#r1">d_x2</a> = d_x1;
00366     } 
00367     <span class="keywordflow">else</span> 
00368     {
00369         r.<a class="code" href="class_qwt_double_rect.html#r0">d_x1</a> = d_x1;
00370         r.<a class="code" href="class_qwt_double_rect.html#r1">d_x2</a> = d_x2; 
00371     }
00372     <span class="keywordflow">if</span> ( d_y2 &lt; d_y1 ) 
00373     { 
00374         r.<a class="code" href="class_qwt_double_rect.html#r2">d_y1</a> = d_y2; 
00375         r.<a class="code" href="class_qwt_double_rect.html#r3">d_y2</a> = d_y1;
00376     } 
00377     <span class="keywordflow">else</span> 
00378     {
00379         r.<a class="code" href="class_qwt_double_rect.html#r2">d_y1</a> = d_y1;
00380         r.<a class="code" href="class_qwt_double_rect.html#r3">d_y2</a> = d_y2;
00381     }
00382     <span class="keywordflow">return</span> r;
00383 }
00384 
<a name="l00390"></a><a class="code" href="class_qwt_double_rect.html#a42">00390</a> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> <a class="code" href="class_qwt_double_rect.html#a42">QwtDoubleRect::unite</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)<span class="keyword"> const</span>
00391 <span class="keyword"></span>{
00392     <span class="keywordflow">return</span> *<span class="keyword">this</span> | other;
00393 }
00394 
<a name="l00400"></a><a class="code" href="class_qwt_double_rect.html#a43">00400</a> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> <a class="code" href="class_qwt_double_rect.html#a43">QwtDoubleRect::intersect</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)<span class="keyword"> const</span>
00401 <span class="keyword"></span>{
00402     <span class="keywordflow">return</span> *<span class="keyword">this</span> &amp; other;
00403 }
00404 
<a name="l00410"></a><a class="code" href="class_qwt_double_rect.html#a44">00410</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_rect.html#a44">QwtDoubleRect::intersects</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)<span class="keyword"> const</span>
00411 <span class="keyword"></span>{
00412     <span class="keywordflow">return</span> ( QMAX(d_x1, other.<a class="code" href="class_qwt_double_rect.html#r0">d_x1</a>) &lt;= QMIN(d_x2, other.<a class="code" href="class_qwt_double_rect.html#r1">d_x2</a>) ) &amp;&amp;
00413          ( QMAX(d_y1, other.<a class="code" href="class_qwt_double_rect.html#r2">d_y1</a> ) &lt;= QMIN(d_y2, other.<a class="code" href="class_qwt_double_rect.html#r3">d_y2</a>) );
00414 }
00415 
00417 
<a name="l00418"></a><a class="code" href="class_qwt_double_rect.html#a37">00418</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_rect.html#a37">QwtDoubleRect::operator==</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)<span class="keyword"> const</span>
00419 <span class="keyword"></span>{
00420     <span class="keywordflow">return</span> d_x1 == other.<a class="code" href="class_qwt_double_rect.html#r0">d_x1</a> &amp;&amp; d_x2 == other.<a class="code" href="class_qwt_double_rect.html#r1">d_x2</a> &amp;&amp; 
00421         d_y1 == other.<a class="code" href="class_qwt_double_rect.html#r2">d_y1</a> &amp;&amp; d_y2 == other.<a class="code" href="class_qwt_double_rect.html#r3">d_y2</a>;
00422 }
00423 
00425 
<a name="l00426"></a><a class="code" href="class_qwt_double_rect.html#a38">00426</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_rect.html#a38">QwtDoubleRect::operator!=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)<span class="keyword"> const</span>
00427 <span class="keyword"></span>{
00428     <span class="keywordflow">return</span> !<a class="code" href="class_qwt_double_rect.html#a37">operator==</a>(other);
00429 }
00430 
<a name="l00437"></a><a class="code" href="class_qwt_double_rect.html#a33">00437</a> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> <a class="code" href="class_qwt_double_rect.html#a33">QwtDoubleRect::operator|</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)<span class="keyword"> const</span>
00438 <span class="keyword"></span>{
00439     <span class="keywordflow">if</span> ( !<a class="code" href="class_qwt_double_rect.html#a5">isValid</a>() ) 
00440         <span class="keywordflow">return</span> other;
00441 
00442     <span class="keywordflow">if</span> ( !other.<a class="code" href="class_qwt_double_rect.html#a5">isValid</a>() ) 
00443         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00444         
00445     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_rect.html#a0">QwtDoubleRect</a>(QMIN(d_x1, other.<a class="code" href="class_qwt_double_rect.html#r0">d_x1</a>), QMAX(d_x2, other.<a class="code" href="class_qwt_double_rect.html#r1">d_x2</a>),
00446         QMIN(d_y1, other.<a class="code" href="class_qwt_double_rect.html#r2">d_y1</a>), QMAX(d_y2, other.<a class="code" href="class_qwt_double_rect.html#r3">d_y2</a>) );
00447 }
00448 
<a name="l00454"></a><a class="code" href="class_qwt_double_rect.html#a34">00454</a> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> <a class="code" href="class_qwt_double_rect.html#a34">QwtDoubleRect::operator&amp;</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)<span class="keyword"> const</span>
00455 <span class="keyword"></span>{
00456     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_rect.html#a0">QwtDoubleRect</a>(QMAX(d_x1, other.<a class="code" href="class_qwt_double_rect.html#r0">d_x1</a>), QMIN(d_x2, other.<a class="code" href="class_qwt_double_rect.html#r1">d_x2</a>),
00457         QMAX(d_y1, other.<a class="code" href="class_qwt_double_rect.html#r2">d_y1</a>), QMIN(d_y2, other.<a class="code" href="class_qwt_double_rect.html#r3">d_y2</a>));
00458 }
00459 
00461 
<a name="l00462"></a><a class="code" href="class_qwt_double_rect.html#a35">00462</a> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;<a class="code" href="class_qwt_double_rect.html#a35">QwtDoubleRect::operator|=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)
00463 {
00464     *<span class="keyword">this</span> = *<span class="keyword">this</span> | other;
00465     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00466 }
00467 
00469 
<a name="l00470"></a><a class="code" href="class_qwt_double_rect.html#a36">00470</a> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;<a class="code" href="class_qwt_double_rect.html#a36">QwtDoubleRect::operator&amp;=</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other)
00471 {
00472     *<span class="keyword">this</span> = *<span class="keyword">this</span> &amp; other;
00473     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00474 }
00475 
00477 
<a name="l00478"></a><a class="code" href="class_qwt_double_rect.html#a19">00478</a> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> <a class="code" href="class_qwt_double_rect.html#a19">QwtDoubleRect::center</a>()<span class="keyword"> const</span>
00479 <span class="keyword"></span>{
00480     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a>(d_x1 + (d_x2 - d_x1) / 2.0, 
00481         d_y1 + (d_y2 - d_y1) / 2.0);
00482 }
00483 
<a name="l00492"></a><a class="code" href="class_qwt_double_rect.html#a40">00492</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_rect.html#a39">QwtDoubleRect::contains</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keywordtype">bool</span> proper)<span class="keyword"> const</span>
00493 <span class="keyword"></span>{
00494     <span class="keywordflow">if</span> ( proper )
00495         <span class="keywordflow">return</span> x &gt; d_x1 &amp;&amp; x &lt; d_x2 &amp;&amp; y &gt; d_y1 &amp;&amp; y &lt; d_y2;
00496     <span class="keywordflow">else</span>
00497         <span class="keywordflow">return</span> x &gt;= d_x1 &amp;&amp; x &lt;= d_x2 &amp;&amp; y &gt;= d_y1 &amp;&amp; y &lt;= d_y2;
00498 }
00499 
<a name="l00508"></a><a class="code" href="class_qwt_double_rect.html#a39">00508</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_rect.html#a39">QwtDoubleRect::contains</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;p, <span class="keywordtype">bool</span> proper)<span class="keyword"> const</span>
00509 <span class="keyword"></span>{
00510     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_rect.html#a39">contains</a>(p.<a class="code" href="class_qwt_double_point.html#a4">x</a>(), p.<a class="code" href="class_qwt_double_point.html#a5">y</a>(), proper);
00511 }
00512 
<a name="l00521"></a><a class="code" href="class_qwt_double_rect.html#a41">00521</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_double_rect.html#a39">QwtDoubleRect::contains</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> &amp;other, <span class="keywordtype">bool</span> proper)<span class="keyword"> const</span>
00522 <span class="keyword"></span>{
00523     <span class="keywordflow">return</span> <a class="code" href="class_qwt_double_rect.html#a39">contains</a>(other.<a class="code" href="class_qwt_double_rect.html#r0">d_x1</a>, other.<a class="code" href="class_qwt_double_rect.html#r2">d_y1</a>, proper) &amp;&amp; 
00524         <a class="code" href="class_qwt_double_rect.html#a39">contains</a>(other.<a class="code" href="class_qwt_double_rect.html#r1">d_x2</a>, other.<a class="code" href="class_qwt_double_rect.html#r3">d_y2</a>, proper);
00525 }
00526 
00528 
<a name="l00529"></a><a class="code" href="class_qwt_double_rect.html#a20">00529</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_rect.html#a20">QwtDoubleRect::moveX</a>(<span class="keywordtype">double</span> x)
00530 {
00531     <span class="keyword">const</span> <span class="keywordtype">double</span> w = <a class="code" href="class_qwt_double_rect.html#a27">width</a>();
00532     d_x1 = x;
00533     d_x2 = d_x1 + w;
00534 }
00535 
00537 
<a name="l00538"></a><a class="code" href="class_qwt_double_rect.html#a21">00538</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_rect.html#a21">QwtDoubleRect::moveY</a>(<span class="keywordtype">double</span> y)
00539 {
00540     <span class="keyword">const</span> <span class="keywordtype">double</span> h = <a class="code" href="class_qwt_double_rect.html#a28">height</a>();
00541     d_y1 = y;
00542     d_y2 = d_y1 + h;
00543 }
00544 
00546 
<a name="l00547"></a><a class="code" href="class_qwt_double_rect.html#a22">00547</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_rect.html#a22">QwtDoubleRect::move</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y)
00548 {
00549     <a class="code" href="class_qwt_double_rect.html#a20">moveX</a>(x);
00550     <a class="code" href="class_qwt_double_rect.html#a21">moveY</a>(y);
00551 }
00552 
00554 
<a name="l00555"></a><a class="code" href="class_qwt_double_rect.html#a23">00555</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_rect.html#a23">QwtDoubleRect::moveBy</a>(<span class="keywordtype">double</span> dx, <span class="keywordtype">double</span> dy)
00556 {
00557     d_x1 += dx;
00558     d_x2 += dx;
00559     d_y1 += dy;
00560     d_y2 += dy;
00561 }
00562 
00564 
<a name="l00565"></a><a class="code" href="class_qwt_double_rect.html#a24">00565</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_rect.html#a24">QwtDoubleRect::moveCenter</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_double_point.html">QwtDoublePoint</a> &amp;pos)
00566 {
00567     <a class="code" href="class_qwt_double_rect.html#a24">moveCenter</a>(pos.<a class="code" href="class_qwt_double_point.html#a4">x</a>(), pos.<a class="code" href="class_qwt_double_point.html#a5">y</a>());
00568 }
00569 
00571 
<a name="l00572"></a><a class="code" href="class_qwt_double_rect.html#a25">00572</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_double_rect.html#a24">QwtDoubleRect::moveCenter</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y)
00573 {
00574     <a class="code" href="class_qwt_double_rect.html#a22">move</a>(x - <a class="code" href="class_qwt_double_rect.html#a27">width</a>() / 2.0, y - <a class="code" href="class_qwt_double_rect.html#a28">height</a>() / 2.0);
00575 }
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Tue Nov 16 21:12:20 2004 for Qwt User's Guide by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
</body>
</html>