libFourierComponent 2.0(r200)
Fourier Widget
|
00001 /*************************************************************************** 00002 * Copyright (C) 2010 by Matthias Nagl * 00003 * mnagl@uni-goettingen.de * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef FOURIERCOMPONENT_H 00021 #define FOURIERCOMPONENT_H 00022 00033 #include <complex> 00034 #include <QPointer> 00035 #include <QVector> 00036 00037 #if defined(FOURIERCOMPONENT_LIBRARY) 00038 # define FOURIERCOMPONENT_EXPORT Q_DECL_EXPORT 00039 #else 00040 # define FOURIERCOMPONENT_EXPORT Q_DECL_IMPORT 00041 #endif 00042 00043 class QDomElement; 00044 class FourierWindowInterface; 00045 class QwtPlotCurve; 00046 namespace Ui { 00047 class FourierComponentToolWidget; 00048 class FourierComponentPlotWidget; 00049 } 00050 00056 class FOURIERCOMPONENT_EXPORT FourierComponent : public QObject 00057 { 00058 Q_OBJECT 00059 public: 00060 00065 FourierComponent(QObject *parent = 0); 00066 ~FourierComponent(); 00068 00069 QWidget * toolWidget(QWidget *parent = 0); 00070 QWidget * plotWidget(QWidget *parent = 0); 00074 void setExportHeader(const QString &header); 00080 void appendToDomNode(QDomElement &node) const; 00086 void initializeFromDomNode(const QDomElement &node); 00087 00088 public slots: 00093 void setRawData(const QString &name, const QVector<qreal> &rawX, const QVector<qreal> &raw, int scale); 00094 00095 private slots: 00096 void showRawData(); 00097 void showFourierSpectrum(); 00098 void computeFourierSpectrum(); 00099 void updateFourierPlot(); 00100 void updateXAxisScale(); 00101 void disableLogScaling(bool checked); 00102 void enableLogScaling(bool checked); 00103 void selectWindowFunctionStackItem(int index); 00104 void saveFourierSpectrum(); 00105 00106 private: 00107 static QString toXmlText(double value); 00108 static QString toXmlText(int value); 00109 QPointer<QWidget> toolwidget; 00110 Ui::FourierComponentToolWidget *tool; 00111 Ui::FourierComponentPlotWidget *plot; 00112 QVector<qreal> rawX; 00113 QVector<qreal> raw; 00114 QVector<qreal> fourierX; 00115 qreal fourierXmax; 00116 QVector< std::complex<double> > fourier; 00117 QwtPlotCurve *fomegaspectrum, *rawwin; 00118 QPointer<QWidget> plotwidget; 00119 QList<FourierWindowInterface*> fourierwindows; 00120 QString exportheader; 00121 QString name; 00122 int scale; 00123 }; 00124 00125 #endif