/[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 852 - (show annotations)
Wed Sep 20 03:23:16 2006 UTC (12 years, 10 months ago) by jongui
File MIME type: text/x-python
File size: 2014 byte(s)
added carpet and isosurface


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

  ViewVC Help
Powered by ViewVC 1.1.26