MonoStation/AbstractStation.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 ABSTRACTSTATION_H
00028 #define ABSTRACTSTATION_H
00029 
00030 #include <GeopsyGui.h>
00031 
00032 #include "StationResults.h"
00033 #include "MonoStationDLLExport.h"
00034 
00035 namespace MonoStation {
00036 
00037 class AbstractToolParameters;
00038 class WinResults;
00039 
00040 class MONOSTATION_EXPORT AbstractStation : public QObject
00041 {
00042   Q_OBJECT
00043 public:
00044   AbstractStation(StationProcessSignals * sig);
00045   virtual ~AbstractStation();
00046 
00047   void setParent(WinResults * p) {_parent=p;}
00048   WinResults * parent() const {return _parent;}
00049   int indexOf(StationResults * c) {return _results.indexOf(c);}
00050 
00051   virtual void start(AbstractToolParameters& param)=0;
00052   virtual void start(const TimeRangeList& twList, AbstractToolParameters& param)=0;
00053   void save(QDir outputDir, bool askIndividualFileName);
00054   virtual void save(int index, QDir outputDir, bool askIndividualFileName)=0;
00055 
00056   virtual int graphCount() const {return _results.count();}
00057   virtual void setResultGraph(int index, AxisWindow * w) {_results[index]->setGraph(w);}
00058   virtual AxisWindow * resultGraph(int index) const {return _results[index]->graph();}
00059 
00060   virtual void setResultLabel(int index, TextEdit * w) {_results[index]->setLabel(w);}
00061   virtual TextEdit * resultLabel(int index) const {return _results[index]->label();}
00062 
00063   void clearResults();
00064   virtual const StationResults * results(int index) const {return index<graphCount() ? _results[index] : 0;}
00065   virtual StationResults * results(int index) {return index<graphCount() ? _results[index] : 0;}
00066   virtual double resultMaxAmplitude() const;
00067   void setHighPassFilter(double frequency) {_signals->setHighPassFilter(frequency);}
00068   virtual bool isSelected() const;
00069 
00070   virtual QString name(int index) const=0;
00071   virtual QString name() const=0;
00072   QString shortFileName() const;
00073   const StationSignals * originalSignals() const {return _signals->originalSignals();}
00074   int nComponents() const {return _signals->nComponents();}
00075 
00076   SparseKeepSignal * keep(const TimeRange& r, const WindowingParameters& param, int stationIndex) const;
00077   SparseTimeRange timeRange(const TimeRange& r) const {return _signals->originalSignals()->timeRange(r);}
00078   void setSampling(SparseKeepSignal * keep) const {_signals->originalSignals()->setSampling(keep);}
00079   void setKeep(SparseKeepSignal * keep, const WindowingParameters& param, int stationIndex) const {_signals->originalSignals()->setKeep(keep,param,stationIndex);}
00080 
00081   void addWindows(const TimeRange& r, const WindowingParameters& param, const SparseKeepSignal& keep);
00082   void addWindows(QTextStream& s) {_timeWindows.add(s, &_winLog); _windowsChanged=true;}
00083   void removeWindows(const TimeRange& r);
00084   void clearAllWindows();
00085   void clearGrayWindows();
00086   void setWindowColors();
00087   bool hasGrayWindows();
00088   void inverseWindows(const TimeRange& r, const WindowingParameters& param, const SparseKeepSignal& keep);
00089   bool windowsModified() {return _windowsChanged;}
00090   TimeRange windowRange() const {return _timeWindows.timeRange();}
00091   int windowCount() const {return _timeWindows.count();}
00092   TimeWindowList& windows() {return _timeWindows;}
00093   const TimeWindow& windowAt(int index) const {return _timeWindows.at(index);}
00094 
00095   void setLog(QString& log) {_log=log;}
00096   QString windowingLog() const {return _winLog;}
00097   void clearWindowingLog() {_winLog.clear();}
00098   void addWindowingLog(const QString& t) {_winLog+=t;}
00099 public slots:
00100   void changeColors(const QVector<int>* selCurves, const QColor& col);
00101 signals:
00102   void windowsChanged();
00103 protected:
00104   SparseKeepSignal * _keep;
00105   StationProcessSignals * _signals;
00106   TimeWindowList _timeWindows;
00107 
00108   bool _windowsChanged;
00109   QString _log, _winLog;
00110 
00111   WinResults * _parent;
00112   QVector<StationResults *> _results;
00113 };
00114 
00115 } // namespace MonoStation
00116 
00117 #endif // ABSTRACTSTATION_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines