Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
component = common base class; added resistor and capacitor class
- Loading branch information
1 parent
91d137b
commit 9c01561
Showing
9 changed files
with
100 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "capacitor.h" | ||
|
||
Capacitor::Capacitor(QString name) : Component(name) { | ||
|
||
Capacitor::NUM_NODES = 2; | ||
_wires = QVector<QVector<Wire*> > (Capacitor::NUM_NODES); | ||
|
||
QPointF p1(-20, 0); | ||
_nodes.append(p1); | ||
QPointF p2(20, 0); | ||
_nodes.append(p2); | ||
|
||
} | ||
|
||
QRectF Capacitor::boundingRect() const { | ||
return QRectF(-30, -20, 60, 40); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef CAPACITOR_H | ||
#define CAPACITOR_H | ||
|
||
#include <QtGui> | ||
#include <QtWidgets> | ||
#include <QDebug> | ||
#include <QVector> | ||
|
||
#include "component.h" | ||
|
||
|
||
class Capacitor : public Component { | ||
|
||
public: | ||
Capacitor(QString); | ||
QRectF boundingRect() const; | ||
}; | ||
|
||
#endif // CAPACITOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "resistor.h" | ||
|
||
Resistor::Resistor(QString name) : Component(name) { | ||
|
||
Resistor::NUM_NODES = 2; | ||
_wires = QVector<QVector<Wire*> > (Resistor::NUM_NODES); | ||
|
||
QPointF p1(-20, 0); | ||
_nodes.append(p1); | ||
QPointF p2(20, 0); | ||
_nodes.append(p2); | ||
|
||
} | ||
|
||
|
||
QRectF Resistor::boundingRect() const { | ||
return QRectF(-30, -20, 60, 40); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef RESISTOR_H | ||
#define RESISTOR_H | ||
|
||
#include <QtGui> | ||
#include <QtWidgets> | ||
#include <QDebug> | ||
#include <QVector> | ||
|
||
#include "component.h" | ||
|
||
class Resistor : public Component { | ||
|
||
public: | ||
Resistor(QString); | ||
QRectF boundingRect() const; | ||
}; | ||
|
||
#endif // RESISTOR_H |