/[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 1057 by jongui, Thu Mar 22 23:57:37 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 MaskPoints
15  from probe import Probe  from average import CellDataToPointData
16    
17  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph
18  # StructuredPoints and Probe  were inherited to allow access to their  # and MaskPoints  were inherited to allow access to their
19  # public methods from the driver.  # public methods from the driver.
20  class Ellipsoid(DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph,  class Ellipsoid(DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph,
21          StructuredPoints, Probe):          MaskPoints):
22      """      """
23      Class that shows a tensor field using ellipsoids. The ellipsoids can either      Class that shows a tensor field using ellipsoids. The ellipsoids can either
24      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 28  class Ellipsoid(DataSetMapper, Actor3D,
28      # 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.
29      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
30      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
31              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, 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 39  class Ellipsoid(DataSetMapper, Actor3D, Line 39  class Ellipsoid(DataSetMapper, Actor3D,
39          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
40          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
41          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
42            @type cell_to_point: Boolean
43            @param cell_to_point: Converts cell data to point data (by averaging)
44          @type outline: Boolean          @type outline: Boolean
45          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
46          """          """
# Line 78  class Ellipsoid(DataSetMapper, Actor3D, Line 80  class Ellipsoid(DataSetMapper, Actor3D,
80              lookup_table = LookupTable()              lookup_table = LookupTable()
81              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
82    
83          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
84          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
85                  StructuredPoints._getStructuredPoints(self))              MaskPoints.__init__(self, c2p._getOutput())
86            elif(cell_to_point == False): # No conversion happens.  
87                MaskPoints.__init__(self, data_collector._getOutput())
88    
89          Sphere.__init__(self)          Sphere.__init__(self)
90          TensorGlyph.__init__(self, Probe._getOutput(self),          TensorGlyph.__init__(self, MaskPoints._getOutput(self),
91                  Sphere._getOutput(self))                  Sphere._getOutput(self))
92          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
93    
# Line 106  from plane import Plane Line 110  from plane import Plane
110  from cutter import Cutter  from cutter import Cutter
111    
112  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,
113  # Cutter, StructuredPoints and Probe were inherited to allow access to  # Cutter and MaskPoints were inherited to allow access to
114  # their public methods from the driver.  # their public methods from the driver.
115  class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals,    class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals,  
116          TensorGlyph, Transform, Plane, Cutter, StructuredPoints, Probe):          TensorGlyph, Transform, Plane, Cutter, MaskPoints):
117      """      """
118      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},
119      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 123  class EllipsoidOnPlaneCut(DataSetMapper,
123      # 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.
124      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
125      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
126              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
127          """          """
128          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
129          @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 134  class EllipsoidOnPlaneCut(DataSetMapper,
134          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
135          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
136          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
137            @type cell_to_point: Boolean
138            @param cell_to_point: Converts cell data to point data (by averaging)
139          @type outline: Boolean          @type outline: Boolean
140          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
141          """          """
# Line 172  class EllipsoidOnPlaneCut(DataSetMapper, Line 178  class EllipsoidOnPlaneCut(DataSetMapper,
178          Transform.__init__(self)              Transform.__init__(self)    
179          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
180    
181          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
182          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
183                  StructuredPoints._getStructuredPoints(self))              Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self))  
184            elif(cell_to_point == False): # No conversion happens.  
185                Cutter.__init__(self, data_collector._getOutput(),
186                        Plane._getPlane(self))  
187    
188            MaskPoints.__init__(self, Cutter._getOutput(self))
189    
         Cutter.__init__(self, Probe._getOutput(self),  
                 Plane._getPlane(self))    
190          Sphere.__init__(self)          Sphere.__init__(self)
191    
192          TensorGlyph.__init__(self, Cutter._getOutput(self),          TensorGlyph.__init__(self, MaskPoints._getOutput(self),
193                  Sphere._getOutput(self))                  Sphere._getOutput(self))
194          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
195    
196    
197    
198    
199          DataSetMapper.__init__(self, Normals._getOutput(self),          DataSetMapper.__init__(self, Normals._getOutput(self),
200                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
201          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
202    
203            data_collector._paramForUpdatingMultipleSources(VizType.ELLIPSOID,
204                    ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self))
205    
206          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
207          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
208    
# Line 198  class EllipsoidOnPlaneCut(DataSetMapper, Line 213  class EllipsoidOnPlaneCut(DataSetMapper,
213  from clipper import Clipper  from clipper import Clipper
214    
215  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,
216  # Clipper, StructuredPoints and Probe were inherited to allow access to  # Clipper and MaskPoints were inherited to allow access to
217  # their public methods from the driver.  # their public methods from the driver.
218  class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals,    class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals,  
219      TensorGlyph, Transform, Plane, Clipper, StructuredPoints, Probe):      TensorGlyph, Transform, Plane, Clipper, MaskPoints):
220      """      """
221      This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>},      This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>},
222      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 226  class EllipsoidOnPlaneClip(DataSetMapper
226      # 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.
227      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
228      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
229              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
230          """          """
231          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
232          @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 237  class EllipsoidOnPlaneClip(DataSetMapper
237          @param viewport: Viewport in which object are to be rendered on          @param viewport: Viewport in which object are to be rendered on
238          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
239          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
240            @type cell_to_point: Boolean
241            @param cell_to_point: Converts cell data to point data (by averaging)
242          @type outline: Boolean          @type outline: Boolean
243          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
244          """          """
# Line 264  class EllipsoidOnPlaneClip(DataSetMapper Line 281  class EllipsoidOnPlaneClip(DataSetMapper
281          Transform.__init__(self)              Transform.__init__(self)    
282          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
283    
284          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
285          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
286                  StructuredPoints._getStructuredPoints(self))              Clipper.__init__(self, c2p._getOutput(),
287                        Plane._getPlane(self))  
288                Clipper._setClipFunction(self)
289            elif(cell_to_point == False): # No conversion happens.  
290                Clipper.__init__(self, data_collector._getOutput(),
291                        Plane._getPlane(self))  
292                Clipper._setClipFunction(self)
293    
294            MaskPoints.__init__(self, Clipper._getOutput(self))
295    
         # NOTE: TensorGlyph must come before Clipper. Otherwise the output  
         # will be incorrect.  
296          Sphere.__init__(self)          Sphere.__init__(self)
297          TensorGlyph.__init__(self, Probe._getOutput(self),          TensorGlyph.__init__(self, MaskPoints._getOutput(self),
298                  Sphere._getOutput(self))                  Sphere._getOutput(self))
299    
300          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)  
301    
302          DataSetMapper.__init__(self, Clipper._getOutput(self),          DataSetMapper.__init__(self, Normals._getOutput(self),
303              lookup_table._getLookupTable())              lookup_table._getLookupTable())
304          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
305    
306            data_collector._paramForUpdatingMultipleSources(VizType.ELLIPSOID,
307                    ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self))
308    
309          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
310          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
311    

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

  ViewVC Help
Powered by ViewVC 1.1.26