My Project
0.0.16
QUCS Mapping
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
DownLoad
QUCS-src
qucs-0.0.16
qucs
diagrams
psdiagram.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
psdiagram.cpp - description
3
-------------------
4
begin : Sat Nov 06 2004
5
copyright : (C) 2004 by Michael Margraf
6
email : michael.margraf@alumni.tu-berlin.de
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#if HAVE_CONFIG_H
19
# include <config.h>
20
#endif
21
22
#include <math.h>
23
#include <float.h>
24
#ifdef __MINGW32__
25
# define finite(x) _finite(x)
26
#endif
27
#if HAVE_IEEEFP_H
28
# include <ieeefp.h>
29
#endif
30
31
#include "
psdiagram.h
"
32
#include "
main.h
"
33
34
// mixed polar and smith diagram
35
PSDiagram::PSDiagram
(
int
_cx,
int
_cy,
bool
_polarUp)
36
:
Diagram
(_cx, _cy)
37
{
38
x1
= 10;
// position of label text
39
y1
=
y3
= 2;
40
x2
= 200;
// initial size of diagram
41
x3
= 207;
42
y2
= 200;
43
if
(_polarUp)
Name
=
"PS"
;
// polar diagram upper half ?
44
else
Name
=
"SP"
;
45
46
Arcs
.append(
new
struct
Arc
(0,
y2
,
x2
,
y2
, 0, 16*360, QPen(QPen::black,0)));
47
// calcDiagram();
48
}
49
50
PSDiagram::~PSDiagram
()
51
{
52
}
53
54
// ------------------------------------------------------------
55
void
PSDiagram::calcCoordinate
(
double
* &,
double
* &yD,
double
* &,
56
float
*px,
float
*py,
Axis
*pa)
57
{
58
double
yr = *(yD++);
59
double
yi = *(yD++);
60
*px = float((yr/pa->
up
+ 1.0)*
double
(
x2
)/2.0);
61
*py = float((yi/pa->
up
+ 1.0)*
double
(
y2
)/2.0);
62
63
if
(finite(*px))
64
if
(finite(*py))
65
return
;
66
67
*px = *py = float(
cx
) / 2.0;
68
}
69
70
// --------------------------------------------------------------
71
void
PSDiagram::calcLimits
()
72
{
73
int
i
;
74
double
a,
b
;
75
Axis
*polarAxis, *smithAxis;
76
77
if
(
Name
==
"PS"
) {
78
smithAxis = &
yAxis
;
79
polarAxis = &
zAxis
;
80
}
81
else
{
82
polarAxis = &
yAxis
;
83
smithAxis = &
zAxis
;
84
}
85
86
calcSmithAxisScale
(smithAxis, i, i);
87
smithAxis->
limit_min
= 0.0;
88
smithAxis->
step
= double(i);
89
smithAxis->
limit_max
= smithAxis->
up
;
90
91
calcPolarAxisScale
(polarAxis, a, polarAxis->
step
, b);
92
polarAxis->
limit_min
= 0.0;
93
polarAxis->
limit_max
= polarAxis->
up
;
94
95
}
96
97
// --------------------------------------------------------------
98
int
PSDiagram::calcDiagram
()
99
{
100
Lines
.clear();
101
Texts
.clear();
102
Arcs
.clear();
103
104
x3
=
x2
+ 7;
105
if
(
Name
==
"PS"
) {
// if polar not in upper half -> mirror
106
createSmithChart
(&
yAxis
, 5);
107
createPolarDiagram
(&
zAxis
, 1);
108
}
109
else
{
110
createSmithChart
(&
zAxis
, 3);
111
createPolarDiagram
(&
yAxis
, 2);
112
}
113
114
// x line
115
Lines
.append(
new
Line
(0,
y2
>>1,
x2
,
y2
>>1,
GridPen
));
116
return
3;
117
}
118
119
// ------------------------------------------------------------
120
Diagram
*
PSDiagram::newOne
()
121
{
122
return
new
PSDiagram
();
123
}
124
125
// ------------------------------------------------------------
126
Element
*
PSDiagram::info
(QString& Name,
char
* &BitmapFile,
bool
getNewOne)
127
{
128
Name = QObject::tr(
"Polar-Smith Combi"
);
129
BitmapFile = (
char
*)
"polarsmith"
;
130
131
if
(getNewOne)
return
new
PSDiagram
();
132
return
0;
133
}
134
135
// ------------------------------------------------------------
136
Element
*
PSDiagram::info_sp
(QString& Name,
char
* &BitmapFile,
bool
getNewOne)
137
{
138
Name = QObject::tr(
"Smith-Polar Combi"
);
139
BitmapFile = (
char
*)
"smithpolar"
;
140
141
if
(getNewOne)
return
new
PSDiagram
(0, 0,
false
);
142
return
0;
143
}
Generated on Tue Dec 25 2012 14:30:42 for My Project by
1.8.2