/[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 946 by jongui, Mon Jan 29 07:22:43 2007 UTC revision 947 by jongui, Wed Jan 31 07:17:43 2007 UTC
# Line 6  import vtk Line 6  import vtk
6  from mapper import DataSetMapper  from mapper import DataSetMapper
7  from lookuptable import LookupTable  from lookuptable import LookupTable
8  from actor import Actor3D  from actor import Actor3D
9  from constant import Viewport, Color, Lut  from constant import Viewport, Color, Lut, WarpMode
10  from warp import Warp  from warp import Warp
11  from outline import Outline  from outline import Outline
12  from transform import Transform  from transform import Transform
# Line 15  from cutter import Cutter Line 15  from cutter import Cutter
15    
16  # NOTE: DataSetMapper, Actor3D, Warp, Transform, Plane and Cutter  were  # NOTE: DataSetMapper, Actor3D, Warp, Transform, Plane and Cutter  were
17  # inherited to allow access to their public methods from the driver.  # inherited to allow access to their public methods from the driver.
18  class Carpet(DataSetMapper, Actor3D, Warp, Transform,  class Carpet(DataSetMapper, Actor3D, Warp, Transform, Plane, Cutter):
         Plane, Cutter):  
19      """      """
20      Class that shows a scalar field on a plance deformated along the place      Class that shows a scalar field on a plane deformated along the normal.
     normal.  
21      """      """
22    
23      # The SOUTH_WEST default viewport is used when there is only one viewport.      # The SOUTH_WEST default viewport is used when there is only one viewport.
24      # This saves the user from specifying the viewport when there is only one.      # This saves the user from specifying the viewport when there is only one.
25      # If no scalar field is specified, the first encountered in the file will      # If no warp_mode is specified, the data will be deformated using scalar
26      # be loaded automatically. If no lut is specified, the color scheme will      # data. If no scalar field is specified, the first encountered in the
27      # be used.      # file will be loaded automatically. If no lut is specified, the
28      def __init__(self, scene, data_collector, scalar = None, warp_mode = None,      # color scheme will be used.
29              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):      def __init__(self, scene, data_collector, scalar = None,
30                warp_mode = WarpMode.SCALAR, viewport = Viewport.SOUTH_WEST,
31                lut = Lut.COLOR, outline = True):
32          """          """
33          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
34          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 37  class Carpet(DataSetMapper, Actor3D, War Line 37  class Carpet(DataSetMapper, Actor3D, War
37          @param data_collector: Deal with source of data for visualisation          @param data_collector: Deal with source of data for visualisation
38          @type scalar: String          @type scalar: String
39          @param scalar: Scalar field to load from the source file          @param scalar: Scalar field to load from the source file
40          @param warp_mode: L{WarpMode {<constant.WarpMode>} constant          @param warp_mode: L{WarpMode <constant.WarpMode>} constant
41          @type warp_mode: Mode in which to deform the scalar data          @type warp_mode: Mode in which to deform the scalar data
42          @type viewport: L{Viewport <constant.Viewport>} constant          @type viewport: L{Viewport <constant.Viewport>} constant
43          @param viewport: Viewport in which the object is to be rendered on          @param viewport: Viewport in which objects are to be rendered on
44          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
45          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
46          @type outline: Boolean          @type outline: Boolean
47          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
48          """          """
49    
50            # NOTE: Actor3D is inherited and there are two instances declared here.
51            # As a result, when methods from Actor3D is invoked from the driver,
52            # only the methods associated with the latest instance (which in this
53            # case is the Actor3D for the carpet) can be executed. Actor3D
54            # methods associated with Outline cannot be invoked from the driver.
55            # They can only be called within here, which is why Outline must
56            # be place before the carpet as there is unlikely to be any changes
57            # made to the Outline's Actor3D.
58    
59          # ----- Outline -----          # ----- Outline -----
60    
61          if(outline == True):          if(outline == True):
# Line 56  class Carpet(DataSetMapper, Actor3D, War Line 65  class Carpet(DataSetMapper, Actor3D, War
65              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
66              # Default outline color is black.              # Default outline color is black.
67              Actor3D.setColor(self, Color.BLACK)              Actor3D.setColor(self, Color.BLACK)
68    
69              # Default line width is 1.              # Default line width is 1.
70              Actor3D._setLineWidth(self, 1)              Actor3D._setLineWidth(self, 1)
71              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(viewport, Actor3D._getActor3D(self))
# Line 75  class Carpet(DataSetMapper, Actor3D, War Line 85  class Carpet(DataSetMapper, Actor3D, War
85              lookup_table = LookupTable()              lookup_table = LookupTable()
86              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
87    
   
88          Transform.__init__(self)          Transform.__init__(self)
89          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
90    
91          Cutter.__init__(self, data_collector._getOutput(),          Cutter.__init__(self, data_collector._getOutput(),
92                  Plane._getPlane(self))                  Plane._getPlane(self))
   
         #warp = Warp(Cutter._getOutput(self), warp_mode)  
93          Warp.__init__(self, Cutter._getOutput(self), warp_mode)          Warp.__init__(self, Cutter._getOutput(self), warp_mode)
94                            
         #DataSetMapper.__init__(self, warp._getOutput(),  
95          DataSetMapper.__init__(self, Warp._getOutput(self),          DataSetMapper.__init__(self, Warp._getOutput(self),
96                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
   
97          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
98    
99          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))

Legend:
Removed from v.946  
changed lines
  Added in v.947

  ViewVC Help
Powered by ViewVC 1.1.26