Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
ProjectPropertiesForm.cpp
1#include "ProjectPropertiesForm.h"
2#include "../utils/HMPlane.h"
3#include "../editors/Workspace.h"
4
5ProjectPropertiesForm::ProjectPropertiesForm(wxWindow* parent, Workspace* workspace)
6 : ProjectPropertiesFormBase(parent), m_workspace(workspace)
7{
8 m_checkBoxAutomaticLabel->SetValue(m_workspace->IsHeatMapAutoLabelEnable());
9 m_textCtrlMaxVoltage->SetValue(wxString::Format("%f", m_workspace->GetHeatMap()->GetMaxLimit()));
10 m_textCtrlMinVoltage->SetValue(wxString::Format("%f", m_workspace->GetHeatMap()->GetMinLimit()));
11
12 EnableLabelLimits(!m_checkBoxAutomaticLabel->GetValue());
13}
14
15void ProjectPropertiesForm::OnAutomaticLabelClick(wxCommandEvent& event)
16{
17 EnableLabelLimits(!m_checkBoxAutomaticLabel->GetValue());
18}
19
20bool ProjectPropertiesForm::ValidateData()
21{
22 if(m_checkBoxAutomaticLabel->GetValue()) {
23 m_workspace->EnableAutoHeatMapLabel();
24 }
25 else {
26 m_workspace->EnableAutoHeatMapLabel(false);
27 double maxVoltage, minVoltage;
28
29 if (!Element::DoubleFromString(this, m_textCtrlMaxVoltage->GetValue(), maxVoltage,
30 _("Value entered incorrectly in the field \"Label max voltage\".")))
31 return false;
32 if (!Element::DoubleFromString(this, m_textCtrlMinVoltage->GetValue(), minVoltage,
33 _("Value entered incorrectly in the field \"Label min voltage\".")))
34 return false;
35
36 m_workspace->GetHeatMap()->SetLabelLimits(static_cast<float>(minVoltage), static_cast<float>(maxVoltage));
37 }
38 return true;
39}
40
41void ProjectPropertiesForm::EnableLabelLimits(const bool& enable)
42{
43 m_textCtrlMaxVoltage->Enable(enable);
44 m_textCtrlMinVoltage->Enable(enable);
45 m_staticTextMaxVoltage->Enable(enable);
46 m_staticTextMinVoltage->Enable(enable);
47 m_staticTextPU_1->Enable(enable);
48 m_staticTextPU_2->Enable(enable);
49}
static bool DoubleFromString(wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
Get a double value from a string. Show a error message if the conversion fail.
Definition Element.cpp:505
This class manages the graphical and power elements. It is responsible for handling the user's intera...
Definition Workspace.h:103