Qucs-GUI
0.0.19
|
00001 /*************************************************************************** 00002 vcresistor.cpp - description 00003 ------------------- 00004 begin : Feb 13 2014 00005 copyright : (C) 2014 by Richard Crozier 00006 email : richard dot crozier at yahoo dot co dot uk 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 "vcresistor.h" 00019 00020 00021 vcresistor::vcresistor() 00022 { 00023 Description = QObject::tr("voltage controlled voltage source"); 00024 00025 // The resistor shape 00026 Lines.append(new Line(5, 18, 5, -18, QPen(Qt::darkBlue,2))); 00027 Lines.append(new Line(17, 18, 17, -18, QPen(Qt::darkBlue,2))); 00028 Lines.append(new Line(5, 18, 17, 18, QPen(Qt::darkBlue,2))); 00029 Lines.append(new Line(5, -18, 17, -18, QPen(Qt::darkBlue,2))); 00030 00031 // horizontal lines on top and bottom of left hand side 00032 Lines.append(new Line(-30,-30,-12,-30,QPen(Qt::darkBlue,2))); 00033 Lines.append(new Line(-30, 30,-12, 30,QPen(Qt::darkBlue,2))); 00034 // horizontal lines on top and bottom of right hand side 00035 Lines.append(new Line( 11,-30, 30,-30,QPen(Qt::darkBlue,2))); 00036 Lines.append(new Line( 11, 30, 30, 30,QPen(Qt::darkBlue,2))); 00037 // vertical lines on top and bottom of left hand side 00038 Lines.append(new Line(-12,-30,-12,-23,QPen(Qt::darkBlue,2))); 00039 Lines.append(new Line(-12, 30,-12, 23,QPen(Qt::darkBlue,2))); 00040 // vertical lines on top and bottom of right hand side 00041 Lines.append(new Line( 11,-30, 11,-18,QPen(Qt::darkBlue,2))); 00042 Lines.append(new Line( 11, 30, 11, 18,QPen(Qt::darkBlue,2))); 00043 00044 // downward pointing arrow 00045 Lines.append(new Line(-12,-18,-12, 18,QPen(Qt::darkBlue,1))); 00046 Lines.append(new Line(-12, 18,-17, 9,QPen(Qt::darkBlue,1))); 00047 Lines.append(new Line(-12, 18, -7, 9,QPen(Qt::darkBlue,1))); 00048 00049 Lines.append(new Line(-25,-27, 25,-27,QPen(Qt::darkGray,1))); 00050 Lines.append(new Line( 25,-27, 25, 27,QPen(Qt::darkGray,1))); 00051 Lines.append(new Line( 25, 27,-25, 27,QPen(Qt::darkGray,1))); 00052 Lines.append(new Line(-25, 27,-25,-27,QPen(Qt::darkGray,1))); 00053 00054 00055 Ports.append(new Port(-30,-30)); 00056 Ports.append(new Port(-30, 30)); 00057 Ports.append(new Port( 30,-30)); 00058 Ports.append(new Port( 30, 30)); 00059 00060 00061 x1 = -30; y1 = -30; 00062 x2 = 30; y2 = 30; 00063 00064 tx = x1+4; 00065 ty = y2+4; 00066 Model = "vcresistor"; 00067 Name = "VCR"; 00068 00069 Props.append(new Property("gain", "1", true, 00070 QObject::tr("resistance gain"))); 00071 } 00072 00073 vcresistor::~vcresistor() 00074 { 00075 } 00076 00077 Component* vcresistor::newOne() 00078 { 00079 return new vcresistor(); 00080 } 00081 00082 Element* vcresistor::info(QString& Name, char* &BitmapFile, bool getNewOne) 00083 { 00084 Name = QObject::tr("Voltage Controlled Resistor"); 00085 BitmapFile = (char *) "vcresistor"; 00086 00087 if(getNewOne) return new vcresistor(); 00088 return 0; 00089 } 00090