casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PGPlotterInterface.h
Go to the documentation of this file.
1 //# PGPlotterInterface.h: Abstract base class for PGPLOT style plotting.
2 //# Copyright (C) 1997,2000,2001
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 //#
27 //# $Id$
28 
29 #ifndef CASA_PGPLOTTERINTERFACE_H
30 #define CASA_PGPLOTTERINTERFACE_H
31 
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 class Record;
38 class String;
39 
40 // <summary>
41 // Abstract base class for PGPLOT style plotting.
42 // </summary>
43 
44 // <use visibility=export>
45 
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> General familiarity with PGPLOT, especially of the style of the
51 // Glish/PGPLOT binding.
52 // </prerequisite>
53 //
54 // <etymology>
55 // PGPlotter for the plotting style, Interface because it is an abstract base
56 // class, not a concrete derived class.
57 // </etymology>
58 //
59 // <synopsis>
60 // This class represents an interface for plotting to a PGPLOT style plotting
61 // interface. In general, the differences between actual PGPLOT and this
62 // interface is:
63 // <ol>
64 // <li> The functions related to opening and closing are not implemented,
65 // since it is assumed the derived class constructor/destructor will
66 // handle this.
67 // <li> The leading "pg" is removed from the name since by being in a class
68 // there are no namespace issues.
69 // <li> Casacore array classes are used in place of raw pointers. This also
70 // obviates the need for passing in array dimensions. Similarly the
71 // subregion arguments (I1, I2, J1, J2) are left out since the array
72 // classes have their own subsectioning methods.
73 // <li> Output values are returned from the function
74 // </ol>
75 // The rules are basically the same as for the Glish/PGPLOT binding, and thus
76 // the individual routines are not documented here.
77 // </synopsis>
78 //
79 // <example>
80 // <srcblock>
81 // void plotFunction(const PGPlotterInterface &plotter) {
82 // // plot y = x*x
83 // Vector<Float> x(100), y(100);
84 // indgen(x);
85 // y = x*x;
86 // plotter.env(0, 100, 0, 100*100, 0, 0);
87 // plotter.line(x, y);
88 // }
89 // </srcblock>
90 // </example>
91 //
92 // <motivation>
93 // General plotting interface for programmers, while allowing the location and
94 // form of the plot to vary.
95 // </motivation>
96 //
97 // <todo asof="1997/1/15">
98 // <li> Add the missing PGPLOT functions.
99 // <li> Emulate band as well as curs?
100 // </todo>
101 
103 {
104 public:
105  virtual ~PGPlotterInterface();
106 
107  // True if it is OK to plot to this object. This method is implemented for
108  // devices where you have to worry about devices detaching (e.g., the Glish
109  // pgplotter might be dismissed by the user). The default implementation is
110  // to always return True.
111  virtual Bool isAttached() const;
112 
113 
114  // This is not a standard PGPLOT command. In the Glish/PGPLOT window, it
115  // puts a message in the message line. By default it sends it to the logger.
116  // In any event, this is intended for short helpful messages (e.g.
117  // saying which keys to press to mark a spectrum).
118  virtual void message(const String &text);
119 
120  // This is not a standard PGPLOT command. It is only needed for
121  // the PGPlotterGlish class which connects to Glish/PGPLOT window
122  // This Glish object (actually a pgplotter/pgplotwidget.g) has an
123  // internal counter plot counter which needs to be reset to 0
124  // when the process detaches from the plotter, so that the next
125  // plot on the device is the first one again. Without this, the
126  // prompting behaviour of the Glish plotter is different from native
127  // PGPLOT
128  virtual void resetPlotNumber () {;};
129 
130  // This is an emulated standard PGPLOT command. It returns a record
131  // containing the fields:
132  // <srcblock>
133  // [ok=Bool, x=Float, y=Float, ch=String];
134  // If the remote device cannot do cursor feedback, ok==F.
135  // </srcblock>
136  // The input x,y values is the "guess" for the location the user will want
137  // to pick. On some devices, the cursor will be positioned at (world
138  // coordinates) x,y.
139  virtual Record curs(Float x, Float y) = 0;
140 
141  // Standard PGPLOT commands. Documentation for the individual commands
142  // can be found in the Glish manual and in the standard PGPLOT documentation
143  // which may be found at <src>http://astro.caltech.edu/~tjp/pgplot/</src>.
144  // The Glish/PGPLOT documentation is preferred since this interface follows
145  // it exactly (e.g. the array sizes are inferred both here and in Glish,
146  // whereas they must be passed into standard PGPLOT).
147  // <group>
148  virtual void arro(Float x1, Float y1, Float x2, Float y2) = 0;
149  virtual void ask(Bool flag) = 0;
150  virtual void bbuf() = 0;
151  virtual void bin(const Vector<Float> &x, const Vector<Float> &data,
152  Bool center) = 0;
153  virtual void box(const String &xopt, Float xtick, Int nxsub,
154  const String &yopt, Float ytick, Int nysub) = 0;
155  virtual void circ(Float xcent, Float ycent, Float radius) = 0;
156  virtual void conb(const Matrix<Float> &a, const Vector<Float> &c,
157  const Vector<Float> &tr, Float blank) = 0;
158  virtual void conl(const Matrix<Float> &a, Float c,
159  const Vector<Float> &tr, const String &label,
160  Int intval, Int minint) = 0;
161  virtual void cons(const Matrix<Float> &a, const Vector<Float> &c,
162  const Vector<Float> &tr) = 0;
163  virtual void cont(const Matrix<Float> &a, const Vector<Float> &c,
164  Bool nc, const Vector<Float> &tr) = 0;
165  virtual void ctab(const Vector<Float> &l, const Vector<Float> &r,
166  const Vector<Float> &g, const Vector<Float> &b,
167  Float contra, Float bright) = 0;
168  virtual void draw(Float x, Float y) = 0;
169  virtual void ebuf() = 0;
170  virtual void env(Float xmin, Float xmax, Float ymin, Float ymax, Int just,
171  Int axis) = 0;
172  virtual void eras() = 0;
173  virtual void errb(Int dir, const Vector<Float> &x, const Vector<Float> &y,
174  const Vector<Float> &e, Float t) = 0;
175  virtual void errx(const Vector<Float> &x1, const Vector<Float> &x2,
176  const Vector<Float> &y, Float t) = 0;
177  virtual void erry(const Vector<Float> &x, const Vector<Float> &y1,
178  const Vector<Float> &y2, Float t) = 0;
179  virtual void gray(const Matrix<Float> &a, Float fg, Float bg,
180  const Vector<Float> &tr) = 0;
181  virtual void hi2d(const Matrix<Float> &data, const Vector<Float> &x,
182  Int ioff, Float bias, Bool center,
183  const Vector<Float> &ylims) = 0;
184  virtual void hist(const Vector<Float> &data, Float datmin, Float datmax,
185  Int nbin, Int pcflag) = 0;
186  virtual void iden() = 0;
187  virtual void imag(const Matrix<Float> &a, Float a1, Float a2,
188  const Vector<Float> &tr) = 0;
189  virtual void lab(const String &xlbl, const String &ylbl,
190  const String &toplbl) = 0;
191  virtual void ldev() = 0;
192  virtual Vector<Float> len(Int units, const String &string) = 0;
193  virtual void line(const Vector<Float> &xpts, const Vector<Float> &ypts) = 0;
194  virtual void move(Float x, Float y) = 0;
195  virtual void mtxt(const String &side, Float disp, Float coord, Float fjust,
196  const String &text) = 0;
197  virtual String numb(Int mm, Int pp, Int form) = 0;
198  virtual void page() = 0;
199  virtual void panl(Int ix, Int iy) = 0;
200  virtual void pap(Float width, Float aspect) = 0;
201  virtual void pixl(const Matrix<Int> &ia, Float x1, Float x2,
202  Float y1, Float y2) = 0;
203  virtual void pnts(const Vector<Float> &x, const Vector<Float> &y,
204  const Vector<Int> symbol) = 0;
205  virtual void poly(const Vector<Float> &xpts, const Vector<Float> &ypts) = 0;
206  virtual void pt(const Vector<Float> &xpts, const Vector<Float> &ypts,
207  Int symbol) = 0;
208  virtual void ptxt(Float x, Float y, Float angle, Float fjust,
209  const String &text) = 0;
210  virtual Vector<Float> qah() = 0;
211  virtual Int qcf() = 0;
212  virtual Float qch() = 0;
213  virtual Int qci() = 0;
214  virtual Vector<Int> qcir() = 0;
215  virtual Vector<Int> qcol() = 0;
216  virtual Vector<Float> qcr(Int ci) = 0;
217  virtual Vector<Float> qcs(Int units) = 0;
218  virtual Int qfs() = 0;
219  virtual Vector<Float> qhs() = 0;
220  virtual Int qid() = 0;
221  virtual String qinf(const String &item) = 0;
222  virtual Int qitf() = 0;
223  virtual Int qls() = 0;
224  virtual Int qlw() = 0;
225  virtual Vector<Float> qpos() = 0;
226  virtual Int qtbg() = 0;
227  virtual Vector<Float> qtxt(Float x, Float y, Float angle, Float fjust,
228  const String &text) = 0;
229  virtual Vector<Float> qvp(Int units) = 0;
230  virtual Vector<Float> qvsz(Int units) = 0;
231  virtual Vector<Float> qwin() = 0;
232  virtual void rect(Float x1, Float x2, Float y1, Float y2) = 0;
233  virtual Float rnd(Float x, Int nsub) = 0;
234  virtual Vector<Float> rnge(Float x1, Float x2) = 0;
235  virtual void sah(Int fs, Float angle, Float vent) = 0;
236  virtual void save() = 0;
237  virtual void scf(Int font) = 0;
238  virtual void sch(Float size) = 0;
239  virtual void sci(Int ci) = 0;
240  virtual void scir(Int icilo, Int icihi) = 0;
241  virtual void scr(Int ci, Float cr, Float cg, Float cb) = 0;
242  virtual void scrn(Int ci, const String &name) = 0;
243  virtual void sfs(Int fs) = 0;
244  virtual void shls(Int ci, Float ch, Float cl, Float cs) = 0;
245  virtual void shs(Float angle, Float sepn, Float phase) = 0;
246  virtual void sitf(Int itf) = 0;
247  virtual void sls(Int ls) = 0;
248  virtual void slw(Int lw) = 0;
249  virtual void stbg(Int tbci) = 0;
250  virtual void subp(Int nxsub, Int nysub) = 0;
251  virtual void svp(Float xleft, Float xright, Float ybot, Float ytop) = 0;
252  virtual void swin(Float x1, Float x2, Float y1, Float y2) = 0;
253  virtual void tbox(const String &xopt, Float xtick, Int nxsub,
254  const String &yopt, Float ytick, Int nysub) = 0;
255  virtual void text(Float x, Float y, const String &text) = 0;
256  virtual void unsa() = 0;
257  virtual void updt() = 0;
258  virtual void vect(const Matrix<Float> &a, const Matrix<Float> &b,
259  Float c, Int nc,
260  const Vector<Float> &tr, Float blank) = 0;
261  virtual void vsiz(Float xleft, Float xright, Float ybot,
262  Float ytop) = 0;
263  virtual void vstd() = 0;
264  virtual void wedg(const String &side, Float disp, Float width,
265  Float fg, Float bg, const String &label) = 0;
266  virtual void wnad(Float x1, Float x2, Float y1, Float y2) = 0;
267  // </group>
268 };
269 
270 
271 } //# NAMESPACE CASACORE - END
272 
273 #endif
virtual Vector< Float > rnge(Float x1, Float x2)=0
virtual void vect(const Matrix< Float > &a, const Matrix< Float > &b, Float c, Int nc, const Vector< Float > &tr, Float blank)=0
virtual void ctab(const Vector< Float > &l, const Vector< Float > &r, const Vector< Float > &g, const Vector< Float > &b, Float contra, Float bright)=0
int Int
Definition: aipstype.h:50
virtual void sci(Int ci)=0
virtual void wedg(const String &side, Float disp, Float width, Float fg, Float bg, const String &label)=0
virtual Float rnd(Float x, Int nsub)=0
virtual Vector< Float > qcs(Int units)=0
virtual void shls(Int ci, Float ch, Float cl, Float cs)=0
virtual void scir(Int icilo, Int icihi)=0
virtual Vector< Float > len(Int units, const String &string)=0
virtual Vector< Float > qpos()=0
virtual void erry(const Vector< Float > &x, const Vector< Float > &y1, const Vector< Float > &y2, Float t)=0
virtual void wnad(Float x1, Float x2, Float y1, Float y2)=0
virtual void cons(const Matrix< Float > &a, const Vector< Float > &c, const Vector< Float > &tr)=0
virtual void imag(const Matrix< Float > &a, Float a1, Float a2, const Vector< Float > &tr)=0
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition: ExprNode.h:1448
virtual void vsiz(Float xleft, Float xright, Float ybot, Float ytop)=0
virtual void ask(Bool flag)=0
virtual Bool isAttached() const
True if it is OK to plot to this object.
virtual void stbg(Int tbci)=0
virtual Vector< Float > qvsz(Int units)=0
virtual void mtxt(const String &side, Float disp, Float coord, Float fjust, const String &text)=0
Abstract base class for PGPLOT style plotting.
virtual String qinf(const String &item)=0
virtual void poly(const Vector< Float > &xpts, const Vector< Float > &ypts)=0
virtual Vector< Int > qcir()=0
virtual Vector< Float > qhs()=0
virtual void env(Float xmin, Float xmax, Float ymin, Float ymax, Int just, Int axis)=0
virtual void cont(const Matrix< Float > &a, const Vector< Float > &c, Bool nc, const Vector< Float > &tr)=0
virtual void message(const String &text)
This is not a standard PGPLOT command.
virtual Vector< Float > qwin()=0
virtual Vector< Float > qcr(Int ci)=0
virtual void scf(Int font)=0
virtual void sls(Int ls)=0
virtual void move(Float x, Float y)=0
virtual void slw(Int lw)=0
virtual void subp(Int nxsub, Int nysub)=0
virtual Vector< Int > qcol()=0
virtual void scr(Int ci, Float cr, Float cg, Float cb)=0
virtual void pnts(const Vector< Float > &x, const Vector< Float > &y, const Vector< Int > symbol)=0
virtual void errb(Int dir, const Vector< Float > &x, const Vector< Float > &y, const Vector< Float > &e, Float t)=0
virtual void hist(const Vector< Float > &data, Float datmin, Float datmax, Int nbin, Int pcflag)=0
virtual Vector< Float > qvp(Int units)=0
virtual void sfs(Int fs)=0
virtual void bin(const Vector< Float > &x, const Vector< Float > &data, Bool center)=0
virtual void resetPlotNumber()
This is not a standard PGPLOT command.
virtual void gray(const Matrix< Float > &a, Float fg, Float bg, const Vector< Float > &tr)=0
virtual void sch(Float size)=0
virtual void conl(const Matrix< Float > &a, Float c, const Vector< Float > &tr, const String &label, Int intval, Int minint)=0
virtual void errx(const Vector< Float > &x1, const Vector< Float > &x2, const Vector< Float > &y, Float t)=0
virtual String numb(Int mm, Int pp, Int form)=0
virtual void arro(Float x1, Float y1, Float x2, Float y2)=0
Standard PGPLOT commands.
virtual void tbox(const String &xopt, Float xtick, Int nxsub, const String &yopt, Float ytick, Int nysub)=0
virtual void scrn(Int ci, const String &name)=0
virtual void pt(const Vector< Float > &xpts, const Vector< Float > &ypts, Int symbol)=0
virtual void pap(Float width, Float aspect)=0
A hierarchical collection of named fields of various types.
Definition: Record.h:180
virtual void lab(const String &xlbl, const String &ylbl, const String &toplbl)=0
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void panl(Int ix, Int iy)=0
float Float
Definition: aipstype.h:54
virtual void shs(Float angle, Float sepn, Float phase)=0
virtual void circ(Float xcent, Float ycent, Float radius)=0
virtual Vector< Float > qah()=0
virtual void sah(Int fs, Float angle, Float vent)=0
virtual void draw(Float x, Float y)=0
const Double e
e and functions thereof:
virtual void sitf(Int itf)=0
const Double c
Fundamental physical constants (SI units):
virtual void hi2d(const Matrix< Float > &data, const Vector< Float > &x, Int ioff, Float bias, Bool center, const Vector< Float > &ylims)=0
virtual void svp(Float xleft, Float xright, Float ybot, Float ytop)=0
virtual void rect(Float x1, Float x2, Float y1, Float y2)=0
virtual Vector< Float > qtxt(Float x, Float y, Float angle, Float fjust, const String &text)=0
String: the storage and methods of handling collections of characters.
Definition: String.h:225
virtual void conb(const Matrix< Float > &a, const Vector< Float > &c, const Vector< Float > &tr, Float blank)=0
virtual void line(const Vector< Float > &xpts, const Vector< Float > &ypts)=0
virtual void swin(Float x1, Float x2, Float y1, Float y2)=0
virtual void text(Float x, Float y, const String &text)=0
virtual void ptxt(Float x, Float y, Float angle, Float fjust, const String &text)=0
virtual Record curs(Float x, Float y)=0
This is an emulated standard PGPLOT command.
virtual void box(const String &xopt, Float xtick, Int nxsub, const String &yopt, Float ytick, Int nysub)=0
virtual void pixl(const Matrix< Int > &ia, Float x1, Float x2, Float y1, Float y2)=0