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

Annotation of /trunk/pyvisi/py_src/carpet.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 879 - (hide annotations)
Wed Oct 25 03:56:34 2006 UTC (14 years ago) by jongui
File MIME type: text/x-python
File size: 1806 byte(s)
First prototype of pyvisi is almost done (testing to be done). 
Added all the epydocs and latex files.

1 jongui 847 import vtk
2 jongui 852 from plane import Plane
3     from common import Common
4 gross 792
5 jongui 852 class Carpet(Common, Plane):
6     """
7 jongui 879 Class that represents a scalar field as a plane deformated along the plane
8 jongui 860 normal and proportional to the scalar value on the plane.
9 jongui 852 """
10 jongui 847
11 jongui 879 def __init__(self, scene, data_collector, transform, lut = None,
12     deform = None):
13 jongui 860 """
14     @type scene: L{Scene <scene.Scene>} object
15     @param scene: Scene in which components are to be added to
16     @type data_collector: L{DataCollector <datacollector.DataCollector>}
17     object
18     @type transform: L{Transform <geo.Transform>} object
19     @param transform: Orientation of the plane
20     @type lut: L{BlueToRed <colormap.BlueToRed>} or
21     L{RedToBlue <colormap.RedToBlue>} object
22     @param lut: Lookup table to be used by the mapper
23 jongui 879 @type deform: String
24     @param deform: Mode the data is deformed. Either by I{Scalar}
25     or I{Vector}
26 jongui 860 """
27    
28 jongui 852 Common.__init__(self, scene, data_collector)
29 jongui 860 # Declared because needed by the setPlane method.
30 jongui 852 self.vtk_plane = vtk.vtkPlane()
31     self.vtk_cutter = vtk.vtkCutter()
32 jongui 860 self.transform = transform.getTransform()
33 jongui 852
34 jongui 879 if(deform == "Scalar"):
35     self.vtk_warp = vtk.vtkWarpScalar()
36     else:
37     self.vtk_warp = vtk.vtkWarpVector()
38    
39    
40 jongui 852 Plane.setPlane(self)
41     Plane.setCutter(self, data_collector.getReader().GetOutput())
42     self.warpScalar()
43    
44 jongui 860 Common.setMapperInput(self, self.vtk_warp.GetOutput(), lut)
45 jongui 852 Common.setActorInput(self)
46     Common.addActor(self)
47    
48     def warpScalar(self):
49 jongui 860 """
50 jongui 879 Set up the warp scalar and deform the plane with scalar data.
51 jongui 860 """
52    
53 jongui 852 self.vtk_warp.SetInput(self.vtk_cutter.GetOutput())
54    
55 jongui 860 def setScaleFactor(self, scale_factor):
56     """
57     Set the displacement scale factor.
58     @type scale_factor: Number
59     @param scale_factor: Size of the displacement
60     """
61 jongui 852
62 jongui 860 self.vtk_warp.SetScaleFactor(scale_factor)

  ViewVC Help
Powered by ViewVC 1.1.26