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