Qucs-GUI
0.0.19
|
00001 /*************************************************************************** 00002 capacitor.cpp - description 00003 ------------------- 00004 begin : Sat Aug 23 2003 00005 copyright : (C) 2003 by Michael Margraf 00006 email : michael.margraf@alumni.tu-berlin.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #include "capacitor.h" 00019 00020 00021 Capacitor::Capacitor() 00022 { 00023 Description = QObject::tr("capacitor"); 00024 00025 Props.append(new Property("C", "1 pF", true, 00026 QObject::tr("capacitance in Farad"))); 00027 Props.append(new Property("V", "", false, 00028 QObject::tr("initial voltage for transient simulation"))); 00029 Props.append(new Property("Symbol", "neutral", false, 00030 QObject::tr("schematic symbol")+" [neutral, polar]")); 00031 00032 createSymbol(); 00033 tx = x1+4; 00034 ty = y2+4; 00035 Model = "C"; 00036 Name = "C"; 00037 } 00038 00039 Component* Capacitor::newOne() 00040 { 00041 return new Capacitor(); 00042 } 00043 00044 Element* Capacitor::info(QString& Name, char* &BitmapFile, bool getNewOne) 00045 { 00046 Name = QObject::tr("Capacitor"); 00047 BitmapFile = (char *) "capacitor"; 00048 00049 if(getNewOne) return new Capacitor(); 00050 return 0; 00051 } 00052 00053 void Capacitor::createSymbol() 00054 { 00055 if(Props.getLast()->Value.at(0) == 'n') { 00056 Lines.append(new Line( -4,-11, -4, 11,QPen(Qt::darkBlue,4))); 00057 Lines.append(new Line( 4,-11, 4, 11,QPen(Qt::darkBlue,4))); 00058 } 00059 else { 00060 Lines.append(new Line(-11, -5,-11,-11,QPen(Qt::red,1))); 00061 Lines.append(new Line(-14, -8, -8, -8,QPen(Qt::red,1))); 00062 Lines.append(new Line( -4,-11, -4, 11,QPen(Qt::darkBlue,3))); 00063 Arcs.append(new Arc(4,-12, 20, 24, 16*122, 16*116,QPen(Qt::darkBlue,3))); 00064 } 00065 00066 Lines.append(new Line(-30, 0, -4, 0,QPen(Qt::darkBlue,2))); 00067 Lines.append(new Line( 4, 0, 30, 0,QPen(Qt::darkBlue,2))); 00068 00069 Ports.append(new Port(-30, 0)); 00070 Ports.append(new Port( 30, 0)); 00071 00072 x1 = -30; y1 = -13; 00073 x2 = 30; y2 = 13; 00074 }