FitDialog.h

Go to the documentation of this file.
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 ColorBox;
00049 class Fit;
00050 class Table;
00051 class DoubleSpinBox;
00052 class FunctionCurve;
00053 class MdiSubWindow;
00054 
00056 class FitDialog : public QDialog
00057 {
00058     Q_OBJECT
00059 
00060 public:
00061     FitDialog(Graph *g, QWidget* parent = 0, Qt::WFlags fl = 0 );
00062 
00063     void setSrcTables(QList<MdiSubWindow*> tables);
00064 
00065 protected:
00066     void closeEvent (QCloseEvent * e );
00067     void initFitPage();
00068     void initEditPage();
00069     void initAdvancedPage();
00070     void chooseFitModelsFolder();
00071     void choosePluginsFolder();
00072 
00073 private slots:
00074     void accept();
00076     void resetFunction();
00077     void showFitPage();
00078     void showEditPage();
00079     void showAdvancedPage();
00080     void showFunctionsList(int category);
00081     void showParseFunctions();
00082     void showExpression(int function);
00083     void addFunction();
00084     void addFunctionName();
00085     void setFunction(bool ok);
00086     void saveUserFunction();
00087     void removeUserFunction();
00088     void setGraph(Graph *g);
00089     void activateCurve(const QString& curveName);
00090     void chooseFolder();
00091     void changeDataRange();
00092     void selectSrcTable(int tabnr);
00093     void enableWeightingParameters(int index);
00094     void showPointsBox(bool);
00095     void showParametersTable();
00096     void showCovarianceMatrix();
00097     void showResiduals();
00098     void showConfidenceLimits();
00099     void showPredictionLimits();
00100 
00102     void applyChanges();
00103 
00105     void deleteFitCurves();
00106 
00108     void enableApplyChanges(int = 0);
00109     void setNumPeaks(int peaks);
00110     void saveInitialGuesses();
00111     void returnToFitPage();
00112     void updatePreview();
00113     void updatePreviewColor(int);
00114     void showPreview(bool on);
00115     void showParameterRange(bool);
00116     void guessParameters();
00117 
00118 private:
00119     void loadPlugins();
00120     void loadUserFunctions();
00121     void initBuiltInFunctions();
00122     void modifyGuesses(double* initVal);
00123     QStringList builtInFunctionNames();
00124     QStringList userFunctionNames();
00125     QStringList plugInNames();
00126     QString parseFormula(const QString& s);
00127     void setEditorTextColor(const QColor& c);
00128     void setCurrentFit(int);
00129 
00130     Fit *d_current_fit;
00131     Graph *d_graph;
00132     Table *d_param_table;
00133     QList <Fit*> d_user_functions, d_built_in_functions, d_plugins;
00134     QList <MdiSubWindow*> srcTables;
00135     FunctionCurve *d_preview_curve;
00136 
00137     QCheckBox* boxUseBuiltIn;
00138     QStackedWidget* tw;
00139     QPushButton* buttonOk;
00140     QPushButton* buttonCancel1;
00141     QPushButton* buttonCancel2;
00142     QPushButton* buttonCancel3;
00143     QPushButton* buttonAdvanced;
00144     QPushButton* buttonClear;
00145     QPushButton* buttonPlugins;
00146     QPushButton* btnBack;
00147     QPushButton* btnSaveGuesses;
00148     QComboBox* boxCurve;
00149     QComboBox* boxAlgorithm;
00150     QTableWidget* boxParams;
00151     DoubleSpinBox* boxFrom;
00152     DoubleSpinBox* boxTo;
00153     DoubleSpinBox* boxTolerance;
00154     QSpinBox* boxPoints, *generatePointsBox, *boxPrecision, *polynomOrderBox;
00155     QWidget *fitPage, *editPage, *advancedPage;
00156     QTextEdit *editBox, *explainBox, *boxFunction;
00157     QListWidget *categoryBox, *funcBox;
00158     QLineEdit *boxName;
00159     QLabel *boxErrorMsg, *boxParam;
00160     QLabel *lblFunction, *lblPoints, *polynomOrderLabel;
00161     QPushButton *btnAddFunc, *btnDelFunc, *btnContinue, *btnApply;
00162     QPushButton *buttonEdit, *btnAddTxt, *btnAddName, *btnDeleteFitCurves;
00163     ColorBox* boxColor;
00164     QComboBox *boxWeighting, *tableNamesBox, *colNamesBox;
00165     QRadioButton *generatePointsBtn, *samePointsBtn;
00166     QPushButton *btnParamTable, *btnCovMatrix, *btnParamRange;
00167     QPushButton *btnResiduals, *btnConfidenceLimits, *btnPredictionLimits;
00168     DoubleSpinBox *boxConfidenceLevel;
00169     QLineEdit *covMatrixName, *paramTableName;
00170     QCheckBox *plotLabelBox, *logBox, *scaleErrorsBox, *globalParamTableBox;
00171     QCheckBox *previewBox;
00172 };
00173 #endif // FITDIALOG_H

Generated by  doxygen 1.6.2