Antares Simulator
Power System Simulator
frame.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_WINDOWS_INSPECTOR_FRAME_H__
22 #define __ANTARES_WINDOWS_INSPECTOR_FRAME_H__
23 
24 #include <wx/propgrid/propgrid.h>
25 
26 #include <antares/study/study.h>
27 #include "../notes.h"
28 #include "data.h"
29 #include <ui/common/component/panel.h>
30 
31 namespace Antares::Window::Inspector
32 {
33 // Forward declaration
34 class InspectorGrid;
35 
36 class Frame final: public Antares::Component::Panel, public Yuni::IEventObserver<Frame>
37 {
38 public:
40 
41 
47  explicit Frame(wxWindow* parent, bool allowAnyObject = false);
49  virtual ~Frame();
51 
53 
54 
59  void apply(const InspectorData::Ptr& data);
60 
65 
69  void delayApply();
70 
72 
78  void attachToTheMainForm();
79 
83  void detachFromTheMainForm();
84 
85 public:
86  // Events
87  void onSelectAllLinks(wxCommandEvent& evt);
88  void onSelectLink(wxCommandEvent& evt);
89  void onSelectAllLinksFromArea(wxCommandEvent& evt);
90 
91  void onSelectAllPlants(wxCommandEvent& evt);
92  void onSelectPlant(wxCommandEvent& evt);
93 
94  void clearAssociatinsBetweenIDAndPtr()
95  {
96  mapIDPointer.clear();
97  }
98 
99  void assign(int id, const void* p)
100  {
101  mapIDPointer[id] = const_cast<void*>(p);
102  }
103 
104 protected:
105  void onDelayApplyGlobalSelection();
106  void onDelayApply();
107  void onStudyClosed();
108  void onSelectProperties(void*);
109  void onSelectNotes(void*);
110  void onPropertyChanging(wxPropertyGridEvent& event);
111  void onLoadUserNotes();
112  void onInternalRefresh(const void* sender);
113 
114 private:
116  wxPropertyGrid* pPropertyGrid;
118  wxPanel* pMainPanel;
120  Window::Notes* pNotes;
122  // with the givel selection
123  bool pAllowAnyObject;
125  InspectorData::Ptr pCurrentSelection;
127  Yuni::Bind<void(const InspectorData::Ptr&)> pApplyPropertyGrid;
128 
129  // Some property pointers are kept to speed-up the update
130  // About a Study
131  wxPGProperty* pPGCommonStudyName;
132  wxPGProperty* pPGCommonStudyAuthor;
133 
134  // About studies
135  wxPGProperty* pPGStudySpace1;
136  wxPGProperty* pPGStudySpace2;
137  wxPGProperty* pPGStudyTitle;
138  wxPGProperty* pPGStudyGrpSimulation;
139  wxPGProperty* pPGStudyGrpCalendar;
140  wxPGProperty* pPGStudyMCScenarios;
141  wxPGProperty* pPGStudyOutputProfile;
142  wxPGProperty* pPGSimulationMode;
143  wxPGProperty* pPGStudyYears;
144  wxPGProperty* pPGStudyCalendarBegin;
145  wxPGProperty* pPGStudyCalendarEnd;
146  wxPGProperty* pPGStudy1rstJanuary;
147  wxPGProperty* pPGStudyHorizon;
148  wxPGProperty* pPGStudyCalendarMonth;
149  wxPGProperty* pPGStudyLeapYear;
150  wxPGProperty* pPGStudyCalendarWeek;
151  wxPGProperty* pPGStudyBuildMode;
152  wxPGProperty* pPGStudyPlaylist;
153  wxPGProperty* pPGStudySimulationSynthesis;
154  wxPGProperty* pPGStudyYearByYear;
155  wxPGProperty* pPGGeographicTrimming;
156  wxPGProperty* pPGThematicTrimming;
157  wxPGProperty* pPGStudyUseMCScenarios;
158 
159  // About Areas
160  wxPGProperty* pPGAreaSeparator;
161  wxPGProperty* pPGAreaTitle;
162  wxPGProperty* pPGAreaGeneral;
163  wxPGProperty* pPGAreaOptimization;
164  wxPGProperty* pPGAreaLocalization;
165  wxPGProperty* pPGAreaFilteringStatus;
166  wxPGProperty* pPGAreaFilteringSynthesis[5];
167  wxPGProperty* pPGAreaFilteringYbY[5];
168  wxPGProperty* pPGAreaDeps;
169  wxPGProperty* pPGAreaResort;
170  wxPGProperty* pPGAreaResortNon;
171  wxPGProperty* pPGAreaResortHydroPower;
172  wxPGProperty* pPGAreaResortOther;
173  wxPGProperty* pPGUnsupplied;
174  wxPGProperty* pPGSpilled;
175  wxPGProperty* pPGAreaName;
176  wxPGProperty* pPGAreaAdequacyPatchTitle;
177  wxPGProperty* pPGAreaAdequacyPatchMode;
178  wxPGProperty* pPGAreaColor;
179  wxPGProperty* pPGAreaLinks;
180  wxPGProperty* pPGAreaPlants;
181 
182  // About links
183  wxPGProperty* pPGLinkSeparator;
184  wxPGProperty* pPGLinkFilteringStatus;
185  wxPGProperty* pPGLinkFilteringSynthesis[5];
186  wxPGProperty* pPGLinkFilteringYbY[5];
187  wxPGProperty* pPGLinkColor;
188  wxPGProperty* pPGLinkStyle;
189  wxPGProperty* pPGLinkWidth;
190 
191  // About Thermal clusters
192  wxPGProperty* pPGThClusterSeparator;
193  wxPGProperty* pPGThClusterGeneral;
194  wxPGProperty* pPGThClusterParams;
195  wxPGProperty* pPGThClusterReliabilityModel;
196  wxPGProperty* pPGThClusterCosts;
197  wxPGProperty* pPGThClusterName;
198  wxPGProperty* pPGThClusterDoGenerateTS;
199 
200 public:
201  wxPGProperty* pPGThClusterNominalCapacity;
202  wxPGProperty* pPGThClusterUnitCount;
203  wxPGProperty* pPGThClusterInstalled;
204 
205 private:
206  wxPGProperty* pPGThClusterEnabled;
207  wxPGProperty* pPGThClusterMustRun;
208  wxPGProperty* pPGThClusterGroup;
209  wxPGProperty* pPGThClusterArea;
210  wxPGProperty* pPGThClusterCO2;
211  wxPGProperty* pPGThClusterVolatilityForced;
212  wxPGProperty* pPGThClusterVolatilityPlanned;
213  wxPGProperty* pPGThClusterLawForced;
214  wxPGProperty* pPGThClusterLawPlanned;
215  wxPGProperty* pPGThClusterSpinning;
216  wxPGProperty* pPGThClusterEfficiency;
217 
218  wxPGProperty* pPGThClusterCostGeneration;
219  wxPGProperty* pPGThClusterMarginalCost;
220  wxPGProperty* pPGThClusterFixedCost;
221  wxPGProperty* pPGThClusterStartupCost;
222  wxPGProperty* pPGThClusterOperatingCost;
223  wxPGProperty* pPGThClusterRandomSpread;
224  wxPGProperty* pPGThClusterVariableOMcost;
225 
226  wxPGProperty* pPGThClusterMinStablePower;
227  wxPGProperty* pPGThClusterMinUpTime;
228  wxPGProperty* pPGThClusterMinDownTime;
229 
230  // About Renewable clusters
231  wxPGProperty* pPGRnClusterSeparator;
232  wxPGProperty* pPGRnClusterGeneral;
233  wxPGProperty* pPGRnClusterName;
234  wxPGProperty* pPGRnClusterGroup;
235  wxPGProperty* pPGRnClusterArea;
236  wxPGProperty* pPGRnClusterParams;
237 
238 public:
239  wxPGProperty* pPGRnClusterUnitCount;
240  wxPGProperty* pPGRnClusterInstalled;
241  wxPGProperty* pPGRnClusterNominalCapacity;
242 
243 private:
244  wxPGProperty* pPGRnClusterEnabled;
245  wxPGProperty* pPGRnClusterTSMode;
246 
247  // About constraints
248  wxPGProperty* pPGConstraintSeparator;
249  wxPGProperty* pPGConstraintTitle;
250  wxPGProperty* pPGConstraintName;
251  wxPGProperty* pPGConstraintGeneral;
252  wxPGProperty* pPGConstraintComments;
253  wxPGProperty* pPGConstraintEnabled;
254  wxPGProperty* pPGConstraintType;
255 
256  // Association between id and a pointer
257  // This ugly map is required because wxMenuItem/Connect() does not support
258  // user-data........
259  std::map<int, void*> mapIDPointer;
260 
261  Component::Button* pBtnInspector;
262  bool pAlreadyConnectedToSimulationChangesEvent;
263 
264  // Friend !
265  friend class InspectorGrid;
266 
267 }; // class InspectorFramce
268 
269 // Singleton
270 extern Frame* gInspector;
271 
272 } // namespace Antares::Window::Inspector
273 
274 #endif // __ANTARES_WINDOWS_INSPECTOR_FRAME_H__
Definition: button.h:32
Panel implementation.
Definition: panel.h:34
Definition: frame.h:37
Frame(wxWindow *parent, bool allowAnyObject=false)
Default constructor.
Definition: frame.cpp:200
void delayApplyGlobalSelection()
Apply the global selection (delayed)
Definition: frame.cpp:89
void detachFromTheMainForm()
Detach this inspector from the main form.
Definition: frame.cpp:633
void apply(const InspectorData::Ptr &data)
Prepare the inspector with the given selection of objects.
Definition: frame.cpp:702
virtual ~Frame()
Destructor.
Definition: frame.cpp:611
void delayApply()
Apply the current selection (delayed)
Definition: frame.cpp:79
void attachToTheMainForm()
Attach this inspector to the main form.
Definition: frame.cpp:643
std::shared_ptr< InspectorData > Ptr
The most suitable smart pointer for the class.
Definition: data.h:40
Custom implementation of a property grid.
Definition: grid.h:37
Save As Dialog
Definition: notes.h:34