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

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

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

revision 1037 by jongui, Fri Mar 16 05:00:32 2007 UTC revision 1056 by jongui, Thu Mar 22 06:52:08 2007 UTC
# Line 11  from sphere import Sphere Line 11  from sphere import Sphere
11  from normals import Normals  from normals import Normals
12  from glyph import  TensorGlyph  from glyph import  TensorGlyph
13  from outline import Outline  from outline import Outline
14  from point import StructuredPoints  from point import StructuredPoints, MaskPoints
15  from probe import Probe  from probe import Probe
16    from average import CellDataToPointData
17    
18  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph
19  # StructuredPoints and Probe  were inherited to allow access to their  # and MaskPoints  were inherited to allow access to their
20  # public methods from the driver.  # public methods from the driver.
21  class Ellipsoid(DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph,  class Ellipsoid(DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph,
22          StructuredPoints, Probe):          MaskPoints):
23      """      """
24      Class that shows a tensor field using ellipsoids. The ellipsoids can either      Class that shows a tensor field using ellipsoids. The ellipsoids can either
25      be colored or grey-scaled, depending on the lookup table used.      be colored or grey-scaled, depending on the lookup table used.
# Line 28  class Ellipsoid(DataSetMapper, Actor3D, Line 29  class Ellipsoid(DataSetMapper, Actor3D,
29      # 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.
30      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
31      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
32              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
33          """          """
34          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
35          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 39  class Ellipsoid(DataSetMapper, Actor3D, Line 40  class Ellipsoid(DataSetMapper, Actor3D,
40          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
41          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
42          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
43            @type cell_to_point: Boolean
44            @param cell_to_point: Converts cell data to point data (by averaging)
45          @type outline: Boolean          @type outline: Boolean
46          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
47          """          """
# Line 78  class Ellipsoid(DataSetMapper, Actor3D, Line 81  class Ellipsoid(DataSetMapper, Actor3D,
81              lookup_table = LookupTable()              lookup_table = LookupTable()
82              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
83    
84          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
85          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
86                  StructuredPoints._getStructuredPoints(self))              MaskPoints.__init__(self, c2p._getOutput())
87            elif(cell_to_point == False): # No conversion happens.  
88                MaskPoints.__init__(self, data_collector._getOutput())
89    
90          Sphere.__init__(self)          Sphere.__init__(self)
91          TensorGlyph.__init__(self, Probe._getOutput(self),          TensorGlyph.__init__(self, MaskPoints._getOutput(self),
92                  Sphere._getOutput(self))                  Sphere._getOutput(self))
93          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
94    
# Line 106  from plane import Plane Line 111  from plane import Plane
111  from cutter import Cutter  from cutter import Cutter
112    
113  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,
114  # Cutter, StructuredPoints and Probe were inherited to allow access to  # Cutter and MaskPoints were inherited to allow access to
115  # their public methods from the driver.  # their public methods from the driver.
116  class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals,    class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals,  
117          TensorGlyph, Transform, Plane, Cutter, StructuredPoints, Probe):          TensorGlyph, Transform, Plane, Cutter, MaskPoints):
118      """      """
119      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},
120      except that it shows a tensor field using ellipsoids cut using a plane.      except that it shows a tensor field using ellipsoids cut using a plane.
# Line 119  class EllipsoidOnPlaneCut(DataSetMapper, Line 124  class EllipsoidOnPlaneCut(DataSetMapper,
124      # 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.
125      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
126      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
127              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
128          """          """
129          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
130          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 130  class EllipsoidOnPlaneCut(DataSetMapper, Line 135  class EllipsoidOnPlaneCut(DataSetMapper,
135          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
136          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
137          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
138            @type cell_to_point: Boolean
139            @param cell_to_point: Converts cell data to point data (by averaging)
140          @type outline: Boolean          @type outline: Boolean
141          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
142          """          """
# Line 172  class EllipsoidOnPlaneCut(DataSetMapper, Line 179  class EllipsoidOnPlaneCut(DataSetMapper,
179          Transform.__init__(self)              Transform.__init__(self)    
180          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
181    
182          StructuredPoints.__init__(self, data_collector._getOutput())          #StructuredPoints.__init__(self, data_collector._getOutput())
183          Probe.__init__(self, data_collector._getOutput(),          #Probe.__init__(self, data_collector._getOutput(),
184                  StructuredPoints._getStructuredPoints(self))          #       StructuredPoints._getStructuredPoints(self))
185    
186            if(cell_to_point == True): # Converts cell data to point data.
187                c2p = CellDataToPointData(data_collector._getOutput())
188                Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self))  
189            elif(cell_to_point == False): # No conversion happens.  
190                Cutter.__init__(self, data_collector._getOutput(),
191                        Plane._getPlane(self))  
192    
193            MaskPoints.__init__(self, Cutter._getOutput(self))
194    
195            #Cutter.__init__(self, Probe._getOutput(self),
196            #       Plane._getPlane(self))  
197    
         Cutter.__init__(self, Probe._getOutput(self),  
                 Plane._getPlane(self))    
198          Sphere.__init__(self)          Sphere.__init__(self)
199    
200          TensorGlyph.__init__(self, Cutter._getOutput(self),          #TensorGlyph.__init__(self, Cutter._getOutput(self),
201            TensorGlyph.__init__(self, MaskPoints._getOutput(self),
202                  Sphere._getOutput(self))                  Sphere._getOutput(self))
203          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
204    
# Line 188  class EllipsoidOnPlaneCut(DataSetMapper, Line 206  class EllipsoidOnPlaneCut(DataSetMapper,
206                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
207          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
208    
209            data_collector._paramForUpdatingMultipleSources(VizType.ELLIPSOID,
210                    ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self))
211    
212          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
213          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
214    
# Line 198  class EllipsoidOnPlaneCut(DataSetMapper, Line 219  class EllipsoidOnPlaneCut(DataSetMapper,
219  from clipper import Clipper  from clipper import Clipper
220    
221  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,
222  # Clipper, StructuredPoints and Probe were inherited to allow access to  # Clipper and MaskPoints were inherited to allow access to
223  # their public methods from the driver.  # their public methods from the driver.
224  class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals,    class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals,  
225      TensorGlyph, Transform, Plane, Clipper, StructuredPoints, Probe):      TensorGlyph, Transform, Plane, Clipper, MaskPoints):
226      """      """
227      This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>},      This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>},
228      except that it shows a tensor field using ellipsoids clipped using a plane.      except that it shows a tensor field using ellipsoids clipped using a plane.
# Line 211  class EllipsoidOnPlaneClip(DataSetMapper Line 232  class EllipsoidOnPlaneClip(DataSetMapper
232      # 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.
233      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
234      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
235              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
236          """          """
237          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
238          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 222  class EllipsoidOnPlaneClip(DataSetMapper Line 243  class EllipsoidOnPlaneClip(DataSetMapper
243          @param viewport: Viewport in which object are to be rendered on          @param viewport: Viewport in which object are to be rendered on
244          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
245          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
246            @type cell_to_point: Boolean
247            @param cell_to_point: Converts cell data to point data (by averaging)
248          @type outline: Boolean          @type outline: Boolean
249          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
250          """          """
# Line 264  class EllipsoidOnPlaneClip(DataSetMapper Line 287  class EllipsoidOnPlaneClip(DataSetMapper
287          Transform.__init__(self)              Transform.__init__(self)    
288          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
289    
290          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
291          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
292                  StructuredPoints._getStructuredPoints(self))              Clipper.__init__(self, c2p._getOutput(),
293                        Plane._getPlane(self))  
294                Clipper._setClipFunction(self)
295            elif(cell_to_point == False): # No conversion happens.  
296                Clipper.__init__(self, data_collector._getOutput(),
297                        Plane._getPlane(self))  
298                Clipper._setClipFunction(self)
299    
300            MaskPoints.__init__(self, Clipper._getOutput(self))
301    
         # NOTE: TensorGlyph must come before Clipper. Otherwise the output  
         # will be incorrect.  
302          Sphere.__init__(self)          Sphere.__init__(self)
303          TensorGlyph.__init__(self, Probe._getOutput(self),          TensorGlyph.__init__(self, MaskPoints._getOutput(self),
304                  Sphere._getOutput(self))                  Sphere._getOutput(self))
305    
306          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
         # NOTE: Clipper must come after TensorGlyph. Otherwise the output  
         # will be incorrect.  
         Clipper.__init__(self, Normals._getOutput(self),  
                 Plane._getPlane(self))    
         Clipper._setClipFunction(self)  
307    
308          DataSetMapper.__init__(self, Clipper._getOutput(self),          DataSetMapper.__init__(self, Normals._getOutput(self),
309              lookup_table._getLookupTable())              lookup_table._getLookupTable())
310          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
311    
312            data_collector._paramForUpdatingMultipleSources(VizType.ELLIPSOID,
313                    ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self))
314    
315          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
316          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
317    

Legend:
Removed from v.1037  
changed lines
  Added in v.1056

  ViewVC Help
Powered by ViewVC 1.1.26