casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PGPlotterLocal.h
Go to the documentation of this file.
00001 //# PGPlotterLocal.h: Plot to a PGPLOT device "local" to this process.
00002 //# Copyright (C) 1997,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$
00028 
00029 #ifndef GRAPHICS_PGPLOTTERLOCAL_H
00030 #define GRAPHICS_PGPLOTTERLOCAL_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/System/PGPlotter.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 class String;
00038 template<class T> class Vector;
00039 
00040 // <summary>
00041 // Plot to a PGPLOT device "local" to this process.
00042 // </summary>
00043 
00044 // <use visibility=export>
00045 
00046 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00047 // </reviewed>
00048 
00049 // <prerequisite>
00050 //   <li> <linkto class="PGPlotterInterface">PGPlotterInterface</linkto>
00051 // </prerequisite>
00052 //
00053 // <etymology>
00054 // "Local" is used to denote that the actuall plotting is done by PGPLOT calls
00055 // linked into this executable, as opposed to the common case where the PGPLOT
00056 // calls are sent over the Glish bus to a "remote" display.
00057 // </etymology>
00058 //
00059 // <synopsis>
00060 // Generally programmers should not use this class, instead they should use
00061 // <linkto class="PGPlotter">PGPlotter</linkto> instead.
00062 //
00063 // This class make a concrete
00064 // <linkto class="PGPlotterInterface">PGPlotterInterface</linkto> object which
00065 // calls PGPLOT directly, i.e. PGPLOT is linked into the current executable.
00066 // </synopsis>
00067 //
00068 // <example>
00069 // <srcblock>
00070 //     // plot y = x*x
00071 //     Vector<Float> x(100), y(100);
00072 //     indgen(x);
00073 //     y = x*x;
00074 
00075 //     PGPlotterLocal plotter("myplot.ps/ps");
00076 //     plotter.env(0, 100, 0, 100*100, 0, 0);
00077 //     plotter.line(x, y);
00078 // </srcblock>
00079 // </example>
00080 //
00081 // <motivation>
00082 // It might be necessary to call PGPLOT directly in some circumstances. For
00083 // example, it might be too inefficient to pass a lot of Image data over the
00084 // glish bus.
00085 // </motivation>
00086 //
00087 // <todo asof="1997/12/31">
00088 //   <li> Add more plot calls.
00089 // </todo>
00090 
00091 class PGPlotterLocal : public PGPlotterInterface
00092 {
00093 public:
00094     // Open "device", which must be a valid PGPLOT style device, for example
00095     // <src>/cps</src> for colour postscript (or <src>myfile.ps/cps</src>
00096     // if you want to name the file), or <src>/xs</src> or <src>/xw</src> for
00097     // and X-windows display.
00098     // <thrown>
00099     //   <li> An <linkto class="AipsError">AipsError</linkto> will be thrown
00100     //        if the underlying PGPLOT open fails for some reason.
00101     // </thrown>
00102     PGPlotterLocal(const String &device);
00103     // The destructor closes the pgplot device.
00104     virtual ~PGPlotterLocal();
00105 
00106     // The create function to create a PGPlotter object using a PGPlotterLocal.
00107     // It only uses the device argument.
00108     static PGPlotter createPlotter (const String &device,
00109                                     uInt, uInt, uInt, uInt);
00110 
00111     // This is an emulated standard PGPLOT command. It returns a record
00112     // containing the fields:
00113     // <srcblock>
00114     // [ok=Bool, x=Float, y=Float, ch=String];
00115     // If the remote device cannot do cursor feedback, ok==F.
00116     // </srcblock>
00117     virtual Record curs(Float x, Float y);
00118 
00119 
00120     // Standard PGPLOT commands. Documentation for the individual commands
00121     // can be found in the Glish manual and in the standard PGPLOT documentation
00122     // which may be found at <src>http://astro.caltech.edu/~tjp/pgplot/</src>.
00123     // The Glish/PGPLOT documentation is preferred since this interface follows
00124     // it exactly (e.g. the array sizes are inferred both here and in Glish,
00125     // whereas they must be passed into standard PGPLOT).
00126     // <group>
00127     virtual void arro(Float x1, Float y1, Float x2, Float y2);
00128     virtual void ask(Bool flag);
00129     virtual void bbuf();
00130     virtual void bin(const Vector<Float> &x, const Vector<Float> &data,
00131                      Bool center);
00132     virtual void box(const String &xopt, Float xtick, Int nxsub, 
00133              const String &yopt, Float ytick, Int nysub);
00134     virtual void circ(Float xcent, Float ycent, Float radius);
00135     virtual void conb(const Matrix<Float> &a, const Vector<Float> &c,
00136                       const Vector<Float> &tr, Float blank);
00137     virtual void conl(const Matrix<Float> &a, Float c,
00138                       const Vector<Float> &tr, const String &label,
00139                       Int intval, Int minint);
00140     virtual void cons(const Matrix<Float> &a, const Vector<Float> &c,
00141                       const Vector<Float> &tr);
00142     virtual void cont(const Matrix<Float> &a, const Vector<Float> &c,
00143                       Bool nc, const Vector<Float> &tr);
00144     virtual void ctab(const Vector<Float> &l, const Vector<Float> &r,
00145                       const Vector<Float> &g, const Vector<Float> &b,
00146                       Float contra, Float bright);
00147     virtual void draw(Float x, Float y);
00148     virtual void ebuf();
00149     virtual void env(Float xmin, Float xmax, Float ymin, Float ymax, Int just,
00150              Int axis);
00151     virtual void eras();
00152     virtual void errb(Int dir, const Vector<Float> &x, const Vector<Float> &y,
00153               const Vector<Float> &e, Float t);
00154     virtual void errx(const Vector<Float> &x1, const Vector<Float> &x2,
00155                       const Vector<Float> &y, Float t);
00156     virtual void erry(const Vector<Float> &x, const Vector<Float> &y1,
00157               const Vector<Float> &y2, Float t);
00158     virtual void gray(const Matrix<Float> &a, Float fg, Float bg,
00159                       const Vector<Float> &tr); 
00160     virtual void hi2d(const Matrix<Float> &data, const Vector<Float> &x,
00161                       Int ioff, Float bias, Bool center, 
00162                       const Vector<Float> &ylims);
00163     virtual void hist(const Vector<Float> &data, Float datmin, Float datmax, 
00164                     Int nbin, Int pcflag);
00165     virtual void iden();
00166     virtual void imag(const Matrix<Float> &a, Float a1, Float a2,
00167                       const Vector<Float> &tr);
00168     virtual void lab(const String &xlbl, const String &ylbl, 
00169                    const String &toplbl);
00170     virtual void ldev();
00171     virtual Vector<Float> len(Int units, const String &string);
00172     virtual void line(const Vector<Float> &xpts, const Vector<Float> &ypts);
00173     virtual void move(Float x, Float y);
00174     virtual void mtxt(const String &side, Float disp, Float coord, Float fjust,
00175                     const String &text);
00176     virtual String numb(Int mm, Int pp, Int form);
00177     virtual void page();
00178     virtual void panl(Int ix, Int iy);
00179     virtual void pap(Float width, Float aspect);
00180     virtual void pixl(const Matrix<Int> &ia, Float x1, Float x2,
00181                       Float y1, Float y2);
00182     virtual void pnts(const Vector<Float> &x, const Vector<Float> &y,
00183                       const Vector<Int> symbol);
00184     virtual void poly(const Vector<Float> &xpts, const Vector<Float> &ypts);
00185     virtual void pt(const Vector<Float> &xpts, const Vector<Float> &ypts, 
00186                   Int symbol);
00187     virtual void ptxt(Float x, Float y, Float angle, Float fjust, 
00188                     const String &text);
00189     virtual Vector<Float>  qah();
00190     virtual Int qcf();
00191     virtual Float qch();
00192     virtual Int qci();
00193     virtual Vector<Int> qcir();
00194     virtual Vector<Int> qcol();
00195     virtual Vector<Float> qcr(Int ci);
00196     virtual Vector<Float> qcs(Int units);
00197     virtual Int qfs();
00198     virtual Vector<Float> qhs();
00199     virtual Int qid();
00200     virtual String qinf(const String &item);
00201     virtual Int qitf();
00202     virtual Int qls();
00203     virtual Int qlw();
00204     virtual Vector<Float> qpos();
00205     virtual Int qtbg();
00206     virtual Vector<Float> qtxt(Float x, Float y, Float angle, Float fjust, 
00207                     const String &text);
00208     virtual Vector<Float> qvp(Int units);
00209     virtual Vector<Float> qvsz(Int units);
00210     virtual Vector<Float> qwin();
00211     virtual void rect(Float x1, Float x2, Float y1, Float y2);
00212     virtual Float rnd(Float x, Int nsub);
00213     virtual Vector<Float> rnge(Float x1, Float x2);
00214     virtual void sah(Int fs, Float angle, Float vent);
00215     virtual void save();
00216     virtual void scf(Int font);
00217     virtual void sch(Float size);
00218     virtual void sci(Int ci);
00219     virtual void scir(Int icilo, Int icihi);
00220     virtual void scr(Int ci, Float cr, Float cg, Float cb);
00221     virtual void scrn(Int ci, const String &name);
00222     virtual void sfs(Int fs);
00223     virtual void shls(Int ci, Float ch, Float cl, Float cs);
00224     virtual void shs(Float angle, Float sepn, Float phase);
00225     virtual void sitf(Int itf);
00226     virtual void sls(Int ls);
00227     virtual void slw(Int lw);
00228     virtual void stbg(Int tbci);
00229     virtual void subp(Int nxsub, Int nysub);
00230     virtual void svp(Float xleft, Float xright, Float ybot, Float ytop);
00231     virtual void swin(Float x1, Float x2, Float y1, Float y2);
00232     virtual void tbox(const String &xopt, Float xtick, Int nxsub,
00233                     const String &yopt, Float ytick, Int nysub);
00234     virtual void text(Float x, Float y, const String &text);
00235     virtual void unsa();
00236     virtual void updt();
00237     virtual void vect(const Matrix<Float> &a, const Matrix<Float> &b,
00238                       Float c, Int nc, 
00239                       const Vector<Float> &tr, Float blank);
00240     virtual void vsiz(Float xleft, Float xright, Float ybot,
00241                       Float ytop);
00242     virtual void vstd();
00243     virtual void wedg(const String &side, Float disp, Float width,
00244                       Float fg, Float bg, const String &label);
00245     virtual void wnad(Float x1, Float x2, Float y1, Float y2);
00246     // </group>
00247 
00248  private:
00249     // Undefined and inaccessible
00250     PGPlotterLocal(const PGPlotterLocal &);
00251     PGPlotterLocal& operator=(const PGPlotterLocal &);
00252 
00253     // PGPLOT id
00254     int id_p;
00255 };
00256 
00257 
00258 
00259 } //# NAMESPACE CASA - END
00260 
00261 #endif