Qucs-GUI
0.0.18
Main Page
Related Pages
Data Structures
Files
File List
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
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
#include <QtGui>
22
#include <math.h>
23
#include <float.h>
24
#if HAVE_IEEEFP_H
25
# include <ieeefp.h>
26
#endif
27
28
#include "
psdiagram.h
"
29
#include "
main.h
"
30
31
// mixed polar and smith diagram
32
PSDiagram::PSDiagram
(
int
_cx,
int
_cy,
bool
_polarUp)
33
:
Diagram
(_cx, _cy)
34
{
35
x1
= 10;
// position of label text
36
y1
=
y3
= 2;
37
x2
= 200;
// initial size of diagram
38
x3
= 207;
39
y2
= 200;
40
if
(_polarUp)
Name
=
"PS"
;
// polar diagram upper half ?
41
else
Name
=
"SP"
;
42
43
Arcs
.append(
new
struct
Arc
(0,
y2
,
x2
,
y2
, 0, 16*360, QPen(Qt::black,0)));
44
// calcDiagram();
45
}
46
47
PSDiagram::~PSDiagram
()
48
{
49
}
50
51
// ------------------------------------------------------------
52
void
PSDiagram::calcCoordinate
(
double
* &,
double
* &yD,
double
* &,
53
float
*px,
float
*py,
Axis
*pa)
54
{
55
double
yr = *(yD++);
56
double
yi = *(yD++);
57
*px = float((yr/pa->
up
+ 1.0)*
double
(
x2
)/2.0);
58
*py = float((yi/pa->
up
+ 1.0)*
double
(
y2
)/2.0);
59
60
if
(isfinite(*px))
61
if
(isfinite(*py))
62
return
;
63
64
*px = *py = float(
cx
) / 2.0;
65
}
66
67
// --------------------------------------------------------------
68
void
PSDiagram::calcLimits
()
69
{
70
int
i;
71
double
a, b;
72
Axis
*polarAxis, *smithAxis;
73
74
if
(
Name
==
"PS"
) {
75
smithAxis = &
yAxis
;
76
polarAxis = &
zAxis
;
77
}
78
else
{
79
polarAxis = &
yAxis
;
80
smithAxis = &
zAxis
;
81
}
82
83
calcSmithAxisScale
(smithAxis, i, i);
84
smithAxis->
limit_min
= 0.0;
85
smithAxis->
step
= double(i);
86
smithAxis->
limit_max
= smithAxis->
up
;
87
88
calcPolarAxisScale
(polarAxis, a, polarAxis->
step
, b);
89
polarAxis->
limit_min
= 0.0;
90
polarAxis->
limit_max
= polarAxis->
up
;
91
92
}
93
94
// --------------------------------------------------------------
95
int
PSDiagram::calcDiagram
()
96
{
97
Lines
.clear();
98
Texts
.clear();
99
Arcs
.clear();
100
101
x3
=
x2
+ 7;
102
if
(
Name
==
"PS"
) {
// if polar not in upper half -> mirror
103
createSmithChart
(&
yAxis
, 5);
104
createPolarDiagram
(&
zAxis
, 1);
105
}
106
else
{
107
createSmithChart
(&
zAxis
, 3);
108
createPolarDiagram
(&
yAxis
, 2);
109
}
110
111
// x line
112
Lines
.append(
new
Line
(0,
y2
>>1,
x2
,
y2
>>1,
GridPen
));
113
return
3;
114
}
115
116
// ------------------------------------------------------------
117
Diagram
*
PSDiagram::newOne
()
118
{
119
return
new
PSDiagram
();
120
}
121
122
// ------------------------------------------------------------
123
Element
*
PSDiagram::info
(QString& Name,
char
* &BitmapFile,
bool
getNewOne)
124
{
125
Name = QObject::tr(
"Polar-Smith Combi"
);
126
BitmapFile = (
char
*)
"polarsmith"
;
127
128
if
(getNewOne)
return
new
PSDiagram
();
129
return
0;
130
}
131
132
// ------------------------------------------------------------
133
Element
*
PSDiagram::info_sp
(QString& Name,
char
* &BitmapFile,
bool
getNewOne)
134
{
135
Name = QObject::tr(
"Smith-Polar Combi"
);
136
BitmapFile = (
char
*)
"smithpolar"
;
137
138
if
(getNewOne)
return
new
PSDiagram
(0, 0,
false
);
139
return
0;
140
}
Arc
Definition:
element.h:55
Element::y1
int y1
Definition:
element.h:153
Diagram::Name
QString Name
Definition:
diagram.h:92
Element::y2
int y2
Definition:
element.h:153
Element::x1
int x1
Definition:
element.h:153
Axis::limit_min
double limit_min
Definition:
diagram.h:56
main.h
Definitions and declarations for the main application.
PSDiagram::calcCoordinate
void calcCoordinate(double *&, double *&, double *&, float *, float *, Axis *)
Definition:
psdiagram.cpp:52
PSDiagram::calcDiagram
int calcDiagram()
Definition:
psdiagram.cpp:95
PSDiagram::info
static Element * info(QString &, char *&, bool getNewOne=false)
Definition:
psdiagram.cpp:123
Element::cx
int cx
Definition:
element.h:153
Diagram::GridPen
QPen GridPen
Definition:
diagram.h:93
PSDiagram::PSDiagram
PSDiagram(int _cx=0, int _cy=0, bool _polarUp=true)
Definition:
psdiagram.cpp:32
psdiagram.h
PSDiagram::newOne
Diagram * newOne()
Definition:
psdiagram.cpp:117
Diagram::createSmithChart
void createSmithChart(Axis *, int Mode=7)
Definition:
diagram.cpp:1415
Diagram::createPolarDiagram
void createPolarDiagram(Axis *, int Mode=3)
Definition:
diagram.cpp:1589
Diagram::zAxis
Axis zAxis
Definition:
diagram.h:101
Diagram::Arcs
Q3PtrList< struct Arc > Arcs
Definition:
diagram.h:96
PSDiagram::calcLimits
void calcLimits()
Definition:
psdiagram.cpp:68
Axis
Definition:
diagram.h:47
PSDiagram::~PSDiagram
~PSDiagram()
Definition:
psdiagram.cpp:47
Diagram::x3
int x3
Definition:
diagram.h:100
Line
Definition:
element.h:48
Element
Superclass of all schematic drawing elements.
Definition:
element.h:142
Axis::limit_max
double limit_max
Definition:
diagram.h:56
Diagram::y3
int y3
Definition:
diagram.h:100
Diagram::Texts
Q3PtrList< Text > Texts
Definition:
diagram.h:98
Diagram
Definition:
diagram.h:60
Diagram::yAxis
Axis yAxis
Definition:
diagram.h:101
Axis::step
double step
Definition:
diagram.h:56
Diagram::calcSmithAxisScale
void calcSmithAxisScale(Axis *, int &, int &)
Definition:
diagram.cpp:1395
PSDiagram::info_sp
static Element * info_sp(QString &, char *&, bool getNewOne=false)
Definition:
psdiagram.cpp:133
Axis::up
double up
Definition:
diagram.h:49
Diagram::calcPolarAxisScale
void calcPolarAxisScale(Axis *, double &, double &, double &)
Definition:
diagram.cpp:1552
Element::x2
int x2
Definition:
element.h:153
Diagram::Lines
Q3PtrList< Line > Lines
Definition:
diagram.h:97
Generated on Mon Sep 1 2014 20:05:20 for Qucs-GUI by
1.8.6