casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PCVGBuffer.h
Go to the documentation of this file.
00001 //# PCVGBuffer.h: buffering vector graphics for the PixelCanvases
00002 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000
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 //#$Id$
00027 
00028 #ifndef TRIALDISPLAY_PCVGBUFFER_H
00029 #define TRIALDISPLAY_PCVGBUFFER_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Arrays/Matrix.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 class PixelCanvas;
00037 
00038 // <summary>
00039 //   
00040 // </summary>
00041 //
00042 // <use visibility=export>
00043 //
00044 // <reviewed>
00045 // </reviewed>
00046 //  
00047 // <prerequisite>
00048 // <li> none
00049 // </prerequisite>
00050 //
00051 // <etymology>
00052 // The name of PCVGBuffer comes from ...
00053 // </etymology>
00054 //
00055 // <synopsis>
00056 // Display Class File
00057 // </synopsis>
00058 //
00059 // <motivation>
00060 // </motivation>
00061 //
00062 // <example>
00063 // none available.
00064 // </example>
00065 //
00066 // <todo>
00067 // <li> write and test!
00068 // </todo>
00069 //
00070 
00071 class PCVGBuffer {
00072 
00073  public:
00074 
00075   enum AccumMode { AMNone, 
00076                    AMPoints, 
00077                    AMLines,
00078                    AMPolyline,
00079                    AMPolygon };
00080 
00081   // Default Constructor Required
00082   PCVGBuffer(PixelCanvas * pc, uInt nVerts = 1024);
00083 
00084   // User Constructor
00085   PCVGBuffer();
00086 
00087   // add point
00088   void accumPoint(Float x, Float y);
00089   
00090   // add line
00091   void accumLine(Float x1, Float y1, Float x2, Float y2);
00092   
00093   // add point to polyline
00094   void accumPolylinePoint(Float x, Float y);
00095 
00096   // add point to polygon
00097   void accumPolygonPoint(Float x, Float y);
00098 
00099   // flush the buffer
00100   void flush();
00101   
00102   // current mode
00103   AccumMode mode() const { return mode_; }
00104   
00105   // change modes
00106   void setMode(AccumMode m);
00107 
00108   // check size and make more if needed
00109   void checkSpace();
00110 
00111   // Destructor
00112   virtual ~PCVGBuffer();
00113 
00114  private:
00115 
00116   PixelCanvas * pc_;
00117 
00118   AccumMode mode_;
00119   uInt c_;
00120   Matrix<Float> verts_;
00121   uInt blockSize_;
00122 
00123 };
00124 
00125 
00126 } //# NAMESPACE CASA - END
00127 
00128 #endif