Mantid
Loading...
Searching...
No Matches
IFitScriptGeneratorView.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "DllOption.h"
10
11#include "MantidAPI/IFunction.h"
16
17#include <string>
18#include <tuple>
19#include <vector>
20
21#include <QObject>
22#include <QPushButton>
23#include <QWidget>
24
25namespace MantidQt {
26namespace MantidWidgets {
27
28class AddWorkspaceDialog;
29class FitScriptGeneratorDataTable;
30class IFitScriptGeneratorPresenter;
31struct GlobalParameter;
32struct GlobalTie;
33
35 Q_OBJECT
36
37public:
38 enum class Event {
39 ADSDeleteEvent,
40 ADSClearEvent,
41 ADSRenameEvent,
42 RemoveDomainClicked,
43 AddDomainClicked,
44 AddDomainAccepted,
45 StartXChanged,
46 EndXChanged,
47 SelectionChanged,
48 FunctionRemoved,
49 FunctionAdded,
50 FunctionReplaced,
51 ParameterChanged,
52 AttributeChanged,
53 ParameterTieChanged,
54 ParameterConstraintRemoved,
55 ParameterConstraintChanged,
56 GlobalParametersChanged,
57 EditLocalParameterClicked,
58 EditLocalParameterFinished,
59 OutputBaseNameChanged,
60 FittingModeChanged,
61 GenerateScriptToFileClicked,
62 GenerateScriptToClipboardClicked
63 };
64
65 IFitScriptGeneratorView(QWidget *parent = nullptr) : API::MantidWidget(parent) {}
66 virtual ~IFitScriptGeneratorView() = default;
67
69
70 [[nodiscard]] virtual std::string workspaceName(FitDomainIndex index) const = 0;
71 [[nodiscard]] virtual WorkspaceIndex workspaceIndex(FitDomainIndex index) const = 0;
72 [[nodiscard]] virtual double startX(FitDomainIndex index) const = 0;
73 [[nodiscard]] virtual double endX(FitDomainIndex index) const = 0;
74
75 [[nodiscard]] virtual std::vector<FitDomainIndex> allRows() const = 0;
76 [[nodiscard]] virtual std::vector<FitDomainIndex> selectedRows() const = 0;
77 [[nodiscard]] virtual FitDomainIndex currentRow() const = 0;
78
79 [[nodiscard]] virtual bool hasLoadedData() const = 0;
80
81 [[nodiscard]] virtual double parameterValue(std::string const &parameter) const = 0;
82 [[nodiscard]] virtual Mantid::API::IFunction::Attribute attributeValue(std::string const &attribute) const = 0;
83
84 virtual void renameWorkspace(std::string const &workspaceName, std::string const &newName) = 0;
85
86 virtual void removeDomain(FitDomainIndex domainIndex) = 0;
87 virtual void addWorkspaceDomain(std::string const &workspaceName, WorkspaceIndex workspaceIndex, double startX,
88 double endX) = 0;
89
90 virtual void openAddWorkspaceDialog() = 0;
91 [[nodiscard]] virtual std::vector<Mantid::API::MatrixWorkspace_const_sptr> getDialogWorkspaces() = 0;
92 [[nodiscard]] virtual std::vector<WorkspaceIndex> getDialogWorkspaceIndices() const = 0;
93
94 virtual void openEditLocalParameterDialog(std::string const &parameter,
95 std::vector<std::string> const &workspaceNames,
96 std::vector<std::string> const &domainNames,
97 std::vector<double> const &values, std::vector<bool> const &fixes,
98 std::vector<std::string> const &ties,
99 std::vector<std::string> const &constraints) = 0;
100 virtual std::tuple<std::string, std::vector<double>, std::vector<bool>, std::vector<std::string>,
101 std::vector<std::string>>
103
104 [[nodiscard]] virtual std::tuple<std::string, std::string, std::string, std::string, std::string, bool>
105 fitOptions() const = 0;
106 [[nodiscard]] virtual std::string filepath() const = 0;
107
108 virtual void resetSelection() = 0;
109
110 virtual bool applyFunctionChangesToAll() const = 0;
111
112 virtual void clearFunction() = 0;
113 virtual void setFunction(Mantid::API::IFunction_sptr const &function) const = 0;
114
115 virtual void setSimultaneousMode(bool simultaneousMode) = 0;
116
117 virtual void setGlobalTies(std::vector<GlobalTie> const &globalTies) = 0;
118 virtual void setGlobalParameters(std::vector<GlobalParameter> const &globalParameter) = 0;
119
120 virtual void displayWarning(std::string const &message) = 0;
121
122 virtual void setSuccessText(std::string const &text) = 0;
123 virtual void saveTextToClipboard(std::string const &text) const = 0;
124
125public:
128 virtual QPushButton *removeButton() const = 0;
129 virtual QPushButton *addWorkspaceButton() const = 0;
131 virtual QPushButton *generateScriptToFileButton() const = 0;
132 virtual QPushButton *generateScriptToClipboardButton() const = 0;
133};
134
135} // namespace MantidWidgets
136} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
This is the base class all customised widgets that do not wish to be tied to a specific Mantid algori...
Definition: MantidWidget.h:27
A dialog for selecting a workspace from the ADS.
This class represents the table widget which holds domain data for the FitScriptGenerator interface.
virtual std::vector< FitDomainIndex > allRows() const =0
virtual QPushButton * addWorkspaceButton() const =0
virtual void subscribePresenter(IFitScriptGeneratorPresenter *presenter)=0
virtual void renameWorkspace(std::string const &workspaceName, std::string const &newName)=0
virtual void setSimultaneousMode(bool simultaneousMode)=0
virtual void setGlobalTies(std::vector< GlobalTie > const &globalTies)=0
virtual FitScriptGeneratorDataTable * tableWidget() const =0
Testing accessors.
virtual std::vector< FitDomainIndex > selectedRows() const =0
virtual Mantid::API::IFunction::Attribute attributeValue(std::string const &attribute) const =0
virtual std::tuple< std::string, std::string, std::string, std::string, std::string, bool > fitOptions() const =0
virtual void setSuccessText(std::string const &text)=0
virtual void removeDomain(FitDomainIndex domainIndex)=0
virtual std::vector< Mantid::API::MatrixWorkspace_const_sptr > getDialogWorkspaces()=0
virtual QPushButton * generateScriptToFileButton() const =0
virtual std::string workspaceName(FitDomainIndex index) const =0
virtual void addWorkspaceDomain(std::string const &workspaceName, WorkspaceIndex workspaceIndex, double startX, double endX)=0
virtual QPushButton * removeButton() const =0
virtual FitDomainIndex currentRow() const =0
virtual std::string filepath() const =0
virtual void openEditLocalParameterDialog(std::string const &parameter, std::vector< std::string > const &workspaceNames, std::vector< std::string > const &domainNames, std::vector< double > const &values, std::vector< bool > const &fixes, std::vector< std::string > const &ties, std::vector< std::string > const &constraints)=0
virtual void setGlobalParameters(std::vector< GlobalParameter > const &globalParameter)=0
virtual double endX(FitDomainIndex index) const =0
virtual double startX(FitDomainIndex index) const =0
virtual AddWorkspaceDialog * addWorkspaceDialog() const =0
virtual void displayWarning(std::string const &message)=0
virtual std::tuple< std::string, std::vector< double >, std::vector< bool >, std::vector< std::string >, std::vector< std::string > > getEditLocalParameterResults() const =0
virtual void setFunction(Mantid::API::IFunction_sptr const &function) const =0
virtual std::vector< WorkspaceIndex > getDialogWorkspaceIndices() const =0
virtual WorkspaceIndex workspaceIndex(FitDomainIndex index) const =0
virtual QPushButton * generateScriptToClipboardButton() const =0
virtual void saveTextToClipboard(std::string const &text) const =0
virtual double parameterValue(std::string const &parameter) const =0
Attribute is a non-fitting parameter.
Definition: IFunction.h:282
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
A struct to impliment strongly typed integers, without implicit conversion.
Definition: IndexTypes.h:24