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