VTK
dox/Hybrid/vtkX3DExporterWriter.h
Go to the documentation of this file.
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 <vtkObject.h>
00027 
00028 // Forward declarations
00029 class vtkDataArray;
00030 class vtkUnsignedCharArray;
00031 class vtkCellArray;
00032 
00033 class VTK_HYBRID_EXPORT vtkX3DExporterWriter : public vtkObject
00034 {
00035 public:
00036   vtkTypeMacro(vtkX3DExporterWriter, vtkObject);
00037   void PrintSelf(ostream& os, vtkIndent indent);
00038 
00041   virtual int OpenFile(const char* file) = 0;
00042 
00044   virtual int OpenStream() = 0;
00045 
00047 
00048   vtkSetMacro(WriteToOutputString,int);
00049   vtkGetMacro(WriteToOutputString,int);
00050   vtkBooleanMacro(WriteToOutputString,int);
00052 
00054 
00057   vtkGetMacro(OutputStringLength, int);
00058   vtkGetStringMacro(OutputString);
00059   unsigned char *GetBinaryOutputString()
00060     {
00061       return reinterpret_cast<unsigned char *>(this->OutputString);
00062     }
00064 
00068   char *RegisterAndGetOutputString();
00069 
00070   // Closes the file if open
00071   virtual void CloseFile() = 0;
00072   // Flush can be called optionally after some operations to
00073   // flush the buffer to the filestream. A writer not necessarily 
00074   // implements this function
00075   virtual void Flush() {};
00076 
00079   virtual void StartDocument() = 0;
00080   
00083   virtual void EndDocument() = 0;
00084 
00086 
00090   virtual void StartNode(int nodeID) = 0;
00091   virtual void EndNode() = 0;
00093   
00097   virtual void SetField(int attributeID, const char* value, bool mfstring = false) = 0;
00098   
00101   virtual void SetField(int attributeID, int) = 0;
00102   
00105   virtual void SetField(int attributeID, float) = 0;
00106   
00109   virtual void SetField(int attributeID, double) = 0;
00110 
00113   virtual void SetField(int attributeID, bool) = 0;
00114 
00118   virtual void SetField(int attributeID, int type, const double* a) = 0;
00119   
00123   virtual void SetField(int attributeID, int type, vtkDataArray* a) = 0;
00124 
00128   virtual void SetField(int attributeID, const double* values, size_t size) = 0;
00129 
00134   virtual void SetField(int attributeID, const int* values, size_t size, bool image = false) = 0;
00135 
00137 
00141 protected:
00142   vtkX3DExporterWriter();
00143   ~vtkX3DExporterWriter();
00145 
00146   char *OutputString;
00147   int OutputStringLength;
00148   int WriteToOutputString;
00149 
00150 private:
00151   vtkX3DExporterWriter(const vtkX3DExporterWriter&); // Not implemented.
00152   void operator=(const vtkX3DExporterWriter&); // Not implemented.
00153 };
00154 #endif
00155