vtkDataWriter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00042 #ifndef __vtkDataWriter_h
00043 #define __vtkDataWriter_h
00044
00045 #include "vtkWriter.h"
00046
00047 class vtkDataSet;
00048 class vtkPoints;
00049 class vtkCellArray;
00050 class vtkDataArray;
00051 class vtkFieldData;
00052
00053 class VTK_IO_EXPORT vtkDataWriter : public vtkWriter
00054 {
00055 public:
00056 vtkTypeRevisionMacro(vtkDataWriter,vtkWriter);
00057 void PrintSelf(ostream& os, vtkIndent indent);
00058
00061 static vtkDataWriter *New();
00062
00064
00065 vtkSetStringMacro(FileName);
00066 vtkGetStringMacro(FileName);
00068
00070
00071 vtkSetMacro(WriteToOutputString,int);
00072 vtkGetMacro(WriteToOutputString,int);
00073 vtkBooleanMacro(WriteToOutputString,int);
00075
00077
00080 vtkGetMacro(OutputStringLength, int);
00081 vtkGetStringMacro(OutputString);
00082 unsigned char *GetBinaryOutputString() {
00083 return (unsigned char *)this->OutputString;};
00085
00089 char *RegisterAndGetOutputString();
00090
00092
00093 vtkSetStringMacro(Header);
00094 vtkGetStringMacro(Header);
00096
00098
00099 vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
00100 vtkGetMacro(FileType,int);
00101 void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
00102 void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
00104
00106
00108 vtkSetStringMacro(ScalarsName);
00109 vtkGetStringMacro(ScalarsName);
00111
00113
00115 vtkSetStringMacro(VectorsName);
00116 vtkGetStringMacro(VectorsName);
00118
00120
00122 vtkSetStringMacro(TensorsName);
00123 vtkGetStringMacro(TensorsName);
00125
00127
00129 vtkSetStringMacro(NormalsName);
00130 vtkGetStringMacro(NormalsName);
00132
00134
00136 vtkSetStringMacro(TCoordsName);
00137 vtkGetStringMacro(TCoordsName);
00139
00141
00143 vtkSetStringMacro(LookupTableName);
00144 vtkGetStringMacro(LookupTableName);
00146
00148
00150 vtkSetStringMacro(FieldDataName);
00151 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, vtkDataArray *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
00193 int WriteToOutputString;
00194 char *OutputString;
00195 int OutputStringLength;
00196 int OutputStringAllocatedLength;
00197
00198 void WriteData();
00199
00200 char *FileName;
00201 char *Header;
00202 int FileType;
00203
00204 char *ScalarsName;
00205 char *VectorsName;
00206 char *TensorsName;
00207 char *TCoordsName;
00208 char *NormalsName;
00209 char *LookupTableName;
00210 char *FieldDataName;
00211
00212 int WriteArray(ostream *fp, int dataType, vtkDataArray *data, const char *format,
00213 int num, int numComp);
00214 int WriteScalarData(ostream *fp, vtkDataArray *s, int num);
00215 int WriteVectorData(ostream *fp, vtkDataArray *v, int num);
00216 int WriteNormalData(ostream *fp, vtkDataArray *n, int num);
00217 int WriteTCoordData(ostream *fp, vtkDataArray *tc, int num);
00218 int WriteTensorData(ostream *fp, vtkDataArray *t, int num);
00219
00220 private:
00221 vtkDataWriter(const vtkDataWriter&);
00222 void operator=(const vtkDataWriter&);
00223 };
00224
00225 #endif
00226
00227