casa
$Rev:20696$
|
00001 //# PlotMSDrawThread.qo.h: Subclass of PlotMSThread for drawing. 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 PLOTMSDRAWTHREAD_QO_H_ 00028 #define PLOTMSDRAWTHREAD_QO_H_ 00029 00030 #include <plotms/Actions/PlotMSThread.qo.h> 00031 00032 #include <vector> 00033 00034 #include <casa/namespace.h> 00035 00036 namespace casa { 00037 00038 //# Forward Declarations 00039 class PlotMSPlotter; 00040 00041 // Subclass of PlotMSThread that handles following the progress of canvas 00042 // drawing. 00043 class PlotMSDrawThread : public PlotMSThread, public PlotOperationWatcher { 00044 Q_OBJECT 00045 00046 public: 00047 // Constructor which takes the plotter, and optional post-thread method 00048 // parameters. 00049 PlotMSDrawThread(PlotMSPlotter* plotter, 00050 PMSPTMethod postThreadMethod = NULL, 00051 PMSPTObject postThreadObject = NULL); 00052 00053 // Destructor. 00054 ~PlotMSDrawThread(); 00055 00056 00057 // Updates the internal list of canvases based upon the parent 00058 // PlotMSPlotter. 00059 void updatePlotterCanvases(); 00060 00061 // Implements PlotMSThread::startOperation(). 00062 void startOperation(); 00063 00064 bool isDrawing() const; 00065 00066 // Implements PlotOperationWatcher::operationChanged(). 00067 void operationChanged(const PlotOperation& operation); 00068 00069 protected: 00070 // Implements PlotMSThread::wasCanceled(). 00071 bool wasCanceled() const; 00072 00073 protected slots: 00074 // Implements PlotMSThread::background(). Currently is unimplemented. 00075 void background(); 00076 00077 // Implements PlotMSThread::pause(). Currently is unimplemented. 00078 void pause(); 00079 00080 // Implements PlotMSThread::resume(). Currently is unimplemented. 00081 void resume(); 00082 00083 // Implements PlotMSThread::cancel(). Currently is unimplemented. 00084 void cancel(); 00085 00086 private: 00087 // Parent plotter. 00088 PlotMSPlotter* itsPlotter_; 00089 00090 // Operations. 00091 vector<PlotOperationPtr> itsOperations_; 00092 00093 // Mutex for accessing operations. 00094 QMutex itsOperationsMutex_; 00095 00096 // Flag for if thread is currently running or not. 00097 bool isRunning_; 00098 00099 // Flag indicating that one or more operations tried to call 00100 // operationChanged() while the operations mutex was locked. 00101 bool itsOperationFlag_; 00102 00103 // Flag for whether thread was canceled or not. 00104 bool wasCanceled_; 00105 }; 00106 00107 } 00108 00109 #endif /* PLOTMSDRAWTHREAD_QO_H_ */