diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-09-04 20:05:30 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-04 20:05:30 -0300 |
commit | 926af7f34aaf5aebdbac0cbc550ed75647874258 (patch) | |
tree | 4df26f8c631aeeeed6e5c9e8aab87c4c663bd30f /Project/Capacitor.cpp | |
parent | 17d1dd82ec065eff08546ef1fd2a188ce77471b2 (diff) | |
parent | 6f3421c4150e49af026432a2a2be0171d741ad03 (diff) | |
download | PSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.tar.gz PSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.tar.xz PSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.zip |
Merge pull request #33 from Thales1330/wip/electromechanical-calc
Wip electromechanical calc
Diffstat (limited to 'Project/Capacitor.cpp')
-rw-r--r-- | Project/Capacitor.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/Project/Capacitor.cpp b/Project/Capacitor.cpp index 4bf595b..75b74f4 100644 --- a/Project/Capacitor.cpp +++ b/Project/Capacitor.cpp @@ -1,15 +1,8 @@ #include "ReactiveShuntElementForm.h" #include "Capacitor.h" -Capacitor::Capacitor() - : Shunt() -{ -} -Capacitor::Capacitor(wxString name) - : Shunt() -{ - m_electricalData.name = name; -} +Capacitor::Capacitor() : Shunt() {} +Capacitor::Capacitor(wxString name) : Shunt() { m_electricalData.name = name; } Capacitor::~Capacitor() {} bool Capacitor::AddParent(Element* parent, wxPoint2DDouble position) { @@ -17,11 +10,11 @@ bool Capacitor::AddParent(Element* parent, wxPoint2DDouble position) m_parentList.push_back(parent); parent->AddChild(this); wxPoint2DDouble parentPt = - parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position. - parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus. - parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back. + parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position. + parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus. + parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back. - m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus. + m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus. m_width = 40; m_height = 30; m_rect = wxRect2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0, m_width, m_height); @@ -34,7 +27,7 @@ bool Capacitor::AddParent(Element* parent, wxPoint2DDouble position) m_inserted = true; wxRect2DDouble genRect(0, 0, 0, 0); - m_switchRect.push_back(genRect); // Push a general rectangle. + m_switchRect.push_back(genRect); // Push a general rectangle. UpdateSwitches(); return true; @@ -45,9 +38,12 @@ bool Capacitor::AddParent(Element* parent, wxPoint2DDouble position) void Capacitor::Draw(wxPoint2DDouble translation, double scale) const { OpenGLColour elementColour; - if(m_online) - elementColour = m_onlineElementColour; - else + if(m_online) { + if(m_dynEvent) + elementColour = m_dynamicEventColour; + else + elementColour = m_onlineElementColour; + } else elementColour = m_offlineElementColour; if(m_inserted) { @@ -180,7 +176,7 @@ wxString Capacitor::GetTipText() const if(!m_online) reactivePower = 0.0; else { - std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetEletricalData().voltage; + std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetElectricalData().voltage; reactivePower *= std::pow(std::abs(v), 2); } tipText += "\n"; |