16#include <QApplication>
32 : m_view(view), m_model(
std::make_unique<
FunctionModel>()), m_editLocalParameterDialog(nullptr) {
37 connect(
m_view, SIGNAL(parameterTieChanged(
const QString &,
const QString &)),
this,
39 connect(
m_view, SIGNAL(parameterConstraintAdded(
const QString &,
const QString &)),
this,
41 connect(
m_view, SIGNAL(parameterConstraintRemoved(
const QString &)),
this,
43 connect(
m_view, SIGNAL(localParameterButtonClicked(
const QString &)),
this,
52 m_model->setFunction(std::move(fun));
58 m_model->setFunctionString(funStr);
86 return m_model->isParameterFixed(parName);
90 return m_model->getParameterTie(parName);
99 m_model->updateMultiDatasetParameters(fun);
104 m_model->updateMultiDatasetAttributes(fun);
119 m_model->setDatasets(datasets);
138 m_model->removeDatasets(indices);
143 return m_model->getLocalParameterValue(parName, i);
147 return m_model->isLocalParameterFixed(parName, i);
151 return m_model->getLocalParameterTie(parName, i);
155 return m_model->getLocalParameterConstraint(parName, i);
160 if (
m_model->currentDomainIndex() == i) {
167 if (
m_model->currentDomainIndex() == i) {
174 m_model->setLocalParameterFixed(parName, i, fixed);
175 if (
m_model->currentDomainIndex() == i) {
185 m_model->setLocalParameterTie(parName, i, tie);
186 if (
m_model->currentDomainIndex() == i) {
192 const QString &constraint) {
193 m_model->setLocalParameterConstraint(parName, i, constraint);
194 if (
m_model->currentDomainIndex() == i) {
202 m_model->setGlobalParameters(globals);
210 if (!paramName.isEmpty())
215 m_model->setFunctionString(funStr);
221 auto const prefixValue = prefix ? *prefix :
"";
222 m_model->addFunction(prefixValue, funStr);
228 m_model->removeFunction(functionIndex);
234 m_model->changeTie(paramName, tie);
239 m_model->addConstraint(functionIndex, constraint);
244 m_model->removeConstraint(parName);
251 QApplication::clipboard()->setText(QString::fromStdString(fun->asString()));
256 m_model->setGlobalParameters(globalParameters);
284 treeView->setStretchLastColumn(stretch);
301 }
catch (
const std::invalid_argument &e) {
317 QStringList constraints;
318 const int n = domainNames.size();
319 for (
int i = 0; i <
n; ++i) {
321 values.push_back(
value);
323 fixes.push_back(fixed);
327 constraints.push_back(constraint);
337 if (result == QDialog::Accepted) {
344 for (
int i = 0; i < values.size(); ++i) {
346 if (!ties[i].isEmpty()) {
348 }
else if (fixes[i]) {
362 for (
auto const &name :
m_model->getParameterNames()) {
377 for (
const auto &name :
m_model->getAttributeNames()) {
382 value.apply(visitor);
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index
void viewRequestedFunctionHelp()
void setParameter(const QString ¶mName, double value)
void setStretchLastColumn(bool stretch)
void updateMultiDatasetAttributes(const IFunction &fun)
void setErrorsEnabled(bool enabled)
bool isLocalParameterFixed(const QString &parName, int i) const
void attributeChanged(const QString &attributeName)
int getNumberOfDatasets() const
void viewRemovedConstraint(const QString &parName)
void setFunctionString(const QString &funStr)
void removeDatasets(QList< int > indices)
void functionStructureChanged()
void setLocalParameterValue(const QString &parName, int i, double value)
void setColumnSizes(int s0, int s1, int s2)
void editLocalParameter(const QString &parName)
Launches the Edit Local Parameter dialog and deals with the input from it.
QString getLocalParameterTie(const QString &parName, int i) const
EditLocalParameterDialog * m_editLocalParameterDialog
void viewChangedTie(const QString &parName, const QString &tie)
void setLocalParameterConstraint(const QString &parName, int i, const QString &constraint)
IFunction_sptr getFitFunction() const
void viewRemovedFunction(const QString &functionIndex)
void viewAddedFunction(const QString &funStr)
QStringList getGlobalParameters() const
void viewAddedConstraint(const QString &functionIndex, const QString &constraint)
int getCurrentDataset() const
QStringList getDatasetNames() const
void updateMultiDatasetParameters(const IFunction &fun)
void parameterChanged(const QString &funcIndex, const QString ¶mName)
QString getFitFunctionString() const
QString getFunctionString() const
void viewChangedGlobals(const QStringList &globalParameters)
QStringList getLocalParameters() const
void viewPastedFunction(const QString &funStr)
void setDatasets(const QStringList &datasetNames)
QString getParameterTie(const QString &parName) const
void updateViewAttributesFromModel()
void updateViewFromModel()
void editLocalParameterFinish(int result)
FunctionMultiDomainPresenter(IFunctionView *view)
void setNumberOfDatasets(int)
void setLocalParameterFixed(const QString &parName, int i, bool fixed)
void viewChangedAttribute(const QString &attrName)
void setCurrentDataset(int)
bool isParameterFixed(const QString &parName) const
void viewRequestedCopyToClipboard()
void updateParameters(const IFunction &fun)
double getLocalParameterValue(const QString &parName, int i) const
IFunction_sptr getFunction() const
std::unique_ptr< FunctionModel > m_model
double getParameter(const QString ¶mName)
QString getLocalParameterConstraint(const QString &parName, int i) const
void viewChangedParameter(const QString &parName)
void setParameterError(const QString ¶mName, double value)
QStringList getDatasetDomainNames() const
void setFunction(IFunction_sptr fun)
boost::optional< QString > currentFunctionIndex() const
void setLocalParameterTie(const QString &parName, int i, const QString &tie)
void setGlobalParameters(const QStringList &globals)
void addDatasets(const QStringList &datasetNames)
IFunction_sptr getFunctionByIndex(const QString &index)
void setBackgroundA0(double value)
This is an interface to a fitting function - a semi-abstarct class.
The Logger class is in charge of the publishing messages from the framework through various channels.
void error(const std::string &msg)
Logs at error level.
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Attribute visitor structure supporting lambda expressions Example usage: AttributeLambdaVisitor{[](co...