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 : 2009-06-02 00022 ** Authors : 00023 ** Marc Wathelet 00024 ** Marc Wathelet (LGIT, Grenoble, France) 00025 ** 00026 ***************************************************************************/ 00027 00028 #ifndef SPARSEKEEPSIGNAL_H 00029 #define SPARSEKEEPSIGNAL_H 00030 00031 #include <QGpCoreTools.h> 00032 #include "GeopsyCoreDLLExport.h" 00033 #include "SparseTimeRange.h" 00034 00035 namespace GeopsyCore { 00036 00037 class KeepSignal; 00038 00039 class GEOPSYCORE_EXPORT SparseKeepSignal : private SparseTimeRange 00040 { 00041 TRANSLATIONS("SparseKeepSignal") 00042 public: 00043 SparseKeepSignal(); 00044 SparseKeepSignal(const SparseTimeRange& r); 00045 SparseKeepSignal(const SparseKeepSignal& o); 00046 ~SparseKeepSignal(); 00047 00048 bool setSampling(const TimeRange& r, double deltaT); 00049 void initValues(int value, double start=-1e99, double end=1e99); 00050 void copySamplesFrom(const SparseKeepSignal& o); 00051 00052 SparseKeepSignal * intersection(const TimeRange& r) const; 00053 void remove(const TimeRange& r); 00054 00055 SparseTimeRange timeRange() const {return *this;} 00056 QVector<KeepSignal *> keeps(const TimeRange& r) const; 00057 const QVector<KeepSignal *>& keeps() const {return _keeps;} 00058 00059 void printDebug() const {SparseTimeRange::printDebug();} 00060 private: 00061 static KeepSignal * cutStart(const KeepSignal * keep, double t); 00062 static KeepSignal * cutEnd(const KeepSignal * keep, double t); 00063 00064 QVector<KeepSignal *> _keeps; 00065 }; 00066 00067 } // namespace GeopsyCore 00068 00069 #endif // SPARSEKEEPSIGNAL_H