00001 /*************************************************************************** 00002 ** 00003 ** This file is part of gplivemodel. 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 : 2008-10-16 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef RESULTSTHREAD_H 00028 #define RESULTSTHREAD_H 00029 00030 #include <SciFigs.h> 00031 #include <QGpCoreWave.h> 00032 00033 class ResultsThread : public Thread 00034 { 00035 Q_OBJECT 00036 public: 00037 ResultsThread(QObject * parent=0); 00038 ~ResultsThread(); 00039 00040 virtual void start(QList<GeophysicalModel *> model); 00041 void terminate() {_terminated.fetchAndStoreOrdered(true);} 00042 bool terminated() {return _terminated.testAndSetOrdered(true,true);} 00043 void setAutomaticLimits(bool a); 00044 bool automaticLimits() const {return _automaticLimits;} 00045 00046 virtual ResultsThread * clone() const=0; 00047 virtual bool setParameters(int& /*argc*/, char ** /*argv*/ ) {return true;} 00048 virtual GeophysicalModel * createModel() const=0; 00049 00050 virtual void initModelGraphs(GraphicSheet * sheet)=0; 00051 virtual void initModelGraphs(const ResultsThread& o)=0; 00052 00053 virtual void initResultsGraphs(GraphicSheet * sheet)=0; 00054 virtual void initResultsGraphs(const ResultsThread& o)=0; 00055 00056 virtual void addModel(GeophysicalModel * m)=0; 00057 virtual void setModel(GeophysicalModel * m)=0; 00058 virtual void clear() {} 00059 00060 virtual void setModelLimits()=0; 00061 virtual void setResultsLimits()=0; 00062 virtual void modelDeepUpdate()=0; 00063 virtual void resultsDeepUpdate()=0; 00064 virtual void run(GeophysicalModel * model)=0; 00065 protected: 00066 LegendWidget * createLegend(GraphicSheet * sheet, double x, double y, const QString& t); 00067 virtual void run(); 00068 00069 QAtomicInt _terminated; 00070 QList<GeophysicalModel *> _models; 00071 bool _automaticLimits; 00072 }; 00073 00074 #endif // RESULTSTHREAD_H