casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ViewerProxy.h
Go to the documentation of this file.
1 //# ViewerProxy.h: allows control of the viewer from C++ via 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 
28 #ifndef DBUS_VIEWERPROXY_H_
29 #define DBUS_VIEWERPROXY_H_
30 
31 #include <vector>
32 #include <string>
33 #include <casadbus/viewer/ViewerProxy.proxy.h>
35 #include <casa/Containers/Record.h>
36 #include <stdcasa/variant.h>
37 
38 namespace casa {
39  class ViewerProxy :
40  private edu::nrao::casa::viewer_proxy,
41  public DBus::IntrospectableProxy,
42  public DBus::ObjectProxy {
43 
44  public:
45 
46  static std::list<std::string> execArgs( const std::list<std::string> &args );
47  static std::string dbusName( ) { return "view_server"; }
48 
49  ViewerProxy( const std::string &name=dbusName( ) );
50 
52  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::start_interact(dbus::fromVariant(input), panel) ); }
53  dbus::variant datarange( const std::vector<double> &range, int data=0 )
54  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::datarange( range, data ) ); }
55  dbus::variant contourlevels( const std::vector<double> &levels, double baselevel=2147483648.0, double unitlevel=2147483648.0, int panel_or_data=0 )
56  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::contourlevels( levels, baselevel, unitlevel, panel_or_data ) ); }
57  dbus::variant axes( const std::string &x="", const std::string &y="", const std::string &z="", int panel=0 )
58  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::axes( x, y, z, panel ) ); }
59  dbus::variant colormap( const std::string &map, int panel_or_data=0 )
60  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::colormap( map, panel_or_data ) ); }
61  dbus::variant colorwedge( bool show, int panel_or_data=0 )
62  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::colorwedge( show, panel_or_data ) ); }
63 
64  dbus::variant load( const std::string &path, const std::string &displaytype = "raster", int panel=0, double scaling=0 )
65  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::load( path, displaytype, panel, scaling ) ); }
66  dbus::variant reload( int panel_or_data )
67  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::reload(panel_or_data) ); }
69  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::unload(data) ); }
70 
71  dbus::variant restore( const std::string &path, int panel=0 )
72  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::restore(path,panel) ); }
73 
74  dbus::variant panel( const std::string &type="viewer", bool hidden=false )
75  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::panel(type,hidden) ); }
77  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::hide(panel) ); }
81  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::close(panel) ); }
82  dbus::variant popup( const std::string &what, int panel=0 )
83  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::popup(what, panel) ); }
84 
85  dbus::variant cwd( const std::string &new_path = "" )
86  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::cwd( new_path ) ); }
87 
89  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::freeze( panel ) ); }
91  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::unfreeze( panel ) ); }
92 
93  dbus::variant channel( int num=-1, int panel=0 )
94  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::channel(num, panel) ); }
95  dbus::variant zoom( int level, int panel=0 )
96  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::zoom(level, panel) ); }
97  dbus::variant zoom( const std::vector<double> &blc, const std::vector<double> &trc, const std::string &coordinates="pixel", int panel=0 )
98  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::zoom( blc, trc, coordinates, panel ) ); }
99 
101  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::release( panel ) ); }
103  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::setoptions(dbus::fromVariant(input), panel) ); }
104  // device: file name or printer name
105  // devicetype: "file", "printer", or "ghostscript"
106  // format: "jpg", "pdf", "eps", "ps", "png", "xbm", "xpm", "ppm"
107  // [only used with devicetype == "file"] [extension on device, e.g. "outfile.pdf" overrides "format"]
108  // scale: size scale factor for raster output (e.g. jpg etc.)
109  // dpi: resolution of PS or EPS images
110  // orientation: "portrait", "landscape"
111  // media: "letter" or "a4"
112  bool output( const std::string &device, const std::string &devicetype = "file", int panel = 0,
113  double scale = 1.0, int dpi = 300, const std::string &format = "jpg",
114  const std::string &orientation = "portrait", const std::string &media = "letter" )
115  { return edu::nrao::casa::viewer_proxy::output( device, devicetype, panel, scale,
116  dpi, format, orientation, media ); }
117 
118  dbus::variant fileinfo( const std::string &path )
119  { return dbus::toVariant( edu::nrao::casa::viewer_proxy::fileinfo( path ) ); }
120  std::vector<std::string> keyinfo( int key )
121  { return edu::nrao::casa::viewer_proxy::keyinfo(key); }
122 
123  bool done( ) { return edu::nrao::casa::viewer_proxy::done( ); }
124  };
125 }
126 #endif
std::vector< std::string > keyinfo(int key)
Definition: ViewerProxy.h:120
dbus::variant reload(int panel_or_data)
Definition: ViewerProxy.h:66
dbus::variant colorwedge(bool show, int panel_or_data=0)
Definition: ViewerProxy.h:61
dbus::variant zoom(const std::vector< double > &blc, const std::vector< double > &trc, const std::string &coordinates="pixel", int panel=0)
Definition: ViewerProxy.h:97
dbus::variant setoptions(const dbus::variant &input, int panel)
Definition: ViewerProxy.h:102
ViewerProxy(const std::string &name=dbusName())
dbus::variant fileinfo(const std::string &path)
Definition: ViewerProxy.h:118
dbus::variant start_interact(const dbus::variant &input, int panel)
Definition: ViewerProxy.h:51
virtual Type type()
Return the type enum.
static std::list< std::string > execArgs(const std::list< std::string > &args)
dbus::variant colormap(const std::string &map, int panel_or_data=0)
Definition: ViewerProxy.h:59
dbus::variant axes(const std::string &x="", const std::string &y="", const std::string &z="", int panel=0)
Definition: ViewerProxy.h:57
dbus::variant unload(int data)
Definition: ViewerProxy.h:68
dbus::variant restore(const std::string &path, int panel=0)
Definition: ViewerProxy.h:71
dbus::variant close(int panel=0)
Definition: ViewerProxy.h:80
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
dbus::variant unfreeze(int panel)
Definition: ViewerProxy.h:90
dbus::variant load(const std::string &path, const std::string &displaytype="raster", int panel=0, double scaling=0)
Definition: ViewerProxy.h:64
void show(const variant &v)
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
dbus::variant popup(const std::string &what, int panel=0)
Definition: ViewerProxy.h:82
dbus::variant zoom(int level, int panel=0)
Definition: ViewerProxy.h:95
dbus::variant release(int panel)
Definition: ViewerProxy.h:100
dbus::variant freeze(int panel)
Definition: ViewerProxy.h:88
std::string path(const std::string &name)
DBus::Variant fromVariant(const variant &src)
dbus::variant show(int panel=0)
Definition: ViewerProxy.h:78
variant toVariant(const DBus::Variant &src)
dbus::variant contourlevels(const std::vector< double > &levels, double baselevel=2147483648.0, double unitlevel=2147483648.0, int panel_or_data=0)
Definition: ViewerProxy.h:55
dbus::variant panel(const std::string &type="viewer", bool hidden=false)
Definition: ViewerProxy.h:74
dbus::variant cwd(const std::string &new_path="")
Definition: ViewerProxy.h:85
dbus::variant channel(int num=-1, int panel=0)
Definition: ViewerProxy.h:93
bool output(const std::string &device, const std::string &devicetype="file", int panel=0, double scale=1.0, int dpi=300, const std::string &format="jpg", const std::string &orientation="portrait", const std::string &media="letter")
device: file name or printer name devicetype: &quot;file&quot;, &quot;printer&quot;, or &quot;ghostscript&quot; format: &quot;jpg&quot;...
Definition: ViewerProxy.h:112
dbus::variant datarange(const std::vector< double > &range, int data=0)
Definition: ViewerProxy.h:53
dbus::variant hide(int panel=0)
Definition: ViewerProxy.h:76
static std::string dbusName()
Definition: ViewerProxy.h:47