MonoStation/StationResults.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of MonoStation.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created : 2007-08-17
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (LGIT, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef STATIONRESULTS_H
00028 #define STATIONRESULTS_H
00029 
00030 #include <GeopsyCore.h>
00031 #include <SciFigs.h>
00032 
00033 #include "MonoStationDLLExport.h"
00034 
00035 namespace MonoStation {
00036 
00037 class AbstractStation;
00038 
00039 class MONOSTATION_EXPORT StationResults : public QObject
00040 {
00041   Q_OBJECT
00042 public:
00043   StationResults();
00044 
00045   enum PeakValue {PeakFrequency, PeakAmplitude};
00046 
00047   void setParent(AbstractStation * p) {_parent=p;}
00048   AbstractStation * parent() const {return _parent;}
00049 
00050   void setGraph(AxisWindow * w);
00051   AxisWindow * graph() const {return _averageLayer->graph();}
00052 
00053   void setLabel(TextEdit * l) {_label=l;}
00054   TextEdit * label() const {return _label;}
00055 
00056   void clear();
00057 
00058   void setWindows(int winCount, SamplingParameters& samp);
00059   void addWindows(int winCount);
00060   int windowCount() const {return _winCount;}
00061   void setWindow(int winIndex, DoubleSignal * sig);
00062   void setWindowColor(int winIndex, const QColor& col);
00063   void setWindowColor(const QVector<int>* selCurves, const QColor& col);
00064   void setT10Layer(double averageWindowLength);
00065   void setAverageLayer();
00066   void setPeakLayer();
00067   void setVisibleLayers(int visibleLayers);
00068   void save(QString fileName, QString log);
00069   void load(QString fileName) {loadAverage(fileName);}
00070 
00071   const QString& category() const {return _category;}
00072   void setCategory(const QString& c);
00073 
00074   const QString& stationName() const {return _stationName;}
00075   void setStationName(const QString& n) {_stationName=n;}
00076 
00077   const Point& coordinates() const {return _coordinates;}
00078   void setCoordinates(const Point& p) {_coordinates=p;}
00079 
00080   const Curve<Point2D>& averageCurve() const;
00081   const Curve<Point2D>& minimumCurve() const;
00082   const Curve<Point2D>& maximumCurve() const;
00083 
00084   void clearPeaks();
00085   void addPeak(double minFreq, double maxFreq);
00086   void setPeak(int index, double minFreq, double maxFreq);
00087   void removePeak(int index);
00088 
00089   int peakCount() const;
00090   int windowPeakCount(int ib) const {return _nWindowsForPeaks.at(ib);}
00091   double peak(int ib, PeakValue pv) const;
00092   double peakMinimum(int ib) const;
00093   double peakMaximum(int ib) const;
00094   double lowestPeak(PeakValue pv) const;
00095   double highestPeak(PeakValue pv) const;
00096   double maximumAmplitudePeak(PeakValue pv) const;
00097   double maximumAmplitude() const;
00098 
00099   void printAverage() const;
00100   void printWindows() const;
00101   void printPeaks() const;
00102 
00103   void derivate();
00104   void integrate();
00105 
00106   ParallelBands * t10Layer() const {return _t10Layer;}
00107   ParallelBands * peakLayer() const {return _peakLayer;}
00108   XUniqueYColorLines * windowsLayer() const {return _windowsLayer;}
00109   LineLayer * averageLayer() const {return _averageLayer;}
00110   LineLayer * stddevLayer() const {return _stddevLayer;}
00111 private slots:
00112   void blackWindows(int, const QVector<int>* selCurves);
00113 signals:
00114   void colorsToChange(const QVector<int>* selCurves, const QColor& col);
00115   void showColors(bool);
00116   void peakChanged();
00117 protected:
00118   virtual QString comments() const;
00119 private:
00120   Curve<Point2D>& averageCurve();
00121   Curve<Point2D>& stddevCurve(int index);
00122   void createAverageLines();
00123   void setPeak(int index, int minFreq, int maxFreq);
00124   int averageMax(const Curve<Point2D>& meanCurve) const;
00125   int max(const double * y, int minFreq, int maxFreq) const;
00126   int frequency2Index(const double * x, double f);
00127   void saveLog(QString fileName, QString log);
00128   void saveAverage(QString fileName);
00129   void loadAverage(QString fileName);
00130   void setToolTips();
00131 
00132   AbstractStation * _parent;
00133 
00134   ParallelBands * _t10Layer;
00135   ParallelBands * _peakLayer;
00136   XUniqueYColorLines * _windowsLayer;
00137   LineLayer * _averageLayer;
00138   LineLayer * _stddevLayer;
00139   TextEdit * _label;
00140 
00141   QString _category;
00142   QString _stationName;
00143   Point _coordinates;
00144   int _winCount;
00145   int _nSamples;
00146   int _nSamples2;
00147   QVector<int> _nWindowsForPeaks;
00148 };
00149 
00150 } // namespace MonoStation
00151 
00152 #endif // STATIONRESULTS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines