/[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 886 - (hide annotations)
Thu Nov 2 01:34:58 2006 UTC (13 years, 11 months ago) by jongui
File MIME type: text/x-python
File size: 1871 byte(s)
- Fixed a couple of minor bugs but the bug relating to the plane normal still exists.
- Updated the documentation.

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 886 Common.setMapperInput(self, self.vtk_warp.GetOutput(), lut)
45     #Common.setMapperInput(self, self.vtk_cutter.GetOutput(), lut)
46 jongui 852 Common.setActorInput(self)
47     Common.addActor(self)
48    
49     def warpScalar(self):
50 jongui 860 """
51 jongui 879 Set up the warp scalar and deform the plane with scalar data.
52 jongui 860 """
53    
54 jongui 852 self.vtk_warp.SetInput(self.vtk_cutter.GetOutput())
55    
56 jongui 860 def setScaleFactor(self, scale_factor):
57     """
58     Set the displacement scale factor.
59     @type scale_factor: Number
60     @param scale_factor: Size of the displacement
61     """
62 jongui 852
63 jongui 860 self.vtk_warp.SetScaleFactor(scale_factor)

  ViewVC Help
Powered by ViewVC 1.1.26