Antares Simulator
Power System Simulator
xcast-k.hxx
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 #include <antares/study/xcast/xcast.h>
23 
24 namespace Antares::Component::Datagrid::Renderer
25 {
26 template<enum Data::TimeSeriesType T>
27 XCastK<T>::XCastK(wxWindow* control, Toolbox::InputSelector::Area* notifier):
28  MatrixAncestorType(control),
29  Renderer::ARendererArea(control, notifier)
30 {
31 }
32 
33 template<enum Data::TimeSeriesType T>
35 {
36  destroyBoundEvents();
37 }
38 
39 template<enum Data::TimeSeriesType T>
40 wxString XCastK<T>::columnCaption(int colIndx) const
41 {
42  return (colIndx < 12) ? wxStringFromUTF8(Date::MonthToString(colIndx)) << wxT(" ")
43  : wxString();
44 }
45 
46 template<enum Data::TimeSeriesType T>
47 wxString XCastK<T>::cellValue(int x, int y) const
48 {
49  return MatrixAncestorType::cellValue(x, y);
50 }
51 
52 template<enum Data::TimeSeriesType T>
53 double XCastK<T>::cellNumericValue(int x, int y) const
54 {
55  return MatrixAncestorType::cellNumericValue(x, y);
56 }
57 
58 template<enum Data::TimeSeriesType T>
59 bool XCastK<T>::cellValue(int x, int y, const Yuni::String& value)
60 {
61  return MatrixAncestorType::cellValue(x, y, value);
62 }
63 
64 template<enum Data::TimeSeriesType T>
66 {
67  if (area)
68  {
69  auto* xcastData = area->xcastData<T>();
70  this->matrix(&(xcastData->K));
71  }
72  else
73  {
74  this->matrix(nullptr);
75  }
76  // parent
77  Renderer::ARendererArea::internalAreaChanged(area);
78 }
79 
80 template<enum Data::TimeSeriesType T>
81 inline IRenderer::CellStyle XCastK<T>::cellStyle(int col, int row) const
82 {
83  return MatrixAncestorType::cellStyle(col, row);
84 }
85 
86 template<enum Data::TimeSeriesType T>
87 inline wxString XCastK<T>::rowCaption(int rowIndx) const
88 {
89  return wxString() << rowIndx;
90 }
91 
92 template<enum Data::TimeSeriesType T>
93 inline int XCastK<T>::width() const
94 {
95  return MatrixAncestorType::width();
96 }
97 
98 template<enum Data::TimeSeriesType T>
99 inline int XCastK<T>::height() const
100 {
101  return MatrixAncestorType::height();
102 }
103 
104 template<enum Data::TimeSeriesType T>
105 inline uint XCastK<T>::maxWidthResize() const
106 {
107  return 0;
108 }
109 
110 template<enum Data::TimeSeriesType T>
111 inline bool XCastK<T>::valid() const
112 {
113  return MatrixAncestorType::valid();
114 }
115 
116 template<enum Data::TimeSeriesType T>
118 {
121 }
122 
123 template<enum Data::TimeSeriesType T>
125 {
128 }
129 
130 } // namespace Antares::Component::Datagrid::Renderer
virtual void onStudyClosed() override
The study has been closed.
Definition: area.cpp:86
virtual void onStudyLoaded() override
Event: the study has been loaded.
Definition: area.cpp:92
XCastK(wxWindow *control, Toolbox::InputSelector::Area *notifier)
Constructor.
Definition: xcast-k.hxx:27
virtual void onStudyClosed() override
Event: the study has been closed.
Definition: xcast-k.hxx:117
virtual wxString rowCaption(int rowIndx) const
Get the row caption.
Definition: xcast-k.hxx:87
virtual double cellNumericValue(int x, int y) const
Get the value of a cell.
Definition: xcast-k.hxx:53
virtual wxString cellValue(int x, int y) const
Get the string representation of a cell.
Definition: xcast-k.hxx:47
virtual int width() const
Get the current width.
Definition: xcast-k.hxx:93
virtual uint maxWidthResize() const
The most suitable column count.
Definition: xcast-k.hxx:105
virtual int height() const
Get the current height.
Definition: xcast-k.hxx:99
virtual void onStudyLoaded() override
Event: the study has been loaded.
Definition: xcast-k.hxx:124
virtual ~XCastK()
Destructor.
Definition: xcast-k.hxx:34
virtual wxString columnCaption(int colIndx) const
Get the column caption.
Definition: xcast-k.hxx:40
Definition for a single area.
Definition: area.h:51
A n-by-n matrix.
Definition: matrix.h:44
Visual Component for displaying all available areas (and groups)
Definition: area.h:37