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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 837 - (show 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 """
2 Class that controls the camera and its settings.
3 """
4
5 import vtk
6
7 class Camera:
8 """
9 @author: John Ngui
10 @author: Lutz Gross
11 """
12
13 def __init__(self, open_scene):
14 """
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 self.open_scene = open_scene
20 self.vtk_camera = None
21
22 self.setCamera()
23
24 def setCamera(self):
25 """
26 Set up the camera and associate it with the renderer.
27 """
28
29 self.vtk_camera = vtk.vtkCamera()
30 self.open_scene.getRenderer().SetActiveCamera(self.vtk_camera)
31
32 def setClippingRange(self, near_clipping, far_clipping):
33 """
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 self.vtk_camera.SetClippingRange(near_clipping, far_clipping)
43
44 def setFocalPoint(self, position):
45 """
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 self.vtk_camera.SetFocalPoint(position.getXCoor(), position.getYCoor(),
53 position.getZCoor())
54
55 def setPosition(self, position):
56 """
57 Set the position of the camera.
58
59 @type position: L{Position <geo.Position>} object
60 @param position: Camera position
61 """
62
63 self.vtk_camera.SetPosition(position.getXCoor(), position.getYCoor(),
64 position.getZCoor())
65
66 def setViewUp(self, position):
67 """
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 self.vtk_camera.SetViewUp(position.getXCoor(), position.getYCoor(),
75 position.getZCoor())
76
77
78
79
80
81
82 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