/[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 850 by gross, Sun Sep 17 23:27:00 2006 UTC revision 882 by jongui, Fri Oct 27 08:15:33 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 a scalar field as a 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            deform = None):
13            """
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            @type deform: String
24            @param deform: Mode the data is deformed. Either by I{Scalar}
25                or I{Vector}
26            """
27    
28            Common.__init__(self, scene, data_collector)
29            # Declared because needed by the setPlane method.
30            self.vtk_plane = vtk.vtkPlane()
31            self.vtk_cutter = vtk.vtkCutter()
32            self.transform = transform.getTransform()
33            
34            if(deform == "Scalar"):
35                self.vtk_warp = vtk.vtkWarpScalar()
36            else:
37                self.vtk_warp = vtk.vtkWarpVector()
38                
39            
40            Plane.setPlane(self)
41            Plane.setCutter(self, data_collector.getReader().GetOutput())  
42            self.warpScalar()
43            
44            #Common.setMapperInput(self, self.vtk_warp.GetOutput(), lut)
45            Common.setMapperInput(self, self.vtk_cutter.GetOutput(), lut)
46            Common.setActorInput(self)
47            Common.addActor(self)
48    
49        def warpScalar(self):
50            """
51            Set up the warp scalar and deform the plane with scalar data.
52            """
53    
54            self.vtk_warp.SetInput(self.vtk_cutter.GetOutput())
55    
56  class Carpet(object):      def setScaleFactor(self, scale_factor):
57      """          """
58      represents scalar data as plane deformated along the plane normal          Set the displacement scale factor.
59      and proportional to the scalar value on the plane.          @type scale_factor: Number
60      """          @param scale_factor: Size of the displacement
61      pass          """
62    
63                self.vtk_warp.SetScaleFactor(scale_factor)
       

Legend:
Removed from v.850  
changed lines
  Added in v.882

  ViewVC Help
Powered by ViewVC 1.1.26