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/Inductor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'Project/Inductor.cpp') diff --git a/Project/Inductor.cpp b/Project/Inductor.cpp index b3f80d9..0a272c1 100644 --- a/Project/Inductor.cpp +++ b/Project/Inductor.cpp @@ -15,6 +15,7 @@ bool Inductor::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/Inductor.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'Project/Inductor.cpp') diff --git a/Project/Inductor.cpp b/Project/Inductor.cpp index 0a272c1..6856ff4 100644 --- a/Project/Inductor.cpp +++ b/Project/Inductor.cpp @@ -164,3 +164,35 @@ Element* Inductor::GetCopy() *copy = *this; return copy; } + +wxString Inductor::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/Inductor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Project/Inductor.cpp') diff --git a/Project/Inductor.cpp b/Project/Inductor.cpp index 6856ff4..69279df 100644 --- a/Project/Inductor.cpp +++ b/Project/Inductor.cpp @@ -111,7 +111,7 @@ void Inductor::Rotate(bool clockwise) bool Inductor::GetContextMenu(wxMenu& menu) { - menu.Append(ID_EDIT_INDUCTOR, _("Edit Inductor")); + menu.Append(ID_EDIT_ELEMENT, _("Edit Inductor")); GeneralMenuItens(menu); return true; } @@ -172,7 +172,7 @@ wxString Inductor::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