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