/[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 827 by jongui, Wed Aug 30 00:08:02 2006 UTC revision 839 by jongui, Wed Sep 6 04:53:50 2006 UTC
# Line 1  Line 1 
1  """  """
2  defines a scene in which items are shown  @author: John Ngui
3    @author: Lutz Gross
4  @var __author__: name of author  """
 @var __license__: licence agreement  
 @var __copyright__: copyrights  
 @var __url__: url entry point on documentation  
 @var __version__: version  
 @var __date__: date of the version  
 """  
   
 __copyright__="""  Copyright (c) 2006 by ACcESS MNRF  
                     http://www.access.edu.au  
                 Primary Business: Queensland, Australia"""  
 __license__="""Licensed under the Open Software License version 3.0  
              http://www.opensource.org/licenses/osl-3.0.php"""  
 __author__="Paul Cochrane, L. Gross"  
 __url__="http://www.iservo.edu.au/esys"  
 __version__="$Revision:$"  
 __date__="$Date:$"  
5    
6  import vtk  import vtk
7    
8  class OpenScene:  class Scene:
9        """
10        Class that defines a scene in which components are displayed.
11        """
12    
13      def __init__(self, renderer = "vtk-online", x_size = 800, y_size = 600):      def __init__(self, renderer = "vtk-online", x_size = 800, y_size = 600):
14            """
15            Initialize all the instance variables.
16    
17    
18            @type renderer: String
19            @param renderer: Type of rendering (I{vtk-online or vtk-offline})      
20            @type x_size: Number
21            @param x_size: Size of the rendering window on the x-axis
22            @type y_size: Number
23            @param y_size: Size of the rendering window on the y-axis
24            """
25    
26          self.renderer = renderer          self.renderer = renderer
27          self.x_size = x_size          self.x_size = x_size
28          self.y_size = y_size          self.y_size = y_size
29          self.vtk_renderer = None          self.vtk_renderer = None
30          self.vtk_render_window = None          self.vtk_render_window = None
31    
32          self.setRenderingWindow()          if(renderer == "vtk-online"):
33                self.setRenderingWindow()
34    
35      def setRenderingWindow(self):      def setRenderingWindow(self):
36            """
37            Set up the renderer and rendering window.
38            """
39    
40          self.vtk_renderer = vtk.vtkRenderer()          self.vtk_renderer = vtk.vtkRenderer()
41          self.vtk_render_window = vtk.vtkRenderWindow()          self.vtk_render_window = vtk.vtkRenderWindow()
42          self.vtk_render_window.AddRenderer(self.vtk_renderer)          self.vtk_render_window.AddRenderer(self.vtk_renderer)
43          self.vtk_render_window.SetSize(self.x_size, self.y_size)          self.vtk_render_window.SetSize(self.x_size, self.y_size)
44          self.vtk_renderer.SetBackground(1, 1, 1)              self.vtk_renderer.SetBackground(1, 1, 1) # Default color is white
45    
46      def render(self):      def render(self):
47            """
48            Set up the render window interactor and render the image.
49            """
50    
51          vtk_render_window_interactor = vtk.vtkRenderWindowInteractor()          vtk_render_window_interactor = vtk.vtkRenderWindowInteractor()
52          vtk_render_window_interactor.SetRenderWindow(self.vtk_render_window)          vtk_render_window_interactor.SetRenderWindow(self.vtk_render_window)
53          vtk_render_window_interactor.Initialize()          vtk_render_window_interactor.Initialize()
# Line 46  class OpenScene: Line 55  class OpenScene:
55          vtk_render_window_interactor.Start()          vtk_render_window_interactor.Start()
56    
57      def getRenderer(self):      def getRenderer(self):
58            """
59            Return the renderer.
60    
61            @rtype: vtkRenderer
62            @return: VTK renderer
63            """
64    
65          return self.vtk_renderer          return self.vtk_renderer
66                    
67                    

Legend:
Removed from v.827  
changed lines
  Added in v.839

  ViewVC Help
Powered by ViewVC 1.1.26