From ab30228b1a57053323363674fa7f137c0329a180 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Tue, 7 Jul 2020 23:12:04 -0300 Subject: Voltage heat map implemented Voltage heat map implemented using modern OpenGL =) New external library required: -GLEW -GLFW -GLM (incorporeted at the source) Old memory leaks fixed =) --- Project/ProjectPropertiesForm.cpp | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Project/ProjectPropertiesForm.cpp (limited to 'Project/ProjectPropertiesForm.cpp') diff --git a/Project/ProjectPropertiesForm.cpp b/Project/ProjectPropertiesForm.cpp new file mode 100644 index 0000000..ad0bcdf --- /dev/null +++ b/Project/ProjectPropertiesForm.cpp @@ -0,0 +1,49 @@ +#include "ProjectPropertiesForm.h" +#include "Workspace.h" +#include "HMPlane.h" + +ProjectPropertiesForm::ProjectPropertiesForm(wxWindow* parent, Workspace* workspace) + : ProjectPropertiesFormBase(parent), m_workspace(workspace) +{ + m_checkBoxAutomaticLabel->SetValue(m_workspace->IsHeatMapAutoLabelEnable()); + m_textCtrlMaxVoltage->SetValue(wxString::Format("%f", m_workspace->GetHeatMap()->GetMaxLimit())); + m_textCtrlMinVoltage->SetValue(wxString::Format("%f", m_workspace->GetHeatMap()->GetMinLimit())); + + EnableLabelLimits(!m_checkBoxAutomaticLabel->GetValue()); +} + +void ProjectPropertiesForm::OnAutomaticLabelClick(wxCommandEvent& event) +{ + EnableLabelLimits(!m_checkBoxAutomaticLabel->GetValue()); +} + +bool ProjectPropertiesForm::ValidateData() +{ + if(m_checkBoxAutomaticLabel->GetValue()) { + m_workspace->EnableAutoHeatMapLabel(); + } + else { + m_workspace->EnableAutoHeatMapLabel(false); + double maxVoltage, minVoltage; + + if (!Element::DoubleFromString(this, m_textCtrlMaxVoltage->GetValue(), maxVoltage, + _("Value entered incorrectly in the field \"Label max voltage\"."))) + return false; + if (!Element::DoubleFromString(this, m_textCtrlMinVoltage->GetValue(), minVoltage, + _("Value entered incorrectly in the field \"Label min voltage\"."))) + return false; + + m_workspace->GetHeatMap()->SetLabelLimits(static_cast(minVoltage), static_cast(maxVoltage)); + } + return true; +} + +void ProjectPropertiesForm::EnableLabelLimits(const bool& enable) +{ + m_textCtrlMaxVoltage->Enable(enable); + m_textCtrlMinVoltage->Enable(enable); + m_staticTextMaxVoltage->Enable(enable); + m_staticTextMinVoltage->Enable(enable); + m_staticTextPU_1->Enable(enable); + m_staticTextPU_2->Enable(enable); +} -- cgit