00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkVRMLImporter.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 =========================================================================*/ 00053 #ifndef __vtkVRMLImporter_h 00054 #define __vtkVRMLImporter_h 00055 00056 // Includes for the yacc/lex parser 00057 #include "vtkImporter.h" 00058 00059 class vtkActor; 00060 class vtkAlgorithm; 00061 class vtkProperty; 00062 class vtkCamera; 00063 class vtkLight; 00064 class vtkTransform; 00065 class vtkLookupTable; 00066 class vtkFloatArray; 00067 class vtkPolyDataMapper; 00068 class vtkPoints; 00069 class vtkIdTypeArray; 00070 class vtkVRMLImporterInternal; 00071 class vtkCellArray; 00072 00073 class VTK_HYBRID_EXPORT vtkVRMLImporter : public vtkImporter 00074 { 00075 public: 00076 static vtkVRMLImporter *New(); 00077 00078 vtkTypeMacro(vtkVRMLImporter,vtkImporter); 00079 void PrintSelf(ostream& os, vtkIndent indent); 00080 00086 vtkObject *GetVRMLDEFObject(const char *name); 00087 00089 00090 void enterNode(const char *); 00091 void exitNode(); 00092 void enterField(const char *); 00093 void exitField(); 00094 void useNode(const char *); 00096 00098 00099 vtkSetStringMacro(FileName); 00100 vtkGetStringMacro(FileName); 00102 00104 FILE *GetFileFD() {return this->FileFD;}; 00105 00106 //BTX 00107 00108 friend int yylex ( vtkVRMLImporter* ); 00109 00110 //ETX 00111 00112 protected: 00113 vtkVRMLImporter(); 00114 ~vtkVRMLImporter(); 00115 00116 virtual int ImportBegin (); 00117 virtual void ImportEnd (); 00118 virtual void ImportActors (vtkRenderer *) {}; 00119 virtual void ImportCameras (vtkRenderer *) {}; 00120 virtual void ImportLights (vtkRenderer *) {}; 00121 virtual void ImportProperties (vtkRenderer *) {}; 00122 00123 int OpenImportFile(); 00124 char *FileName; 00125 FILE *FileFD; 00126 00127 private: 00128 vtkActor *CurrentActor; 00129 vtkProperty *CurrentProperty; 00130 vtkCamera *CurrentCamera; 00131 vtkLight *CurrentLight; 00132 vtkTransform *CurrentTransform; 00133 vtkAlgorithm *CurrentSource; 00134 vtkPoints *CurrentPoints; 00135 vtkFloatArray *CurrentNormals; 00136 vtkCellArray *CurrentNormalCells; 00137 vtkFloatArray *CurrentTCoords; 00138 vtkCellArray *CurrentTCoordCells; 00139 vtkLookupTable *CurrentLut; 00140 vtkFloatArray *CurrentScalars; 00141 vtkPolyDataMapper *CurrentMapper; 00142 00143 vtkPoints* PointsNew(); 00144 vtkFloatArray* FloatArrayNew(); 00145 vtkIdTypeArray* IdTypeArrayNew(); 00146 00147 void DeleteObject(vtkObject*); 00148 00149 vtkVRMLImporterInternal* Internal; 00150 00151 private: 00152 vtkVRMLImporter(const vtkVRMLImporter&); // Not implemented. 00153 void operator=(const vtkVRMLImporter&); // Not implemented. 00154 }; 00155 00156 #endif 00157