00001 //# PlotMSCacheThread.qo.h: Subclass of PlotMSThread for cache loading. 00002 //# Copyright (C) 2009 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library 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 Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: $ 00027 #ifndef PLOTMSCACHETHREAD_QO_H_ 00028 #define PLOTMSCACHETHREAD_QO_H_ 00029 00030 #include <plotms/Threads/Gui/PlotMSThread.qo.h> 00031 #include <plotms/PlotMS/PlotMSSelection.h> 00032 #include <plotms/PlotMS/PlotMSAveraging.h> 00033 #include <plotms/PlotMS/PlotMSTransformations.h> 00034 #include <plotms/PlotMS/PlotMSConstants.h> 00035 00036 #include <QThread> 00037 00038 #include <vector> 00039 00040 namespace casa { 00041 00042 //# Forward Declarations 00043 class PlotMSCacheBase; 00044 class PlotMSPlotter; 00045 00046 // Subclass of PlotMSThread for loading axes in a PlotMSCache. 00047 class PlotMSCacheThread : public PlotMSThread { 00048 Q_OBJECT 00049 00050 //# Friend class declarations. 00051 friend class PlotMSCacheBase; 00052 friend class MSCache; 00053 friend class CalCache; 00054 friend class PlotMSCacheThreadHelper; 00055 00056 public: 00057 00058 PlotMSCacheThread(QtProgressWidget* progress, PlotMSPlotter* plotter, 00059 PMSPTMethod postThreadMethod = NULL, 00060 PMSPTObject postThreadObject = NULL); 00061 00062 // Destructor. 00063 ~PlotMSCacheThread(); 00064 00065 00066 // Implements PlotMSThread::startOperation(). 00067 virtual void startOperation(); 00068 00069 virtual void cancelOperation(); 00070 00071 virtual QString getName() const; 00072 virtual bool isCacheThread() const; 00073 00074 protected: 00075 00076 00077 // Allows the cache to set the progress. 00078 void setProgress(unsigned int progress) { 00079 setProgressAndStatus(progress, itsLastStatus_); } 00080 00081 // Allows the cache to set the status. 00082 void setStatus(const String& status) { 00083 setProgressAndStatus(itsLastProgress_, status); } 00084 00085 // Allows the cache to set the progress and the status. 00086 void setProgressAndStatus(unsigned int progress, const String& status); 00087 00088 // Slot for when the QThread finishes. 00089 virtual void threadFinished(); 00090 00091 private: 00092 PlotMSCacheThread( const PlotMSCacheThread& other ); 00093 PlotMSCacheThread operator=( const PlotMSCacheThread& other ); 00094 00095 // Plotter 00096 PlotMSPlotter* itsPlotter_; 00097 00098 // Data. 00099 PlotMSCacheBase* itsCache_; 00100 00101 // Load (true) or release (false) axes. 00102 bool itsLoad_; 00103 00104 // Axes. 00105 std::vector<PMS::Axis> itsAxes_; 00106 00107 // Axes data columns. 00108 std::vector<PMS::DataColumn> itsAxesData_; 00109 00110 // MS selection/averaging info 00111 String itsMSName_; 00112 PlotMSSelection itsSelection_; 00113 PlotMSAveraging itsAveraging_; 00114 PlotMSTransformations itsTransformations_; 00115 00116 // Whether to set up the cache afterwards. 00117 bool itsSetupPlot_; 00118 00119 // Last set progress. 00120 unsigned int itsLastProgress_; 00121 00122 // Last set status. 00123 String itsLastStatus_; 00124 00125 }; 00126 00127 } 00128 00129 #endif /* PLOTMSCACHETHREAD_QO_H_ */