casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PGPlotterInterface.h
Go to the documentation of this file.
00001 //# PGPlotterInterface.h: Abstract base class for PGPLOT style plotting.
00002 //# Copyright (C) 1997,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id: PGPlotterInterface.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00028 
00029 #ifndef CASA_PGPLOTTERINTERFACE_H
00030 #define CASA_PGPLOTTERINTERFACE_H
00031 
00032 #include <casa/aips.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 class Record;
00037 class String;
00038 template<class T> class Vector;
00039 template<class T> class Matrix;
00040 
00041 // <summary>
00042 // Abstract base class for PGPLOT style plotting.
00043 // </summary>
00044 
00045 // <use visibility=export>
00046 
00047 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00048 // </reviewed>
00049 
00050 // <prerequisite>
00051 //   <li> General familiarity with PGPLOT, especially of the style of the
00052 //        Glish/PGPLOT binding.
00053 // </prerequisite>
00054 //
00055 // <etymology>
00056 // PGPlotter for the plotting style, Interface because it is an abstract base
00057 // class, not a concrete derived class.
00058 // </etymology>
00059 //
00060 // <synopsis>
00061 // This class represents an interface for plotting to a PGPLOT style plotting
00062 // interface. In general, the differences between actual PGPLOT and this 
00063 // interface is:
00064 // <ol>
00065 //   <li> The functions related to opening and closing are not implemented,
00066 //        since it is assumed the derived class constructor/destructor will 
00067 //        handle this.
00068 //   <li> The leading "pg" is removed from the name since by being in a class
00069 //        there are no namespace issues.
00070 //   <li> AIPS++ array classes are used in place of raw pointers. This also
00071 //        obviates the need for passing in array dimensions. Similarly the
00072 //        subregion arguments (I1, I2, J1, J2) are left out since the array
00073 //        classes have their own subsectioning methods.
00074 //   <li> Output values are returned from the function
00075 // </ol>
00076 // The rules are basically the same as for the Glish/PGPLOT binding, and thus
00077 // the individual routines are not documented here.
00078 // </synopsis>
00079 //
00080 // <example>
00081 // <srcblock>
00082 // void plotFunction(const PGPlotterInterface &plotter) {
00083 //     // plot y = x*x
00084 //     Vector<Float> x(100), y(100);
00085 //     indgen(x);
00086 //     y = x*x;
00087 //     plotter.env(0, 100, 0, 100*100, 0, 0);
00088 //     plotter.line(x, y);
00089 // }
00090 // </srcblock>
00091 // </example>
00092 //
00093 // <motivation>
00094 // General plotting interface for programmers, while allowing the location and
00095 // form of the plot to vary.
00096 // </motivation>
00097 //
00098 // <todo asof="1997/1/15">
00099 //   <li> Add the missing PGPLOT functions.
00100 //   <li> Emulate band as well as curs?
00101 // </todo>
00102 
00103 class PGPlotterInterface
00104 {
00105 public:
00106     virtual ~PGPlotterInterface();
00107 
00108     // True if it is OK to plot to this object. This method is implemented for
00109     // devices where you have to worry about devices detaching (e.g., the Glish
00110     // pgplotter might be dismissed by the user). The default implementation is
00111     // to always return True.
00112     virtual Bool isAttached() const;
00113 
00114 
00115     // This is not a standard PGPLOT command. In the Glish/PGPLOT window, it
00116     // puts a message in the message line. By default it sends it to the logger.
00117     // In any event, this is intended for short helpful messages (e.g.
00118     // saying which keys to press to mark a spectrum).
00119     virtual void message(const String &text);
00120 
00121     // This is not a standard PGPLOT command.  It is only needed for
00122     // the PGPlotterGlish class which connects to Glish/PGPLOT window
00123     // This Glish object (actually a pgplotter/pgplotwidget.g) has an 
00124     // internal counter plot counter which needs to be reset to 0
00125     // when the process detaches from the plotter, so that the next
00126     // plot on the device is the first one again.  Without this, the
00127     // prompting behaviour of the Glish plotter  is different from native
00128     // PGPLOT
00129     virtual void resetPlotNumber () {;};
00130 
00131     // This is an emulated standard PGPLOT command. It returns a record
00132     // containing the fields:
00133     // <srcblock>
00134     // [ok=Bool, x=Float, y=Float, ch=String];
00135     // If the remote device cannot do cursor feedback, ok==F.
00136     // </srcblock>
00137     // The input x,y values is the "guess" for the location the user will want
00138     // to pick. On some devices, the cursor will be positioned at (world
00139     // coordinates) x,y.
00140     virtual Record curs(Float x, Float y) = 0;
00141 
00142     // Standard PGPLOT commands. Documentation for the individual commands
00143     // can be found in the Glish manual and in the standard PGPLOT documentation
00144     // which may be found at <src>http://astro.caltech.edu/~tjp/pgplot/</src>.
00145     // The Glish/PGPLOT documentation is preferred since this interface follows
00146     // it exactly (e.g. the array sizes are inferred both here and in Glish,
00147     // whereas they must be passed into standard PGPLOT).
00148     // <group>
00149     virtual void arro(Float x1, Float y1, Float x2, Float y2) = 0;
00150     virtual void ask(Bool flag) = 0;
00151     virtual void bbuf() = 0;
00152     virtual void bin(const Vector<Float> &x, const Vector<Float> &data,
00153                      Bool center) = 0;
00154     virtual void box(const String &xopt, Float xtick, Int nxsub, 
00155              const String &yopt, Float ytick, Int nysub) = 0;
00156     virtual void circ(Float xcent, Float ycent, Float radius) = 0;
00157     virtual void conb(const Matrix<Float> &a, const Vector<Float> &c,
00158                       const Vector<Float> &tr, Float blank) = 0;
00159     virtual void conl(const Matrix<Float> &a, Float c,
00160                       const Vector<Float> &tr, const String &label,
00161                       Int intval, Int minint) = 0;
00162     virtual void cons(const Matrix<Float> &a, const Vector<Float> &c,
00163                       const Vector<Float> &tr) = 0;
00164     virtual void cont(const Matrix<Float> &a, const Vector<Float> &c,
00165                       Bool nc, const Vector<Float> &tr) = 0;
00166     virtual void ctab(const Vector<Float> &l, const Vector<Float> &r,
00167                       const Vector<Float> &g, const Vector<Float> &b,
00168                       Float contra, Float bright) = 0;
00169     virtual void draw(Float x, Float y) = 0;
00170     virtual void ebuf() = 0;
00171     virtual void env(Float xmin, Float xmax, Float ymin, Float ymax, Int just,
00172              Int axis) = 0;
00173     virtual void eras() = 0;
00174     virtual void errb(Int dir, const Vector<Float> &x, const Vector<Float> &y,
00175               const Vector<Float> &e, Float t) = 0;
00176     virtual void errx(const Vector<Float> &x1, const Vector<Float> &x2,
00177                       const Vector<Float> &y, Float t) = 0;
00178     virtual void erry(const Vector<Float> &x, const Vector<Float> &y1,
00179               const Vector<Float> &y2, Float t) = 0;
00180     virtual void gray(const Matrix<Float> &a, Float fg, Float bg,
00181                       const Vector<Float> &tr) = 0; 
00182     virtual void hi2d(const Matrix<Float> &data, const Vector<Float> &x,
00183                       Int ioff, Float bias, Bool center, 
00184                       const Vector<Float> &ylims) = 0;
00185     virtual void hist(const Vector<Float> &data, Float datmin, Float datmax, 
00186                     Int nbin, Int pcflag) = 0;
00187     virtual void iden() = 0;
00188     virtual void imag(const Matrix<Float> &a, Float a1, Float a2,
00189                       const Vector<Float> &tr) = 0;
00190     virtual void lab(const String &xlbl, const String &ylbl, 
00191                    const String &toplbl) = 0;
00192     virtual void ldev() = 0;
00193     virtual Vector<Float> len(Int units, const String &string) = 0;
00194     virtual void line(const Vector<Float> &xpts, const Vector<Float> &ypts) = 0;
00195     virtual void move(Float x, Float y) = 0;
00196     virtual void mtxt(const String &side, Float disp, Float coord, Float fjust,
00197                     const String &text) = 0;
00198     virtual String numb(Int mm, Int pp, Int form) = 0;
00199     virtual void page() = 0;
00200     virtual void panl(Int ix, Int iy) = 0;
00201     virtual void pap(Float width, Float aspect) = 0;
00202     virtual void pixl(const Matrix<Int> &ia, Float x1, Float x2,
00203                       Float y1, Float y2) = 0;
00204     virtual void pnts(const Vector<Float> &x, const Vector<Float> &y,
00205                       const Vector<Int> symbol) = 0;
00206     virtual void poly(const Vector<Float> &xpts, const Vector<Float> &ypts) = 0;
00207     virtual void pt(const Vector<Float> &xpts, const Vector<Float> &ypts, 
00208                   Int symbol) = 0;
00209     virtual void ptxt(Float x, Float y, Float angle, Float fjust, 
00210                     const String &text) = 0;
00211     virtual Vector<Float>  qah() = 0;
00212     virtual Int qcf() = 0;
00213     virtual Float qch() = 0;
00214     virtual Int qci() = 0;
00215     virtual Vector<Int> qcir() = 0;
00216     virtual Vector<Int> qcol() = 0;
00217     virtual Vector<Float> qcr(Int ci) = 0;
00218     virtual Vector<Float> qcs(Int units) = 0;
00219     virtual Int qfs() = 0;
00220     virtual Vector<Float> qhs() = 0;
00221     virtual Int qid() = 0;
00222     virtual String qinf(const String &item) = 0;
00223     virtual Int qitf() = 0;
00224     virtual Int qls() = 0;
00225     virtual Int qlw() = 0;
00226     virtual Vector<Float> qpos() = 0;
00227     virtual Int qtbg() = 0;
00228     virtual Vector<Float> qtxt(Float x, Float y, Float angle, Float fjust, 
00229                     const String &text) = 0;
00230     virtual Vector<Float> qvp(Int units) = 0;
00231     virtual Vector<Float> qvsz(Int units) = 0;
00232     virtual Vector<Float> qwin() = 0;
00233     virtual void rect(Float x1, Float x2, Float y1, Float y2) = 0;
00234     virtual Float rnd(Float x, Int nsub) = 0;
00235     virtual Vector<Float> rnge(Float x1, Float x2) = 0;
00236     virtual void sah(Int fs, Float angle, Float vent) = 0;
00237     virtual void save() = 0;
00238     virtual void scf(Int font) = 0;
00239     virtual void sch(Float size) = 0;
00240     virtual void sci(Int ci) = 0;
00241     virtual void scir(Int icilo, Int icihi) = 0;
00242     virtual void scr(Int ci, Float cr, Float cg, Float cb) = 0;
00243     virtual void scrn(Int ci, const String &name) = 0;
00244     virtual void sfs(Int fs) = 0;
00245     virtual void shls(Int ci, Float ch, Float cl, Float cs) = 0;
00246     virtual void shs(Float angle, Float sepn, Float phase) = 0;
00247     virtual void sitf(Int itf) = 0;
00248     virtual void sls(Int ls) = 0;
00249     virtual void slw(Int lw) = 0;
00250     virtual void stbg(Int tbci) = 0;
00251     virtual void subp(Int nxsub, Int nysub) = 0;
00252     virtual void svp(Float xleft, Float xright, Float ybot, Float ytop) = 0;
00253     virtual void swin(Float x1, Float x2, Float y1, Float y2) = 0;
00254     virtual void tbox(const String &xopt, Float xtick, Int nxsub,
00255                     const String &yopt, Float ytick, Int nysub) = 0;
00256     virtual void text(Float x, Float y, const String &text) = 0;
00257     virtual void unsa() = 0;
00258     virtual void updt() = 0;
00259     virtual void vect(const Matrix<Float> &a, const Matrix<Float> &b,
00260                       Float c, Int nc, 
00261                       const Vector<Float> &tr, Float blank) = 0;
00262     virtual void vsiz(Float xleft, Float xright, Float ybot,
00263                       Float ytop) = 0;
00264     virtual void vstd() = 0;
00265     virtual void wedg(const String &side, Float disp, Float width,
00266                       Float fg, Float bg, const String &label) = 0;
00267     virtual void wnad(Float x1, Float x2, Float y1, Float y2) = 0;
00268     // </group>
00269 };
00270 
00271 
00272 } //# NAMESPACE CASA - END
00273 
00274 #endif