OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / HP / util / HP / include / vtk / vtkImporter.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkImporter.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:33:18 $
7   Version:   $Revision: 1.1.1.1 $
8
9
10 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
11
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.
17
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.
27
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.
32
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.
38
39
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
45 // vtkRenderWindow.
46 // The following takes place:
47 // Create a RenderWindow and Renderer if none is provided.
48 // Open the import file
49 // Import the Actors
50 // Import the cameras
51 // Import the lights
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.
63
64 // .SECTION See Also
65 // vtk3DSImporter vtkExporter
66
67 #ifndef __vtkImporter_h
68 #define __vtkImporter_h
69
70 #include <stdio.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"
77
78 class VTK_EXPORT vtkImporter : public vtkObject
79 {
80 public:
81   vtkImporter();
82   ~vtkImporter();
83   static vtkImporter *New() {return new vtkImporter;};
84   const char *GetClassName() {return "vtkImporter";};
85   void PrintSelf(ostream& os, vtkIndent indent);
86
87   // Description:
88   // Specify the name of the file to read.
89   vtkSetStringMacro(FileName);
90   vtkGetStringMacro(FileName);
91
92   // Description
93   // Get the renderer that contains the imported actors, cameras and
94   // lights.
95   vtkGetObjectMacro(Renderer,vtkRenderer);
96
97   // Description
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);
106
107   // Description:
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);
113
114   // Description
115   // Import the actors, cameras, lights and properties into a vtkRenderWindow.
116   void Read();
117   void Update() {this->Read();};
118   
119   // Description:
120   // Return the file pointer to the open file.
121   FILE *GetFileFD() {return this->FileFD;};
122
123 protected:
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 () {};
132
133   char *FileName;
134   FILE *FileFD;
135   vtkRenderer *Renderer;
136   vtkRenderWindow *RenderWindow;
137   int ComputeNormals;
138
139 };
140
141 #endif
142
143
144
145