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

Annotation of /trunk/pyvisi/py_src/camera.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 837 - (hide annotations)
Tue Sep 5 07:23:50 2006 UTC (13 years, 11 months ago) by jongui
File MIME type: text/x-python
File size: 2030 byte(s)
added more epydocs and improved the way colors are specified in the driver.


1 gross 792 """
2 jongui 837 Class that controls the camera and its settings.
3 gross 792 """
4    
5 jongui 830 import vtk
6 gross 792
7 jongui 830 class Camera:
8 jongui 837 """
9     @author: John Ngui
10     @author: Lutz Gross
11     """
12    
13 jongui 830 def __init__(self, open_scene):
14 jongui 837 """
15     @type open_scene: L{OpenScene <openscene.OpenScene>} object
16     @param open_scene: Scene in which components are to be added to
17     """
18    
19 jongui 830 self.open_scene = open_scene
20     self.vtk_camera = None
21 gross 792
22 jongui 830 self.setCamera()
23    
24     def setCamera(self):
25 jongui 837 """
26     Set up the camera and associate it with the renderer.
27     """
28    
29 jongui 830 self.vtk_camera = vtk.vtkCamera()
30     self.open_scene.getRenderer().SetActiveCamera(self.vtk_camera)
31    
32     def setClippingRange(self, near_clipping, far_clipping):
33 jongui 837 """
34     Set the near and far clipping plane of the camera.
35    
36     @type near_clipping: Number
37     @param near_clipping: Distance to the near clipping range
38     @type far_clipping: Number
39     @param far_clipping: Distance to the far clipping plane
40     """
41    
42 jongui 830 self.vtk_camera.SetClippingRange(near_clipping, far_clipping)
43    
44 jongui 835 def setFocalPoint(self, position):
45 jongui 837 """
46     Set the focal point of the camera.
47    
48     @type position: L{Position <geo.Position>} object
49     @param position: Camera focal point position
50     """
51    
52 jongui 835 self.vtk_camera.SetFocalPoint(position.getXCoor(), position.getYCoor(),
53     position.getZCoor())
54 jongui 830
55 jongui 835 def setPosition(self, position):
56 jongui 837 """
57     Set the position of the camera.
58    
59     @type position: L{Position <geo.Position>} object
60     @param position: Camera position
61     """
62    
63 jongui 835 self.vtk_camera.SetPosition(position.getXCoor(), position.getYCoor(),
64     position.getZCoor())
65 jongui 830
66 jongui 835 def setViewUp(self, position):
67 jongui 837 """
68     Set the up direction of the camera.
69    
70     @type position: L{Position <geo.Position>} object
71     @param position: Camera view up position
72     """
73    
74 jongui 835 self.vtk_camera.SetViewUp(position.getXCoor(), position.getYCoor(),
75     position.getZCoor())
76 jongui 830
77    
78    
79    
80    
81    
82 gross 792 class FrontView(Camera):
83     pass
84    
85     class BackView(Camera):
86     pass
87    
88     class TopView(Camera):
89     pass
90    
91     class BottomView(Camera):
92     pass
93    
94     class LeftView(Camera):
95     pass
96    
97     class RightView(Camera):
98     pass
99    
100     class IsometricView(Camera):
101     pass

  ViewVC Help
Powered by ViewVC 1.1.26