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 vtkCellArray;
00034 class vtkDataArray;
00035 class vtkDataSet;
00036 class vtkFieldData;
00037 class vtkGraph;
00038 class vtkPoints;
00039
00040 class VTK_IO_EXPORT vtkDataWriter : public vtkWriter
00041 {
00042 public:
00043 vtkTypeRevisionMacro(vtkDataWriter,vtkWriter);
00044 void PrintSelf(ostream& os, vtkIndent indent);
00045
00048 static vtkDataWriter *New();
00049
00051
00052 vtkSetStringMacro(FileName);
00053 vtkGetStringMacro(FileName);
00055
00057
00058 vtkSetMacro(WriteToOutputString,int);
00059 vtkGetMacro(WriteToOutputString,int);
00060 vtkBooleanMacro(WriteToOutputString,int);
00062
00064
00067 vtkGetMacro(OutputStringLength, int);
00068 vtkGetStringMacro(OutputString);
00069 unsigned char *GetBinaryOutputString()
00070 {
00071 return reinterpret_cast<unsigned char *>(this->OutputString);
00072 }
00074
00078 char *RegisterAndGetOutputString();
00079
00081
00082 vtkSetStringMacro(Header);
00083 vtkGetStringMacro(Header);
00085
00087
00088 vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
00089 vtkGetMacro(FileType,int);
00090 void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
00091 void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
00093
00095
00097 vtkSetStringMacro(ScalarsName);
00098 vtkGetStringMacro(ScalarsName);
00100
00102
00104 vtkSetStringMacro(VectorsName);
00105 vtkGetStringMacro(VectorsName);
00107
00109
00111 vtkSetStringMacro(TensorsName);
00112 vtkGetStringMacro(TensorsName);
00114
00116
00118 vtkSetStringMacro(NormalsName);
00119 vtkGetStringMacro(NormalsName);
00121
00123
00125 vtkSetStringMacro(TCoordsName);
00126 vtkGetStringMacro(TCoordsName);
00128
00130
00132 vtkSetStringMacro(GlobalIdsName);
00133 vtkGetStringMacro(GlobalIdsName);
00135
00137
00139 vtkSetStringMacro(PedigreeIdsName);
00140 vtkGetStringMacro(PedigreeIdsName);
00142
00144
00146 vtkSetStringMacro(LookupTableName);
00147 vtkGetStringMacro(LookupTableName);
00149
00151
00153 vtkSetStringMacro(FieldDataName);
00154 vtkGetStringMacro(FieldDataName);
00156
00158 virtual ostream *OpenVTKFile();
00159
00161 int WriteHeader(ostream *fp);
00162
00164 int WritePoints(ostream *fp, vtkPoints *p);
00165
00167 int WriteCoordinates(ostream *fp, vtkDataArray *coords, int axes);
00168
00170 int WriteCells(ostream *fp, vtkCellArray *cells, const char *label);
00171
00174 int WriteCellData(ostream *fp, vtkDataSet *ds);
00175
00178 int WritePointData(ostream *fp, vtkDataSet *ds);
00179
00182 int WriteEdgeData(ostream *fp, vtkGraph *g);
00183
00186 int WriteVertexData(ostream *fp, vtkGraph *g);
00187
00189 int WriteFieldData(ostream *fp, vtkFieldData *f);
00190
00194 int WriteDataSetData(ostream *fp, vtkDataSet *ds);
00195
00197 void CloseVTKFile(ostream *fp);
00198
00199
00200 protected:
00201 vtkDataWriter();
00202 ~vtkDataWriter();
00203
00204 int WriteToOutputString;
00205 char *OutputString;
00206 int OutputStringLength;
00207 int OutputStringAllocatedLength;
00208
00209 void WriteData();
00210
00211 char *FileName;
00212 char *Header;
00213 int FileType;
00214
00215 char *ScalarsName;
00216 char *VectorsName;
00217 char *TensorsName;
00218 char *TCoordsName;
00219 char *NormalsName;
00220 char *LookupTableName;
00221 char *FieldDataName;
00222 char* GlobalIdsName;
00223 char* PedigreeIdsName;
00224
00225 int WriteArray(ostream *fp, int dataType, vtkAbstractArray *data, const char *format,
00226 int num, int numComp);
00227 int WriteScalarData(ostream *fp, vtkDataArray *s, int num);
00228 int WriteVectorData(ostream *fp, vtkDataArray *v, int num);
00229 int WriteNormalData(ostream *fp, vtkDataArray *n, int num);
00230 int WriteTCoordData(ostream *fp, vtkDataArray *tc, int num);
00231 int WriteTensorData(ostream *fp, vtkDataArray *t, int num);
00232 int WriteGlobalIdData(ostream *fp, vtkDataArray *g, int num);
00233 int WritePedigreeIdData(ostream *fp, vtkAbstractArray *p, int num);
00234
00235 private:
00236 vtkDataWriter(const vtkDataWriter&);
00237 void operator=(const vtkDataWriter&);
00238 };
00239
00240 #endif