00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00028 #ifndef __vtkDataWriter_h
00029 #define __vtkDataWriter_h
00030
00031 #include "vtkWriter.h"
00032
00033 class vtkDataSet;
00034 class vtkPoints;
00035 class vtkCellArray;
00036 class vtkDataArray;
00037 class vtkFieldData;
00038
00039 class VTK_IO_EXPORT vtkDataWriter : public vtkWriter
00040 {
00041 public:
00042 vtkTypeRevisionMacro(vtkDataWriter,vtkWriter);
00043 void PrintSelf(ostream& os, vtkIndent indent);
00044
00047 static vtkDataWriter *New();
00048
00050
00051 vtkSetStringMacro(FileName);
00052 vtkGetStringMacro(FileName);
00054
00056
00057 vtkSetMacro(WriteToOutputString,int);
00058 vtkGetMacro(WriteToOutputString,int);
00059 vtkBooleanMacro(WriteToOutputString,int);
00061
00063
00066 vtkGetMacro(OutputStringLength, int);
00067 vtkGetStringMacro(OutputString);
00068 unsigned char *GetBinaryOutputString() {
00069 return (unsigned char *)this->OutputString;};
00071
00075 char *RegisterAndGetOutputString();
00076
00078
00079 vtkSetStringMacro(Header);
00080 vtkGetStringMacro(Header);
00082
00084
00085 vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
00086 vtkGetMacro(FileType,int);
00087 void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
00088 void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
00090
00092
00094 vtkSetStringMacro(ScalarsName);
00095 vtkGetStringMacro(ScalarsName);
00097
00099
00101 vtkSetStringMacro(VectorsName);
00102 vtkGetStringMacro(VectorsName);
00104
00106
00108 vtkSetStringMacro(TensorsName);
00109 vtkGetStringMacro(TensorsName);
00111
00113
00115 vtkSetStringMacro(NormalsName);
00116 vtkGetStringMacro(NormalsName);
00118
00120
00122 vtkSetStringMacro(TCoordsName);
00123 vtkGetStringMacro(TCoordsName);
00125
00127
00129 vtkSetStringMacro(LookupTableName);
00130 vtkGetStringMacro(LookupTableName);
00132
00134
00136 vtkSetStringMacro(FieldDataName);
00137 vtkGetStringMacro(FieldDataName);
00139
00141 virtual ostream *OpenVTKFile();
00142
00144 int WriteHeader(ostream *fp);
00145
00147 int WritePoints(ostream *fp, vtkPoints *p);
00148
00150 int WriteCoordinates(ostream *fp, vtkDataArray *coords, int axes);
00151
00153 int WriteCells(ostream *fp, vtkCellArray *cells, const char *label);
00154
00157 int WriteCellData(ostream *fp, vtkDataSet *ds);
00158
00161 int WritePointData(ostream *fp, vtkDataSet *ds);
00162
00164 int WriteFieldData(ostream *fp, vtkFieldData *f);
00165
00169 int WriteDataSetData(ostream *fp, vtkDataSet *ds);
00170
00172 void CloseVTKFile(ostream *fp);
00173
00174
00175 protected:
00176 vtkDataWriter();
00177 ~vtkDataWriter();
00178
00179 int WriteToOutputString;
00180 char *OutputString;
00181 int OutputStringLength;
00182 int OutputStringAllocatedLength;
00183
00184 void WriteData();
00185
00186 char *FileName;
00187 char *Header;
00188 int FileType;
00189
00190 char *ScalarsName;
00191 char *VectorsName;
00192 char *TensorsName;
00193 char *TCoordsName;
00194 char *NormalsName;
00195 char *LookupTableName;
00196 char *FieldDataName;
00197
00198 int WriteArray(ostream *fp, int dataType, vtkDataArray *data, const char *format,
00199 int num, int numComp);
00200 int WriteScalarData(ostream *fp, vtkDataArray *s, int num);
00201 int WriteVectorData(ostream *fp, vtkDataArray *v, int num);
00202 int WriteNormalData(ostream *fp, vtkDataArray *n, int num);
00203 int WriteTCoordData(ostream *fp, vtkDataArray *tc, int num);
00204 int WriteTensorData(ostream *fp, vtkDataArray *t, int num);
00205
00206 private:
00207 vtkDataWriter(const vtkDataWriter&);
00208 void operator=(const vtkDataWriter&);
00209 };
00210
00211 #endif