casa
$Rev:20696$
|
00001 //# ViewerProxy.h: allows control of the viewer from C++ via DBus 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 DBUS_VIEWERPROXY_H_ 00029 #define DBUS_VIEWERPROXY_H_ 00030 00031 #include <vector> 00032 #include <string> 00033 #include <casadbus/viewer/ViewerProxy.proxy.h> 00034 #include <casadbus/utilities/Conversion.h> 00035 #include <casa/Containers/Record.h> 00036 #include <stdcasa/variant.h> 00037 00038 namespace casa { 00039 class ViewerProxy : 00040 private edu::nrao::casa::viewer_proxy, 00041 public DBus::IntrospectableProxy, 00042 public DBus::ObjectProxy { 00043 00044 public: 00045 00046 static std::list<std::string> execArgs( const std::list<std::string> &args ); 00047 static std::string dbusName( ) { return "view_server"; } 00048 00049 ViewerProxy( const std::string &name=dbusName( ) ); 00050 00051 dbus::variant start_interact( const dbus::variant &input, int panel ) 00052 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::start_interact(dbus::fromVariant(input), panel) ); } 00053 dbus::variant datarange( const std::vector<double> &range, int data=0 ) 00054 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::datarange( range, data ) ); } 00055 dbus::variant contourlevels( const std::vector<double> &levels, double baselevel=2147483648.0, double unitlevel=2147483648.0, int panel_or_data=0 ) 00056 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::contourlevels( levels, baselevel, unitlevel, panel_or_data ) ); } 00057 dbus::variant axes( const std::string &x="", const std::string &y="", const std::string &z="", int panel=0 ) 00058 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::axes( x, y, z, panel ) ); } 00059 dbus::variant colormap( const std::string &map, int panel_or_data=0 ) 00060 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::colormap( map, panel_or_data ) ); } 00061 dbus::variant colorwedge( bool show, int panel_or_data=0 ) 00062 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::colorwedge( show, panel_or_data ) ); } 00063 00064 dbus::variant load( const std::string &path, const std::string &displaytype = "raster", int panel=0, double scaling=0 ) 00065 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::load( path, displaytype, panel, scaling ) ); } 00066 dbus::variant reload( int panel_or_data ) 00067 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::reload(panel_or_data) ); } 00068 dbus::variant unload( int data ) 00069 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::unload(data) ); } 00070 00071 dbus::variant restore( const std::string &path, int panel=0 ) 00072 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::restore(path,panel) ); } 00073 00074 dbus::variant panel( const std::string &type="viewer", bool hidden=false ) 00075 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::panel(type,hidden) ); } 00076 dbus::variant hide( int panel=0 ) 00077 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::hide(panel) ); } 00078 dbus::variant show( int panel=0 ) 00079 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::show(panel) ); } 00080 dbus::variant close( int panel=0 ) 00081 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::close(panel) ); } 00082 dbus::variant popup( const std::string &what, int panel=0 ) 00083 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::popup(what, panel) ); } 00084 00085 dbus::variant cwd( const std::string &new_path = "" ) 00086 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::cwd( new_path ) ); } 00087 00088 dbus::variant freeze( int panel ) 00089 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::freeze( panel ) ); } 00090 dbus::variant unfreeze( int panel ) 00091 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::unfreeze( panel ) ); } 00092 00093 dbus::variant channel( int num=-1, int panel=0 ) 00094 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::channel(num, panel) ); } 00095 dbus::variant zoom( int level, int panel=0 ) 00096 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::zoom(level, panel) ); } 00097 dbus::variant zoom( const std::vector<double> &blc, const std::vector<double> &trc, const std::string &coordinates="pixel", int panel=0 ) 00098 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::zoom( blc, trc, coordinates, panel ) ); } 00099 00100 dbus::variant release( int panel ) 00101 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::release( panel ) ); } 00102 dbus::variant setoptions( const dbus::variant &input, int panel ) 00103 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::setoptions(dbus::fromVariant(input), panel) ); } 00104 // device: file name or printer name 00105 // devicetype: "file", "printer", or "ghostscript" 00106 // format: "jpg", "pdf", "eps", "ps", "png", "xbm", "xpm", "ppm" 00107 // [only used with devicetype == "file"] [extension on device, e.g. "outfile.pdf" overrides "format"] 00108 // scale: size scale factor for raster output (e.g. jpg etc.) 00109 // dpi: resolution of PS or EPS images 00110 // orientation: "portrait", "landscape" 00111 // media: "letter" or "a4" 00112 bool output( const std::string &device, const std::string &devicetype = "file", int panel = 0, 00113 double scale = 1.0, int dpi = 300, const std::string &format = "jpg", 00114 const std::string &orientation = "portrait", const std::string &media = "letter" ) 00115 { return edu::nrao::casa::viewer_proxy::output( device, devicetype, panel, scale, 00116 dpi, format, orientation, media ); } 00117 00118 dbus::variant fileinfo( const std::string &path ) 00119 { return dbus::toVariant( edu::nrao::casa::viewer_proxy::fileinfo( path ) ); } 00120 std::vector<std::string> keyinfo( int key ) 00121 { return edu::nrao::casa::viewer_proxy::keyinfo(key); } 00122 00123 bool done( ) { return edu::nrao::casa::viewer_proxy::done( ); } 00124 }; 00125 } 00126 #endif