Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
constraintsbuilder.h
1/*
2** Copyright 2007-2024, 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_APPLICATION_WINDOW_CONSTRAINTSBUILDER_H__
22#define __ANTARES_APPLICATION_WINDOW_CONSTRAINTSBUILDER_H__
23
24#include <wx/dialog.h>
25#include <wx/sizer.h>
26#include <wx/checkbox.h>
27#include <wx/radiobut.h>
28#include <wx/timer.h>
29#include "../../toolbox/components/datagrid/component.h"
30#include "../../toolbox/components/datagrid/renderer/constraintsbuilder/links.h"
31#include "antares/solver/constraints-builder/cbuilder.h"
32#include <ui/common/component/spotlight.h>
33#include <yuni/thread/thread.h>
34#include <yuni/core/event.h>
35
36#include <memory>
37
38namespace Antares
39{
40namespace Window
41{
42class ConstraintsBuilderWizard final : public wxDialog
43{
44public:
50 using FileMappingPtr = std::shared_ptr<FileMapping>;
51
52 enum IDs
53 {
54 mnIDCancel = wxID_HIGHEST + 1,
55 mnIDPrefixMesh,
56 mnIDPrefixGrid,
57 mnIDPrefixNetwork,
58 mnIDAutoClean,
59 mnIDUpdateInfo,
60 mnIDUpdateFileMapping,
61 mnIDGridUpdate,
62 mnIDCanRunAnalyzer,
63 };
64
65public:
67
68
71 ConstraintsBuilderWizard(wxFrame* parent);
74 void onIncludeLoopFlow(wxCommandEvent& evt);
75 void onUsePhaseShift(wxCommandEvent& evt);
76 void onUpdateLinesStatus(void*);
77 void onCheckNodalLoopFlow(wxCommandEvent& evt);
78 void onUpdateInfiniteValue(wxCommandEvent& evt);
80
81 void fileMapping(FileMappingPtr m);
82
87
91 bool saveToFile(const Yuni::String& filename) const;
92
93 const Yuni::String& cBuilderInfoFile() const
94 {
95 return pInfoFilename;
96 }
97
98 void cBuilderInfoFile(const Yuni::String& f)
99 {
100 pInfoFilename = f;
101 }
102
103 void beforeUpdate(int, int);
104 void afterUpdate(int, int);
105
106private:
107 void onCancel(void*);
108 void onBuild(void*);
109 void onDelete(void*);
110
111 void onPrefix(Component::Button&, wxMenu& menu, void*);
112 void evtPrefixChanged(wxCommandEvent& evt);
113 void enableAll(bool v);
114
115 void gridAppend(wxFlexGridSizer& sizer,
116 const wxString& title,
117 const wxString& key,
118 wxWindow* value,
119 bool bold = false);
120
121 void updateBeginningHourLabel(wxEvent& evt);
122
123 void updateEndHourLabel(wxEvent& evt);
124
125private:
126 wxStaticText* mapName;
127 wxStaticText* startingHourLabel;
128 wxStaticText* endHourLabel;
129 wxTextCtrl* startingHourCtrl;
130 wxTextCtrl* endHourCtrl;
131 wxSizer* startingHourSizer;
132 wxSizer* endHourSizer;
133 wxFlexGridSizer* pFlexSizer;
134
135 wxCheckBox* pIncludeLoopFlow;
136 wxCheckBox* pIncludePhaseShifts;
137 wxCheckBox* pCheckNodalLoopFlow;
138 wxTextCtrl* pInfiniteValue;
139
140 Yuni::String pInfoFilename;
141
142 wxButton* pBtnDelete;
143 wxButton* pBtnBuild;
144 Component::Button* pBtnPrefix;
145 wxTimer* pProceedTimer;
146
148
149 wxRadioButton* pPrefixMesh;
150 wxRadioButton* pPrefixGrid;
151 wxRadioButton* pPrefixNetwork;
152
153 bool pDelete;
154 wxStaticText* pTextDelete;
155
156 FileMappingPtr pFileMapping;
157
159 RendererType* pRenderer;
160
161 CBuilder* pCBuilder;
162
163 DECLARE_EVENT_TABLE()
164
165}; // class ConstraintsBuilderWizard
166
167} // namespace Window
168} // namespace Antares
169
170#endif // __ANTARES_APPLICATION_WINDOW_CONSTRAINTSBUILDER_H__
Definition cbuilder.h:218
Definition button.h:34
A datagrid with virtual values.
Definition component.h:84
Definition constraintsbuilder.h:43
ConstraintsBuilderWizard(wxFrame *parent)
Default constructor, with a parent frame.
Definition constraintsbuilder.cpp:76
bool saveToFile(const Yuni::String &filename) const
Export all infos into an INI file.
Definition constraintsbuilder.cpp:677
Component::Datagrid::Renderer::ConstraintsBuilder::Links::Map FileMapping
File mapping.
Definition constraintsbuilder.h:46
virtual ~ConstraintsBuilderWizard()
Destructor.
Definition constraintsbuilder.cpp:427
std::shared_ptr< FileMapping > FileMappingPtr
Smartptr for file mapping.
Definition constraintsbuilder.h:50
void refreshGrid()
Force the refresh of the grid.