Client.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 #ifndef CLIENT_H_
00029 #define CLIENT_H_
00030 
00031 #include <plotms/Actions/PlotMSAction.h>
00032 #include <plotms/PlotMS/PlotMSFlagging.h>
00033 #include <graphics/GenericPlotter/PlotOptions.h>
00034 #include <plotms/PlotMS/PlotMSLabelFormat.h>
00035 
00036 namespace casa {
00037 
00038 class PlotMSPlot;
00039 
00045 class Client {
00046 public:
00047         //Returns whether or not the user can invoke a particular action.
00048         virtual bool isActionEnabled( PlotMSAction::Type type ) const = 0;
00049 
00050         //Return the current client plot.
00051         virtual vector<PlotMSPlot*> getCurrentPlots() const = 0;
00052 
00053         //Retrieve the plot load axes the user has specified.
00054         virtual vector<vector<PMS::Axis> > getSelectedLoadAxes() const = 0;
00055 
00056         //Retrieve the release axes the user has specified.
00057         virtual vector<vector<PMS::Axis> > getSelectedReleaseAxes() const = 0;
00058 
00059 
00060 
00061         //Retrieve flagging information specified by the client.
00062         virtual PlotMSFlagging getFlagging() const = 0;
00063 
00064         //In the case of a grid of plots whether to use common x- or y- axes.
00065         virtual void setCommonAxes( bool commonX, bool commonY );
00066         virtual bool isCommonAxisX() const;
00067         virtual bool isCommonAxisY() const;
00068 
00069         virtual void setAxisLocation( PlotAxis locationX, PlotAxis locationY );
00070         virtual PlotAxis getAxisLocationX() const;
00071         virtual PlotAxis getAxisLocationY() const;
00072 
00073         //Return a list of files loaded in the client
00074         virtual vector<String> getFiles() const = 0;
00075 
00076 
00077         //Flagging
00078         virtual void setFlagging(PlotMSFlagging flag) = 0;
00079 
00080         //Return whether the client is interactive (a GUI) or noninteractive
00081         //(a script)
00082         virtual bool isInteractive() const = 0;
00083 
00084         virtual bool exportToFormat(const PlotExportFormat& format);
00085 
00086         //Save the current plot to a file.
00087         virtual bool exportPlot(const PlotExportFormat& format,
00088                         const bool async) = 0;
00089 
00090         //Display an error in a client dependent way.  For a GUI, this may
00091         //mean popping up a dialog; for a script, this may mean writing the
00092         //error to a log file or web log.
00093         virtual void showError(const String& message,
00094                         const String& title, bool isWarning) = 0;
00095 
00096         //Display a message.  For a GUI client, this may mean popping up a dialog;
00097         //for a script client, this may mean writing the message to a log file or
00098         //a web log.
00099         virtual void showMessage(const String& message, const String& title, bool warning = false) = 0;
00100 
00101         virtual void clearMessage() = 0;
00102 
00103         virtual void setCanvasCachedAxesStackImageSize(int width, int height );
00104 
00105         //Get the abstraction that holds the plots.
00106         virtual PlotterPtr getPlotter();
00107 
00108         //Use to enable annotations in the GUI client
00109         virtual void setAnnotationModeActive( PlotMSAction::Type /*type*/, bool /*active*/ ){
00110 
00111         }
00112 
00113         //Ask the client to make a deep copy of the given plot symbol.  The client
00114         //(and only the client) should have access to the PlotFactory that makes
00115         //the plot components.
00116         virtual PlotSymbolPtr createSymbol( const PlotSymbolPtr& copy );
00117         //Ask the client to make a symbol with the given specifications for insertion
00118         //into the plot.
00119         virtual PlotSymbolPtr createSymbol(const String& descriptor, Int size,
00120                         const String& color, const String& fillPattern, bool outline);
00121 
00122         //Logging is client (implementation) specific so that client needs to
00123         //be asked for the logger.
00124         virtual PlotLoggerPtr getLogger();
00125 
00126         //Add a plot to those displayed.
00127         virtual void canvasAdded( PlotCanvasPtr& canvas ) = 0;
00128 
00129         //Is the plot visible?
00130         virtual bool isVisible(PlotCanvasPtr& canvas );
00131 
00132         //The client is responsible for doing threaded operations.  For a GUI
00133         //client this will involve starting a background thread so that the GUI
00134         //is not frozen.  For a script client, this may be a no-opt as the script
00135         //can just wait for the operation to complete.
00136         virtual void doThreadedOperation( ThreadController* controller ) = 0;
00137 
00138         //FactoryMethod for producing a thread controller to manage a specific type
00139         //of threaded operation.  Examples include caching, exporting a plot, and
00140         //drawing.
00141         virtual ThreadController* getThreadController( PlotMSAction::Type type,
00142                         PMSPTMethod postThreadMethod = NULL,
00143                         PlotMSPlot* postThreadObject = NULL,
00144                         int index = 0) = 0;
00145 
00146 
00147 
00148         virtual vector<PlotCanvasPtr> currentCanvases();
00149 
00150         //Keeps resizes from flooding event loop (dragging).
00151         virtual void holdDrawing();
00152         virtual void releaseDrawing();
00153         virtual bool allDrawingHeld() const;
00154 
00155         virtual void setOperationCompleted( bool completed );
00156         virtual bool plot() = 0;
00157         virtual void showGUI( bool show = true) = 0;
00158         virtual int showAndExec(bool show = true);
00159         virtual int execLoop() = 0;
00160         virtual bool guiShown() const = 0;
00161         virtual bool close() = 0;
00162         virtual bool isDrawing() const = 0;
00163         virtual bool isClosed() const = 0;
00164         virtual PlotFactoryPtr getPlotFactory();
00165         virtual void gridSizeChanged( int /*rowCount*/, int /*colCount*/ )=0;
00166 
00167 
00168 protected:
00169         // Plotter.
00170         PlotterPtr itsPlotter_;
00171         // Plot factory.
00172         PlotFactoryPtr itsFactory_;
00173 
00174         Client(){};
00175         virtual ~Client(){};
00176 };
00177 
00178 }
00179 #endif /* CLIENTINTERFACE_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1