00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkVRMLImporter.h,v $ 00005 Language: C++ 00006 00007 00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 00009 All rights reserved. 00010 00011 Redistribution and use in source and binary forms, with or without 00012 modification, are permitted provided that the following conditions are met: 00013 00014 * Redistributions of source code must retain the above copyright notice, 00015 this list of conditions and the following disclaimer. 00016 00017 * Redistributions in binary form must reproduce the above copyright notice, 00018 this list of conditions and the following disclaimer in the documentation 00019 and/or other materials provided with the distribution. 00020 00021 * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names 00022 of any contributors may be used to endorse or promote products derived 00023 from this software without specific prior written permission. 00024 00025 * Modified source versions must be plainly marked as such, and must not be 00026 misrepresented as being the original software. 00027 00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR 00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00038 00039 =========================================================================*/ 00080 #ifndef __vtkVRMLImporter_h 00081 #define __vtkVRMLImporter_h 00082 00083 // Includes for the yacc/lex parser 00084 #include "vtkVRML.h" 00085 00086 #include "vtkImporter.h" 00087 class vtkActor; 00088 class vtkProperty; 00089 class vtkCamera; 00090 class vtkLight; 00091 class vtkTransform; 00092 class vtkSource; 00093 class vtkLookupTable; 00094 class vtkFloatArray; 00095 class vtkPolyDataMapper; 00096 class vtkPoints; 00097 00098 class VTK_HYBRID_EXPORT vtkVRMLImporter : public vtkImporter 00099 { 00100 public: 00101 static vtkVRMLImporter *New(); 00102 00103 vtkTypeMacro(vtkVRMLImporter,vtkImporter); 00104 void PrintSelf(ostream& os, vtkIndent indent); 00105 00111 vtkObject *GetVRMLDEFObject(const char *name); 00112 00114 00115 void enterNode(const char *); 00116 void exitNode(); 00117 void enterField(const char *); 00118 void exitField(); 00119 void useNode(const char *); 00121 00123 00124 vtkSetStringMacro(FileName); 00125 vtkGetStringMacro(FileName); 00127 00129 FILE *GetFileFD() {return this->FileFD;}; 00130 00131 //BTX 00132 00133 friend int yylex ( vtkVRMLImporter* ); 00134 00135 //ETX 00136 00137 protected: 00138 vtkVRMLImporter(); 00139 ~vtkVRMLImporter(); 00140 00141 virtual int ImportBegin (); 00142 virtual void ImportEnd (); 00143 virtual void ImportActors (vtkRenderer *) {}; 00144 virtual void ImportCameras (vtkRenderer *) {}; 00145 virtual void ImportLights (vtkRenderer *) {}; 00146 virtual void ImportProperties (vtkRenderer *) {}; 00147 00148 int OpenImportFile(); 00149 char *FileName; 00150 FILE *FileFD; 00151 00152 private: 00153 vtkActor *CurrentActor; 00154 vtkProperty *CurrentProperty; 00155 vtkCamera *CurrentCamera; 00156 vtkLight *CurrentLight; 00157 vtkTransform *CurrentTransform; 00158 vtkSource *CurrentSource; 00159 vtkPoints *CurrentPoints; 00160 vtkFloatArray *CurrentNormals; 00161 vtkLookupTable *CurrentLut; 00162 vtkFloatArray *CurrentScalars; 00163 vtkPolyDataMapper *CurrentMapper; 00164 00165 vtkPoints* PointsNew(); 00166 vtkIdTypeArray* IdTypeArrayNew(); 00167 00168 void DeleteObject(vtkObject*); 00169 00170 //BTX 00171 00172 #ifdef WIN32 00173 #pragma warning( disable : 4251 ) 00174 #endif 00175 00176 VectorType<vtkObject*> Heap; 00177 00178 #ifdef WIN32 00179 #pragma warning( default : 4251 ) 00180 #endif 00181 00182 //ETX 00183 00184 private: 00185 vtkVRMLImporter(const vtkVRMLImporter&); // Not implemented. 00186 void operator=(const vtkVRMLImporter&); // Not implemented. 00187 }; 00188 00189 #endif 00190