ClientScript.h

Go to the documentation of this file.
00001 //# PlotMSAction.h: Actions on plotms that can be triggered.
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 
00028 
00029 #ifndef CLIENTSCRIPT_H_
00030 #define CLIENTSCRIPT_H_
00031 
00032 #include <plotms/Client/Client.h>
00033 #include <plotms/Plots/PlotMSPlotParameters.h>
00034 namespace casa {
00035 
00036 class PlotMSPlot;
00037 class PlotMSApp;
00038 
00043 class ClientScript : public Client {
00044 public:
00045         ClientScript( PlotMSApp* app,Plotter::Implementation impl = Plotter::DEFAULT);
00046         virtual ~ClientScript();
00047 
00048         //Returns whether or not the user can invoke a particular action.
00049         virtual bool isActionEnabled( PlotMSAction::Type type ) const;
00050 
00051         //Return the current client plot.
00052         virtual vector<PlotMSPlot*> getCurrentPlots() const;
00053 
00054         //Retrieve the plot load axes the user has specified.
00055         virtual vector<vector<PMS::Axis> > getSelectedLoadAxes() const;
00056 
00057         //Retrieve the release axes the user has specified.
00058         virtual vector<vector<PMS::Axis> > getSelectedReleaseAxes() const;
00059 
00060         //Retrieve flagging information specified by the client.
00061         virtual PlotMSFlagging getFlagging() const;
00062         virtual void setFlagging(PlotMSFlagging flag);
00063 
00064         
00065 
00066         //Return whether the client is interactive (a GUI) or noninteractive
00067         //(a script)
00068         virtual bool isInteractive() const;
00069 
00070         
00071 
00072 
00073         //Save the current plot to a file.
00074         virtual bool exportPlot(const PlotExportFormat& format, const bool async);
00075 
00076 
00077         //Display an error in a client dependent way.  For a GUI, this may
00078         //mean popping up a dialog; for a script, this may mean writing the
00079         //error to a log file or web log.
00080         virtual void showError(const String& message, const String& title, bool warning );
00081 
00082         //Display a message.  For a GUI client, this may mean popping up a dialog;
00083         //for a script client, this may mean writing the message to a log file or
00084         //a web log.
00085         virtual void showMessage(const String& message, const String& title, bool warning = false);
00086 
00087         // only for GUI client
00088         virtual void clearMessage() {};
00089 
00090 
00091         //Add a plot to those displayed.
00092         virtual void canvasAdded( PlotCanvasPtr& /*canvas*/ ){
00093 
00094         }
00095 
00096         virtual void setOperationCompleted( bool completed );
00097 
00098         //The client is responsible for doing threaded operations.  For a GUI
00099         //client this will involve starting a background thread so that the GUI
00100         //is not frozen.  For a script client, this may be a no-opt as the script
00101         //can just wait for the operation to complete.
00102         virtual void doThreadedOperation( ThreadController* /*controller*/ ){
00103 
00104         }
00105 
00106         //FactoryMethod for producing a thread controller to manage a specific type
00107         //of threaded operation.  Examples include caching, exporting a plot, and
00108         //drawing.
00109         virtual ThreadController* getThreadController( PlotMSAction::Type type,
00110                         PMSPTMethod postThreadMethod = NULL,
00111                         PlotMSPlot* postThreadObject = NULL,
00112                         int index = 0);
00113 
00114         virtual bool plot();
00115         virtual void showGUI( bool show = true);
00116 
00117         virtual int execLoop() {
00118                 return itsFactory_->execLoop();
00119         }
00120         virtual bool guiShown() const {
00121                 return false;
00122         }
00123         virtual bool close() {
00124                 return true;
00125         }
00126         virtual bool isDrawing() const{
00127                 return false;//taskRunning;
00128         }
00129         virtual bool isClosed() const {
00130                 return false;
00131         }
00132         virtual void gridSizeChanged( int /*rowCount*/, int /*colCount*/ );
00133 
00134         virtual vector<String> getFiles() const;
00135 
00136 private:
00137         void initializeCurrentPlot();
00138         void initialize( Plotter::Implementation impl );
00139         PlotMSApp* plotController;
00140         PlotMSFlagging flagging;
00141         vector<PlotMSPlot*> currentPlots;
00142 
00143         const String SCRIPT_CLIENT;
00144 };
00145 
00146 } /* namespace casa */
00147 #endif /* CLIENTSCRIPT_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1