Qucs-GUI  0.0.18
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vcresistor.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  vcresistor.cpp - description
3  -------------------
4  begin : Feb 13 2014
5  copyright : (C) 2014 by Richard Crozier
6  email : richard dot crozier at yahoo dot co dot uk
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 "vcresistor.h"
19 
20 
22 {
23  Description = QObject::tr("voltage controlled voltage source");
24 
25  // The resistor shape
26  Lines.append(new Line(5, 18, 5, -18, QPen(Qt::darkBlue,2)));
27  Lines.append(new Line(17, 18, 17, -18, QPen(Qt::darkBlue,2)));
28  Lines.append(new Line(5, 18, 17, 18, QPen(Qt::darkBlue,2)));
29  Lines.append(new Line(5, -18, 17, -18, QPen(Qt::darkBlue,2)));
30 
31  // horizontal lines on top and bottom of left hand side
32  Lines.append(new Line(-30,-30,-12,-30,QPen(Qt::darkBlue,2)));
33  Lines.append(new Line(-30, 30,-12, 30,QPen(Qt::darkBlue,2)));
34  // horizontal lines on top and bottom of right hand side
35  Lines.append(new Line( 11,-30, 30,-30,QPen(Qt::darkBlue,2)));
36  Lines.append(new Line( 11, 30, 30, 30,QPen(Qt::darkBlue,2)));
37  // vertical lines on top and bottom of left hand side
38  Lines.append(new Line(-12,-30,-12,-23,QPen(Qt::darkBlue,2)));
39  Lines.append(new Line(-12, 30,-12, 23,QPen(Qt::darkBlue,2)));
40  // vertical lines on top and bottom of right hand side
41  Lines.append(new Line( 11,-30, 11,-18,QPen(Qt::darkBlue,2)));
42  Lines.append(new Line( 11, 30, 11, 18,QPen(Qt::darkBlue,2)));
43 
44  // downward pointing arrow
45  Lines.append(new Line(-12,-18,-12, 18,QPen(Qt::darkBlue,1)));
46  Lines.append(new Line(-12, 18,-17, 9,QPen(Qt::darkBlue,1)));
47  Lines.append(new Line(-12, 18, -7, 9,QPen(Qt::darkBlue,1)));
48 
49  Lines.append(new Line(-25,-27, 25,-27,QPen(Qt::darkGray,1)));
50  Lines.append(new Line( 25,-27, 25, 27,QPen(Qt::darkGray,1)));
51  Lines.append(new Line( 25, 27,-25, 27,QPen(Qt::darkGray,1)));
52  Lines.append(new Line(-25, 27,-25,-27,QPen(Qt::darkGray,1)));
53 
54 
55  Ports.append(new Port(-30,-30));
56  Ports.append(new Port(-30, 30));
57  Ports.append(new Port( 30,-30));
58  Ports.append(new Port( 30, 30));
59 
60 
61  x1 = -30; y1 = -30;
62  x2 = 30; y2 = 30;
63 
64  tx = x1+4;
65  ty = y2+4;
66  Model = "vcresistor";
67  Name = "VCR";
68 
69  Props.append(new Property("gain", "1", true,
70  QObject::tr("resistance gain")));
71 }
72 
74 {
75 }
76 
78 {
79  return new vcresistor();
80 }
81 
82 Element* vcresistor::info(QString& Name, char* &BitmapFile, bool getNewOne)
83 {
84  Name = QObject::tr("Voltage Controlled Resistor");
85  BitmapFile = (char *) "vcresistor";
86 
87  if(getNewOne) return new vcresistor();
88  return 0;
89 }
90 
Q3PtrList< Line > Lines
Definition: component.h:67
int y1
Definition: element.h:153
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
Q3PtrList< Property > Props
Definition: component.h:72
static Element * info(QString &, char *&, bool getNewOne=false)
Definition: vcresistor.cpp:82
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
int x2
Definition: element.h:153
Component * newOne()
Definition: vcresistor.cpp:77