From 7aed88dbcf9d37a1f40c8cad115f055c4d69e7a9 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Thu, 29 Dec 2016 19:03:16 -0200 Subject: Parent/child optimization implemented And others bugfixes. --- Project/Capacitor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'Project/Capacitor.cpp') diff --git a/Project/Capacitor.cpp b/Project/Capacitor.cpp index a4320c9..7545135 100644 --- a/Project/Capacitor.cpp +++ b/Project/Capacitor.cpp @@ -15,6 +15,7 @@ bool Capacitor::AddParent(Element* parent, wxPoint2DDouble position) { if(parent) { 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. -- cgit From 2c0b51586b3b2243ae0fdcd653139818e4b4e23e Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Mon, 2 Jan 2017 19:31:11 -0200 Subject: Fast data visualization implemented --- Project/Capacitor.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'Project/Capacitor.cpp') diff --git a/Project/Capacitor.cpp b/Project/Capacitor.cpp index 7545135..1ec17fc 100644 --- a/Project/Capacitor.cpp +++ b/Project/Capacitor.cpp @@ -170,3 +170,35 @@ Element* Capacitor::GetCopy() *copy = *this; return copy; } + +wxString Capacitor::GetTipText() const +{ + wxString tipText = m_electricalData.name; + + // TODO: Avoid reactive power calculation. + double reactivePower = m_electricalData.reactivePower; + if(m_online) { + std::complex v = ((Bus*)m_parentList[0])->GetEletricalData().voltage; + reactivePower *= std::pow(std::abs(v), 2); + } + tipText += "\n"; + tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5); + switch(m_electricalData.reactivePowerUnit) { + case UNIT_PU: { + tipText += _(" p.u."); + } break; + case UNIT_VAr: { + tipText += _(" VAr"); + } break; + case UNIT_kVAr: { + tipText += _(" kVAr"); + } break; + case UNIT_MVAr: { + tipText += _(" MVAr"); + } break; + default: + break; + } + + return tipText; +} -- cgit From b6f96ca48bc156898df79deba63d270b393fb150 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Thu, 5 Jan 2017 19:31:28 -0200 Subject: Text bugs fixed --- Project/Capacitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Project/Capacitor.cpp') diff --git a/Project/Capacitor.cpp b/Project/Capacitor.cpp index 1ec17fc..4f43f05 100644 --- a/Project/Capacitor.cpp +++ b/Project/Capacitor.cpp @@ -113,7 +113,7 @@ void Capacitor::Rotate(bool clockwise) bool Capacitor::GetContextMenu(wxMenu& menu) { - menu.Append(ID_EDIT_CAPACITOR, _("Edit Capacitor")); + menu.Append(ID_EDIT_ELEMENT, _("Edit Capacitor")); GeneralMenuItens(menu); return true; } @@ -178,7 +178,7 @@ wxString Capacitor::GetTipText() const // TODO: Avoid reactive power calculation. double reactivePower = m_electricalData.reactivePower; if(m_online) { - std::complex v = ((Bus*)m_parentList[0])->GetEletricalData().voltage; + std::complex v = static_cast(m_parentList[0])->GetEletricalData().voltage; reactivePower *= std::pow(std::abs(v), 2); } tipText += "\n"; -- cgit