casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FlagPlotServerProxy.h
Go to the documentation of this file.
1 //# FlagPlotServerProxy.h: Flagger's version of PlotServerProxy
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_LFPLOTSERVERPROXY_H
29 #define DBUS_LFPLOTSERVERPROXY_H
30 
31 #include <cmath>
32 #include <cstdio>
33 
37 
38 namespace casa {
39 
41  public:
42  FlagPlotServerProxy( char *&dbusname ) : PlotServerProxy(dbusname ) { }
43  void exiting( ) {
45  returnvalue = "Quit";
46  }
47  void closing(const int32_t& /*panel*/, const bool &/*gone*/) {
49  //std::cout << "closing panel: " << panel << " (" << gone << ")..." << std::endl;
50  returnvalue = "Quit";
51  }
52 
53  dbus::variant panel( const std::string& title, const std::string &xlabel="", const std::string &ylabel="",
54  const std::string &window_title="", const std::vector<int> &size=std::vector<int>( ),
55  const std::string& legend="bottom", const std::string &zoom="bottom",
56  const int32_t& with_panel=0, const bool& new_row=false, const bool& hidden=false )
57  {
58  dbus::variant v = PlotServerProxy::panel( title,xlabel,ylabel,window_title,size,
59  legend,zoom,with_panel,new_row,hidden );
60  if ( v.type( ) == dbus::variant::INT ) {
61  p = v.getInt( );
62  }
63  return v;
64  }
65 
66  dbus::variant line( const std::vector< double >& x, const std::vector< double >& y, const std::string& color="black",
67  const std::string& label="", const int32_t& panel=0 ) {
68  dbus::variant v = PlotServerProxy::line( x, y, color, label, panel );
69  if ( v.type( ) == dbus::variant::INT ) {
70  l = v.getInt( );
71  }
72  return v;
73  }
74 
75  dbus::variant raster( const std::vector<double> &matrix, int sizex, int sizey, const std::string& colormap="Greyscale 1", int panel=0 )
76 {
77  dbus::variant v = PlotServerProxy::raster( matrix, sizex, sizey, colormap, panel );
78  if ( v.type( ) == dbus::variant::INT ) {
79  l = v.getInt( );
80  }
81  return v;
82  }
83 
84  void draw( std::vector<double> x, std::vector<double> y, std::string color="blue" ) {
85  xvals = x;
86  yvals = y;
87  dbus::variant v = line(x,y,color,"",p);
88  if ( v.type( ) == dbus::variant::INT ) {
89  l = v.getInt( );
90  }
91  }
92 
93  void button(const int32_t& /*panel*/, const std::string& name) {
94  //std::cout << "button: " << name << "/" << panel << std::endl;
95  returnvalue = name;
96  // std::cout << returnvalue << std::endl;
98  }
99 
100  void check(const int32_t& /*panel*/, const std::string& name, const int32_t& state) {
101  //std::cout << "check: " << name << "/" << panel << " <" << state << ">" << std::endl;
102  std::stringstream rval;
103  rval << name << ":"<< state;
104  returnvalue = rval.str();
106  }
107 
108  void radio(const int32_t& panel, const std::string& name, const bool& state) {
109  std::cout << "radio: " << name << "/" << panel << " <" << state << ">" << std::endl;
110  }
111 
112  void linetext(const int32_t& panel, const std::string& name, const std::string& text) {
113  std::cout << "line: " << name << "/" << panel << " <" << text << ">" << std::endl;
114  }
115 
116  void slidevalue(const int32_t& panel, const std::string& name, const int32_t& value) {
117  std::cout << "slider: " << name << "/" << panel << " <" << value << ">" << std::endl;
118  }
119 
120 
121  std::string eventloop()
122  {
124  return returnvalue;
125  }
126 
127 
128  private:
129  int p;
130  int l;
131  std::vector<double> xvals;
132  std::vector<double> yvals;
133 
134  std::string returnvalue;
135 
136 };
137 
138 }
139 #endif
void enter()
pure virtual functions from Dispatcher
static DBusSession & instance()
TYPE type() const
Definition: variant.h:190
dbus::variant panel(const std::string &title, const std::string &xlabel="", const std::string &ylabel="", const std::string &window_title="", const std::vector< int > &size=std::vector< int >(), const std::string &legend="bottom", const std::string &zoom="bottom", const int32_t &with_panel=0, const bool &new_row=false, const bool &hidden=false)
void closing(const int32_t &, const bool &)
void slidevalue(const int32_t &panel, const std::string &name, const int32_t &value)
dbus::variant line(const std::vector< double > &x, const std::vector< double > &y, const std::string &color="black", const std::string &label="", const int32_t &panel=0)
dbus::Dispatcher & dispatcher()
Definition: DBusSession.h:47
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
size_t size() const
void button(const int32_t &, const std::string &name)
void draw(std::vector< double > x, std::vector< double > y, std::string color="blue")
void radio(const int32_t &panel, const std::string &name, const bool &state)
int getInt() const
FlagPlotServerProxy(char *&dbusname)
dbus::variant panel(const std::string &title, const std::string &xlabel="", const std::string &ylabel="", const std::string &window_title="", const std::vector< int > &size=std::vector< int >(), const std::string &legend="bottom", const std::string &zoom="bottom", const int32_t &with_panel=0, const bool &new_row=false, const bool &hidden=false)
std::vector< double > xvals
dbus::variant raster(const std::vector< double > &matrix, int sizex, int sizey, const std::string &colormap="Greyscale 1", int panel=0)
dbus::variant line(const std::vector< double > &x, const std::vector< double > &y, const std::string &color="black", const std::string &label="", const int32_t &panel=0)
void linetext(const int32_t &panel, const std::string &name, const std::string &text)
std::vector< double > yvals
void check(const int32_t &, const std::string &name, const int32_t &state)
dbus::variant raster(const std::vector< double > &matrix, int sizex, int sizey, const std::string &colormap="Rainbow 2", int panel=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
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.