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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.847  
changed lines
  Added in v.860

  ViewVC Help
Powered by ViewVC 1.1.26