22 #include <antares/study/xcast/xcast.h>
23 #include <antares/date/date.h>
25 namespace Antares::Component::Datagrid::Renderer
27 template<enum Data::TimeSeriesType T>
35 template<enum Data::TimeSeriesType T>
41 template<enum Data::TimeSeriesType T>
53 template<enum Data::TimeSeriesType T>
56 return MatrixAncestorType::cellValue(x, y);
59 template<enum Data::TimeSeriesType T>
62 return MatrixAncestorType::cellNumericValue(x, y);
65 template<enum Data::TimeSeriesType T>
68 using namespace Antares::Data;
74 auto& xcast = *(pArea->xcastData<T>());
80 if ((uint)x >= xcast.data.width || (uint)y >= xcast.data.height)
87 case XCast::dataCoeffAlpha:
89 switch (xcast.distribution)
97 return MatrixAncestorType::cellValue(x, y,
"0");
105 if (v < 1.f || v > 50.f)
107 return MatrixAncestorType::cellValue(x, y,
"1");
113 case XCast::dataCoeffBeta:
115 switch (xcast.distribution)
123 return MatrixAncestorType::cellValue(x, y,
"0");
130 case XCast::dataCoeffGamma:
132 switch (xcast.distribution)
154 case XCast::dataCoeffDelta:
156 switch (xcast.distribution)
177 case XCast::dataCoeffTheta:
181 return MatrixAncestorType::cellValue(x, y,
"0");
185 case XCast::dataCoeffMu:
189 return MatrixAncestorType::cellValue(x, y,
"1");
193 return MatrixAncestorType::cellValue(x, y,
"23");
198 return MatrixAncestorType::cellValue(x, y, value);
201 template<enum Data::TimeSeriesType T>
207 this->matrix(&(xcastData->
data));
213 Renderer::ARendererArea::internalAreaChanged(area);
216 template<enum Data::TimeSeriesType T>
217 IRenderer::CellStyle XCastCoefficients<T>::cellStyle(
int col,
int row)
const
233 using namespace Antares::Data;
236 return IRenderer::cellStyleDefault;
238 XCast& xcast = *(pArea->xcastData<T>());
241 return IRenderer::cellStyleDefault;
244 float d = xcast.
data[col][row];
247 case XCast::dataCoeffAlpha:
252 return IRenderer::cellStyleDefaultDisabled;
257 return IRenderer::cellStyleError;
265 if (d < 1.f || d > 50.f)
267 return IRenderer::cellStyleError;
273 case XCast::dataCoeffBeta:
278 return IRenderer::cellStyleDefaultDisabled;
283 return IRenderer::cellStyleError;
291 return IRenderer::cellStyleError;
298 case XCast::dataCoeffGamma:
304 if (d > xcast.
data.entry[XCast::dataCoeffDelta][row])
306 return IRenderer::cellStyleError;
312 if (d >= xcast.
data.entry[XCast::dataCoeffDelta][row])
314 return IRenderer::cellStyleError;
319 return IRenderer::cellStyleDefaultDisabled;
325 case XCast::dataCoeffDelta:
331 if (d < xcast.
data.entry[XCast::dataCoeffGamma][row])
333 return IRenderer::cellStyleError;
339 if (d <= xcast.
data.entry[XCast::dataCoeffGamma][row])
341 return IRenderer::cellStyleError;
346 return IRenderer::cellStyleDefaultDisabled;
350 case XCast::dataCoeffTheta:
354 return IRenderer::cellStyleError;
358 case XCast::dataCoeffMu:
360 if (d < 1.f || d > 23.f)
362 return IRenderer::cellStyleError;
369 return Yuni::Math::Zero(d) ? IRenderer::cellStyleDefaultDisabled : IRenderer::cellStyleDefault;
372 template<enum Data::TimeSeriesType T>
375 return ((uint)rowIndx < 12) ? wxString() << (1 + rowIndx) << wxT(
" - ")
376 << wxStringFromUTF8(Date::MonthToString(rowIndx))
380 template<enum Data::TimeSeriesType T>
383 return Date::monthly;
386 template<enum Data::TimeSeriesType T>
393 template<enum Data::TimeSeriesType T>
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 int height() const override
Get the height of the datagrid.
virtual int width() const override
Get the width of the datagrid.
Definition: xcast-coefficients.h:31
virtual wxString columnCaption(int colIndx) const
Get the column caption.
Definition: xcast-coefficients.hxx:42
virtual double cellNumericValue(int x, int y) const
Get the value of a cell.
Definition: xcast-coefficients.hxx:60
virtual ~XCastCoefficients()
Destructor.
Definition: xcast-coefficients.hxx:36
XCastCoefficients(wxWindow *control, Toolbox::InputSelector::Area *notifier)
Constructor.
Definition: xcast-coefficients.hxx:28
virtual wxString rowCaption(int rowIndx) const
Get the row caption.
Definition: xcast-coefficients.hxx:373
virtual void onStudyClosed() override
Event: the study has been closed.
Definition: xcast-coefficients.hxx:387
virtual void onStudyLoaded() override
Event: the study has been loaded.
Definition: xcast-coefficients.hxx:394
virtual Date::Precision precision()
Time Precision.
Definition: xcast-coefficients.hxx:381
virtual wxString cellValue(int x, int y) const
Get the string representation of a cell.
Definition: xcast-coefficients.hxx:54
Definition for a single area.
Definition: area.h:51
Distribution distribution
The probability distribution to use.
Definition: xcast.h:182
@ dataMax
The maximum number of coefficients.
Definition: xcast.h:54
@ dtNormal
The normal distribution.
Definition: xcast.h:69
@ dtBeta
The Beta distribution.
Definition: xcast.h:67
@ dtUniform
The uniform distribution.
Definition: xcast.h:65
Matrix< float > data
Data required for XCast: coefficients (coeffMax x 12)
Definition: xcast.h:166
A n-by-n matrix.
Definition: matrix.h:44