Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
panel.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_WINDOWS_OUTPUT_PANEL_PANEL_H__
22#define __ANTARES_WINDOWS_OUTPUT_PANEL_PANEL_H__
23
24#include <ui/common/component/panel.h>
25#include "../fwd.h"
26#include <vector>
27#include <wx/sizer.h>
28#include <wx/statbmp.h>
29#include <antares/array/matrix.h>
30#include <yuni/core/event.h>
31
32#include <mutex>
33#include <memory>
34#include <atomic>
35
36namespace Antares
37{
38namespace Private
39{
40namespace OutputViewerData
41{
42class Panel final : public Antares::Component::Panel
43{
44public:
46 using Vector = std::vector<Panel*>;
51
54
55 class IData
56 {
57 public:
58 IData()
59 {
60 }
61 virtual ~IData()
62 {
63 }
64 };
65
66public:
68
69
72 Panel(OutputViewerComponent* component, wxWindow* parent);
74 virtual ~Panel();
76
78
79
80 void index(uint i);
82 uint index() const;
84
86
87
88 void layer(Layer* newLayer, bool forceUpdate = false);
90 const Layer* layer() const;
92 Layer* layer();
94
96
97
98 const Yuni::String& filename() const;
100
102
103
106 void forceRefresh();
108
110
111
114 void message(const wxString& msg, const char* image = NULL);
115
116 void messageMergeYbY();
118
119 void loadVirtualLayer();
120 void loadDataFromFile();
121 void loadDataFromMatrix(MatrixType* matrix);
122 void clearAllComponents();
123
124private:
125 void onProceed(void*);
126 void runMerge();
127 void executeAggregator();
128 void noData();
129
130private:
132 OutputViewerComponent* pComponent;
134 Layer* pLayer;
136 uint pIndex;
137
139 wxSizer* pSizer;
141 wxWindow* pLabelMessage;
142 wxStaticBitmap* pIconMessage;
143 wxWindow* pButton;
144 bool pShouldRebuildMessage;
145
146 std::mutex pMutex;
148 IData* pData;
150 Yuni::String pFilename;
151
153 // This method is often an async call
154 static std::atomic<int> pPanelsInCallingLoadDataFromFile;
155
156}; // class Panel
157
166std::shared_ptr<std::mutex> ProvideLockingForFileLocking(const YString& filename);
167
171void ClearAllMutexForFileLocking();
172
173} // namespace OutputViewerData
174} // namespace Private
175} // namespace Antares
176
177#include "panel.hxx"
178
179#endif // __ANTARES_WINDOWS_OUTPUT_PANEL_PANEL_H__
Panel implementation.
Definition panel.h:36
A n-by-n matrix.
Definition jit.h:30
const Yuni::String & filename() const
Get the filename currently used (empty if the layer is virtual)
Definition panel.hxx:45
void message(const wxString &msg, const char *image=NULL)
Replace the whole panel by a message with an icon.
Definition panel.cpp:294
std::vector< Panel * > Vector
Vector.
Definition panel.h:46
void forceRefresh()
Force the GUI refresh.
Definition panel.cpp:150
const Layer * layer() const
Get the attached layer (const)
Definition panel.hxx:30
virtual ~Panel()
Destructor.
Definition panel.cpp:111
uint index() const
Get the index.
Definition panel.hxx:40
Panel(OutputViewerComponent *component, wxWindow *parent)
Constructor.
Definition panel.cpp:78
Component: Viewer for simulation results.
Definition output.h:49