casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlotMSDBusApp.h
Go to the documentation of this file.
1 //# PlotMSDBusApp.h: Controller for plotms using DBus.
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 #ifndef PLOTMSDBUSAPP_H_
28 #define PLOTMSDBUSAPP_H_
29 
34 
35 namespace casa {
36 
37 //# Forward declarations.
38 //class PlotEngine;
39 
40 
41 // Subclass of QtDBusXmlApp to control plotms using DBus communication.
44 
45  //# Friend class declarations.
46  friend class PlotMSDBusAppWatcher;
47 
48 public:
49 
50  static const QString &name( );
51  QString dbusName( ) const { return QString(name( )); }
52 
53  // Static //
54 
55  // Constants for the casaplotms standalone executable.
56  // <group>
57  static const casacore::String APP_NAME;
61  // </group>
62 
63 
64  // PARAMETERS //
65 
66  // Parameter names.
67  // <group>
68  static const casacore::String PARAM_AVERAGING; // casacore::Record (see PlotMSAveraging)
69  static const casacore::String PARAM_AXIS_X; // String
70  static const casacore::String PARAM_AXIS_Y; // String
72  static const casacore::String PARAM_SHOWATM; // bool
73  static const casacore::String PARAM_SHOWTSKY; // bool
74  static const casacore::String PARAM_SHOWIMAGE; // bool
75  static const casacore::String PARAM_GRIDROWS; //int
76  static const casacore::String PARAM_GRIDCOLS; //int
78  static const casacore::String PARAM_DATACOLUMN_X; // String
79  static const casacore::String PARAM_DATACOLUMN_Y; // String
80  static const casacore::String PARAM_FRAME_X; // String
81  static const casacore::String PARAM_FRAME_Y; // String
82  static const casacore::String PARAM_INTERP_X; // String
83  static const casacore::String PARAM_INTERP_Y; // String
84  static const casacore::String PARAM_DATA_INDEX; //int
85  static const casacore::String PARAM_FILENAME; // String
86  static const casacore::String PARAM_FLAGGING; // Record
87  static const casacore::String PARAM_HEIGHT; // int or uInt
88  static const casacore::String PARAM_ITERATE; // casacore::Record (see PlotMSIterParam)
89  static const casacore::String PARAM_PLOTINDEX; // int or uInt
90  static const casacore::String PARAM_PRIORITY; // String
91  static const casacore::String PARAM_SELECTION; // casacore::Record (see PlotMSSelection)
92  static const casacore::String PARAM_TRANSFORMATIONS; // casacore::Record (see PlotMSTransformations)
93  static const casacore::String PARAM_CALIBRATION; // casacore::Record (see PlotMSCalibration)
94  static const casacore::String PARAM_PAGE_HEADER_ITEMS; // String
96  static const casacore::String PARAM_WIDTH; // int or uInt
97  static const casacore::String PARAM_EXPORT_FILENAME; // String
98  static const casacore::String PARAM_EXPORT_FORMAT; //String
99  static const casacore::String PARAM_EXPORT_VERBOSE; // bool
100  static const casacore::String PARAM_EXPORT_RANGE; //String
102  static const casacore::String PARAM_EXPORT_DPI; // int
106  static const casacore::String PARAM_EXPORT_ASYNC; // bool
107  static const casacore::String PARAM_COLORIZE; // bool
108  static const casacore::String PARAM_COLORAXIS; // string
109  static const casacore::String PARAM_CANVASTITLE; // string
111  static const casacore::String PARAM_SHOWXLABEL; // bool
112  static const casacore::String PARAM_SHOWYLABEL; // bool
113  static const casacore::String PARAM_XAXISLABEL; // string
114  static const casacore::String PARAM_YAXISLABEL; // string
115  static const casacore::String PARAM_XAXISFONT; // int
116  static const casacore::String PARAM_YAXISFONT; // int
117  static const casacore::String PARAM_SHOWMAJORGRID; // bool
118  static const casacore::String PARAM_SHOWMINORGRID; // bool
119  static const casacore::String PARAM_MAJORCOLOR; // string
120  static const casacore::String PARAM_MINORCOLOR; // string
121  static const casacore::String PARAM_MAJORSTYLE; // string
122  static const casacore::String PARAM_MINORSTYLE; // string
123  static const casacore::String PARAM_MAJORWIDTH; // int
124  static const casacore::String PARAM_MINORWIDTH; // int
125  static const casacore::String PARAM_SHOWLEGEND; //bool
126  static const casacore::String PARAM_LEGENDPOSITION; //string
127  static const casacore::String PARAM_XAUTORANGE; // bool
128  static const casacore::String PARAM_XMIN; // double
129  static const casacore::String PARAM_XMAX; // double
130  static const casacore::String PARAM_YAUTORANGE; // bool
131  static const casacore::String PARAM_YMIN; // double
132  static const casacore::String PARAM_YMAX; // double
133  static const casacore::String PARAM_SYMBOL; // bool
134  static const casacore::String PARAM_SYMBOLSHAPE; // string
135  static const casacore::String PARAM_SYMBOLSIZE; // int
136  static const casacore::String PARAM_SYMBOLCOLOR; // string
137  static const casacore::String PARAM_SYMBOLFILL; // string
138  static const casacore::String PARAM_SYMBOLOUTLINE; // bool
139  static const casacore::String PARAM_FLAGGEDSYMBOL; // bool
145  static const casacore::String PARAM_XCONNECTOR; // string
146  static const casacore::String PARAM_TIMECONNECTOR; // bool
147 
148 
149  // </group>
150 
151  // DBus method name for getting the log parameters, including: the sink
152  // filename (PARAM_FILENAME) and the filter priority (PARAM_PRIORITY).
153  // PARAMETERS: none.
154  // RETURNS: value (casacore::Record), unless invalid or run asynchronously.
156 
157  // DBus method name for setting the log parameters, using a casacore::Record with
158  // zero or more of the parameters set (see METHOD_GETLOGPARAMS).
159  // PARAMETERS: value (casacore::Record).
160  // RETURNS: none.
162 
163  // DBus method name for getting the plotms parameters, including: the
164  // "clear selections on axes change" flag (PARAM_CLEARSELECTIONS), and the
165  // cached image width (PARAM_WIDTH) and height (PARAM_HEIGHT).
166  // PARAMETERS: none.
167  // RETURNS: value (casacore::Record), unless invalid or run asynchronously.
169 
170  // DBus method name for setting the plotms parameters, using a casacore::Record with
171  // zero or more of the parameters set (see METHOD_GETPLOTMSPARAMS).
172  // PARAMETERS: value (casacore::Record).
173  // RETURNS: none.
175 
176  // DBus method name for setting the cached image size to the current screen
177  // resolution.
178  // PARAMETERS: none.
179  // RETURNS: none.
181 
182  // DBus method name for getting the plot parameters at the given index
183  // (PARAM_PLOTINDEX), including: the casacore::MS filename (PARAM_FILENAME), the x
184  // axis (PARAM_AXIS_X) and data column (PARAM_DATACOLUMN_X), the y axis
185  // (PARAM_AXIS_Y) and data column (PARAM_DATACOLUMN_Y), averaging
186  // (PARAM_AVERAGING), selection (PARAM_SELECTION), transformations
187  // (PARAM_TRANSFORMATIONS), and calibration (PARAM_CALIBRATION)
188  // PARAMETERS: plot index.
189  // RETURNS: value (casacore::Record), unless invalid or run asynchronously.
191 
192  // DBus method name for setting the plot parameters at the given index
193  // (PARAM_PLOTINDEX), using a casacore::Record with zero or more of the parameters
194  // set (see METHOD_GETPLOTPARAMS).
195  // PARAMETERS: value (casacore::Record).
196  // RETURNS: none.
198 
199  //Sets the export parameters.
200  // PARAMETERS: value (casacore::Record).
201  // RETURNS: none.
203 
204  // DBus method name for getting the flag extension parameters
205  // (PARAM_FLAGGING).
206  // PARAMETERS: none.
207  // RETURNS: value (casacore::Record), unless invalid or run asynchronously.
209 
210  // DBus method name for setting the flag extension parameters.
211  // PARAMETERS: flagging value.
212  // RETURNS: none.
214 
215  // DBus method names for showing/hiding the window. Does NOT quit the
216  // entire application.
217  // PARAMETERS: none.
218  // RETURNS: none.
219  // <group>
222  // </group>
223 
224  // DBus method name for updating the running PlotMS with any attributes
225  // that were set with updateImmediately = false.
226  // PARAMETERS: none.
227  // RETURNS: none.
229 
230  //Existing plots should be removed.
231  //PARAMETERS: none.
232  //RETURNS: none.
234 
235  // DBus method name for quitting the entire application.
236  // PARAMETERS: none.
237  // RETURNS: none.
239 
240  //DBus method name for exporting plot file.
241 
243 
244  //DBus method name for determining if a plot is being drawn
246 
247  //is the top widget still shown
249 
250  // DBus method name for locating points in a specified region
251  // PARAMETERS: upper left and lower right bounding box coordinates
252  // RETURNS: meta data of located points (casacore::Record)
254 
255  // Returns the name that the plotms in the process with the given ID is (or
256  // would be) registered with in the CASA DBus server.
257  static casacore::String dbusName(pid_t pid);
258 
259  // Non-Static //
260 
261  // Constructor which takes PlotMS parent object.
262  PlotMSDBusApp(PlotEngine& plotms);
263 
264  // Destructor.
265  ~PlotMSDBusApp();
266 
267  // Connects to the DBus server using the dbusName() method with the current
268  // process ID. Returns whether the connection succeeded or not.
269  bool connectToDBus( const QString &dbus_name="" );
270 
271  // Implements PlotMSParametersWatcher::parametersHaveChanged().
273  const PlotMSWatchedParameters& params, int updateFlag
274  );
275 
276  // Implements PlotMSPlotManagerWatcher::plotsChanged().
277  void plotsChanged(const PlotMSPlotManager& manager);
278 
279 protected:
280  // Implements QtDBusXmlApp::dbusRunXmlMethod().
281  void dbusRunXmlMethod(
282  const casacore::String& methodName, const casacore::Record& parameters,
283  casacore::Record& retValue, const casacore::String& callerName, bool isAsync
284  );
285 
286  // Overrides QtDBusXmlApp::dbusXmlReceived() to print the message to the log
287  // as needed.
288  void dbusXmlReceived(const QtDBusXML& xml);
289 
290 private:
291  // Parent PlotMS.
292  //PlotMSApp& itsPlotms_;
294 
295  // Set PlotMS parameters that haven't yet been transferred to the current
296  // PlotMS.
298 
299  // Set PlotMSSinglePlot parameters that haven't yet been transfered to the
300  // current PlotMS.
301  std::vector<PlotMSPlotParameters> itsPlotParams_;
302 
303  // Flag for whether to call update() during show() or not. This will be
304  // true if the user updates something while the GUI is hidden.
306 
307  // Helper methods for posting log messages.
308  void log(const casacore::String& message);
309  void logWarn(const casacore::String& message);
310 
311  // Adjusts the given plot index to be an acceptable, and returns whether
312  // the parameters were resized or not.
313  bool plotParameters(int& plotIndex) const;
314 
315  // Helper for updating.
316  bool update();
317 
318  // helper for saving
319  bool _savePlot(const casacore::Record& parameters);
320 
321  // helper for locate
322  casacore::Record _locateInfo(const casacore::Record& parameters);
323 
324  //Make sure users don't set the plot index to an invalid value.
325  bool checkPlotIndex( int index );
326 
327 };
328 
329 }
330 
331 #endif /* PLOTMSDBUSAPP_H_ */
static const casacore::String METHOD_SETFLAGGING
DBus method name for setting the flag extension parameters.
static const casacore::String PARAM_YMIN
static const casacore::String PARAM_DATACOLUMN_X
Definition: PlotMSDBusApp.h:78
static const casacore::String APP_NAME
Static //.
Definition: PlotMSDBusApp.h:57
static const casacore::String METHOD_SHOW
DBus method names for showing/hiding the window.
static const casacore::String PARAM_FILENAME
Definition: PlotMSDBusApp.h:85
static const casacore::String PARAM_FLAGGEDSYMBOLOUTLINE
void dbusXmlReceived(const QtDBusXML &xml)
Overrides QtDBusXmlApp::dbusXmlReceived() to print the message to the log as needed.
PlotMSParameters itsParams_
Set PlotMS parameters that haven&#39;t yet been transferred to the current PlotMS.
static const casacore::String PARAM_AXIS_X
Definition: PlotMSDBusApp.h:69
static const casacore::String PARAM_EXPORT_ASYNC
static const casacore::String PARAM_TRANSFORMATIONS
Definition: PlotMSDBusApp.h:92
static const casacore::String PARAM_YAXISFONT
static const casacore::String METHOD_GETPLOTPARAMS
DBus method name for getting the plot parameters at the given index (PARAM_PLOTINDEX), including: the casacore::MS filename (PARAM_FILENAME), the x axis (PARAM_AXIS_X) and data column (PARAM_DATACOLUMN_X), the y axis (PARAM_AXIS_Y) and data column (PARAM_DATACOLUMN_Y), averaging (PARAM_AVERAGING), selection (PARAM_SELECTION), transformations (PARAM_TRANSFORMATIONS), and calibration (PARAM_CALIBRATION) PARAMETERS: plot index.
Subclass of QDomDocument that represents an XML scheme that is to be used with CASA&#39;s Qt dbus communi...
Definition: QtDBusXML.h:55
static const casacore::String PARAM_MAJORCOLOR
casacore::Record _locateInfo(const casacore::Record &parameters)
helper for locate
static const casacore::String PARAM_FLAGGEDSYMBOLCOLOR
static const casacore::String METHOD_ISCLOSED
is the top widget still shown
static const casacore::String PARAM_SYMBOLOUTLINE
static const casacore::String PARAM_CANVASTITLEFONT
static const casacore::String PARAM_EXPORT_FILENAME
Definition: PlotMSDBusApp.h:97
PlotEngine & itsPlotms_
Parent PlotMS.
static const casacore::String PARAM_FRAME_X
Definition: PlotMSDBusApp.h:80
static const casacore::String PARAM_CALIBRATION
Definition: PlotMSDBusApp.h:93
static const casacore::String PARAM_XMIN
static const casacore::String PARAM_SHOWMAJORGRID
static const casacore::String PARAM_COLORAXIS
static const casacore::String PARAM_SYMBOLSIZE
static const casacore::String PARAM_MINORCOLOR
static const casacore::String PARAM_SHOWMINORGRID
Subclass of PlotMSWatchedParameters that hold parameters for the whole plotter.
static const QString & name()
static const casacore::String PARAM_EXPORT_HEIGHT
static const casacore::String PARAM_FLAGGING
Definition: PlotMSDBusApp.h:86
static const casacore::String METHOD_GETLOGPARAMS
DBus method name for getting the log parameters, including: the sink filename (PARAM_FILENAME) and th...
static const casacore::String METHOD_SETPLOTMSPARAMS
DBus method name for setting the plotms parameters, using a casacore::Record with zero or more of the...
static const casacore::String METHOD_SETCACHEDIMAGESIZETOSCREENRES
DBus method name for setting the cached image size to the current screen resolution.
static const casacore::String PARAM_CLEARSELECTIONS
Definition: PlotMSDBusApp.h:77
static const casacore::String PARAM_GRIDROWS
Definition: PlotMSDBusApp.h:75
static const casacore::String PARAM_HEIGHT
Definition: PlotMSDBusApp.h:87
static const casacore::String APP_LOGFILTER_SWITCH
Definition: PlotMSDBusApp.h:60
static const casacore::String PARAM_EXPORT_HIGHRES
static const casacore::String PARAM_PLOTINDEX
Definition: PlotMSDBusApp.h:89
static const casacore::String METHOD_SETEXPORTPARAMS
Sets the export parameters.
Abstract class for parameters that may be watched by one or more interested classes.
QString dbusName() const
Definition: PlotMSDBusApp.h:51
static const casacore::String PARAM_YAUTORANGE
static const casacore::String PARAM_EXPORT_WIDTH
static const casacore::String PARAM_PAGE_HEADER_ITEMS
Definition: PlotMSDBusApp.h:94
bool checkPlotIndex(int index)
Make sure users don&#39;t set the plot index to an invalid value.
static const casacore::String PARAM_MINORSTYLE
static const casacore::String PARAM_EXPORT_RANGE
static const casacore::String PARAM_XMAX
bool plotParameters(int &plotIndex) const
Adjusts the given plot index to be an acceptable, and returns whether the parameters were resized or ...
static const casacore::String PARAM_DATA_INDEX
Definition: PlotMSDBusApp.h:84
static const casacore::String PARAM_INTERP_X
Definition: PlotMSDBusApp.h:82
static const casacore::String PARAM_FLAGGEDSYMBOLSHAPE
class PlotEngine;
Definition: PlotMSDBusApp.h:42
static const casacore::String PARAM_SHOWTSKY
Definition: PlotMSDBusApp.h:73
static const casacore::String PARAM_SHOWATM
Definition: PlotMSDBusApp.h:72
static const casacore::String APP_CASAPY_SWITCH
Definition: PlotMSDBusApp.h:58
static const casacore::String PARAM_COLORIZE
static const casacore::String PARAM_FLAGGEDSYMBOLSIZE
void parametersHaveChanged(const PlotMSWatchedParameters &params, int updateFlag)
Implements PlotMSParametersWatcher::parametersHaveChanged().
static const casacore::String PARAM_LEGENDPOSITION
static const casacore::String PARAM_TIMECONNECTOR
static const casacore::String PARAM_FRAME_Y
Definition: PlotMSDBusApp.h:81
static const casacore::String PARAM_YAXISLABEL
void plotsChanged(const PlotMSPlotManager &manager)
Implements PlotMSPlotManagerWatcher::plotsChanged().
static const casacore::String PARAM_DATACOLUMN_Y
Definition: PlotMSDBusApp.h:79
static const casacore::String PARAM_SELECTION
Definition: PlotMSDBusApp.h:91
static const casacore::String METHOD_SETLOGPARAMS
DBus method name for setting the log parameters, using a casacore::Record with zero or more of the pa...
static const casacore::String PARAM_SHOWIMAGE
Definition: PlotMSDBusApp.h:74
PlotMSDBusApp(PlotEngine &plotms)
Non-Static //.
Abstract parent of classes that want to register themselves with CASA&#39;s DBus server.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
static const casacore::String PARAM_SHOWLEGEND
void dbusRunXmlMethod(const casacore::String &methodName, const casacore::Record &parameters, casacore::Record &retValue, const casacore::String &callerName, bool isAsync)
Implements QtDBusXmlApp::dbusRunXmlMethod().
static const casacore::String METHOD_ISDRAWING
DBus method name for determining if a plot is being drawn.
static const casacore::String PARAM_WIDTH
Definition: PlotMSDBusApp.h:96
static const casacore::String METHOD_GETPLOTMSPARAMS
DBus method name for getting the plotms parameters, including: the &quot;clear selections on axes change&quot; ...
static const casacore::String PARAM_XAXISLABEL
Interface for any class that wants to be notified when the plots in the manager have changed...
static const casacore::String METHOD_SAVE
DBus method name for exporting plot file.
static const casacore::String PARAM_AVERAGING
PARAMETERS //.
Definition: PlotMSDBusApp.h:68
void logWarn(const casacore::String &message)
static const casacore::String METHOD_LOCATEINFO
DBus method name for locating points in a specified region PARAMETERS: upper left and lower right bou...
void log(const casacore::String &message)
Helper methods for posting log messages.
static const casacore::String PARAM_SHOWXLABEL
static const casacore::String PARAM_EXPORT_FORMAT
Definition: PlotMSDBusApp.h:98
std::vector< PlotMSPlotParameters > itsPlotParams_
Set PlotMSSinglePlot parameters that haven&#39;t yet been transfered to the current PlotMS.
bool update()
Helper for updating.
static const casacore::String PARAM_SHOWYLABEL
static const casacore::String PARAM_MAJORSTYLE
static const casacore::String PARAM_CANVASTITLE
static const casacore::String METHOD_UPDATE
DBus method name for updating the running PlotMS with any attributes that were set with updateImmedia...
static const casacore::String PARAM_UPDATEIMMEDIATELY
Definition: PlotMSDBusApp.h:95
static const casacore::String PARAM_XAUTORANGE
static const casacore::String PARAM_EXPORT_DPI
static const casacore::String METHOD_CLEARPLOTS
Existing plots should be removed.
bool _savePlot(const casacore::Record &parameters)
helper for saving
Interface for classes that wish to be notified when PlotMSWatchedParameters have changed.
static const casacore::String METHOD_HIDE
static const casacore::String PARAM_SYMBOLCOLOR
static const casacore::String PARAM_AXIS_Y_LOCATION
Definition: PlotMSDBusApp.h:71
static const casacore::String PARAM_SYMBOL
static const casacore::String PARAM_FLAGGEDSYMBOLFILL
static const casacore::String PARAM_MAJORWIDTH
static const casacore::String PARAM_FLAGGEDSYMBOL
static const casacore::String PARAM_YMAX
static const casacore::String PARAM_INTERP_Y
Definition: PlotMSDBusApp.h:83
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static const casacore::String METHOD_GETFLAGGING
DBus method name for getting the flag extension parameters (PARAM_FLAGGING).
static const casacore::String PARAM_SYMBOLFILL
static const casacore::String PARAM_AXIS_Y
Definition: PlotMSDBusApp.h:70
Abstracts the interface DBUS uses to talk to the main PlotMS application.
Definition: PlotEngine.h:45
static const casacore::String PARAM_XCONNECTOR
static const casacore::String PARAM_ITERATE
Definition: PlotMSDBusApp.h:88
Class which manages PlotMSPlots for plotms.
static const casacore::String PARAM_MINORWIDTH
static const casacore::String APP_LOGFILENAME_SWITCH
Definition: PlotMSDBusApp.h:59
~PlotMSDBusApp()
Destructor.
bool connectToDBus(const QString &dbus_name="")
Connects to the DBus server using the dbusName() method with the current process ID.
static const casacore::String PARAM_EXPORT_VERBOSE
Definition: PlotMSDBusApp.h:99
bool itsUpdateFlag_
Flag for whether to call update() during show() or not.
static const casacore::String PARAM_PRIORITY
Definition: PlotMSDBusApp.h:90
static const casacore::String PARAM_SYMBOLSHAPE
static const casacore::String PARAM_GRIDCOLS
Definition: PlotMSDBusApp.h:76
static const casacore::String METHOD_SETPLOTPARAMS
DBus method name for setting the plot parameters at the given index (PARAM_PLOTINDEX), using a casacore::Record with zero or more of the parameters set (see METHOD_GETPLOTPARAMS).
friend class PlotMSDBusAppWatcher
Definition: PlotMSDBusApp.h:46
static const casacore::String METHOD_QUIT
DBus method name for quitting the entire application.
static const casacore::String PARAM_XAXISFONT
static const casacore::String PARAM_EXPORT_INTERACTIVE