/[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 1054 by jongui, Thu Mar 22 03:41:46 2007 UTC revision 1079 by jongui, Tue Apr 10 04:27:31 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, MaskPoints  from point import MaskPoints
 from probe import Probe  
15  from average import CellDataToPointData  from average import CellDataToPointData
16    
17  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph
# Line 31  class Ellipsoid(DataSetMapper, Actor3D, Line 30  class Ellipsoid(DataSetMapper, Actor3D,
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, cell_to_point = False, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
32          """          """
33            Initialise the Ellipsoid.
34    
35            @attention: The source can either be point or cell data. If the
36            source is cell data, a conversion to point data may or may not be
37            required, in order for the object to be rendered correctly.
38            If a conversion is needed, the 'cell_to_point' flag must be set to
39            'True', otherwise 'False' (which is the default).
40    
41          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
42          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
43          @type data_collector: L{DataCollector <datacollector.DataCollector>}          @type data_collector: L{DataCollector <datacollector.DataCollector>}
44                  object                  object
45          @param data_collector: Deal with source of data for visualisation          @param data_collector: Deal with source of data for vizualisation
46          @type viewport: L{Viewport <constant.Viewport>} constant          @type viewport: L{Viewport <constant.Viewport>} constant
47          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
48          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
# Line 81  class Ellipsoid(DataSetMapper, Actor3D, Line 88  class Ellipsoid(DataSetMapper, Actor3D,
88              lookup_table = LookupTable()              lookup_table = LookupTable()
89              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
90    
         #StructuredPoints.__init__(self, data_collector._getOutput())  
         #Probe.__init__(self, data_collector._getOutput(),  
         #       StructuredPoints._getStructuredPoints(self))  
   
91          if(cell_to_point == True): # Converts cell data to point data.          if(cell_to_point == True): # Converts cell data to point data.
92              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(data_collector._getOutput())
93              MaskPoints.__init__(self, c2p._getOutput())              MaskPoints.__init__(self, c2p._getOutput())
# Line 92  class Ellipsoid(DataSetMapper, Actor3D, Line 95  class Ellipsoid(DataSetMapper, Actor3D,
95              MaskPoints.__init__(self, data_collector._getOutput())              MaskPoints.__init__(self, data_collector._getOutput())
96    
97          Sphere.__init__(self)          Sphere.__init__(self)
         #TensorGlyph.__init__(self, Probe._getOutput(self),  
98          TensorGlyph.__init__(self, MaskPoints._getOutput(self),          TensorGlyph.__init__(self, MaskPoints._getOutput(self),
99                  Sphere._getOutput(self))                  Sphere._getOutput(self))
100          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
# Line 116  from plane import Plane Line 118  from plane import Plane
118  from cutter import Cutter  from cutter import Cutter
119    
120  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,
121  # Cutter, StructuredPoints and Probe were inherited to allow access to  # Cutter and MaskPoints were inherited to allow access to
122  # their public methods from the driver.  # their public methods from the driver.
123  class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals,    class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals,  
124          TensorGlyph, Transform, Plane, Cutter, StructuredPoints, Probe):          TensorGlyph, Transform, Plane, Cutter, MaskPoints):
125      """      """
126      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},
127      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 129  class EllipsoidOnPlaneCut(DataSetMapper, Line 131  class EllipsoidOnPlaneCut(DataSetMapper,
131      # 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.
132      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
133      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
134              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
135          """          """
136            Initialise the EllipsoidOnPlaneCut.
137    
138            @attention: The source can either be point or cell data. If the
139            source is cell data, a conversion to point data may or may not be
140            required, in order for the object to be rendered correctly.
141            If a conversion is needed, the 'cell_to_point' flag must be set to
142            'True', otherwise 'False' (which is the default).
143    
144          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
145          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
146          @type data_collector: L{DataCollector <datacollector.DataCollector>}          @type data_collector: L{DataCollector <datacollector.DataCollector>}
147                  object                  object
148          @param data_collector: Deal with source of data for visualisation          @param data_collector: Deal with source of data for vizualisation
149          @type viewport: L{Viewport <constant.Viewport>} constant          @type viewport: L{Viewport <constant.Viewport>} constant
150          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
151          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
152          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
153            @type cell_to_point: Boolean
154            @param cell_to_point: Converts cell data to point data (by averaging)
155          @type outline: Boolean          @type outline: Boolean
156          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
157          """          """
# Line 182  class EllipsoidOnPlaneCut(DataSetMapper, Line 194  class EllipsoidOnPlaneCut(DataSetMapper,
194          Transform.__init__(self)              Transform.__init__(self)    
195          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
196    
197          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
198          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
199                  StructuredPoints._getStructuredPoints(self))              Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self))  
200            elif(cell_to_point == False): # No conversion happens.  
201                Cutter.__init__(self, data_collector._getOutput(),
202                        Plane._getPlane(self))  
203    
204          Cutter.__init__(self, Probe._getOutput(self),          MaskPoints.__init__(self, Cutter._getOutput(self))
                 Plane._getPlane(self))    
205          Sphere.__init__(self)          Sphere.__init__(self)
206    
207          TensorGlyph.__init__(self, Cutter._getOutput(self),          TensorGlyph.__init__(self, MaskPoints._getOutput(self),
208                  Sphere._getOutput(self))                  Sphere._getOutput(self))
209          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
210    
# Line 211  class EllipsoidOnPlaneCut(DataSetMapper, Line 225  class EllipsoidOnPlaneCut(DataSetMapper,
225  from clipper import Clipper  from clipper import Clipper
226    
227  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,
228  # Clipper, StructuredPoints and Probe were inherited to allow access to  # Clipper and MaskPoints were inherited to allow access to
229  # their public methods from the driver.  # their public methods from the driver.
230  class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals,    class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals,  
231      TensorGlyph, Transform, Plane, Clipper, StructuredPoints, Probe):      TensorGlyph, Transform, Plane, Clipper, MaskPoints):
232      """      """
233      This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>},      This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>},
234      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 224  class EllipsoidOnPlaneClip(DataSetMapper Line 238  class EllipsoidOnPlaneClip(DataSetMapper
238      # 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.
239      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
240      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
241              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
242          """          """
243            Initialise the EllipsoidOnPlaneClip.
244    
245            @attention: The source can either be point or cell data. If the
246            source is cell data, a conversion to point data may or may not be
247            required, in order for the object to be rendered correctly.
248            If a conversion is needed, the 'cell_to_point' flag must be set to
249            'True', otherwise 'False' (which is the default).
250    
251          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
252          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
253          @type data_collector: L{DataCollector <datacollector.DataCollector>}          @type data_collector: L{DataCollector <datacollector.DataCollector>}
# Line 235  class EllipsoidOnPlaneClip(DataSetMapper Line 257  class EllipsoidOnPlaneClip(DataSetMapper
257          @param viewport: Viewport in which object are to be rendered on          @param viewport: Viewport in which object are to be rendered on
258          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
259          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
260            @type cell_to_point: Boolean
261            @param cell_to_point: Converts cell data to point data (by averaging)
262          @type outline: Boolean          @type outline: Boolean
263          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
264          """          """
# Line 277  class EllipsoidOnPlaneClip(DataSetMapper Line 301  class EllipsoidOnPlaneClip(DataSetMapper
301          Transform.__init__(self)              Transform.__init__(self)    
302          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
303    
304          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
305          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
306                  StructuredPoints._getStructuredPoints(self))              Clipper.__init__(self, c2p._getOutput(),
307                        Plane._getPlane(self))  
308                Clipper._setClipFunction(self)
309            elif(cell_to_point == False): # No conversion happens.  
310                Clipper.__init__(self, data_collector._getOutput(),
311                        Plane._getPlane(self))  
312                Clipper._setClipFunction(self)
313    
314          # NOTE: TensorGlyph must come before Clipper. Otherwise the output          MaskPoints.__init__(self, Clipper._getOutput(self))
         # will be incorrect.  
315          Sphere.__init__(self)          Sphere.__init__(self)
316          TensorGlyph.__init__(self, Probe._getOutput(self),          TensorGlyph.__init__(self, MaskPoints._getOutput(self),
317                  Sphere._getOutput(self))                  Sphere._getOutput(self))
318    
319          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
320          # NOTE: Clipper must come after TensorGlyph. Otherwise the output          DataSetMapper.__init__(self, Normals._getOutput(self),
         # will be incorrect.  
         Clipper.__init__(self, Normals._getOutput(self),  
                 Plane._getPlane(self))    
         Clipper._setClipFunction(self)  
   
         DataSetMapper.__init__(self, Clipper._getOutput(self),  
321              lookup_table._getLookupTable())              lookup_table._getLookupTable())
322          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
323    

Legend:
Removed from v.1054  
changed lines
  Added in v.1079

  ViewVC Help
Powered by ViewVC 1.1.26