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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 792 - (show annotations)
Fri Jul 28 10:37:16 2006 UTC (14 years ago) by gross
File MIME type: text/x-python
File size: 3262 byte(s)
frame for pyvisi set up
1 """
2 defines a scene in which items are shown
3
4 @var __author__: name of author
5 @var __license__: licence agreement
6 @var __copyright__: copyrights
7 @var __url__: url entry point on documentation
8 @var __version__: version
9 @var __date__: date of the version
10 """
11
12 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
13 http://www.access.edu.au
14 Primary Business: Queensland, Australia"""
15 __license__="""Licensed under the Open Software License version 3.0
16 http://www.opensource.org/licenses/osl-3.0.php"""
17 __author__="Paul Cochrane, L. Gross"
18 __url__="http://www.iservo.edu.au/esys"
19 __version__="$Revision:$"
20 __date__="$Date:$"
21
22 from camera import IsometricCamera
23 from colors import White
24
25
26
27 def Scene(PyvisiObject):
28 """
29 a scene for visualization
30 """
31 def __init__(self,x_size,y_size,camera,background):
32 self.setSize(x_size,y_size)
33 self.setBackgroundColor(backgound)
34 self.setCamera(backgound)
35
36 def render(self,filename=None,wait=False):
37 """
38 renders the scene. If filename is present the file is rendered in the file filename
39 """
40 pass
41 def setSize(self,x_size,y_size):
42 """
43 sets the size of the output window
44 """
45 pass
46
47 def setBackgroundColor(self,color):
48 """
49 Sets the background color of the Scene
50
51 @param color: The color to set the background to. Can be RGB or CMYK
52 @type color: L{Color}
53 """
54 pass
55
56 def setCamera(self,camera):
57 """
58 sets the camera
59 ` """
60 pass
61
62 def openScene(renderer="pyvisi",x_size=640,y_size=480,camera=IsometricCamera(),background=White()):
63 """
64 opens a scene
65
66 @param renderer: renderer to be used
67 @param x_size: window width (in pixel)
68 @param y_size: window height (in pixel)
69 @param camera: camera
70 @param background: background color
71 @returns: L{Scene}
72 """
73 if renderer == "vtk_online":
74 import renderers.vtk.VTKScene as VTKScene
75 return VTKScene(x_size,y_size,camera,background,"online", offscreen=False)
76 elif renderer == "vtk_ps":
77 import renderers.vtk.VTKScene as VTKScene
78 return VTKScene(x_size,y_size,camera,background,"ps", offscreen=True)
79 elif renderer == "vtk_png":
80 import renderers.vtk.VTKScene as VTKScene
81 return VTKScene(x_size,y_size,camera,background,"png", offscreen=True)
82 elif renderer == "vtk_jpeg":
83 import renderers.vtk.VTKScene as VTKScene
84 return VTKScene(x_size,y_size,camera,background,"jpeg", offscreen=True)
85 elif renderer == "vtk_tiff":
86 import renderers.vtk.VTKScene as VTKScene
87 return VTKScene(x_size,y_size,camera,background,"tiff", offscreen=True)
88 elif renderer == "vtk_bmp":
89 import renderers.vtk.VTKScene as VTKScene
90 return VTKScene(x_size,y_size,camera,background,"bmp", offscreen=True)
91 elif renderer == "vtk_pnm":
92 import renderers.vtk.VTKScene as VTKScene
93 return VTKScene(x_size,y_size,camera,background,"pnm", offscreen=True)
94 elif renderer == "pyvisi" or renderer==None:
95 import Scene
96 return Scene(x_size,y_size,camera,background)
97 else:
98 raise ValueError, "Unknown renderer %s."%renderer
99

  ViewVC Help
Powered by ViewVC 1.1.26