/[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 792 by gross, Fri Jul 28 10:37:16 2006 UTC revision 879 by jongui, Wed Oct 25 03:56:34 2006 UTC
# Line 1  Line 1 
1  """  import vtk
2  class that represents scalar data as plane deformated along the plane normal and proportional to the scalar value on the plane.  from plane import Plane
3    from common import Common
4    
5  @var __author__: name of author  class Carpet(Common, Plane):
6  @var __license__: licence agreement      """
7  @var __copyright__: copyrights      Class that represents a scalar field as a plane deformated along the plane
8  @var __url__: url entry point on documentation      normal and proportional to the scalar value on the plane.
9  @var __version__: version      """
10  @var __date__: date of the version  
11  """      def __init__(self, scene, data_collector, transform, lut = None,
12  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF          deform = None):
13                      http://www.access.edu.au          """
14                  Primary Business: Queensland, Australia"""          @type scene: L{Scene <scene.Scene>} object
15  __license__="""Licensed under the Open Software License version 3.0          @param scene: Scene in which components are to be added to
16               http://www.opensource.org/licenses/osl-3.0.php"""          @type data_collector: L{DataCollector <datacollector.DataCollector>}
17  __author__="Paul Cochrane, L. Gross"              object
18  __url__="http://www.iservo.edu.au/esys"          @type transform: L{Transform <geo.Transform>} object
19  __version__="$Revision:$"          @param transform: Orientation of the plane
20  __date__="$Date:$"          @type lut: L{BlueToRed <colormap.BlueToRed>} or
21                L{RedToBlue <colormap.RedToBlue>} object
22  from common import Component          @param lut: Lookup table to be used by the mapper
23            @type deform: String
24  class Carpet(Component):          @param deform: Mode the data is deformed. Either by I{Scalar}
25      """              or I{Vector}
26      represents scalar data as plane deformated along the plane normal and proportional to the scalar value on the plane.          """
27      """  
28      pass          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.setActorInput(self)
46            Common.addActor(self)
47    
48        def warpScalar(self):
49            """
50            Set up the warp scalar and deform the plane with scalar data.
51            """
52    
53            self.vtk_warp.SetInput(self.vtk_cutter.GetOutput())
54    
55        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    
62            self.vtk_warp.SetScaleFactor(scale_factor)

Legend:
Removed from v.792  
changed lines
  Added in v.879

  ViewVC Help
Powered by ViewVC 1.1.26