Antares Simulator
Power System Simulator
cell.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 
22 #pragma once
23 
24 #include <wx/string.h>
25 #include "../renderer.h"
26 #include <map>
27 
28 using namespace Yuni;
29 
30 namespace Antares::Component::Datagrid::Renderer
31 {
32 using namespace Antares::Data;
33 
34 class Cell: public Yuni::IEventObserver<Cell>
35 {
36 public:
37  Cell(TimeSeriesType ts);
38  ~Cell();
39  virtual wxString cellValue() const = 0;
40  virtual double cellNumericValue() const = 0;
41  virtual bool setCellValue(const String& value) = 0;
42  virtual IRenderer::CellStyle cellStyle() const = 0;
43 
44 protected:
45  void onStudyLoaded();
46  virtual bool isTSgeneratorOn() const;
47 
48 protected:
49  Data::Study::Ptr study_;
50  TimeSeriesType tsKind_;
51 };
52 
53 class blankCell: public Cell
54 {
55 public:
56  blankCell();
57  ~blankCell() = default;
58  wxString cellValue() const override;
59  double cellNumericValue() const override;
60  bool setCellValue(const String& value) override;
61  IRenderer::CellStyle cellStyle() const override;
62 };
63 
64 class inactiveCell: public Cell
65 {
66 public:
67  inactiveCell(wxString toPrintInCell);
68  ~inactiveCell() = default;
69  wxString cellValue() const override;
70  double cellNumericValue() const override;
71  bool setCellValue(const String& value) override;
72  IRenderer::CellStyle cellStyle() const override;
73 
74 private:
75  wxString toBePrintedInCell_;
76 };
77 
78 class readyMadeTSstatus: public Cell
79 {
80 public:
81  readyMadeTSstatus(TimeSeriesType ts);
82  ~readyMadeTSstatus() = default;
83  wxString cellValue() const override;
84  double cellNumericValue() const override;
85  bool setCellValue(const String& value) override;
86  IRenderer::CellStyle cellStyle() const override;
87 };
88 
89 class generatedTSstatus: public Cell
90 {
91 public:
92  generatedTSstatus(TimeSeriesType ts);
93  ~generatedTSstatus() = default;
94  wxString cellValue() const override;
95  double cellNumericValue() const override;
96  bool setCellValue(const String& value) override;
97  IRenderer::CellStyle cellStyle() const override;
98 };
99 
100 class NumberTsCell: public Cell
101 {
102 public:
103  NumberTsCell(TimeSeriesType ts);
104  ~NumberTsCell() = default;
105  wxString cellValue() const override;
106  double cellNumericValue() const override;
107  bool setCellValue(const String& value) override;
108  IRenderer::CellStyle cellStyle() const override;
109 
110 private:
111  void onStudyLoaded();
112 
113 private:
114  std::map<TimeSeriesType, uint*> tsToNumberTs_;
115 };
116 
118 {
119 public:
121  IRenderer::CellStyle cellStyle() const override;
122 };
123 
124 class RefreshTsCell: public Cell
125 {
126 public:
127  RefreshTsCell(TimeSeriesType ts);
128  ~RefreshTsCell() = default;
129  wxString cellValue() const override;
130  double cellNumericValue() const override;
131  bool setCellValue(const String& value) override;
132  IRenderer::CellStyle cellStyle() const override;
133 };
134 
136 {
137 public:
139  IRenderer::CellStyle cellStyle() const override;
140 };
141 
142 class RefreshSpanCell: public Cell
143 {
144 public:
145  RefreshSpanCell(TimeSeriesType ts);
146  ~RefreshSpanCell() = default;
147  wxString cellValue() const override;
148  double cellNumericValue() const override;
149  bool setCellValue(const String& value) override;
150  IRenderer::CellStyle cellStyle() const override;
151 
152 private:
153  void onStudyLoaded();
154 
155 private:
156  std::map<TimeSeriesType, uint*> tsToRefreshSpan_;
157 };
158 
160 {
161 public:
163  IRenderer::CellStyle cellStyle() const override;
164 };
165 
167 {
168 public:
169  SeasonalCorrelationCell(TimeSeriesType ts);
170  ~SeasonalCorrelationCell() = default;
171  virtual wxString cellValue() const override;
172  double cellNumericValue() const override;
173  bool setCellValue(const String& value) override;
174  IRenderer::CellStyle cellStyle() const override;
175 
176 private:
177  void onStudyLoaded();
178 
179 private:
180  std::map<TimeSeriesType, Correlation*> tsToCorrelation_;
181 };
182 
184 {
185 public:
187  wxString cellValue() const override;
188  IRenderer::CellStyle cellStyle() const override;
189 };
190 
191 class storeToInputCell: public Cell
192 {
193 public:
194  storeToInputCell(TimeSeriesType ts);
195  ~storeToInputCell() = default;
196  wxString cellValue() const override;
197  double cellNumericValue() const override;
198  bool setCellValue(const String& value) override;
199  IRenderer::CellStyle cellStyle() const override;
200 };
201 
202 class storeToOutputCell: public Cell
203 {
204 public:
205  storeToOutputCell(TimeSeriesType ts);
206  ~storeToOutputCell() = default;
207  wxString cellValue() const override;
208  double cellNumericValue() const override;
209  bool setCellValue(const String& value) override;
210  IRenderer::CellStyle cellStyle() const override;
211 };
212 
213 class intraModalCell: public Cell
214 {
215 public:
216  intraModalCell(TimeSeriesType ts);
217  ~intraModalCell() = default;
218  wxString cellValue() const override;
219  double cellNumericValue() const override;
220  bool setCellValue(const String& value) override;
221  IRenderer::CellStyle cellStyle() const override;
222 };
223 
224 class interModalCell: public Cell
225 {
226 public:
227  interModalCell(TimeSeriesType ts);
228  ~interModalCell() = default;
229  wxString cellValue() const override;
230  double cellNumericValue() const override;
231  bool setCellValue(const String& value) override;
232  IRenderer::CellStyle cellStyle() const override;
233 };
234 
235 } // namespace Antares::Component::Datagrid::Renderer