/[escript]/trunk/pyvisi/py_src/scene.py
ViewVC logotype

Diff of /trunk/pyvisi/py_src/scene.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1167 by gross, Wed May 23 23:56:39 2007 UTC revision 1168 by jongui, Thu May 24 05:36:42 2007 UTC
# Line 43  class Scene: Line 43  class Scene:
43          self.__PNG = "png"          self.__PNG = "png"
44          self.__TIF = "tif"          self.__TIF = "tif"
45          self.__PS  = "ps"          self.__PS  = "ps"
46            self.__VRML = "vrml"
47            self.__IV = "iv"
48            
49          self.__vtk_render_window = vtk.vtkRenderWindow()          self.__vtk_render_window = vtk.vtkRenderWindow()
50          self.__setupScene()          self.__setupScene()
# Line 182  class Scene: Line 184  class Scene:
184                    
185      def __getImageWriter(self):      def __getImageWriter(self):
186          """          """
187          Return the appropriate image writer based on the specified renderer.          Return the appropriate image writer or exporter based on the
188            specified renderer.
189    
190          @rtype: vtkImageWriter          @rtype: vtkImageWriter or vtkExporter
191          @return: Image writer          @return: Image writer or exporter
192          """          """
193    
194          if(self.__renderer.endswith(self.__JPG)):          if(self.__renderer.endswith(self.__JPG)):
# Line 200  class Scene: Line 203  class Scene:
203              return vtk.vtkTIFFWriter()              return vtk.vtkTIFFWriter()
204          elif(self.__renderer.endswith(self.__PS)):          elif(self.__renderer.endswith(self.__PS)):
205              return vtk.vtkPostScriptWriter()              return vtk.vtkPostScriptWriter()
206            elif(self.__renderer.endswith(self.__VRML)):
207                return vtk.vtkVRMLExporter() # Generates VRML files (.wrl).
208            elif(self.__renderer.endswith(self.__IV)):
209                return vtk.vtkIVExporter() # Generate OpenInventor files (.iv).
210            
211      def __saveImage(self, image_name):      def __saveImage(self, image_name):
212          """          """
# Line 217  class Scene: Line 224  class Scene:
224                    
225          # Retrieve the rendered object from the window and convert it into an          # Retrieve the rendered object from the window and convert it into an
226          # image.          # image.
227          self.__vtk_image_writer.SetInput(          # True for all writers besides VRML.
228                  self.__vtk_window_to_image.GetOutput())          if(not(self.__renderer.endswith(self.__VRML)) and \
229                    not(self.__renderer.endswith(self.__IV))):
230                self.__vtk_image_writer.SetInput(
231                        self.__vtk_window_to_image.GetOutput())
232            # True only for VRML and IV.
233            elif(self.__renderer.endswith(self.__VRML) or \
234                    self.__renderer.endswith(self.__IV)):
235                self.__vtk_image_writer.SetInput(
236                        self.__vtk_render_window)
237          self.__vtk_image_writer.SetFileName(image_name)          self.__vtk_image_writer.SetFileName(image_name)
238          self.__vtk_image_writer.Write()              self.__vtk_image_writer.Write()    
239    
# Line 236  class Scene: Line 251  class Scene:
251          Render the object using either the online, offline or display mode.          Render the object using either the online, offline or display mode.
252          """          """
253          for i in range(0, len(self.__visualization_modules)):          for i in range(0, len(self.__visualization_modules)):
             #self.__visualization_modules[i]._render()    
254              self.__visualization_modules[i]._render(self)                self.__visualization_modules[i]._render(self)  
255    
256          self.__vtk_render_window.Render()          self.__vtk_render_window.Render()

Legend:
Removed from v.1167  
changed lines
  Added in v.1168

  ViewVC Help
Powered by ViewVC 1.1.26