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


1 gross 792 """
2 jongui 839 @author: John Ngui
3     @author: Lutz Gross
4 gross 792 """
5    
6 jongui 830 import vtk
7 gross 792
8 jongui 830 class Camera:
9 jongui 837 """
10 jongui 839 Class that controls the camera and its settings.
11 jongui 837 """
12    
13 jongui 839 def __init__(self, scene):
14 jongui 837 """
15 jongui 846 @type scene: L{Scene <scene.Scene>} object
16 jongui 839 @param scene: Scene in which components are to be added to
17 jongui 837 """
18    
19 jongui 839 self.scene = scene
20 jongui 852 self.vtk_camera = vtk.vtkCamera()
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 839 self.scene.getRenderer().SetActiveCamera(self.vtk_camera)
30 jongui 830
31     def setClippingRange(self, near_clipping, far_clipping):
32 jongui 837 """
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 jongui 830 self.vtk_camera.SetClippingRange(near_clipping, far_clipping)
42    
43 jongui 835 def setFocalPoint(self, position):
44 jongui 837 """
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 jongui 835 self.vtk_camera.SetFocalPoint(position.getXCoor(), position.getYCoor(),
52     position.getZCoor())
53 jongui 830
54 jongui 835 def setPosition(self, position):
55 jongui 837 """
56     Set the position of the camera.
57    
58     @type position: L{Position <geo.Position>} object
59     @param position: Camera position
60     """
61    
62 jongui 835 self.vtk_camera.SetPosition(position.getXCoor(), position.getYCoor(),
63     position.getZCoor())
64 jongui 830
65 jongui 835 def setViewUp(self, position):
66 jongui 837 """
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 jongui 835 self.vtk_camera.SetViewUp(position.getXCoor(), position.getYCoor(),
74     position.getZCoor())
75 jongui 830
76 jongui 852 def setZoom(self, zoom):
77     self.vtk_camera.Zoom(zoom)
78 jongui 830
79    
80    
81 gross 792 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