GeopsyCore/SignalFile.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyCore.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2003-11-10
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 #ifndef SIGNALFILE_H
00029 #define SIGNALFILE_H
00030 
00031 #include <QGpCoreTools.h>
00032 
00033 #include "GeopsyCoreDLLExport.h"
00034 #include "SignalFileFormat.h"
00035 
00036 namespace GeopsyCore {
00037 
00038 class Signal;
00039 class SignalDB;
00040 class SubSignalPool;
00041 class GeopsySignalHeader;
00042 class SignalFileFormat;
00043 
00044 class GEOPSYCORE_EXPORT SignalFile : public XMLClass
00045 {
00046   TRANSLATIONS("SignalFile")
00047 public:
00048   SignalFile(SignalDB * db, QString fileName="", const SignalFileFormat& format=SignalFileFormat::Unknown);
00049   SignalFile(SignalDB * db, SignalFile& f, QDir& d);
00050   ~SignalFile();
00051 
00052   virtual const QString& xml_tagName() const {return xmlSignalFileTag;}
00053   static const QString xmlSignalFileTag;
00054 
00055   SignalFile& operator=(const SignalFile& p);
00056   QString name(int len) const;
00057   QString shortName() const;
00058   // Interface function to data members
00059   QString name() const {return _name;}
00060   void setName(QString n) {_name=n;}
00061 
00062   const SignalFileFormat& format() const {return _format;}
00063   void setFormat(const SignalFileFormat& f) {_format=f;}
00064   void setFormat(QString f) {_format=SignalFileFormat::fromString(f);}
00065 
00066   bool isOriginalFile() {return _isOriginalFile;}
00067   void setOriginalFile(bool b) {_isOriginalFile=b;}
00068 
00069   SignalDB * database() const {return _db;}
00070   void setDatabase(SignalDB * db) {_db=db;}
00071 
00072   // Load signals of the file
00073   void removeFile();
00074   bool load();
00075   bool loadGeopsySignal(const SubSignalPool& subPool);
00076 
00077   static bool setTimeReference(double& t0, QDateTime& timeRef, QDateTime timeTrue);
00078   static void setSignalName(Signal * sig, QString stationName, QString sufix,
00079                              int recNum, QString fileName);
00080   bool save(const QDir& d);
00081 protected:
00082   virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00083   virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00084   virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00085   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00086   virtual void xml_polish(XML_POLISH_ARGS);
00087 private:
00088   SignalFileFormat _format;
00089   QString _name;
00090   bool _isOriginalFile;
00091   SignalDB * _db;
00092 
00093   bool loadGeopsySignal();
00094   bool loadCity2();
00095   bool loadSeg2();
00096   bool loadSegD();
00097   bool loadSu(QDataStream::ByteOrder bo);
00098   bool loadSegY(QDataStream::ByteOrder bo);
00099   bool loadPasscalSegY(QDataStream::ByteOrder bo);
00100   bool loadRD3();
00101   bool loadTomo();
00102   bool loadNiSismo();
00103   bool loadSac(QDataStream::ByteOrder bo);
00104   bool loadRadan();
00105   bool loadGse2(SignalFileFormat::Storage sto=SignalFileFormat::Multi);
00106   bool loadAsciiOneColumn();
00107   bool loadAscii();
00108   bool loadFourier();
00109   bool loadSaf();
00110   bool loadSismalp();
00111   bool loadWav();
00112   bool loadSyscomXmr();
00113   bool loadSyscomSmr();
00114   bool loadSyscomVmrx();
00115   bool loadGuralpGcf();
00116   bool loadAsciiGeoSig();
00117   bool loadMiniSeed();
00118 
00119   void warnAsciiHeader();
00120 };
00121 
00122 } // namespace GeopsyCore
00123 
00124 #endif // SIGNALFILE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines