QtiPlot 0.9.7.3
|
00001 /*************************************************************************** 00002 File : FitDialog.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2004-2007 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : Fit Wizard 00008 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU General Public License * 00024 * along with this program; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00026 * Boston, MA 02110-1301 USA * 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 ColorButton; 00049 class Fit; 00050 class Table; 00051 class DoubleSpinBox; 00052 class FunctionCurve; 00053 class MdiSubWindow; 00054 class ScriptEdit; 00055 00057 class FitDialog : public QDialog 00058 { 00059 Q_OBJECT 00060 00061 public: 00062 FitDialog(Graph *g, QWidget* parent = 0, Qt::WFlags fl = 0 ); 00063 00064 void setSrcTables(QList<MdiSubWindow*> tables); 00065 00066 protected: 00067 void closeEvent (QCloseEvent * e ); 00068 void initFitPage(); 00069 void initEditPage(); 00070 void initAdvancedPage(); 00071 void chooseFitModelsFolder(); 00072 void choosePluginsFolder(); 00073 00074 private slots: 00075 void accept(); 00077 void resetFunction(); 00078 void showFitPage(); 00079 void showEditPage(); 00080 void showAdvancedPage(); 00081 void showFunctionsList(int category); 00082 void showParseFunctions(); 00083 void showExpression(int function); 00084 void addFunction(); 00085 void addFunctionName(); 00086 void setFunction(bool ok); 00087 void saveUserFunction(); 00088 void removeUserFunction(); 00089 void setGraph(Graph *g); 00090 void activateCurve(const QString& curveName); 00091 void chooseFolder(); 00092 void changeDataRange(); 00093 void selectSrcTable(int tabnr); 00094 void enableWeightingParameters(int index); 00095 void showPointsBox(bool); 00096 void showParametersTable(); 00097 void showCovarianceMatrix(); 00098 void showResiduals(); 00099 void showConfidenceLimits(); 00100 void showPredictionLimits(); 00101 00103 void applyChanges(); 00104 00106 void deleteFitCurves(); 00107 00109 void enableApplyChanges(int = 0); 00110 void setNumPeaks(int peaks); 00111 void saveInitialGuesses(); 00112 void loadInitialGuesses(); 00113 void guessInitialValues(); 00114 void returnToFitPage(); 00115 void updatePreview(); 00116 void updatePreviewColor(const QColor &); 00117 void showPreview(bool on); 00118 void showParameterRange(bool); 00119 void guessParameters(); 00120 00121 private: 00122 void loadPlugins(); 00123 void loadUserFunctions(); 00124 void initBuiltInFunctions(); 00125 void modifyGuesses(double* initVal); 00126 QStringList builtInFunctionNames(); 00127 QStringList userFunctionNames(); 00128 QStringList plugInNames(); 00129 QString parseFormula(const QString& s); 00130 void setEditorTextColor(const QColor& c); 00131 void setCurrentFit(int); 00132 00133 Fit *d_current_fit; 00134 Graph *d_graph; 00135 QPointer <Table> d_param_table; 00136 QList <Fit*> d_user_functions, d_built_in_functions, d_plugins; 00137 QList <MdiSubWindow*> srcTables; 00138 FunctionCurve *d_preview_curve; 00139 00140 QCheckBox* boxUseBuiltIn; 00141 QStackedWidget* tw; 00142 QPushButton* buttonOk; 00143 QPushButton* buttonCancel1; 00144 QPushButton* buttonCancel2; 00145 QPushButton* buttonCancel3; 00146 QPushButton* buttonAdvanced; 00147 QPushButton* buttonClear; 00148 QPushButton* buttonPlugins; 00149 QPushButton* btnBack; 00150 QPushButton* btnSaveGuesses, *btnLoadGuesses, *btnGuess; 00151 QComboBox* boxCurve; 00152 QComboBox* boxAlgorithm; 00153 QTableWidget* boxParams; 00154 DoubleSpinBox* boxFrom; 00155 DoubleSpinBox* boxTo; 00156 DoubleSpinBox* boxTolerance; 00157 QSpinBox* boxPoints, *generatePointsBox, *boxPrecision, *polynomOrderBox; 00158 QWidget *fitPage, *editPage, *advancedPage; 00159 ScriptEdit *editBox; 00160 QTextEdit *explainBox, *boxFunction; 00161 QListWidget *categoryBox, *funcBox; 00162 QLineEdit *boxName; 00163 QLabel *boxErrorMsg, *boxParam; 00164 QLabel *lblFunction, *lblPoints, *polynomOrderLabel; 00165 QPushButton *btnAddFunc, *btnDelFunc, *btnContinue, *btnApply; 00166 QPushButton *buttonEdit, *btnAddTxt, *btnAddName, *btnDeleteFitCurves; 00167 ColorButton* boxColor; 00168 QComboBox *boxWeighting, *tableNamesBox, *colNamesBox; 00169 QRadioButton *generatePointsBtn, *samePointsBtn; 00170 QPushButton *btnParamTable, *btnCovMatrix, *btnParamRange; 00171 QPushButton *btnResiduals, *btnConfidenceLimits, *btnPredictionLimits; 00172 DoubleSpinBox *boxConfidenceLevel; 00173 QLineEdit *covMatrixName, *paramTableName; 00174 QCheckBox *plotLabelBox, *logBox, *scaleErrorsBox, *globalParamTableBox; 00175 QCheckBox *previewBox; 00176 }; 00177 #endif // FITDIALOG_H