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 public:
102
103 // True if it is OK to plot to this object. This method is implemented for
104 // devices where you have to worry about devices detaching (e.g., the Glish
105 // pgplotter might be dismissed by the user). The default implementation is
106 // to always return True.
107 virtual Bool isAttached() const;
108
109 // This is not a standard PGPLOT command. In the Glish/PGPLOT window, it
110 // puts a message in the message line. By default it sends it to the logger.
111 // In any event, this is intended for short helpful messages (e.g.
112 // saying which keys to press to mark a spectrum).
113 virtual void message(const String &text);
114
115 // This is not a standard PGPLOT command. It is only needed for
116 // the PGPlotterGlish class which connects to Glish/PGPLOT window
117 // This Glish object (actually a pgplotter/pgplotwidget.g) has an
118 // internal counter plot counter which needs to be reset to 0
119 // when the process detaches from the plotter, so that the next
120 // plot on the device is the first one again. Without this, the
121 // prompting behaviour of the Glish plotter is different from native
122 // PGPLOT
123 virtual void resetPlotNumber() { ; };
124
125 // This is an emulated standard PGPLOT command. It returns a record
126 // containing the fields:
127 // <srcblock>
128 // [ok=Bool, x=Float, y=Float, ch=String];
129 // If the remote device cannot do cursor feedback, ok==F.
130 // </srcblock>
131 // The input x,y values is the "guess" for the location the user will want
132 // to pick. On some devices, the cursor will be positioned at (world
133 // coordinates) x,y.
134 virtual Record curs(Float x, Float y) = 0;
135
136 // Standard PGPLOT commands. Documentation for the individual commands
137 // can be found in the Glish manual and in the standard PGPLOT documentation
138 // which may be found at <src>http://astro.caltech.edu/~tjp/pgplot/</src>.
139 // The Glish/PGPLOT documentation is preferred since this interface follows
140 // it exactly (e.g. the array sizes are inferred both here and in Glish,
141 // whereas they must be passed into standard PGPLOT).
142 // <group>
143 virtual void arro(Float x1, Float y1, Float x2, Float y2) = 0;
144 virtual void ask(Bool flag) = 0;
145 virtual void bbuf() = 0;
146 virtual void bin(const Vector<Float> &x, const Vector<Float> &data, Bool center) = 0;
147 virtual void box(const String &xopt, Float xtick, Int nxsub, const String &yopt, Float ytick,
148 Int nysub) = 0;
149 virtual void circ(Float xcent, Float ycent, Float radius) = 0;
150 virtual void conb(const Matrix<Float> &a, const Vector<Float> &c, const Vector<Float> &tr,
151 Float blank) = 0;
152 virtual void conl(const Matrix<Float> &a, Float c, const Vector<Float> &tr, const String &label,
153 Int intval, Int minint) = 0;
154 virtual void cons(const Matrix<Float> &a, const Vector<Float> &c, const Vector<Float> &tr) = 0;
155 virtual void cont(const Matrix<Float> &a, const Vector<Float> &c, Bool nc,
156 const Vector<Float> &tr) = 0;
157 virtual void ctab(const Vector<Float> &l, const Vector<Float> &r, const Vector<Float> &g,
158 const Vector<Float> &b, Float contra, Float bright) = 0;
159 virtual void draw(Float x, Float y) = 0;
160 virtual void ebuf() = 0;
161 virtual void env(Float xmin, Float xmax, Float ymin, Float ymax, Int just, Int axis) = 0;
162 virtual void eras() = 0;
163 virtual void errb(Int dir, const Vector<Float> &x, const Vector<Float> &y, const Vector<Float> &e,
164 Float t) = 0;
165 virtual void errx(const Vector<Float> &x1, const Vector<Float> &x2, const Vector<Float> &y,
166 Float t) = 0;
167 virtual void erry(const Vector<Float> &x, const Vector<Float> &y1, const Vector<Float> &y2,
168 Float t) = 0;
169 virtual void gray(const Matrix<Float> &a, Float fg, Float bg, const Vector<Float> &tr) = 0;
170 virtual void hi2d(const Matrix<Float> &data, const Vector<Float> &x, Int ioff, Float bias,
171 Bool center, const Vector<Float> &ylims) = 0;
172 virtual void hist(const Vector<Float> &data, Float datmin, Float datmax, Int nbin,
173 Int pcflag) = 0;
174 virtual void iden() = 0;
175 virtual void imag(const Matrix<Float> &a, Float a1, Float a2, const Vector<Float> &tr) = 0;
176 virtual void lab(const String &xlbl, const String &ylbl, const String &toplbl) = 0;
177 virtual void ldev() = 0;
178 virtual Vector<Float> len(Int units, const String &string) = 0;
179 virtual void line(const Vector<Float> &xpts, const Vector<Float> &ypts) = 0;
180 virtual void move(Float x, Float y) = 0;
181 virtual void mtxt(const String &side, Float disp, Float coord, Float fjust,
182 const String &text) = 0;
183 virtual String numb(Int mm, Int pp, Int form) = 0;
184 virtual void page() = 0;
185 virtual void panl(Int ix, Int iy) = 0;
186 virtual void pap(Float width, Float aspect) = 0;
187 virtual void pixl(const Matrix<Int> &ia, Float x1, Float x2, Float y1, Float y2) = 0;
188 virtual void pnts(const Vector<Float> &x, const Vector<Float> &y, const Vector<Int> symbol) = 0;
189 virtual void poly(const Vector<Float> &xpts, const Vector<Float> &ypts) = 0;
190 virtual void pt(const Vector<Float> &xpts, const Vector<Float> &ypts, Int symbol) = 0;
191 virtual void ptxt(Float x, Float y, Float angle, Float fjust, const String &text) = 0;
192 virtual Vector<Float> qah() = 0;
193 virtual Int qcf() = 0;
194 virtual Float qch() = 0;
195 virtual Int qci() = 0;
196 virtual Vector<Int> qcir() = 0;
197 virtual Vector<Int> qcol() = 0;
198 virtual Vector<Float> qcr(Int ci) = 0;
199 virtual Vector<Float> qcs(Int units) = 0;
200 virtual Int qfs() = 0;
201 virtual Vector<Float> qhs() = 0;
202 virtual Int qid() = 0;
203 virtual String qinf(const String &item) = 0;
204 virtual Int qitf() = 0;
205 virtual Int qls() = 0;
206 virtual Int qlw() = 0;
207 virtual Vector<Float> qpos() = 0;
208 virtual Int qtbg() = 0;
209 virtual Vector<Float> qtxt(Float x, Float y, Float angle, Float fjust, const String &text) = 0;
210 virtual Vector<Float> qvp(Int units) = 0;
211 virtual Vector<Float> qvsz(Int units) = 0;
212 virtual Vector<Float> qwin() = 0;
213 virtual void rect(Float x1, Float x2, Float y1, Float y2) = 0;
214 virtual Float rnd(Float x, Int nsub) = 0;
215 virtual Vector<Float> rnge(Float x1, Float x2) = 0;
216 virtual void sah(Int fs, Float angle, Float vent) = 0;
217 virtual void save() = 0;
218 virtual void scf(Int font) = 0;
219 virtual void sch(Float size) = 0;
220 virtual void sci(Int ci) = 0;
221 virtual void scir(Int icilo, Int icihi) = 0;
222 virtual void scr(Int ci, Float cr, Float cg, Float cb) = 0;
223 virtual void scrn(Int ci, const String &name) = 0;
224 virtual void sfs(Int fs) = 0;
225 virtual void shls(Int ci, Float ch, Float cl, Float cs) = 0;
226 virtual void shs(Float angle, Float sepn, Float phase) = 0;
227 virtual void sitf(Int itf) = 0;
228 virtual void sls(Int ls) = 0;
229 virtual void slw(Int lw) = 0;
230 virtual void stbg(Int tbci) = 0;
231 virtual void subp(Int nxsub, Int nysub) = 0;
232 virtual void svp(Float xleft, Float xright, Float ybot, Float ytop) = 0;
233 virtual void swin(Float x1, Float x2, Float y1, Float y2) = 0;
234 virtual void tbox(const String &xopt, Float xtick, Int nxsub, const String &yopt, Float ytick,
235 Int nysub) = 0;
236 virtual void text(Float x, Float y, const String &text) = 0;
237 virtual void unsa() = 0;
238 virtual void updt() = 0;
239 virtual void vect(const Matrix<Float> &a, const Matrix<Float> &b, Float c, Int nc,
240 const Vector<Float> &tr, Float blank) = 0;
241 virtual void vsiz(Float xleft, Float xright, Float ybot, Float ytop) = 0;
242 virtual void vstd() = 0;
243 virtual void wedg(const String &side, Float disp, Float width, Float fg, Float bg,
244 const String &label) = 0;
245 virtual void wnad(Float x1, Float x2, Float y1, Float y2) = 0;
246 // </group>
247};
248
249} // namespace casacore
250
251#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:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
Int blank() const
Definition hdu.h:405
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition ExprNode.h:1281
float Float
Definition aipstype.h:52
String name() const
Return the name of the field.
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
size_t size() const
Definition Block.h:566