summaryrefslogtreecommitdiffstats
path: root/Project/ProjectPropertiesForm.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-07 23:12:04 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-07 23:12:04 -0300
commitab30228b1a57053323363674fa7f137c0329a180 (patch)
tree50849a3680d61a2428665cc1035f1f4215870acb /Project/ProjectPropertiesForm.cpp
parent6c0e98a2727d07e1fbb38b78c27d68e98ad09465 (diff)
downloadPSP.git-ab30228b1a57053323363674fa7f137c0329a180.tar.gz
PSP.git-ab30228b1a57053323363674fa7f137c0329a180.tar.xz
PSP.git-ab30228b1a57053323363674fa7f137c0329a180.zip
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 =)
Diffstat (limited to 'Project/ProjectPropertiesForm.cpp')
-rw-r--r--Project/ProjectPropertiesForm.cpp49
1 files changed, 49 insertions, 0 deletions
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<float>(minVoltage), static_cast<float>(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);
+}