00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef FITDIALOG_H
00030 #define FITDIALOG_H
00031
00032 #include "../../plot2D/Graph.h"
00033 #include <QDoubleSpinBox>
00034 #include <QCheckBox>
00035
00036 class QPushButton;
00037 class QLineEdit;
00038 class QComboBox;
00039 class QStackedWidget;
00040 class QWidget;
00041 class QTextEdit;
00042 class QListWidget;
00043 class QTableWidget;
00044 class QSpinBox;
00045 class QLabel;
00046 class QRadioButton;
00047 class QLineEdit;
00048 class ColorBox;
00049 class Fit;
00050 class Table;
00051 class DoubleSpinBox;
00052 class QwtPlotCurve;
00053
00055 class FitDialog : public QDialog
00056 {
00057 Q_OBJECT
00058
00059 public:
00060 FitDialog(Graph *g, QWidget* parent = 0, Qt::WFlags fl = 0 );
00061
00062 void setSrcTables(QList<MdiSubWindow*> tables);
00063
00064 protected:
00065 void closeEvent (QCloseEvent * e );
00066 void initFitPage();
00067 void initEditPage();
00068 void initAdvancedPage();
00069
00070 private slots:
00071 void accept();
00073 void resetFunction();
00074 void showFitPage();
00075 void showEditPage();
00076 void showAdvancedPage();
00077 void showFunctionsList(int category);
00078 void showParseFunctions();
00079 void showExpression(int function);
00080 void addFunction();
00081 void addFunctionName();
00082 void setFunction(bool ok);
00083 void saveUserFunction();
00084 void removeUserFunction();
00085 void setGraph(Graph *g);
00086 void activateCurve(const QString& curveName);
00087 void chooseFolder();
00088 void changeDataRange();
00089 void selectSrcTable(int tabnr);
00090 void enableWeightingParameters(int index);
00091 void showPointsBox(bool);
00092 void showParametersTable();
00093 void showCovarianceMatrix();
00094 void showResiduals();
00095 void showConfidenceLimits();
00096 void showPredictionLimits();
00097
00099 void applyChanges();
00100
00102 void deleteFitCurves();
00103
00105 void enableApplyChanges(int = 0);
00106 void setNumPeaks(int peaks);
00107 void saveInitialGuesses();
00108 void returnToFitPage();
00109 void updatePreview();
00110 void showParameterRange(bool);
00111
00112 private:
00113 void loadPlugins();
00114 void loadUserFunctions();
00115 void initBuiltInFunctions();
00116 void modifyGuesses(double* initVal);
00117 QStringList builtInFunctionNames();
00118 QStringList userFunctionNames();
00119 QStringList plugInNames();
00120 QString parseFormula(const QString& s);
00121
00122 Fit *d_current_fit;
00123 Graph *d_graph;
00124 Table *d_param_table;
00125 QList <Fit*> d_user_functions, d_built_in_functions, d_plugins;
00126 QList <MdiSubWindow*> srcTables;
00127 QwtPlotCurve *d_preview_curve;
00128
00129 QCheckBox* boxUseBuiltIn;
00130 QStackedWidget* tw;
00131 QPushButton* buttonOk;
00132 QPushButton* buttonCancel1;
00133 QPushButton* buttonCancel2;
00134 QPushButton* buttonCancel3;
00135 QPushButton* buttonAdvanced;
00136 QPushButton* buttonClear;
00137 QPushButton* buttonPlugins;
00138 QPushButton* btnBack;
00139 QPushButton* btnSaveGuesses;
00140 QComboBox* boxCurve;
00141 QComboBox* boxAlgorithm;
00142 QTableWidget* boxParams;
00143 DoubleSpinBox* boxFrom;
00144 DoubleSpinBox* boxTo;
00145 DoubleSpinBox* boxTolerance;
00146 QSpinBox* boxPoints, *generatePointsBox, *boxPrecision, *polynomOrderBox;
00147 QWidget *fitPage, *editPage, *advancedPage;
00148 QTextEdit *editBox, *explainBox, *boxFunction;
00149 QListWidget *categoryBox, *funcBox;
00150 QLineEdit *boxName, *boxParam;
00151 QLabel *lblFunction, *lblPoints, *polynomOrderLabel;
00152 QPushButton *btnAddFunc, *btnDelFunc, *btnContinue, *btnApply;
00153 QPushButton *buttonEdit, *btnAddTxt, *btnAddName, *btnDeleteFitCurves;
00154 ColorBox* boxColor;
00155 QComboBox *boxWeighting, *tableNamesBox, *colNamesBox;
00156 QRadioButton *generatePointsBtn, *samePointsBtn;
00157 QPushButton *btnParamTable, *btnCovMatrix, *btnParamRange;
00158 QPushButton *btnResiduals, *btnConfidenceLimits, *btnPredictionLimits;
00159 DoubleSpinBox *boxConfidenceLevel;
00160 QLineEdit *covMatrixName, *paramTableName;
00161 QCheckBox *plotLabelBox, *logBox, *scaleErrorsBox, *globalParamTableBox;
00162 QCheckBox *previewBox;
00163 };
00164 #endif // FITDIALOG_H