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
polardiagram.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
polardiagram.cpp - description
3
-------------------
4
begin : Fri Oct 17 2003
5
copyright : (C) 2003 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 "
polardiagram.h
"
29
#include "
main.h
"
30
31
32
PolarDiagram::PolarDiagram
(
int
_cx,
int
_cy) :
Diagram
(_cx, _cy)
33
{
34
x1
= 10;
// position of label text
35
y1
= 2;
36
x2
= 200;
// initial size of diagram
37
y2
= 200;
38
x3
= 207;
// with some distance for right axes text
39
Name
=
"Polar"
;
40
41
Arcs
.append(
new
struct
Arc
(0,
y2
,
x2
,
y2
, 0, 16*360, QPen(Qt::black,0)));
42
// calcDiagram();
43
}
44
45
PolarDiagram::~PolarDiagram
()
46
{
47
}
48
49
// ------------------------------------------------------------
50
void
PolarDiagram::calcCoordinate
(
double
* &,
double
* &yD,
double
* &,
51
float
*px,
float
*py,
Axis
*)
52
{
53
double
yr = *(yD++);
54
double
yi = *(yD++);
55
*px = float((yr/
yAxis
.
up
+ 1.0)*
double
(
x2
)/2.0);
56
*py = float((yi/
yAxis
.
up
+ 1.0)*
double
(
y2
)/2.0);
57
58
if
(isfinite(*px))
59
if
(isfinite(*py))
60
return
;
61
62
*px = *py = float(
cx
) / 2.0;
63
}
64
65
// --------------------------------------------------------------
66
void
PolarDiagram::calcLimits
()
67
{
68
double
a, b;
69
calcPolarAxisScale
(&
yAxis
, a,
yAxis
.
step
, b);
70
yAxis
.
limit_min
= 0.0;
71
yAxis
.
limit_max
=
yAxis
.
up
;
72
}
73
74
// --------------------------------------------------------------
75
int
PolarDiagram::calcDiagram
()
76
{
77
Lines
.clear();
78
Texts
.clear();
79
Arcs
.clear();
80
81
// x line
82
Lines
.append(
new
Line
(0,
y2
>>1,
x2
,
y2
>>1,
GridPen
));
83
84
x3
=
x2
+ 7;
85
createPolarDiagram
(&
yAxis
);
86
return
3;
87
}
88
89
// ------------------------------------------------------------
90
Diagram
*
PolarDiagram::newOne
()
91
{
92
return
new
PolarDiagram
();
93
}
94
95
// ------------------------------------------------------------
96
Element
*
PolarDiagram::info
(QString& Name,
char
* &BitmapFile,
bool
getNewOne)
97
{
98
Name = QObject::tr(
"Polar"
);
99
BitmapFile = (
char
*)
"polar"
;
100
101
if
(getNewOne)
return
new
PolarDiagram
();
102
return
0;
103
}
polardiagram.h
PolarDiagram::calcLimits
void calcLimits()
Definition:
polardiagram.cpp:66
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
PolarDiagram::calcCoordinate
void calcCoordinate(double *&, double *&, double *&, float *, float *, Axis *)
Definition:
polardiagram.cpp:50
Axis::limit_min
double limit_min
Definition:
diagram.h:56
main.h
Definitions and declarations for the main application.
PolarDiagram::PolarDiagram
PolarDiagram(int _cx=0, int _cy=0)
Definition:
polardiagram.cpp:32
Element::cx
int cx
Definition:
element.h:153
Diagram::GridPen
QPen GridPen
Definition:
diagram.h:93
Diagram::createPolarDiagram
void createPolarDiagram(Axis *, int Mode=3)
Definition:
diagram.cpp:1589
Diagram::Arcs
Q3PtrList< struct Arc > Arcs
Definition:
diagram.h:96
Axis
Definition:
diagram.h:47
Diagram::x3
int x3
Definition:
diagram.h:100
PolarDiagram::info
static Element * info(QString &, char *&, bool getNewOne=false)
Definition:
polardiagram.cpp:96
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::Texts
Q3PtrList< Text > Texts
Definition:
diagram.h:98
Diagram
Definition:
diagram.h:60
Diagram::yAxis
Axis yAxis
Definition:
diagram.h:101
PolarDiagram::calcDiagram
int calcDiagram()
Definition:
polardiagram.cpp:75
Axis::step
double step
Definition:
diagram.h:56
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
PolarDiagram::~PolarDiagram
~PolarDiagram()
Definition:
polardiagram.cpp:45
PolarDiagram::newOne
Diagram * newOne()
Definition:
polardiagram.cpp:90
Generated on Mon Sep 1 2014 20:05:20 for Qucs-GUI by
1.8.6