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

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

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

revision 1042 by jongui, Fri Mar 16 05:00:32 2007 UTC revision 1043 by jongui, Mon Mar 19 06:46:34 2007 UTC
# Line 9  from lookuptable import LookupTable Line 9  from lookuptable import LookupTable
9  from outline import Outline  from outline import Outline
10  from constant import Viewport, Color, Lut, VizType, ColorMode  from constant import Viewport, Color, Lut, VizType, ColorMode
11  from contourmodule import ContourModule  from contourmodule import ContourModule
12    from average import CellDataToPointData
13    
14  # NOTE: DataSetMapper, Actor3D and ContourModule were inherited to allow  # NOTE: DataSetMapper, Actor3D and ContourModule were inherited to allow
15  # access to their public methods from the driver.  # access to their public methods from the driver.
# Line 23  class Contour(DataSetMapper, Actor3D, Co Line 24  class Contour(DataSetMapper, Actor3D, Co
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 lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
26      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
27              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
28          """          """
29          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
30          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 34  class Contour(DataSetMapper, Actor3D, Co Line 35  class Contour(DataSetMapper, Actor3D, Co
35          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
36          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
37          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
38            @type cell_to_point: Boolean
39            @param cell_to_point: Converts cell data to point data (by averaging)
40          @type outline: Boolean          @type outline: Boolean
41          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
42          """          """
# Line 73  class Contour(DataSetMapper, Actor3D, Co Line 76  class Contour(DataSetMapper, Actor3D, Co
76              lookup_table = LookupTable()              lookup_table = LookupTable()
77              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
78    
79          ContourModule.__init__(self, data_collector._getOutput())            if(cell_to_point == True): # Converts cell data to point data.
80                c2p = CellDataToPointData(data_collector._getOutput())
81                ContourModule.__init__(self, c2p._getOutput())  
82            elif(cell_to_point == False): # No conversion happens.  
83                ContourModule.__init__(self, data_collector._getOutput())  
84    
85          # By default 10 contours are generated and the scalar range is based          # By default 10 contours are generated and the scalar range is based
86          # on the scalar data range.          # on the scalar data range.
87          ContourModule.generateContours(self, 10,          ContourModule.generateContours(self, 10,
# Line 112  class ContourOnPlaneCut(DataSetMapper, A Line 120  class ContourOnPlaneCut(DataSetMapper, A
120      # 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.
121      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
122      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
123              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
124    
125          """          """
126          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
# Line 124  class ContourOnPlaneCut(DataSetMapper, A Line 132  class ContourOnPlaneCut(DataSetMapper, A
132          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
133          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
134          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
135            @type cell_to_point: Boolean
136            @param cell_to_point: Converts cell data to point data (by averaging)
137          @type outline: Boolean          @type outline: Boolean
138          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
139          """          """
# Line 166  class ContourOnPlaneCut(DataSetMapper, A Line 176  class ContourOnPlaneCut(DataSetMapper, A
176          Transform.__init__(self)              Transform.__init__(self)    
177          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
178    
179          Cutter.__init__(self, data_collector._getOutput(),          if(cell_to_point == True): # Converts cell data to point data.
180                  Plane._getPlane(self))              c2p = CellDataToPointData(data_collector._getOutput())
181                Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self))
182            elif(cell_to_point == False): # No conversion happens.  
183                Cutter.__init__(self, data_collector._getOutput(),
184                        Plane._getPlane(self))
185    
186          ContourModule.__init__(self, Cutter._getOutput(self))          ContourModule.__init__(self, Cutter._getOutput(self))
187    
188          # By default 10 contours are generated and the scalar range is based          # By default 10 contours are generated and the scalar range is based
# Line 180  class ContourOnPlaneCut(DataSetMapper, A Line 195  class ContourOnPlaneCut(DataSetMapper, A
195                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
196          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())            DataSetMapper._setScalarRange(self, data_collector._getScalarRange())  
197    
198            data_collector._paramForUpdatingMultipleSources(VizType.CONTOUR,
199                    ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self),
200                    ContourModule._getContour(self))
201    
202          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
203          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
204    
# Line 203  class ContourOnPlaneClip(DataSetMapper, Line 222  class ContourOnPlaneClip(DataSetMapper,
222      # 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.
223      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
224      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
225              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
226    
227          """          """
228          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
# Line 215  class ContourOnPlaneClip(DataSetMapper, Line 234  class ContourOnPlaneClip(DataSetMapper,
234          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
235          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
236          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
237            @type cell_to_point: Boolean
238            @param cell_to_point: Converts cell data to point data (by averaging)
239          @type outline: Boolean          @type outline: Boolean
240          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
241          """          """
# Line 257  class ContourOnPlaneClip(DataSetMapper, Line 278  class ContourOnPlaneClip(DataSetMapper,
278          Transform.__init__(self)              Transform.__init__(self)    
279          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
280    
281          Clipper.__init__(self, data_collector._getOutput(),          if(cell_to_point == True): # Converts cell data to point data.
282                  Plane._getPlane(self))              c2p = CellDataToPointData(data_collector._getOutput())
283                Clipper.__init__(self, c2p._getOutput(), Plane._getPlane(self))
284            elif(cell_to_point == False): # No conversion happens.  
285                Clipper.__init__(self, data_collector._getOutput(),
286                        Plane._getPlane(self))
287    
288          Clipper._setClipFunction(self)          Clipper._setClipFunction(self)
289    
290          ContourModule.__init__(self, Clipper._getOutput(self))          ContourModule.__init__(self, Clipper._getOutput(self))
# Line 272  class ContourOnPlaneClip(DataSetMapper, Line 298  class ContourOnPlaneClip(DataSetMapper,
298                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
299          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())            DataSetMapper._setScalarRange(self, data_collector._getScalarRange())  
300    
301            data_collector._paramForUpdatingMultipleSources(VizType.CONTOUR,
302                    ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self),
303                    ContourModule._getContour(self))
304    
305          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
306          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
307    

Legend:
Removed from v.1042  
changed lines
  Added in v.1043

  ViewVC Help
Powered by ViewVC 1.1.26