casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClientScript.h
Go to the documentation of this file.
1 //# PlotMSAction.h: Actions on plotms that can be triggered.
2 //# Copyright (C) 2009
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: $
27 
28 
29 #ifndef CLIENTSCRIPT_H_
30 #define CLIENTSCRIPT_H_
31 
32 #include <plotms/Client/Client.h>
34 namespace casa {
35 
36 class PlotMSPlot;
37 class PlotMSApp;
38 
43 class ClientScript : public Client {
44 public:
46  virtual ~ClientScript();
47 
48  //Returns whether or not the user can invoke a particular action.
49  virtual bool isActionEnabled( PlotMSAction::Type type ) const;
50 
51  //Return the current client plot.
52  virtual std::vector<PlotMSPlot*> getCurrentPlots() const;
53 
54  //Retrieve the plot load axes the user has specified.
55  virtual std::vector<std::vector<PMS::Axis> > getSelectedLoadAxes() const;
56 
57  //Retrieve the release axes the user has specified.
58  virtual std::vector<std::vector<PMS::Axis> > getSelectedReleaseAxes() const;
59 
60  //Retrieve flagging information specified by the client.
61  virtual PlotMSFlagging getFlagging() const;
62  virtual void setFlagging(PlotMSFlagging flag);
63 
64 
65 
66  //Return whether the client is interactive (a GUI) or noninteractive
67  //(a script)
68  virtual bool isInteractive() const;
69 
70 
71 
72 
73  //Save the current plot to a file.
74  virtual bool exportPlot(const PlotExportFormat& format, const bool async);
75 
76 
77  //Display an error in a client dependent way. For a GUI, this may
78  //mean popping up a dialog; for a script, this may mean writing the
79  //error to a log file or web log.
80  virtual void showError(const casacore::String& message, const casacore::String& title, bool warning );
81 
82  //Display a message. For a GUI client, this may mean popping up a dialog;
83  //for a script client, this may mean writing the message to a log file or
84  //a web log.
85  virtual void showMessage(const casacore::String& message, const casacore::String& title, bool warning = false);
86 
87  // only for GUI client
88  virtual void clearMessage() {};
89 
90 
91  //Add a plot to those displayed.
92  virtual void canvasAdded( PlotCanvasPtr& /*canvas*/ ){
93 
94  }
95 
96  virtual void setOperationCompleted( bool completed );
97 
98  //The client is responsible for doing threaded operations. For a GUI
99  //client this will involve starting a background thread so that the GUI
100  //is not frozen. For a script client, this may be a no-opt as the script
101  //can just wait for the operation to complete.
102  virtual void doThreadedOperation( ThreadController* /*controller*/ ){
103 
104  }
105 
106  //FactoryMethod for producing a thread controller to manage a specific type
107  //of threaded operation. Examples include caching, exporting a plot, and
108  //drawing.
110  PMSPTMethod postThreadMethod = NULL,
111  PlotMSPlot* postThreadObject = NULL,
112  int index = 0);
113 
114  virtual bool plot();
115  virtual void showGUI( bool show = true);
116 
117  virtual int execLoop() {
118  return itsFactory_->execLoop();
119  }
120  virtual bool guiShown() const {
121  return false;
122  }
123  virtual bool close() {
124  return true;
125  }
126  virtual bool isDrawing() const{
127  return false;//taskRunning;
128  }
129  virtual bool isClosed() const {
130  return false;
131  }
132  virtual void gridSizeChanged( int /*rowCount*/, int /*colCount*/ );
133 
134  virtual std::vector<casacore::String> getFiles() const;
135 
136 private:
137  void initializeCurrentPlot();
138  void initialize( Plotter::Implementation impl );
142  std::vector<PlotMSPlot*> currentPlots;
143 
145 };
146 
147 } /* namespace casa */
148 #endif /* CLIENTSCRIPT_H_ */
virtual void showMessage(const casacore::String &message, const casacore::String &title, bool warning=false)
Display a message.
void updatePlotterPageHeader()
virtual void clearMessage()
only for GUI client
Definition: ClientScript.h:88
virtual bool isInteractive() const
Return whether the client is interactive (a GUI) or noninteractive (a script)
Implementation of Client built for user scripting (non-GUI) user interface.
Definition: ClientScript.h:43
virtual Type type()
Return the type enum.
virtual bool plot()
PlotFactoryPtr itsFactory_
Plot factory.
Definition: Client.h:172
virtual bool guiShown() const
Definition: ClientScript.h:120
virtual bool isActionEnabled(PlotMSAction::Type type) const
Returns whether or not the user can invoke a particular action.
virtual bool exportPlot(const PlotExportFormat &format, const bool async)
Save the current plot to a file.
virtual ~ClientScript()
virtual std::vector< std::vector< PMS::Axis > > getSelectedLoadAxes() const
Retrieve the plot load axes the user has specified.
void show(const variant &v)
void initializeCurrentPlot()
PlotMSApp * plotController
Definition: ClientScript.h:140
virtual void canvasAdded(PlotCanvasPtr &)
Add a plot to those displayed.
Definition: ClientScript.h:92
virtual std::vector< PlotMSPlot * > getCurrentPlots() const
Return the current client plot.
Controller class for plotms.
Definition: PlotMS.h:55
virtual bool close()
Definition: ClientScript.h:123
virtual void gridSizeChanged(int, int)
Specifies flagging parameters (including possibly flag extension) for an MS.
Type
Static // Enum for implemented actions.
Definition: PlotMSAction.h:51
virtual void doThreadedOperation(ThreadController *)
The client is responsible for doing threaded operations.
Definition: ClientScript.h:102
ClientScript(PlotMSApp *app, Plotter::Implementation impl=Plotter::DEFAULT)
Implementation
Static //.
Definition: Plotter.h:48
PlotMSFlagging flagging
Definition: ClientScript.h:141
Class for a single &quot;plot&quot; concept.
Definition: PlotMSPlot.h:57
virtual void setOperationCompleted(bool completed)
PlotExportFormat contains parameters for exporting a canvas to a file.
Definition: PlotOptions.h:817
Abstraction for the interface between the client (possibly a GUI) and the model (plot engine) that is...
Definition: Client.h:45
virtual PlotMSFlagging getFlagging() const
Retrieve flagging information specified by the client.
virtual void showError(const casacore::String &message, const casacore::String &title, bool warning)
Display an error in a client dependent way.
void PMSPTMethod(PMSPTObject, bool)
virtual ThreadController * getThreadController(PlotMSAction::Type type, PMSPTMethod postThreadMethod=NULL, PlotMSPlot *postThreadObject=NULL, int index=0)
FactoryMethod for producing a thread controller to manage a specific type of threaded operation...
void initialize(Plotter::Implementation impl)
virtual void setFlagging(PlotMSFlagging flag)
Flagging.
virtual void showGUI(bool show=true)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual std::vector< casacore::String > getFiles() const
Return a list of files loaded in the client.
Default plotter implementation is set here.
Definition: Plotter.h:52
const casacore::String SCRIPT_CLIENT
Definition: ClientScript.h:144
virtual std::vector< std::vector< PMS::Axis > > getSelectedReleaseAxes() const
Retrieve the release axes the user has specified.
virtual bool isClosed() const
Definition: ClientScript.h:129
std::vector< PlotMSPlot * > currentPlots
Definition: ClientScript.h:142
virtual bool isDrawing() const
Definition: ClientScript.h:126
virtual int execLoop()
Definition: ClientScript.h:117