Qucs-GUI
0.0.19
|
00001 /*************************************************************************** 00002 resistor.cpp 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 #include "resistor.h" 00018 #include "node.h" 00019 #include "schematic.h" 00020 00021 00022 Resistor::Resistor(bool european) 00023 { 00024 Description = QObject::tr("resistor"); 00025 00026 Props.append(new Property("R", "50 Ohm", true, 00027 QObject::tr("ohmic resistance in Ohms"))); 00028 Props.append(new Property("Temp", "26.85", false, 00029 QObject::tr("simulation temperature in degree Celsius"))); 00030 Props.append(new Property("Tc1", "0.0", false, 00031 QObject::tr("first order temperature coefficient"))); 00032 Props.append(new Property("Tc2", "0.0", false, 00033 QObject::tr("second order temperature coefficient"))); 00034 Props.append(new Property("Tnom", "26.85", false, 00035 QObject::tr("temperature at which parameters were extracted"))); 00036 00037 // this must be the last property in the list !!! 00038 Props.append(new Property("Symbol", "european", false, 00039 QObject::tr("schematic symbol")+" [european, US]")); 00040 if(!european) Props.getLast()->Value = "US"; 00041 00042 createSymbol(); 00043 tx = x1+4; 00044 ty = y2+4; 00045 Model = "R"; 00046 Name = "R"; 00047 } 00048 00049 // ------------------------------------------------------- 00050 Component* Resistor::newOne() 00051 { 00052 return new Resistor(Props.getLast()->Value != "US"); 00053 } 00054 00055 // ------------------------------------------------------- 00056 void Resistor::createSymbol() 00057 { 00058 if(Props.getLast()->Value != "US") { 00059 Lines.append(new Line(-18, -9, 18, -9,QPen(Qt::darkBlue,2))); 00060 Lines.append(new Line( 18, -9, 18, 9,QPen(Qt::darkBlue,2))); 00061 Lines.append(new Line( 18, 9,-18, 9,QPen(Qt::darkBlue,2))); 00062 Lines.append(new Line(-18, 9,-18, -9,QPen(Qt::darkBlue,2))); 00063 Lines.append(new Line(-30, 0,-18, 0,QPen(Qt::darkBlue,2))); 00064 Lines.append(new Line( 18, 0, 30, 0,QPen(Qt::darkBlue,2))); 00065 } 00066 else { 00067 Lines.append(new Line(-30, 0,-18, 0,QPen(Qt::darkBlue,2))); 00068 Lines.append(new Line(-18, 0,-15, -7,QPen(Qt::darkBlue,2))); 00069 Lines.append(new Line(-15, -7, -9, 7,QPen(Qt::darkBlue,2))); 00070 Lines.append(new Line( -9, 7, -3, -7,QPen(Qt::darkBlue,2))); 00071 Lines.append(new Line( -3, -7, 3, 7,QPen(Qt::darkBlue,2))); 00072 Lines.append(new Line( 3, 7, 9, -7,QPen(Qt::darkBlue,2))); 00073 Lines.append(new Line( 9, -7, 15, 7,QPen(Qt::darkBlue,2))); 00074 Lines.append(new Line( 15, 7, 18, 0,QPen(Qt::darkBlue,2))); 00075 Lines.append(new Line( 18, 0, 30, 0,QPen(Qt::darkBlue,2))); 00076 } 00077 00078 Ports.append(new Port(-30, 0)); 00079 Ports.append(new Port( 30, 0)); 00080 00081 x1 = -30; y1 = -11; 00082 x2 = 30; y2 = 11; 00083 } 00084 00085 // ------------------------------------------------------- 00086 Element* Resistor::info(QString& Name, char* &BitmapFile, bool getNewOne) 00087 { 00088 Name = QObject::tr("Resistor"); 00089 BitmapFile = (char *) "resistor"; 00090 00091 if(getNewOne) return new Resistor(); 00092 return 0; 00093 } 00094 00095 // ------------------------------------------------------- 00096 Element* Resistor::info_us(QString& Name, char* &BitmapFile, bool getNewOne) 00097 { 00098 Name = QObject::tr("Resistor US"); 00099 BitmapFile = (char *) "resistor_us"; 00100 00101 if(getNewOne) return new Resistor(false); 00102 return 0; 00103 }