1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkImporter.h,v $
6 Date: $Date: 2002/02/01 06:33:18 $
7 Version: $Revision: 1.1.1.1 $
10 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
12 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
13 The following terms apply to all files associated with the software unless
14 explicitly disclaimed in individual files. This copyright specifically does
15 not apply to the related textbook "The Visualization Toolkit" ISBN
16 013199837-4 published by Prentice Hall which is covered by its own copyright.
18 The authors hereby grant permission to use, copy, and distribute this
19 software and its documentation for any purpose, provided that existing
20 copyright notices are retained in all copies and that this notice is included
21 verbatim in any distributions. Additionally, the authors grant permission to
22 modify this software and its documentation for any purpose, provided that
23 such modifications are not distributed without the explicit consent of the
24 authors and that existing copyright notices are retained in all copies. Some
25 of the algorithms implemented by this software are patented, observe all
26 applicable patent law.
28 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
29 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
30 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
31 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
34 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
35 PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
36 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
37 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
40 =========================================================================*/
41 // .NAME vtkImporter - importer abstract class
42 // .SECTION Description
43 // vtkImporter is an abstract class that specifies the protocol for
44 // importing actors, cameras, lights and proeperties into a
46 // The following takes place:
47 // Create a RenderWindow and Renderer if none is provided.
48 // Open the import file
52 // Import the Properties
53 // Close the import file
54 // Subclasses optionally implement the ImportActors, ImportCameras,
55 // ImportLights and ImportProperties methods. An ImportBegin and
56 // ImportEnd can optionally be provided to perform Importer-specific
57 // initialization and termination. The Read method initiates the import
58 // process. If a RenderWindow is provided, its Renderer will contained
59 // the imported objects. If the RenderWindow has no Renderer, one is
60 // created. If no RenderWindow is provided, both a RenderWindow and
61 // Renderer will be created. Both the RenderWindow and Renderer can be
62 // accessed using Get methods.
65 // vtk3DSImporter vtkExporter
67 #ifndef __vtkImporter_h
68 #define __vtkImporter_h
71 #include "vtkObject.h"
72 #include "vtkRenderWindow.h"
73 #include "vtkRenderer.h"
74 #include "vtkPolyData.h"
75 #include "vtkActorCollection.h"
76 #include "vtkLightCollection.h"
78 class VTK_EXPORT vtkImporter : public vtkObject
83 static vtkImporter *New() {return new vtkImporter;};
84 const char *GetClassName() {return "vtkImporter";};
85 void PrintSelf(ostream& os, vtkIndent indent);
88 // Specify the name of the file to read.
89 vtkSetStringMacro(FileName);
90 vtkGetStringMacro(FileName);
93 // Get the renderer that contains the imported actors, cameras and
95 vtkGetObjectMacro(Renderer,vtkRenderer);
98 // Set the vtkRenderWindow to contain the imported actors, cameras and
99 // lights, If no vtkRenderWindow is set, one will be created and can be
100 // obtained with the GetRenderWindow method. If the vtkRenderWindow has been
101 // specified, the first vtkRenderer it has will be used to import the
102 // objects. If the vtkRenderWindow has no Renderer, one will be created and
103 // can be accessed using GetRenderer.
104 vtkSetObjectMacro(RenderWindow,vtkRenderWindow);
105 vtkGetObjectMacro(RenderWindow,vtkRenderWindow);
108 // Set/Get the computation of normals. If on, imported geometry will
109 // be run through vtkPolyDataNormals.
110 vtkSetMacro(ComputeNormals,int);
111 vtkGetMacro(ComputeNormals,int);
112 vtkBooleanMacro(ComputeNormals,int);
115 // Import the actors, cameras, lights and properties into a vtkRenderWindow.
117 void Update() {this->Read();};
120 // Return the file pointer to the open file.
121 FILE *GetFileFD() {return this->FileFD;};
124 int OpenImportFile();
125 void CloseImportFile();
126 virtual int ImportBegin () {return 1;};
127 virtual void ImportActors (vtkRenderer *vtkNotUsed(renderer)) {};
128 virtual void ImportCameras (vtkRenderer *vtkNotUsed(renderer)) {};
129 virtual void ImportLights (vtkRenderer *vtkNotUsed(renderer)) {};
130 virtual void ImportProperties (vtkRenderer *vtkNotUsed(renderer)) {};
131 virtual void ImportEnd () {};
135 vtkRenderer *Renderer;
136 vtkRenderWindow *RenderWindow;