Qucs-GUI  0.0.18
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
capacitor.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  capacitor.cpp - description
3  -------------------
4  begin : Sat Aug 23 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 #include "capacitor.h"
19 
20 
22 {
23  Description = QObject::tr("capacitor");
24 
25  Props.append(new Property("C", "1 pF", true,
26  QObject::tr("capacitance in Farad")));
27  Props.append(new Property("V", "", false,
28  QObject::tr("initial voltage for transient simulation")));
29  Props.append(new Property("Symbol", "neutral", false,
30  QObject::tr("schematic symbol")+" [neutral, polar]"));
31 
32  createSymbol();
33  tx = x1+4;
34  ty = y2+4;
35  Model = "C";
36  Name = "C";
37 }
38 
40 {
41  return new Capacitor();
42 }
43 
44 Element* Capacitor::info(QString& Name, char* &BitmapFile, bool getNewOne)
45 {
46  Name = QObject::tr("Capacitor");
47  BitmapFile = (char *) "capacitor";
48 
49  if(getNewOne) return new Capacitor();
50  return 0;
51 }
52 
54 {
55  if(Props.getLast()->Value.at(0) == 'n') {
56  Lines.append(new Line( -4,-11, -4, 11,QPen(Qt::darkBlue,4)));
57  Lines.append(new Line( 4,-11, 4, 11,QPen(Qt::darkBlue,4)));
58  }
59  else {
60  Lines.append(new Line(-11, -5,-11,-11,QPen(Qt::red,1)));
61  Lines.append(new Line(-14, -8, -8, -8,QPen(Qt::red,1)));
62  Lines.append(new Line( -4,-11, -4, 11,QPen(Qt::darkBlue,3)));
63  Arcs.append(new Arc(4,-12, 20, 24, 16*122, 16*116,QPen(Qt::darkBlue,3)));
64  }
65 
66  Lines.append(new Line(-30, 0, -4, 0,QPen(Qt::darkBlue,2)));
67  Lines.append(new Line( 4, 0, 30, 0,QPen(Qt::darkBlue,2)));
68 
69  Ports.append(new Port(-30, 0));
70  Ports.append(new Port( 30, 0));
71 
72  x1 = -30; y1 = -13;
73  x2 = 30; y2 = 13;
74 }
Q3PtrList< Line > Lines
Definition: component.h:67
void createSymbol()
Definition: capacitor.cpp:53
Definition: element.h:55
int y1
Definition: element.h:153
Q3PtrList< struct Arc > Arcs
Definition: component.h:68
int tx
Definition: component.h:78
int y2
Definition: element.h:153
Definition: element.h:72
int x1
Definition: element.h:153
int ty
Definition: component.h:78
Component * newOne()
Definition: capacitor.cpp:39
Q3PtrList< Property > Props
Definition: component.h:72
Definition: element.h:48
Superclass of all schematic drawing elements.
Definition: element.h:142
Q3PtrList< Port > Ports
Definition: component.h:70
QString Name
Definition: component.h:80
QString Model
Definition: component.h:80
QString Description
Definition: component.h:81
static Element * info(QString &, char *&, bool getNewOne=false)
Definition: capacitor.cpp:44
int x2
Definition: element.h:153