VTK
dox/IO/Import/vtkVRMLImporter.h
Go to the documentation of this file.
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 "vtkIOImportModule.h" // For export macro
00058 #include "vtkImporter.h"
00059 
00060 class vtkActor;
00061 class vtkAlgorithm;
00062 class vtkProperty;
00063 class vtkCamera;
00064 class vtkLight;
00065 class vtkTransform;
00066 class vtkLookupTable;
00067 class vtkFloatArray;
00068 class vtkPolyDataMapper;
00069 class vtkPoints;
00070 class vtkIdTypeArray;
00071 class vtkVRMLImporterInternal;
00072 class vtkCellArray;
00073 
00074 class VTKIOIMPORT_EXPORT vtkVRMLImporter : public vtkImporter
00075 {
00076 public:
00077   static vtkVRMLImporter *New();
00078 
00079   vtkTypeMacro(vtkVRMLImporter,vtkImporter);
00080   void PrintSelf(ostream& os, vtkIndent indent);
00081 
00087   vtkObject *GetVRMLDEFObject(const char *name);
00088 
00090 
00091   void enterNode(const char *);
00092   void exitNode();
00093   void enterField(const char *);
00094   void exitField();
00095   void useNode(const char *);
00097 
00099 
00100   vtkSetStringMacro(FileName);
00101   vtkGetStringMacro(FileName);
00103 
00105   FILE *GetFileFD() {return this->FileFD;};
00106 
00107 //BTX
00108 
00109   friend int yylex ( vtkVRMLImporter* );
00110 
00111 //ETX
00112 
00113 protected:
00114   vtkVRMLImporter();
00115   ~vtkVRMLImporter();
00116 
00117   virtual int ImportBegin ();
00118   virtual void ImportEnd ();
00119   virtual void ImportActors (vtkRenderer *) {};
00120   virtual void ImportCameras (vtkRenderer *) {};
00121   virtual void ImportLights (vtkRenderer *) {};
00122   virtual void ImportProperties (vtkRenderer *) {};
00123 
00124   int OpenImportFile();
00125   char *FileName;
00126   FILE *FileFD;
00127 
00128 private:
00129   vtkActor             *CurrentActor;
00130   vtkProperty          *CurrentProperty;
00131   vtkCamera            *CurrentCamera;
00132   vtkLight             *CurrentLight;
00133   vtkTransform         *CurrentTransform;
00134   vtkAlgorithm         *CurrentSource;
00135   vtkPoints            *CurrentPoints;
00136   vtkFloatArray        *CurrentNormals;
00137   vtkCellArray         *CurrentNormalCells;
00138   vtkFloatArray        *CurrentTCoords;
00139   vtkCellArray         *CurrentTCoordCells;
00140   vtkLookupTable       *CurrentLut;
00141   vtkFloatArray        *CurrentScalars;
00142   vtkPolyDataMapper    *CurrentMapper;
00143 
00144   vtkPoints* PointsNew();
00145   vtkFloatArray* FloatArrayNew();
00146   vtkIdTypeArray* IdTypeArrayNew();
00147 
00148   void DeleteObject(vtkObject*);
00149 
00150   vtkVRMLImporterInternal* Internal;
00151 
00152 private:
00153   vtkVRMLImporter(const vtkVRMLImporter&);  // Not implemented.
00154   void operator=(const vtkVRMLImporter&);  // Not implemented.
00155 };
00156 
00157 #endif
00158