Antares Simulator
Power System Simulator
xcast-translation.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 #ifndef __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_AREA_XCAST_TRANSLATION_HXX__
22 #define __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_AREA_XCAST_TRANSLATION_HXX__
23 
24 #include <antares/study/xcast/xcast.h>
25 #include <antares/date/date.h>
26 
27 namespace Antares::Component::Datagrid::Renderer
28 {
29 template<enum Data::TimeSeriesType T>
31  MatrixAncestorType(control),
32  Renderer::ARendererArea(control, notifier)
33 {
34 }
35 
36 template<enum Data::TimeSeriesType T>
38 {
39  destroyBoundEvents();
40 }
41 
42 template<enum Data::TimeSeriesType T>
43 inline wxString XCastTranslation<T>::columnCaption(int colIndx) const
44 {
45  return MatrixAncestorType::columnCaption(colIndx);
46 }
47 
48 template<enum Data::TimeSeriesType T>
49 wxString XCastTranslation<T>::cellValue(int x, int y) const
50 {
51  return MatrixAncestorType::cellValue(x, y);
52 }
53 
54 template<enum Data::TimeSeriesType T>
55 inline double XCastTranslation<T>::cellNumericValue(int x, int y) const
56 {
57  return MatrixAncestorType::cellNumericValue(x, y);
58 }
59 
60 template<enum Data::TimeSeriesType T>
61 inline bool XCastTranslation<T>::cellValue(int x, int y, const Yuni::String& value)
62 {
63  return MatrixAncestorType::cellValue(x, y, value);
64 }
65 
66 template<enum Data::TimeSeriesType T>
68 {
69  if (area)
70  {
71  auto* xcastData = area->xcastData<T>();
72  this->matrix(&(xcastData->translation));
73  }
74  else
75  {
76  this->matrix(nullptr);
77  }
78  // parent
79  Renderer::ARendererArea::internalAreaChanged(area);
80 }
81 
82 template<enum Data::TimeSeriesType T>
83 inline IRenderer::CellStyle XCastTranslation<T>::cellStyle(int col, int row) const
84 {
85  return MatrixAncestorType::cellStyle(col, row);
86 }
87 
88 template<enum Data::TimeSeriesType T>
89 inline wxString XCastTranslation<T>::rowCaption(int rowIndx) const
90 {
91  return MatrixAncestorType::rowCaption(rowIndx);
92 }
93 
94 template<enum Data::TimeSeriesType T>
95 wxColour XCastTranslation<T>::horizontalBorderColor(int x, int y) const
96 {
97  // Getting informations about the next hour
98  // (because the returned color is about the bottom border of the cell,
99  // so the next hour for the user)
100  if (!(!study) && y + 1 < Date::Calendar::maxHoursInYear)
101  {
102  auto& hourinfo = study->calendar.hours[y + 1];
103 
104  if (hourinfo.firstHourInMonth)
105  {
106  return Default::BorderMonthSeparator();
107  }
108  if (hourinfo.firstHourInDay)
109  {
110  return Default::BorderDaySeparator();
111  }
112  }
113  return IRenderer::verticalBorderColor(x, y);
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
131 
132 #endif // __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_AREA_XCAST_TRANSLATION_HXX__
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
virtual wxColour verticalBorderColor(int x, int y) const
Get the color of the vertical right border.
Definition: renderer.hxx:69
virtual wxString columnCaption(int colIndx) const
Get the column caption.
Definition: xcast-translation.hxx:43
virtual wxString cellValue(int x, int y) const
Get the string representation of a cell.
Definition: xcast-translation.hxx:49
virtual void onStudyClosed() override
Event: the study has been closed.
Definition: xcast-translation.hxx:117
virtual wxString rowCaption(int rowIndx) const
Get the row caption.
Definition: xcast-translation.hxx:89
virtual double cellNumericValue(int x, int y) const
Get the value of a cell.
Definition: xcast-translation.hxx:55
virtual ~XCastTranslation()
Destructor.
Definition: xcast-translation.hxx:37
virtual wxColour horizontalBorderColor(int x, int y) const
Get the color of the horizontal bottom border.
Definition: xcast-translation.hxx:95
XCastTranslation(wxWindow *control, Toolbox::InputSelector::Area *notifier)
Constructor.
Definition: xcast-translation.hxx:30
virtual void onStudyLoaded() override
Event: the study has been loaded.
Definition: xcast-translation.hxx:124
Definition for a single area.
Definition: area.h:51
@ maxHoursInYear
The maximum number of hours in a year.
Definition: date.h:192
A n-by-n matrix.
Definition: matrix.h:44
Visual Component for displaying all available areas (and groups)
Definition: area.h:37