/[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 839 - (hide annotations)
Wed Sep 6 04:53:50 2006 UTC (13 years, 11 months ago) by jongui
File MIME type: text/x-python
File size: 1992 byte(s)
- Added lookup table spectrum from blue to red and red to blue.
- Updated open scene to scene

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

  ViewVC Help
Powered by ViewVC 1.1.26