Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
analyzer.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_ANALYZER_H__
22#define __ANTARES_APPLICATION_WINDOW_ANALYZER_H__
23
24#include <wx/dialog.h>
25#include <wx/checkbox.h>
26#include <wx/radiobut.h>
27#include <wx/timer.h>
28#include "../../toolbox/components/datagrid/component.h"
29#include "../../toolbox/components/datagrid/renderer/analyzer/areas.h"
30#include <ui/common/component/spotlight.h>
31#include <yuni/thread/thread.h>
32#include <yuni/core/event.h>
33
34#include <memory>
35
36namespace Antares
37{
38namespace Window
39{
41{
42public:
45
47
48
51 FileSearchProvider() = default;
53 ~FileSearchProvider() override = default;
55
59 void search(Spotlight::IItem::Vector& out,
60 const Spotlight::SearchToken::Vector& tokens,
61 const Yuni::String& text = "") override;
62
66 bool onSelect(Spotlight::IItem::Ptr&) override;
67
68 void onFileSearchAdd(const YString& filename);
69
70 void onFileSearchClear();
71
72private:
74 YString::Vector pFiles;
75};
76
77class AnalyzerWizard final : public wxDialog
78{
79public:
85 using FileMappingPtr = std::shared_ptr<FileMapping>;
86
87 enum IDs
88 {
89 mnIDCancel = wxID_HIGHEST + 1,
90 mnIDTmpUseDefault,
91 mnIDTmpUseStudyUserDir,
92 mnIDTmpUseCustom,
93 mnIDAutoClean,
94 mnIDUpdateInfo,
95 mnIDUpdateFileMapping,
96 mnIDGridUpdate,
97 mnIDCanRunAnalyzer,
98 };
99
100public:
107
108public:
110
111
114 AnalyzerWizard(wxFrame* parent);
116 virtual ~AnalyzerWizard();
118
119 void info(const Yuni::NullPtr&);
120 void info(const AnyString& text);
121
122 void fileMapping(FileMappingPtr m);
123
127 void refreshGrid();
128
129 void enableAnalyzer(bool v);
130
134 void recheckEachArea();
135
139 bool saveToFile(const Yuni::String& filename) const;
140
141 const Yuni::String& analyzerInfoFile() const
142 {
143 return pInfoFilename;
144 }
145
146 void analyzerInfoFile(const Yuni::String& f)
147 {
148 pInfoFilename = f;
149 }
150
151private:
152 void onCancel(void*);
153 void onProceed(void*);
154
155 void onBrowse(void*);
156 void onBrowseMenu(Component::Button&, wxMenu& menu, void*);
157 void onBrowseRefresh(wxCommandEvent&);
158 void onBrowseOpenInExplorer(wxCommandEvent&);
159 void onBrowseReset(wxCommandEvent&);
160
161 void onSelectTimeseries(Component::Button&, wxMenu& menu, void*);
162 void onSelectTSLoad(wxCommandEvent&);
163 void onSelectTSWind(wxCommandEvent&);
164 void onSelectTSSolar(wxCommandEvent&);
165
166 void onBrowseTemp(void* evt);
167 void evtUpdateInfo(wxCommandEvent& evt);
168 void evtUpdateFileMapping(wxCommandEvent& evt);
169 void evtGridUpdate(wxCommandEvent& evt);
170 void evtCanRunAnalyzer(wxCommandEvent& evt);
171 void evtTemporaryPathSelectorChanged(wxCommandEvent& evt);
172 void evtLimitsChanged(wxCommandEvent& evt);
173 void updateInfoForTempFolder();
174 void updateMaxTimeseries();
175
176 void browseDataFolder(const wxString& p);
177
178 void enableAll(bool v);
179
180 void beforeUpdate(int, int);
181 void afterUpdate(int, int);
182
183private:
184 Yuni::Event<void(bool, uint)> onUpdateMaxTimeseries;
185 Yuni::Event<void(Data::TimeSeriesType)> onUpdateTimeseriesType;
186
188
189 Yuni::Event<void()> onFileSearchClear;
190 Yuni::Event<void(const Yuni::String&)> onFileSearchAdd;
192
193 Yuni::String pInfoFilename;
194 wxTextCtrl* pPath;
195 wxTextCtrl* pPathTemp;
196 wxButton* pBtnRun;
197 wxButton* pBtnBrowseTemp;
198 wxCheckBox* pAutoClean;
199 wxRadioButton* pTmpUseDefault;
200 wxRadioButton* pTmpUseStudyUserDir;
201 wxRadioButton* pTmpUseCustom;
202 wxStaticText* pLblInfo;
203 wxStaticText* pLblCleanInfo;
205 wxTimer* pRefreshTimer;
206 wxTimer* pProceedTimer;
207
208 wxCheckBox* pCbMaxTimeseries;
209 wxCheckBox* pCbUpperBound;
210 wxCheckBox* pCbLowerBound;
211
212 wxTextCtrl* pEdShortTermAutoCorr;
213 wxTextCtrl* pEdMediumTermAutoCorr;
214 wxTextCtrl* pEdTrim;
215 wxTextCtrl* pEdMaxTimeseries;
216 wxTextCtrl* pEdLowerBound;
217 wxTextCtrl* pEdUpperBound;
218
219 Yuni::Thread::IThread* pAnalyzeSource;
220 Yuni::Thread::IThread* pCheckRelationship;
221 FileMappingPtr pFileMapping;
222
223 Component::Spotlight* pFileSearch;
224
225 Data::TimeSeriesType pTSSelected;
226 Component::Button* pTSSelector;
227
228 bool pUpdating;
229
231 RendererType* pRenderer;
232
233 std::shared_ptr<FileSearchProvider> mProvider;
234
235 DECLARE_EVENT_TABLE()
236
237}; // class AnalyzerWizard
238
239} // namespace Window
240} // namespace Antares
241
242#include "analyzer.hxx"
243
244#endif // __ANTARES_APPLICATION_WINDOW_ANALYZER_H__
A datagrid with virtual values.
Definition component.h:84
std::map< Yuni::String, Yuni::String > Map
Map of string.
Definition areas.h:45
Data Provider.
Definition spotlight.h:31
Definition spotlight.h:40
Definition analyzer.h:78
void refreshGrid()
Force the refresh of the grid.
Definition analyzer.cpp:1248
void recheckEachArea()
Force the analyze of each area.
Definition analyzer.cpp:1316
virtual ~AnalyzerWizard()
Destructor.
Definition analyzer.cpp:1000
Component::Datagrid::Renderer::Analyzer::Areas::Map FileMapping
File mapping.
Definition analyzer.h:81
bool saveToFile(const Yuni::String &filename) const
Export all infos into an INI file.
Definition analyzer.cpp:1385
AnalyzerWizard(wxFrame *parent)
Default constructor, with a parent frame.
Definition analyzer.cpp:544
static void ResetLastFolderToCurrentStudyUser()
Reset the address of the last used folder.
Definition analyzer.cpp:513
std::shared_ptr< FileMapping > FileMappingPtr
Smartptr for file mapping.
Definition analyzer.h:85
Definition analyzer.h:41
bool onSelect(Spotlight::IItem::Ptr &) override
An item has been selected.
Definition analyzer.cpp:498
FileSearchProvider()=default
Default constructor.
~FileSearchProvider() override=default
Destructor.
void search(Spotlight::IItem::Vector &out, const Spotlight::SearchToken::Vector &tokens, const Yuni::String &text="") override
Perform a new search.
Definition analyzer.cpp:462