VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkX3DExporterWriter.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00023 #ifndef __vtkX3DExporterWriter_h 00024 #define __vtkX3DExporterWriter_h 00025 00026 #include "vtkIOExportModule.h" // For export macro 00027 #include <vtkObject.h> 00028 00029 // Forward declarations 00030 class vtkDataArray; 00031 class vtkUnsignedCharArray; 00032 class vtkCellArray; 00033 00034 class VTKIOEXPORT_EXPORT vtkX3DExporterWriter : public vtkObject 00035 { 00036 public: 00037 vtkTypeMacro(vtkX3DExporterWriter, vtkObject); 00038 void PrintSelf(ostream& os, vtkIndent indent); 00039 00042 virtual int OpenFile(const char* file) = 0; 00043 00045 virtual int OpenStream() = 0; 00046 00048 00049 vtkSetMacro(WriteToOutputString,int); 00050 vtkGetMacro(WriteToOutputString,int); 00051 vtkBooleanMacro(WriteToOutputString,int); 00053 00055 00058 vtkGetMacro(OutputStringLength, int); 00059 vtkGetStringMacro(OutputString); 00060 unsigned char *GetBinaryOutputString() 00061 { 00062 return reinterpret_cast<unsigned char *>(this->OutputString); 00063 } 00065 00069 char *RegisterAndGetOutputString(); 00070 00071 // Closes the file if open 00072 virtual void CloseFile() = 0; 00073 // Flush can be called optionally after some operations to 00074 // flush the buffer to the filestream. A writer not necessarily 00075 // implements this function 00076 virtual void Flush() {} 00077 00080 virtual void StartDocument() = 0; 00081 00084 virtual void EndDocument() = 0; 00085 00087 00091 virtual void StartNode(int nodeID) = 0; 00092 virtual void EndNode() = 0; 00094 00098 virtual void SetField(int attributeID, const char* value, bool mfstring = false) = 0; 00099 00102 virtual void SetField(int attributeID, int) = 0; 00103 00106 virtual void SetField(int attributeID, float) = 0; 00107 00110 virtual void SetField(int attributeID, double) = 0; 00111 00114 virtual void SetField(int attributeID, bool) = 0; 00115 00119 virtual void SetField(int attributeID, int type, const double* a) = 0; 00120 00124 virtual void SetField(int attributeID, int type, vtkDataArray* a) = 0; 00125 00129 virtual void SetField(int attributeID, const double* values, size_t size) = 0; 00130 00135 virtual void SetField(int attributeID, const int* values, size_t size, bool image = false) = 0; 00136 00138 00142 protected: 00143 vtkX3DExporterWriter(); 00144 ~vtkX3DExporterWriter(); 00146 00147 char *OutputString; 00148 int OutputStringLength; 00149 int WriteToOutputString; 00150 00151 private: 00152 vtkX3DExporterWriter(const vtkX3DExporterWriter&); // Not implemented. 00153 void operator=(const vtkX3DExporterWriter&); // Not implemented. 00154 }; 00155 #endif 00156