Antares Simulator
Power System Simulator
thermal-cluster.h
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 #ifndef __ANTARES_TOOLBOX_INPUT_THERMAL_CLUSTER_H__
22 #define __ANTARES_TOOLBOX_INPUT_THERMAL_CLUSTER_H__
23 
24 #include <yuni/core/event.h>
25 #include <antares/study/study.h>
26 #include "input.h"
27 #include "area.h"
28 #include <wx/panel.h>
29 #include <wx/arrstr.h>
30 #include <wx/stattext.h>
31 #include <wx/imaglist.h>
32 #include "../components/htmllistbox/component.h"
33 #include "../components/htmllistbox/item/thermal-cluster-item.h"
34 #include "../components/htmllistbox/datasource/thermal-cluster-order.h"
35 #include "../components/htmllistbox/item/thermal-cluster-item.h"
36 
37 namespace Antares::Toolbox::InputSelector
38 {
39 using namespace Component::HTMLListbox::Datasource;
40 
44 class ThermalCluster final: public AInput, public Yuni::IEventObserver<ThermalCluster>
45 {
46 public:
48 
49 
52  ThermalCluster(wxWindow* parent, InputSelector::Area* area);
54  virtual ~ThermalCluster();
56 
57  virtual void update();
58 
59  virtual wxPoint recommendedSize() const
60  {
61  return wxPoint(150, 240);
62  }
63 
64  void updateInnerValues();
65 
73  void renameAggregate(Antares::Data::ThermalCluster* cluster,
74  const wxString& newName,
75  const bool broadcast = true);
76 
77 public:
78  Yuni::Event<void(Antares::Data::ThermalCluster*)> onThermalClusterChanged;
79 
80 protected:
84  virtual void internalBuildSubControls();
87 
88 private:
93  void areaHasChanged(Antares::Data::Area* area);
94 
96  void onStudyEndUpdate();
97 
99  void internalAddPlant(void*);
101  void internalDeletePlant(void*);
103  void internalClonePlant(void*);
104 
105  void internalDeleteAll(void*);
106 
111  void onApplicationOnQuit();
112 
116  void onStudyClosed();
117 
122  void onThSelected(Component::HTMLListbox::Item::IItem::Ptr item);
123 
124  void onStudyThermalClusterCommonSettingsChanged();
125 
126  void onStudyThermalClusterRenamed(Antares::Data::ThermalCluster* cluster);
127 
128  void onStudyThermalClusterGroupChanged(Antares::Data::Area* area);
129 
130  void onDeleteDropdown(Antares::Component::Button&, wxMenu& menu, void*);
131 
132  void evtPopupDelete(wxCommandEvent&);
133  void evtPopupDeleteAll(wxCommandEvent&);
134 
135  void delayedSelection(Component::HTMLListbox::Item::IItem::Ptr item);
136 
137  void updateWhenGroupChanges();
138 
139 private:
141  Antares::Data::Area* pArea;
143  wxStaticText* pTotalMW;
145  wxImageList pImageList;
149  InputSelector::Area* pAreaNotifier;
151  Component::HTMLListbox::Item::ThermalClusterItem::Ptr pLastSelectedThermalCluster;
152 
153  ThermalClustersByAlphaOrder* pDataSourceAZ;
154  ThermalClustersByAlphaReverseOrder* pDataSourceZA;
155 
156 }; // class Area
157 
158 } // namespace Antares::Toolbox::InputSelector
159 
160 #endif // __ANTARES_TOOLBOX_INPUT_THERMAL_CLUSTER_H__
Definition: button.h:32
Listbox with HTML content.
Definition: component.h:46
std::shared_ptr< IItem > Ptr
The most suitable smartptr for this class.
Definition: item.h:47
Definition for a single area.
Definition: area.h:51
A single thermal cluster.
Definition: cluster.h:76
Visual Component for displaying all available areas (and groups)
Definition: area.h:37
Visual Component for displaying thermal clusters of an arbitrary area.
Definition: thermal-cluster.h:45
void onThermalGroupChanged(Antares::Data::Area *area)
Event: a group has been changed.
virtual wxPoint recommendedSize() const
Get the recommended size for the control.
Definition: thermal-cluster.h:59