My Project  0.0.16
QUCS Mapping
 All Classes Namespaces 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(QPen::darkBlue,4)));
57  Lines.append(new Line( 4,-11, 4, 11,QPen(QPen::darkBlue,4)));
58  }
59  else {
60  Lines.append(new Line(-11, -5,-11,-11,QPen(QPen::red,1)));
61  Lines.append(new Line(-14, -8, -8, -8,QPen(QPen::red,1)));
62  Lines.append(new Line( -4,-11, -4, 11,QPen(QPen::darkBlue,3)));
63  Arcs.append(new Arc(4,-12, 20, 24, 16*122, 16*116,QPen(QPen::darkBlue,3)));
64  }
65 
66  Lines.append(new Line(-30, 0, -4, 0,QPen(QPen::darkBlue,2)));
67  Lines.append(new Line( 4, 0, 30, 0,QPen(QPen::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 }