00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkX3DExporterWriter.h,v $ 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 =========================================================================*/ 00015 #ifndef __vtkX3DExporterWriter_h 00016 #define __vtkX3DExporterWriter_h 00017 00018 #include <vtkObject.h> 00019 #include <vtkstd/vector> // Needed as function parameter 00020 00021 // Forward declarations 00022 class vtkDataArray; 00023 class vtkUnsignedCharArray; 00024 class vtkCellArray; 00025 00026 // Description: 00027 // vtkX3DExporterWriter is the definition for 00028 // classes that implement a encoding for the 00029 // X3D exporter 00030 class VTK_HYBRID_EXPORT vtkX3DExporterWriter : public vtkObject 00031 { 00032 public: 00033 vtkTypeRevisionMacro(vtkX3DExporterWriter, vtkObject); 00034 void PrintSelf(ostream& os, vtkIndent indent); 00035 00036 // Description: 00037 // Opens the file specified with file 00038 // returns 1 if sucessfull otherwise 0 00039 virtual int OpenFile(const char* file) = 0; 00040 // Closes the file if open 00041 virtual void CloseFile() = 0; 00042 // Flush can be called optionally after some operations to 00043 // flush the buffer to the filestream. A writer not necessarily 00044 // implements this function 00045 virtual void Flush() {}; 00046 00047 // Description: 00048 // Starts a document and sets all necessary informations, 00049 // i.e. the header of the implemented encoding 00050 virtual void StartDocument() = 0; 00051 00052 // Description: 00053 // Ends a document and sets all necessary informations 00054 // or necessary bytes to finish the encoding correctly 00055 virtual void EndDocument() = 0; 00056 00057 // Description: 00058 // Starts/ends a new X3D node specified via nodeID. The list of 00059 // nodeIds can be found in vtkX3DExportWriterSymbols.h. The EndNode 00060 // function closes the last open node. So there must be 00061 // corresponding Start/EndNode() calls for every node 00062 virtual void StartNode(int nodeID) = 0; 00063 virtual void EndNode() = 0; 00064 00065 // Description: 00066 // Sets the field specified with attributeID 00067 // of the active node to the given value. 00068 // The type of the field is SFString and MFString 00069 //virtual void SetField(int attributeID, const vtkstd::string &value) = 0; 00070 virtual void SetField(int attributeID, const char* value, bool mfstring = false) = 0; 00071 00072 // Description: 00073 // Sets the field specified with attributeID 00074 // of the active node to the given value. 00075 // The type of the field is SFInt32 00076 virtual void SetField(int attributeID, int) = 0; 00077 00078 // Description: 00079 // Sets the field specified with attributeID 00080 // of the active node to the given value. 00081 // The type of the field is SFFloat 00082 virtual void SetField(int attributeID, float) = 0; 00083 00084 // Description: 00085 // Sets the field specified with attributeID 00086 // of the active node to the given value. 00087 // The type of the field is SFDouble 00088 virtual void SetField(int attributeID, double) = 0; 00089 00090 // Description: 00091 // Sets the field specified with attributeID 00092 // of the active node to the given value. 00093 // The type of the field is SFBool 00094 virtual void SetField(int attributeID, bool) = 0; 00095 00096 // Description: 00097 // Sets the field specified with attributeID 00098 // of the active node to the given value. 00099 // The type of the field is specified with type 00100 // Supported types: SFVEC3F, SFCOLOR, SFROTATION 00101 virtual void SetField(int attributeID, int type, const double* a) = 0; 00102 00103 // Description: 00104 // Sets the field specified with attributeID 00105 // of the active node to the given value. 00106 // The type of the field is specified with type 00107 // Supported types: MFVEC3F, MFVEC2F 00108 virtual void SetField(int attributeID, int type, vtkDataArray* a) = 0; 00109 00110 // Description: 00111 // Sets the field specified with attributeID 00112 // of the active node to the given value. 00113 // The type of the field is specified with type 00114 // Supported types: MFCOLOR 00115 //virtual void SetField(int attributeID, int type, const vtkstd::vector<double> &values) = 0; 00116 virtual void SetField(int attributeID, const double* values, size_t size) = 0; 00117 00118 // Description: 00119 // Sets the field specified with attributeID 00120 // of the active node to the given value. 00121 // The type of the field is specified with type 00122 // It is possible to specify that the field is an 00123 // image for optimized formating or compression 00124 // Supported types: MFINT32, SFIMAGE 00125 //virtual void SetField(int attributeID, const vtkstd::vector<int> &values, bool image = false) = 0; 00126 virtual void SetField(int attributeID, const int* values, size_t size, bool image = false) = 0; 00127 00128 // Description: 00129 // Sets the field specified with attributeID 00130 // of the active node to the given value. 00131 // The type of the field is specified with type 00132 // Supported types: MFString 00133 //virtual void SetField(int attributeID, int type, vtkstd::string) = 0; 00134 protected: 00135 vtkX3DExporterWriter(); 00136 ~vtkX3DExporterWriter(); 00137 00138 private: 00139 vtkX3DExporterWriter(const vtkX3DExporterWriter&); // Not implemented. 00140 void operator=(const vtkX3DExporterWriter&); // Not implemented. 00141 }; 00142 #endif 00143