VTK  9.7.1
vtkVRMLImporter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
50 #ifndef vtkVRMLImporter_h
51 #define vtkVRMLImporter_h
52 
53 #include "vtkIOImportModule.h" // For export macro
54 #include "vtkImporter.h"
55 
56 VTK_ABI_NAMESPACE_BEGIN
57 class vtkActor;
58 class vtkAlgorithm;
59 class vtkProperty;
60 class vtkLight;
61 class vtkTransform;
62 class vtkLookupTable;
63 class vtkFloatArray;
64 class vtkPolyDataMapper;
65 class vtkPoints;
66 class vtkIdTypeArray;
67 class vtkVRMLImporterInternal;
68 class vtkVRMLYaccData;
69 class vtkCellArray;
70 class vtkPolyData;
71 
72 class VTKIOIMPORT_EXPORT vtkVRMLImporter : public vtkImporter
73 {
74 public:
75  static vtkVRMLImporter* New();
76 
77  vtkTypeMacro(vtkVRMLImporter, vtkImporter);
78  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
81 
85  vtkSetMacro(ShapeResolution, int);
86  vtkGetMacro(ShapeResolution, int);
88 
97  vtkObject* GetVRMLDEFObject(const char* name);
98 
103 
104 protected:
105  vtkVRMLImporter();
106  ~vtkVRMLImporter() override;
107 
108  int OpenImportFile();
109  int ImportBegin() override;
110  void ImportEnd() override;
111  void ImportActors(vtkRenderer*) override {}
112  void ImportCameras(vtkRenderer*) override {}
113  void ImportLights(vtkRenderer*) override {}
114  void ImportProperties(vtkRenderer*) override {}
115 
117 
120  virtual void enterNode(const char*);
121  virtual void exitNode();
122  virtual void enterField(const char*);
123  virtual void exitField();
124  virtual void useNode(const char*);
126 
130  FILE* GetFileFD() { return this->FileFD; }
131 
132  FILE* FileFD;
134 
135  friend class vtkVRMLYaccData;
136 
137 private:
138  vtkPoints* PointsNew();
139  vtkFloatArray* FloatArrayNew();
140  vtkIdTypeArray* IdTypeArrayNew();
141 
142  void DeleteObject(vtkObject*);
143 
144  vtkVRMLImporterInternal* Internal;
145  vtkVRMLYaccData* Parser;
146  vtkActor* CurrentActor;
147  vtkProperty* CurrentProperty;
148  vtkSmartPointer<vtkPolyData> CurrentPoly;
149  vtkLight* CurrentLight;
150  vtkTransform* CurrentTransform;
151  vtkAlgorithm* CurrentSource;
152  vtkPoints* CurrentPoints;
153  vtkFloatArray* CurrentNormals;
154  vtkCellArray* CurrentNormalCells;
155  vtkFloatArray* CurrentTCoords;
156  vtkCellArray* CurrentTCoordCells;
157  vtkLookupTable* CurrentLut;
158  vtkFloatArray* CurrentScalars;
159  vtkPolyDataMapper* CurrentMapper;
160  struct ExtrusionOptions
161  {
162  bool beginCap;
163  bool endCap;
164  } CurrenExtrusionOptions;
165  struct TransformOptions
166  {
167  double scale[3];
168  float rotation[4];
169  double translation[3];
170  bool scaleSet;
171  bool rotationSet;
172  bool translationSet;
173  } CurrentTransformOptions;
174 
175  vtkVRMLImporter(const vtkVRMLImporter&) = delete;
176  void operator=(const vtkVRMLImporter&) = delete;
177 };
178 
179 VTK_ABI_NAMESPACE_END
180 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
void ImportActors(vtkRenderer *) override
abstract base class for most VTK objects
Definition: vtkObject.h:52
represent surface properties of a geometric object
Definition: vtkProperty.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
FILE * GetFileFD()
Return the file pointer to the open file.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
map scalar values into colors via a lookup table
void ImportLights(vtkRenderer *) override
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
dynamic, self-adjusting array of vtkIdType
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
importer abstract class
Definition: vtkImporter.h:60
virtual void ImportEnd()
Definition: vtkImporter.h:280
virtual int ImportBegin()
Definition: vtkImporter.h:279
void ImportProperties(vtkRenderer *) override
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
a simple class to control print indentation
Definition: vtkIndent.h:28
a virtual light for 3D rendering
Definition: vtkLight.h:49
virtual std::string GetOutputsDescription()
Recover a printable string that let importer implementation Describe their outputs.
Definition: vtkImporter.h:136
void ImportCameras(vtkRenderer *) override
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:177
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
imports VRML 2.0 files.
represent and manipulate 3D points
Definition: vtkPoints.h:30