Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

graphics/vtkDataWriter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDataWriter.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00055 #ifndef __vtkDataWriter_h
00056 #define __vtkDataWriter_h
00057 
00058 #include <stdio.h>
00059 #include "vtkWriter.h"
00060 
00061 class vtkDataSet;
00062 class vtkPoints;
00063 class vtkCellArray;
00064 class vtkScalars;
00065 class vtkVectors;
00066 class vtkNormals;
00067 class vtkTCoords;
00068 class vtkTensors;
00069 class vtkGhostLevels;
00070 class vtkDataArray;
00071 
00072 class VTK_EXPORT vtkDataWriter : public vtkWriter
00073 {
00074 public:
00075   vtkTypeMacro(vtkDataWriter,vtkWriter);
00076   void PrintSelf(ostream& os, vtkIndent indent);
00077 
00080   static vtkDataWriter *New();
00081 
00083   vtkSetStringMacro(FileName);
00084   vtkGetStringMacro(FileName);
00085 
00087   vtkSetMacro(WriteToOutputString,int);
00088   vtkGetMacro(WriteToOutputString,int);
00089   vtkBooleanMacro(WriteToOutputString,int);
00090 
00094   vtkGetMacro(OutputStringLength, int);  
00095   vtkGetStringMacro(OutputString);
00096   unsigned char *GetBinaryOutputString() {
00097       return (unsigned char *)this->OutputString;};
00098       
00102   char *RegisterAndGetOutputString();
00103   
00105   vtkSetStringMacro(Header);
00106   vtkGetStringMacro(Header);
00107 
00109   vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
00110   vtkGetMacro(FileType,int);
00111   void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
00112   void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
00113 
00116   vtkSetStringMacro(ScalarsName);
00117   vtkGetStringMacro(ScalarsName);
00118 
00121   vtkSetStringMacro(VectorsName);
00122   vtkGetStringMacro(VectorsName);
00123 
00126   vtkSetStringMacro(TensorsName);
00127   vtkGetStringMacro(TensorsName);
00128 
00131   vtkSetStringMacro(GhostLevelsName);
00132   vtkGetStringMacro(GhostLevelsName);
00133   
00136   vtkSetStringMacro(NormalsName);
00137   vtkGetStringMacro(NormalsName);
00138 
00141   vtkSetStringMacro(TCoordsName);
00142   vtkGetStringMacro(TCoordsName);
00143 
00146   vtkSetStringMacro(LookupTableName);
00147   vtkGetStringMacro(LookupTableName);
00148 
00151   vtkSetStringMacro(FieldDataName);
00152   vtkGetStringMacro(FieldDataName);
00153 
00155   virtual ostream *OpenVTKFile();
00156 
00158   int WriteHeader(ostream *fp);
00159 
00161   int WritePoints(ostream *fp, vtkPoints *p);
00162 
00164   int WriteCoordinates(ostream *fp, vtkScalars *coords, int axes);
00165 
00167   int WriteCells(ostream *fp, vtkCellArray *cells, const char *label);
00168 
00171   int WriteCellData(ostream *fp, vtkDataSet *ds);
00172 
00175   int WritePointData(ostream *fp, vtkDataSet *ds);
00176 
00178   int WriteFieldData(ostream *fp, vtkFieldData *f);
00179 
00183   int WriteDataSetData(ostream *fp, vtkDataSet *ds);
00184 
00186   void CloseVTKFile(ostream *fp);
00187 
00188 
00189 protected:
00190   vtkDataWriter();
00191   ~vtkDataWriter();
00192   vtkDataWriter(const vtkDataWriter&) {};
00193   void operator=(const vtkDataWriter&) {};
00194 
00195   int WriteToOutputString;
00196   char *OutputString;
00197   int OutputStringLength;
00198   int OutputStringAllocatedLength;
00199   
00200   void WriteData(); //dummy method to allow this class to be instantiated and delegated to
00201 
00202   char *FileName;
00203   char *Header;
00204   int FileType;
00205 
00206   char *ScalarsName;
00207   char *VectorsName;
00208   char *TensorsName;
00209   char *GhostLevelsName;
00210   char *TCoordsName;
00211   char *NormalsName;
00212   char *LookupTableName;
00213   char *FieldDataName;
00214 
00215   int WriteArray(ostream *fp, int dataType, vtkDataArray *data, const char *format, 
00216        int num, int numComp);
00217   int WriteScalarData(ostream *fp, vtkScalars *s, int num);
00218   int WriteVectorData(ostream *fp, vtkVectors *v, int num);
00219   int WriteNormalData(ostream *fp, vtkNormals *n, int num);
00220   int WriteTCoordData(ostream *fp, vtkTCoords *tc, int num);
00221   int WriteTensorData(ostream *fp, vtkTensors *t, int num);
00222   int WriteGhostLevelData(ostream *fp, vtkGhostLevels *g, int num);
00223 
00224 };
00225 
00226 #endif
00227 
00228 

Generated on Wed Nov 21 12:26:58 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001