Antares Simulator
Power System Simulator
area-link-renderer.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 #ifndef __ANTARES_WINDOWS_OUTPUT_PANEL_AREA_LINK_RENDERER_H__
22 #define __ANTARES_WINDOWS_OUTPUT_PANEL_AREA_LINK_RENDERER_H__
23 
24 #include "../../../toolbox/components/datagrid/renderer.h"
25 #include <yuni/core/string.h>
26 #include <antares/array/matrix.h>
27 #include "../output.h"
28 
29 namespace Antares::Private::OutputViewerData
30 {
32 {
33 public:
41  using CellType = Yuni::CString<64, false>;
42 
43 public:
45 
46 
50 
52  virtual ~AreaLinkRenderer();
54 
55  virtual int width() const;
56 
57  virtual int height() const;
58 
59  virtual wxString columnCaption(int colIndx) const;
60 
61  virtual wxString rowCaption(int rowIndx) const;
62 
63  virtual wxString cellValue(int, int) const;
64 
65  virtual double cellNumericValue(int, int) const;
66 
67  virtual bool cellValue(int x, int y, const Yuni::String& value);
68 
69  virtual void resetColors(int, int, wxColour&, wxColour&) const
70  { /*Do nothing*/
71  }
72 
73  virtual Date::Precision precision()
74  {
75  return Date::hourly;
76  }
77 
78  virtual IRenderer::CellStyle cellStyle(int, int) const;
79  virtual wxColour cellBackgroundColor(int, int) const;
80  virtual wxColour cellTextColor(int, int) const;
81  virtual wxColour verticalBorderColor(int x, int y) const;
82  virtual int cellAlignment(int, int) const;
83 
84  virtual bool valid() const;
85 
86  virtual void onScroll();
87  virtual void onSelectCell(unsigned x, unsigned y);
88  virtual void onExternalSelectCell(unsigned x, unsigned y);
89 
91 
92  void grid(DatagridType* grid)
93  {
94  pGrid = grid;
95  }
96 
98 
99 protected:
103  DatagridType* pGrid;
104 
110  uint pWidth;
112  uint pHeight;
114  std::vector<wxString> pColNames;
115  std::vector<bool> pColToUseForRowCaption;
116 
119  uint pSelectionCellY;
120 
121 }; // class AreaLinkRenderer
122 
123 } // namespace Antares::Private::OutputViewerData
124 
125 #endif // __ANTARES_WINDOWS_OUTPUT_PANEL_AREA_LINK_RENDERER_H__
A datagrid with virtual values.
Definition: component.h:84
Data provider for Datagrids.
Definition: renderer.h:50
A n-by-n matrix.
Definition: matrix.h:44
Definition: area-link-renderer.h:32
virtual wxString rowCaption(int rowIndx) const
Get the caption of a row.
Definition: area-link-renderer.cpp:205
virtual wxString columnCaption(int colIndx) const
Get the caption of a column.
Definition: area-link-renderer.cpp:196
virtual double cellNumericValue(int, int) const
Get the floating value of a Cell.
Definition: area-link-renderer.cpp:321
AreaLinkRenderer(OutputViewerComponent *component, const Antares::Matrix< CellType > *matrix)
Constructor.
Definition: area-link-renderer.cpp:32
OutputViewerComponent * pComponent
Reference to the parent control.
Definition: area-link-renderer.h:101
uint pSelectionCellX
Current selection.
Definition: area-link-renderer.h:118
const MatrixType * pMatrix
The matrix.
Definition: area-link-renderer.h:108
virtual ~AreaLinkRenderer()
Destructor.
Definition: area-link-renderer.cpp:175
virtual wxColour verticalBorderColor(int x, int y) const
Get the color of the vertical right border.
Definition: area-link-renderer.cpp:284
virtual int cellAlignment(int, int) const
Get the alignment of a cell (-1: left, 0: center, +1: right)
Definition: area-link-renderer.cpp:316
uint pWidth
The pseudo Width.
Definition: area-link-renderer.h:110
virtual void onScroll()
A scroll event has been triggered.
Definition: area-link-renderer.cpp:354
virtual wxString cellValue(int, int) const
Get the string representation of a Cell.
Definition: area-link-renderer.cpp:293
Antares::Component::Datagrid::Component DatagridType
Grid.
Definition: area-link-renderer.h:39
virtual Date::Precision precision()
Time Precision.
Definition: area-link-renderer.h:73
virtual bool cellValue(int x, int y, const Yuni::String &value)
Try to modify a cell value.
virtual int width() const
The effective width of the grid.
Definition: area-link-renderer.cpp:181
uint pHeight
The pseudo height.
Definition: area-link-renderer.h:112
virtual int height() const
The effective height of the grid.
Definition: area-link-renderer.cpp:186
Component: Viewer for simulation results.
Definition: output.h:45