/[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 846 - (show annotations)
Mon Sep 11 07:40:09 2006 UTC (14 years, 2 months ago) by jongui
File MIME type: text/x-python
File size: 1988 byte(s)
Added modules to diplay image and 2D text. Also added simple drivers for 
creating maps, contours, arrows, image and text.

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