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

IO/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 =========================================================================*/
00056 #ifndef __vtkDataWriter_h
00057 #define __vtkDataWriter_h
00058 
00059 #include <stdio.h>
00060 #include "vtkWriter.h"
00061 
00062 class vtkDataSet;
00063 class vtkPoints;
00064 class vtkCellArray;
00065 class vtkDataArray;
00066 
00067 class VTK_IO_EXPORT vtkDataWriter : public vtkWriter
00068 {
00069 public:
00070   vtkTypeMacro(vtkDataWriter,vtkWriter);
00071   void PrintSelf(ostream& os, vtkIndent indent);
00072 
00075   static vtkDataWriter *New();
00076 
00078 
00079   vtkSetStringMacro(FileName);
00080   vtkGetStringMacro(FileName);
00082 
00084 
00085   vtkSetMacro(WriteToOutputString,int);
00086   vtkGetMacro(WriteToOutputString,int);
00087   vtkBooleanMacro(WriteToOutputString,int);
00089 
00091 
00094   vtkGetMacro(OutputStringLength, int);  
00095   vtkGetStringMacro(OutputString);
00096   unsigned char *GetBinaryOutputString() {
00097       return (unsigned char *)this->OutputString;};
00099       
00103   char *RegisterAndGetOutputString();
00104   
00106 
00107   vtkSetStringMacro(Header);
00108   vtkGetStringMacro(Header);
00110 
00112 
00113   vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
00114   vtkGetMacro(FileType,int);
00115   void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
00116   void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
00118 
00120 
00122   vtkSetStringMacro(ScalarsName);
00123   vtkGetStringMacro(ScalarsName);
00125 
00127 
00129   vtkSetStringMacro(VectorsName);
00130   vtkGetStringMacro(VectorsName);
00132 
00134 
00136   vtkSetStringMacro(TensorsName);
00137   vtkGetStringMacro(TensorsName);
00139 
00141 
00143   vtkSetStringMacro(NormalsName);
00144   vtkGetStringMacro(NormalsName);
00146 
00148 
00150   vtkSetStringMacro(TCoordsName);
00151   vtkGetStringMacro(TCoordsName);
00153 
00155 
00157   vtkSetStringMacro(LookupTableName);
00158   vtkGetStringMacro(LookupTableName);
00160 
00162 
00164   vtkSetStringMacro(FieldDataName);
00165   vtkGetStringMacro(FieldDataName);
00167 
00169   virtual ostream *OpenVTKFile();
00170 
00172   int WriteHeader(ostream *fp);
00173 
00175   int WritePoints(ostream *fp, vtkPoints *p);
00176 
00178   int WriteCoordinates(ostream *fp, vtkDataArray *coords, int axes);
00179 
00181   int WriteCells(ostream *fp, vtkCellArray *cells, const char *label);
00182 
00185   int WriteCellData(ostream *fp, vtkDataSet *ds);
00186 
00189   int WritePointData(ostream *fp, vtkDataSet *ds);
00190 
00192   int WriteFieldData(ostream *fp, vtkFieldData *f);
00193 
00197   int WriteDataSetData(ostream *fp, vtkDataSet *ds);
00198 
00200   void CloseVTKFile(ostream *fp);
00201 
00202 
00203 protected:
00204   vtkDataWriter();
00205   ~vtkDataWriter();
00206 
00207   int WriteToOutputString;
00208   char *OutputString;
00209   int OutputStringLength;
00210   int OutputStringAllocatedLength;
00211   
00212   void WriteData(); //dummy method to allow this class to be instantiated and delegated to
00213 
00214   char *FileName;
00215   char *Header;
00216   int FileType;
00217 
00218   char *ScalarsName;
00219   char *VectorsName;
00220   char *TensorsName;
00221   char *TCoordsName;
00222   char *NormalsName;
00223   char *LookupTableName;
00224   char *FieldDataName;
00225 
00226   int WriteArray(ostream *fp, int dataType, vtkDataArray *data, const char *format, 
00227                  int num, int numComp);
00228   int WriteScalarData(ostream *fp, vtkDataArray *s, int num);
00229   int WriteVectorData(ostream *fp, vtkDataArray *v, int num);
00230   int WriteNormalData(ostream *fp, vtkDataArray *n, int num);
00231   int WriteTCoordData(ostream *fp, vtkDataArray *tc, int num);
00232   int WriteTensorData(ostream *fp, vtkDataArray *t, int num);
00233 
00234 private:
00235   vtkDataWriter(const vtkDataWriter&);  // Not implemented.
00236   void operator=(const vtkDataWriter&);  // Not implemented.
00237 };
00238 
00239 #endif
00240 
00241 

Generated on Thu Mar 28 14:19:28 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001