casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Client.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 #ifndef CLIENT_H_
29 #define CLIENT_H_
30 
35 
36 namespace casa {
37 
38 class PlotMSPlot;
39 
45 class Client {
46 public:
47  //Returns whether or not the user can invoke a particular action.
48  virtual bool isActionEnabled( PlotMSAction::Type type ) const = 0;
49 
50  //Return the current client plot.
51  virtual std::vector<PlotMSPlot*> getCurrentPlots() const = 0;
52 
53  //Retrieve the plot load axes the user has specified.
54  virtual std::vector<std::vector<PMS::Axis> > getSelectedLoadAxes() const = 0;
55 
56  //Retrieve the release axes the user has specified.
57  virtual std::vector<std::vector<PMS::Axis> > getSelectedReleaseAxes() const = 0;
58 
59 
60 
61  //Retrieve flagging information specified by the client.
62  virtual PlotMSFlagging getFlagging() const = 0;
63 
64  //In the case of a grid of plots whether to use common x- or y- axes.
65  virtual void setCommonAxes( bool commonX, bool commonY );
66  virtual bool isCommonAxisX() const;
67  virtual bool isCommonAxisY() const;
68 
69  virtual void setAxisLocation( PlotAxis locationX, PlotAxis locationY );
70  virtual PlotAxis getAxisLocationX() const;
71  virtual PlotAxis getAxisLocationY() const;
72 
73  //Return a list of files loaded in the client
74  virtual std::vector<casacore::String> getFiles() const = 0;
75 
76 
77  //Flagging
78  virtual void setFlagging(PlotMSFlagging flag) = 0;
79 
80  //Return whether the client is interactive (a GUI) or noninteractive
81  //(a script)
82  virtual bool isInteractive() const = 0;
83 
84  virtual bool exportToFormat(const PlotExportFormat& format);
85 
86  //Save the current plot to a file.
87  virtual bool exportPlot(const PlotExportFormat& format,
88  const bool async) = 0;
89 
90  //Display an error in a client dependent way. For a GUI, this may
91  //mean popping up a dialog; for a script, this may mean writing the
92  //error to a log file or web log.
93  virtual void showError(const casacore::String& message,
94  const casacore::String& title, bool isWarning) = 0;
95 
96  //Display a message. For a GUI client, this may mean popping up a dialog;
97  //for a script client, this may mean writing the message to a log file or
98  //a web log.
99  virtual void showMessage(const casacore::String& message, const casacore::String& title, bool warning = false) = 0;
100 
101  virtual void clearMessage() = 0;
102 
103  virtual void setCanvasCachedAxesStackImageSize(int width, int height );
104 
105  //Get the abstraction that holds the plots.
106  virtual PlotterPtr getPlotter();
107 
108  //Use to enable annotations in the GUI client
109  virtual void setAnnotationModeActive( PlotMSAction::Type /*type*/, bool /*active*/ ){
110 
111  }
112 
113  //Ask the client to make a deep copy of the given plot symbol. The client
114  //(and only the client) should have access to the PlotFactory that makes
115  //the plot components.
116  virtual PlotSymbolPtr createSymbol( const PlotSymbolPtr& copy );
117  //Ask the client to make a symbol with the given specifications for insertion
118  //into the plot.
119  virtual PlotSymbolPtr createSymbol(const casacore::String& descriptor, casacore::Int size,
120  const casacore::String& color, const casacore::String& fillPattern, bool outline);
121 
122  //Logging is client (implementation) specific so that client needs to
123  //be asked for the logger.
124  virtual PlotLoggerPtr getLogger();
125 
126  //Add a plot to those displayed.
127  virtual void canvasAdded( PlotCanvasPtr& canvas ) = 0;
128 
129  //Is the plot visible?
130  virtual bool isVisible(PlotCanvasPtr& canvas );
131 
132  //The client is responsible for doing threaded operations. For a GUI
133  //client this will involve starting a background thread so that the GUI
134  //is not frozen. For a script client, this may be a no-opt as the script
135  //can just wait for the operation to complete.
136  virtual void doThreadedOperation( ThreadController* controller ) = 0;
137 
138  //FactoryMethod for producing a thread controller to manage a specific type
139  //of threaded operation. Examples include caching, exporting a plot, and
140  //drawing.
142  PMSPTMethod postThreadMethod = NULL,
143  PlotMSPlot* postThreadObject = NULL,
144  int index = 0) = 0;
145 
146 
147 
148  virtual std::vector<PlotCanvasPtr> currentCanvases();
149 
150  //Keeps resizes from flooding event loop (dragging).
151  virtual void holdDrawing();
152  virtual void releaseDrawing();
153  virtual bool allDrawingHeld() const;
154 
155  virtual void setOperationCompleted( bool completed );
156  virtual bool plot() = 0;
157  virtual void showGUI( bool show = true) = 0;
158  virtual int showAndExec(bool show = true);
159  virtual int execLoop() = 0;
160  virtual bool guiShown() const = 0;
161  virtual bool close() = 0;
162  virtual bool isDrawing() const = 0;
163  virtual bool isClosed() const = 0;
164  virtual PlotFactoryPtr getPlotFactory();
165  virtual void gridSizeChanged( int /*rowCount*/, int /*colCount*/ )=0;
166 
167 
168 protected:
169  // Plotter.
171  // Plot factory.
173 
174  Client(){};
175  virtual ~Client(){};
176 };
177 
178 }
179 #endif /* CLIENTINTERFACE_H_ */
int Int
Definition: aipstype.h:50
virtual bool plot()=0
virtual std::vector< casacore::String > getFiles() const =0
Return a list of files loaded in the client.
virtual std::vector< std::vector< PMS::Axis > > getSelectedReleaseAxes() const =0
Retrieve the release axes the user has specified.
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
virtual void showError(const casacore::String &message, const casacore::String &title, bool isWarning)=0
Display an error in a client dependent way.
virtual bool isActionEnabled(PlotMSAction::Type type) const =0
Returns whether or not the user can invoke a particular action.
virtual PlotMSFlagging getFlagging() const =0
Retrieve flagging information specified by the client.
virtual std::vector< PlotCanvasPtr > currentCanvases()
virtual int showAndExec(bool show=true)
virtual void releaseDrawing()
virtual bool isDrawing() const =0
virtual Type type()
Return the type enum.
virtual void setOperationCompleted(bool completed)
virtual bool exportPlot(const PlotExportFormat &format, const bool async)=0
Save the current plot to a file.
virtual void canvasAdded(PlotCanvasPtr &canvas)=0
Add a plot to those displayed.
virtual void showMessage(const casacore::String &message, const casacore::String &title, bool warning=false)=0
Display a message.
virtual void doThreadedOperation(ThreadController *controller)=0
The client is responsible for doing threaded operations.
virtual bool exportToFormat(const PlotExportFormat &format)
PlotFactoryPtr itsFactory_
Plot factory.
Definition: Client.h:172
virtual PlotFactoryPtr getPlotFactory()
PlotterPtr itsPlotter_
Plotter.
Definition: Client.h:170
virtual PlotSymbolPtr createSymbol(const PlotSymbolPtr &copy)
Ask the client to make a deep copy of the given plot symbol.
virtual bool close()=0
virtual void holdDrawing()
Keeps resizes from flooding event loop (dragging).
size_t size() const
void show(const variant &v)
virtual void setFlagging(PlotMSFlagging flag)=0
Flagging.
virtual ~Client()
Definition: Client.h:175
virtual int execLoop()=0
virtual bool allDrawingHeld() const
virtual bool isInteractive() const =0
Return whether the client is interactive (a GUI) or noninteractive (a script)
Specifies flagging parameters (including possibly flag extension) for an MS.
Type
Static // Enum for implemented actions.
Definition: PlotMSAction.h:51
virtual std::vector< std::vector< PMS::Axis > > getSelectedLoadAxes() const =0
Retrieve the plot load axes the user has specified.
virtual bool guiShown() const =0
Class for a single &quot;plot&quot; concept.
Definition: PlotMSPlot.h:57
virtual bool isCommonAxisY() const
PlotAxis
Enum for the four plot axes.
Definition: PlotOptions.h:62
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 ThreadController * getThreadController(PlotMSAction::Type type, PMSPTMethod postThreadMethod=NULL, PlotMSPlot *postThreadObject=NULL, int index=0)=0
FactoryMethod for producing a thread controller to manage a specific type of threaded operation...
virtual PlotLoggerPtr getLogger()
Logging is client (implementation) specific so that client needs to be asked for the logger...
virtual void setAxisLocation(PlotAxis locationX, PlotAxis locationY)
virtual PlotAxis getAxisLocationX() const
virtual void setCommonAxes(bool commonX, bool commonY)
In the case of a grid of plots whether to use common x- or y- axes.
virtual void setAnnotationModeActive(PlotMSAction::Type, bool)
Use to enable annotations in the GUI client.
Definition: Client.h:109
void PMSPTMethod(PMSPTObject, bool)
virtual bool isClosed() const =0
virtual void gridSizeChanged(int, int)=0
virtual void showGUI(bool show=true)=0
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual bool isCommonAxisX() const
virtual PlotAxis getAxisLocationY() const
virtual void clearMessage()=0
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
virtual bool isVisible(PlotCanvasPtr &canvas)
Is the plot visible?
virtual void setCanvasCachedAxesStackImageSize(int width, int height)
virtual std::vector< PlotMSPlot * > getCurrentPlots() const =0
Return the current client plot.
virtual PlotterPtr getPlotter()
Get the abstraction that holds the plots.