mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/statistics] Create a class Histogram parameter controller
Change-Id: I269ef1faa0aaecbd6d328ab0985dd428ae387702
This commit is contained in:
57
apps/statistics/histogram_parameter_controller.cpp
Normal file
57
apps/statistics/histogram_parameter_controller.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "histogram_parameter_controller.h"
|
||||
#include "app.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Statistics {
|
||||
|
||||
HistogramParameterController::HistogramParameterController(Responder * parentResponder, Data * data) :
|
||||
FloatParameterController(parentResponder),
|
||||
m_binWidthCell(EditableTextMenuListCell(&m_selectableTableView, this, m_draftTextBuffer, (char*)"Largeur des rectanges : ")),
|
||||
m_minValueCell(EditableTextMenuListCell(&m_selectableTableView, this, m_draftTextBuffer, (char*)"Debut de la serie : ")),
|
||||
m_data(data)
|
||||
{
|
||||
}
|
||||
|
||||
ExpressionTextFieldDelegate * HistogramParameterController::textFieldDelegate() {
|
||||
ExpressionTextFieldDelegate * myApp = (ExpressionTextFieldDelegate *)app();
|
||||
return myApp;
|
||||
}
|
||||
|
||||
const char * HistogramParameterController::title() const {
|
||||
return "Histogramme";
|
||||
}
|
||||
|
||||
float HistogramParameterController::parameterAtIndex(int index) {
|
||||
assert(index >= 0 && index < 2);
|
||||
if (index == 0) {
|
||||
return m_data->binWidth();
|
||||
}
|
||||
return m_data->minValue();
|
||||
}
|
||||
|
||||
void HistogramParameterController::setParameterAtIndex(int parameterIndex, float f) {
|
||||
assert(parameterIndex >= 0 && parameterIndex < 2);
|
||||
if (parameterIndex == 0) {
|
||||
m_data->setBinWidth(f);
|
||||
} else {
|
||||
m_data->setMinValue(f);
|
||||
}
|
||||
}
|
||||
|
||||
int HistogramParameterController::numberOfRows() {
|
||||
return 2;
|
||||
};
|
||||
|
||||
TableViewCell * HistogramParameterController::reusableCell(int index) {
|
||||
assert(index >= 0 && index < 2);
|
||||
if (index == 0) {
|
||||
return &m_binWidthCell;
|
||||
}
|
||||
return &m_minValueCell;
|
||||
}
|
||||
|
||||
int HistogramParameterController::reusableCellCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user