22#include <antares/study/xcast/xcast.h>
23#include <antares/date/date.h>
33template<enum Data::TimeSeriesType T>
40template<enum Data::TimeSeriesType T>
46template<enum Data::TimeSeriesType T>
58template<enum Data::TimeSeriesType T>
61 return MatrixAncestorType::cellValue(x, y);
64template<enum Data::TimeSeriesType T>
67 return MatrixAncestorType::cellNumericValue(x, y);
70template<enum Data::TimeSeriesType T>
73 using namespace Antares::Data;
77 auto& xcast = *(pArea->xcastData<T>());
81 if ((uint)x >= xcast.data.width || (uint)y >= xcast.data.height)
86 case XCast::dataCoeffAlpha:
88 switch (xcast.distribution)
95 return MatrixAncestorType::cellValue(x, y,
"0");
102 if (v < 1.f || v > 50.f)
103 return MatrixAncestorType::cellValue(x, y,
"1");
108 case XCast::dataCoeffBeta:
110 switch (xcast.distribution)
117 return MatrixAncestorType::cellValue(x, y,
"0");
123 case XCast::dataCoeffGamma:
125 switch (xcast.distribution)
147 case XCast::dataCoeffDelta:
149 switch (xcast.distribution)
170 case XCast::dataCoeffTheta:
173 return MatrixAncestorType::cellValue(x, y,
"0");
176 case XCast::dataCoeffMu:
179 return MatrixAncestorType::cellValue(x, y,
"1");
181 return MatrixAncestorType::cellValue(x, y,
"23");
185 return MatrixAncestorType::cellValue(x, y, value);
188template<enum Data::TimeSeriesType T>
194 this->matrix(&(xcastData->
data));
198 Renderer::ARendererArea::internalAreaChanged(area);
201template<enum Data::TimeSeriesType T>
202IRenderer::CellStyle XCastCoefficients<T>::cellStyle(
int col,
int row)
const
218 using namespace Antares::Data;
220 return IRenderer::cellStyleDefault;
221 XCast& xcast = *(pArea->xcastData<T>());
223 return IRenderer::cellStyleDefault;
225 float d = xcast.
data[col][row];
228 case XCast::dataCoeffAlpha:
233 return IRenderer::cellStyleDefaultDisabled;
237 return IRenderer::cellStyleError;
244 if (d < 1.f || d > 50.f)
245 return IRenderer::cellStyleError;
250 case XCast::dataCoeffBeta:
255 return IRenderer::cellStyleDefaultDisabled;
259 return IRenderer::cellStyleError;
265 return IRenderer::cellStyleError;
271 case XCast::dataCoeffGamma:
277 if (d > xcast.
data.entry[XCast::dataCoeffDelta][row])
278 return IRenderer::cellStyleError;
283 if (d >= xcast.
data.entry[XCast::dataCoeffDelta][row])
284 return IRenderer::cellStyleError;
288 return IRenderer::cellStyleDefaultDisabled;
294 case XCast::dataCoeffDelta:
300 if (d < xcast.
data.entry[XCast::dataCoeffGamma][row])
301 return IRenderer::cellStyleError;
306 if (d <= xcast.
data.entry[XCast::dataCoeffGamma][row])
307 return IRenderer::cellStyleError;
311 return IRenderer::cellStyleDefaultDisabled;
315 case XCast::dataCoeffTheta:
318 return IRenderer::cellStyleError;
321 case XCast::dataCoeffMu:
323 if (d < 1.f || d > 23.f)
324 return IRenderer::cellStyleError;
330 return Yuni::Math::Zero(d) ? IRenderer::cellStyleDefaultDisabled : IRenderer::cellStyleDefault;
333template<enum Data::TimeSeriesType T>
336 return ((uint)rowIndx < 12) ? wxString() << (1 + rowIndx) << wxT(
" - ")
337 << wxStringFromUTF8(Date::MonthToString(rowIndx))
341template<enum Data::TimeSeriesType T>
344 return Date::monthly;
347template<enum Data::TimeSeriesType T>
354template<enum Data::TimeSeriesType T>
virtual void onStudyClosed() override
The study has been closed.
Definition area.cpp:83
virtual void onStudyLoaded() override
Event: the study has been loaded.
Definition area.cpp:89
virtual int width() const override
Get the width of the datagrid.
Definition matrix.hxx:63
virtual void onStudyLoaded() override
Event: the study has been loaded.
Definition matrix.hxx:244
virtual void onStudyClosed() override
Event: the study has been closed.
Definition matrix.hxx:238
virtual int height() const override
Get the height of the datagrid.
Definition matrix.hxx:69
Definition xcast-coefficients.h:37
virtual wxString columnCaption(int colIndx) const
Get the column caption.
Definition xcast-coefficients.hxx:47
virtual double cellNumericValue(int x, int y) const
Get the value of a cell.
Definition xcast-coefficients.hxx:65
virtual ~XCastCoefficients()
Destructor.
Definition xcast-coefficients.hxx:41
XCastCoefficients(wxWindow *control, Toolbox::InputSelector::Area *notifier)
Constructor.
Definition xcast-coefficients.hxx:34
virtual wxString rowCaption(int rowIndx) const
Get the row caption.
Definition xcast-coefficients.hxx:334
virtual void onStudyClosed() override
Event: the study has been closed.
Definition xcast-coefficients.hxx:348
virtual void onStudyLoaded() override
Event: the study has been loaded.
Definition xcast-coefficients.hxx:355
virtual Date::Precision precision()
Time Precision.
Definition xcast-coefficients.hxx:342
virtual wxString cellValue(int x, int y) const
Get the value of a cell.
Definition xcast-coefficients.hxx:59
Definition for a single area.
Definition area.h:52
Distribution distribution
The probability distribution to use.
Definition xcast.h:182
@ 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
@ dataMax
The maximum number of coefficients.
Definition xcast.h:54