Qucs-GUI  0.0.18
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
volt_dc.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  volt_dc.cpp
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 "volt_dc.h"
19 
20 
22 {
23  Description = QObject::tr("ideal dc voltage source");
24 
25  Lines.append(new Line( 4,-13, 4, 13,QPen(Qt::darkBlue,2)));
26  Lines.append(new Line( -4, -6, -4, 6,QPen(Qt::darkBlue,4)));
27  Lines.append(new Line( 30, 0, 4, 0,QPen(Qt::darkBlue,2)));
28  Lines.append(new Line( -4, 0,-30, 0,QPen(Qt::darkBlue,2)));
29  Lines.append(new Line( 11, 5, 11, 11,QPen(Qt::red,1)));
30  Lines.append(new Line( 14, 8, 8, 8,QPen(Qt::red,1)));
31  Lines.append(new Line(-11, 5,-11, 11,QPen(Qt::black,1)));
32 
33  Ports.append(new Port( 30, 0));
34  Ports.append(new Port(-30, 0));
35 
36  x1 = -30; y1 = -14;
37  x2 = 30; y2 = 14;
38 
39  tx = x1+4;
40  ty = y2+4;
41  Model = "Vdc";
42  Name = "V";
43 
44  Props.append(new Property("U", "1 V", true,
45  QObject::tr("voltage in Volts")));
46 
47  rotate(); // fix historical flaw
48 }
49 
51 {
52 }
53 
55 {
56  return new Volt_dc();
57 }
58 
59 Element* Volt_dc::info(QString& Name, char* &BitmapFile, bool getNewOne)
60 {
61  Name = QObject::tr("dc Voltage Source");
62  BitmapFile = (char *) "dc_voltage";
63 
64  if(getNewOne) return new Volt_dc();
65  return 0;
66 }
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
Volt_dc()
Definition: volt_dc.cpp:21
int x1
Definition: element.h:153
int ty
Definition: component.h:78
Q3PtrList< Property > Props
Definition: component.h:72
Definition: element.h:48
Superclass of all schematic drawing elements.
Definition: element.h:142
Q3PtrList< Port > Ports
Definition: component.h:70
void rotate()
Definition: component.cpp:390
QString Name
Definition: component.h:80
QString Model
Definition: component.h:80
QString Description
Definition: component.h:81
Component * newOne()
Definition: volt_dc.cpp:54
~Volt_dc()
Definition: volt_dc.cpp:50
static Element * info(QString &, char *&, bool getNewOne=false)
Definition: volt_dc.cpp:59
int x2
Definition: element.h:153