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

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

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

revision 1147 by ksteube, Wed May 16 06:39:11 2007 UTC revision 1197 by jongui, Mon Jun 18 02:08:34 2007 UTC
# Line 1  Line 1 
1  """  """
2  @author: John NGUI  @var __author__: name of author
3    @var __copyright__: copyrights
4    @var __license__: licence agreement
5    @var __url__: url entry point on documentation
6    @var __version__: version
7    @var __date__: date of the version
8  """  """
9    
10    __author__="John Ngui, john.ngui@uq.edu.au"
11    __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
12                        http://www.access.edu.au
13                    Primary Business: Queensland, Australia"""
14    __license__="""Licensed under the Open Software License version 3.0
15                 http://www.opensource.org/licenses/osl-3.0.php"""
16    __url__="http://www.iservo.edu.au/esys"
17    __version__="$Revision$"
18    __date__="$Date$"
19    
20    
21  import vtk  import vtk
22  from mapper import DataSetMapper  from mapper import DataSetMapper
23  from lookuptable import LookupTable  from lookuptable import LookupTable
24  from actor import Actor3D  from actor import Actor3D
25  from constant import Viewport, Color, Arrow, ColorMode, Lut, VizType  from constant import Viewport, Color, Arrow, ColorMode, Lut
26  from arrow import Arrow2D, Arrow3D  from arrow import Arrow2D, Arrow3D
27  from glyph import  Glyph3D  from glyph import  Glyph3D
28  from outline import Outline  from outline import Outline
# Line 28  class Velocity(DataSetMapper, Actor3D, A Line 44  class Velocity(DataSetMapper, Actor3D, A
44      # 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.
45      # 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.
46      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
47      def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,      def __init__(self, scene, data_collector, arrow = Arrow.TWO_D,
48              color_mode = ColorMode.VECTOR, arrow = Arrow.TWO_D,                color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,  
49              lut = Lut.COLOR, cell_to_point = False, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
50          """          """
51          Initialise the Velocity.          Initialise the Velocity.
# Line 45  class Velocity(DataSetMapper, Actor3D, A Line 61  class Velocity(DataSetMapper, Actor3D, A
61          @type data_collector: L{DataCollector <datacollector.DataCollector>}          @type data_collector: L{DataCollector <datacollector.DataCollector>}
62                  object                  object
63          @param data_collector: Deal with source of data for visualisation          @param data_collector: Deal with source of data for visualisation
         @type viewport: L{Viewport <constant.Viewport>} constant  
         @param viewport: Viewport in which objects are to be rendered on  
         @type color_mode: L{ColorMode <constant.ColorMode>} constant  
         @param color_mode: Type of color mode  
64          @type arrow: L{Arrow <constant.Arrow>} constant          @type arrow: L{Arrow <constant.Arrow>} constant
65          @param arrow: Type of arrow (two dimensional or three dimensional)          @param arrow: Type of arrow (two dimensional or three dimensional)
66            @type color_mode: L{ColorMode <constant.ColorMode>} constant
67            @param color_mode: Type of color mode
68            @type viewport: L{Viewport <constant.Viewport>} constant
69            @param viewport: Viewport in which objects are to be rendered on
70          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
71          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
72          @type cell_to_point: Boolean          @type cell_to_point: Boolean
# Line 59  class Velocity(DataSetMapper, Actor3D, A Line 75  class Velocity(DataSetMapper, Actor3D, A
75          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
76          """          """
77    
78          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__data_collector = data_collector
79          # As a result, when methods from Actor3D is invoked from the driver,          self.__arrow = arrow
80          # only the methods associated with the latest instance (which in this          self.__color_mode = color_mode
81          # case is the Actor3D for the Velocity) can be executed. Actor3D          self.__viewport = viewport
82          # methods associated with Outline cannot be invoked from the driver.          self.__lut = lut
83          # They can only be called within here, which is why Outline must be          self.__cell_to_point = cell_to_point
84          # place before Velocity as there is unlikely to be any changes          self.__outline = outline
85          # made to the Outline's Actor3D.          
86            self.__modified = True # Keeps track whether Velocity has been modified.
87          # ----- Outline -----          MaskPoints.__init__(self)
88            Glyph3D.__init__(self)
89          if(outline == True):          DataSetMapper.__init__(self)
90              outline = Outline(data_collector._getOutput())          Actor3D.__init__(self)
91              DataSetMapper.__init__(self, outline._getOutput())          scene._addVisualizationModules(self)
92    
93            # ----- Outline -----
94    
95            # NOTE: Changes cannot be made to the Outline's properties from the
96            # driver.
97            if(self.__outline == True):
98                outline = Outline(self.__data_collector._getDataCollectorOutput())
99                mapper = DataSetMapper()
100                mapper._setupDataSetMapper(outline._getOutlineOutput())
101    
102              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              actor3D = Actor3D()
103                actor3D._setupActor3D(mapper._getDataSetMapper())
104              # Default outline color is black.              # Default outline color is black.
105              Actor3D.setColor(self, Color.BLACK)              actor3D.setColor(Color.BLACK)
106    
107              # Default line width is 1.              # Default line width is 1.
108              Actor3D._setLineWidth(self, 1)              actor3D._setLineWidth(1)
109              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(self.__viewport, actor3D._getActor3D())
110    
111          # ----- Velocity -----          # ----- Velocity -----
112    
113          # NOTE: Lookup table color mapping (color or grey scale) MUST be set          # NOTE: Lookup table color mapping (color or grey scale) MUST be set
114          # before DataSetMapper. If it is done after DataSetMapper, no effect          # before DataSetMapper. If it is done after DataSetMapper, no effect
115          # will take place.          # will take place.
116          if(lut == Lut.COLOR): # Colored lookup table.          if(self.__lut == Lut.COLOR): # Colored lookup table.
117              lookup_table = LookupTable()              lookup_table = LookupTable()
118              lookup_table._setTableValue()              lookup_table._setTableValue()
119          elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.          elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
120              lookup_table = LookupTable()              lookup_table = LookupTable()
121              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
122                    
123          if(cell_to_point == True): # Converts cell data to point data.          if(self.__cell_to_point == True): # Converts cell data to point data.
124              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(
125              MaskPoints.__init__(self, c2p._getOutput())                      self.__data_collector._getDataCollectorOutput())
126          elif(cell_to_point == False): # No conversion happens.                self._setupMaskPoints(c2p._getCellToPointOutput())
127              MaskPoints.__init__(self, data_collector._getOutput())          elif(self.__cell_to_point == False): # No conversion happens.  
128                self._setupMaskPoints(data_collector._getDataCollectorOutput())
129            
130          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
131              Arrow2D.__init__(self)              Arrow2D.__init__(self)
132              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
133                      Arrow2D._getOutput(self))                      self._getArrow2DOutput())
134          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(arrow == Arrow.THREE_D): # Use 3D arrows.
135              Arrow3D.__init__(self)              Arrow3D.__init__(self)
136              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
137                      Arrow3D._getOutput(self))                      self._getArrow3DOutput())
138    
139          DataSetMapper.__init__(self, Glyph3D._getOutput(self),          self._setupDataSetMapper(self._getGlyph3DOutput(),
140                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
141    
142          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          self._setupActor3D(self._getDataSetMapper())
143              Glyph3D._setColorModeByVector(self)          scene._addActor3D(self.__viewport, self._getActor3D())
             Glyph3D._setRange(self, data_collector._getVectorRange())  
             DataSetMapper._setScalarRange(self,  
                     data_collector._getVectorRange())  
             data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,  
                     ColorMode.VECTOR, DataSetMapper._getDataSetMapper(self),  
                     Glyph3D._getGlyph3D(self))  
   
         elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.  
             Glyph3D._setColorModeByScalar(self)  
             Glyph3D._setRange(self, data_collector._getScalarRange())  
             DataSetMapper._setScalarRange(self,  
                     data_collector._getScalarRange())  
             data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,  
                     ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self),  
                     Glyph3D._getGlyph3D(self))  
144    
145          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))      def _isModified(self):  
146          scene._addActor3D(viewport, Actor3D._getActor3D(self))          """
147            Return whether the Velocity or DataCollector has been modified.
148    
149            @rtype: Boolean
150            @return: True or False
151            """
152    
153            return self.__modified or self.__data_collector._isModified()
154    
155        def _render(self, scene):
156            """
157            Render the velocity.
158    
159            @type scene: L{Scene <scene.Scene>} object
160            @param scene: Scene in which objects are to be rendered on
161            """
162    
163            if (self._isModified() == True):
164                if(self.__data_collector._isScalarSet() == True):
165                    self.__data_collector._setActiveScalar()
166                if(self.__data_collector._isVectorSet() == True):
167                    self.__data_collector._setActiveVector()
168    
169                # Color velocity by vector.
170                if(self.__color_mode == ColorMode.VECTOR):              
171                    self._setColorModeByVector()
172    
173                    # self._isScalarRangeSet checks whether the scalar range has
174                    # been specified by the user. If it has, then the scalar range
175                    # read from the source will be ignored.
176                    if(not(self._isScalarRangeSet())):
177                        self._setRange(self.__data_collector._getVectorRange())
178                        self._setScalarRange(\
179                                self.__data_collector._getVectorRange())
180                    else:
181                        self._setRange(self._getDataSetMapperRange())
182                        
183                # Color velocity by scalar.
184                elif(self.__color_mode == ColorMode.SCALAR):                
185                    self._setColorModeByScalar()
186    
187                    # self._isScalarRangeSet checks whether the scalar range has
188                    # been specified by the user. If it has, then the scalar range
189                    # read from the source will be ignored.
190                    if(not(self._isScalarRangeSet())):
191                        self._setRange(self.__data_collector._getScalarRange())
192                        self._setScalarRange(\
193                                self.__data_collector._getScalarRange())
194                    else:
195                        self._setRange(self._getDataSetMapperRange())
196    
197                self.__modified = False
198    
199    
200  ###############################################################################  ###############################################################################
# Line 148  class VelocityOnPlaneCut(DataSetMapper, Line 211  class VelocityOnPlaneCut(DataSetMapper,
211          Glyph3D, Transform, Plane, Cutter, MaskPoints):          Glyph3D, Transform, Plane, Cutter, MaskPoints):
212      """      """
213      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},
214      except that it shows a vector field using arrows on a plane.      except that it shows a vector field using arrows cut using a plane.
215      """      """
216    
217      # 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.
# Line 185  class VelocityOnPlaneCut(DataSetMapper, Line 248  class VelocityOnPlaneCut(DataSetMapper,
248          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
249          """          """
250    
251          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__data_collector = data_collector
252          # As a result, when methods from Actor3D is invoked from the driver,          self.__arrow = arrow
253          # only the methods associated with the latest instance (which in this          self.__color_mode = color_mode
254          # case is the Actor3D for the Velocity) can be executed. Actor3D          self.__viewport = viewport
255          # methods associated with Outline cannot be invoked from the driver.          self.__lut = lut
256          # They can only be called within here, which is why Outline must be          self.__cell_to_point = cell_to_point
257          # place before Velocity as there is unlikely to be any changes          self.__outline = outline
258          # made to the Outline's Actor3D.          
259            # Keeps track whether VelocityOnPlaneCut has been modified.
260          # ----- Outline -----          self.__modified = True
261            Transform.__init__(self)
262          if(outline == True):          Plane.__init__(self)
263              outline = Outline(data_collector._getOutput())          Cutter.__init__(self)
264              DataSetMapper.__init__(self, outline._getOutput())          MaskPoints.__init__(self)
265            Glyph3D.__init__(self)
266            DataSetMapper.__init__(self)
267            Actor3D.__init__(self)
268            scene._addVisualizationModules(self)
269    
270            # ----- Outline -----
271    
272            # NOTE: Changes cannot be made to the Outline's properties from the
273            # driver.
274            if(self.__outline == True):
275                outline = Outline(self.__data_collector._getDataCollectorOutput())
276                mapper = DataSetMapper()
277                mapper._setupDataSetMapper(outline._getOutlineOutput())
278    
279              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              actor3D = Actor3D()
280                actor3D._setupActor3D(mapper._getDataSetMapper())
281              # Default outline color is black.              # Default outline color is black.
282              Actor3D.setColor(self, Color.BLACK)              actor3D.setColor(Color.BLACK)
283    
284              # Default line width is 1.              # Default line width is 1.
285              Actor3D._setLineWidth(self, 1)              actor3D._setLineWidth(1)
286              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(self.__viewport, actor3D._getActor3D())
287    
288          # ----- Velocity on a cut plane -----          # ----- Velocity on a cut plane -----
289    
# Line 220  class VelocityOnPlaneCut(DataSetMapper, Line 297  class VelocityOnPlaneCut(DataSetMapper,
297              lookup_table = LookupTable()              lookup_table = LookupTable()
298              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
299    
300          Transform.__init__(self)              self._setupPlane(self._getTransform())
         Plane.__init__(self, Transform._getTransform(self))  
301    
302          if(cell_to_point == True): # Converts cell data to point data.          if(self.__cell_to_point == True): # Converts cell data to point data.
303              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(
304              Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self))                        self.__data_collector._getDataCollectorOutput())
305          elif(cell_to_point == False): # No conversion happens.                self._setupCutter(c2p._getCellToPointOutput(), self._getPlane())    
306              Cutter.__init__(self, data_collector._getOutput(),          elif(self.__cell_to_point == False): # No conversion happens.  
307                      Plane._getPlane(self))                self._setupCutter(self.__data_collector._getDataCollectorOutput(),
308                        self._getPlane())  
309    
310          MaskPoints.__init__(self, Cutter._getOutput(self))          self._setupMaskPoints(self._getCutterOutput())
311    
312          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
313              Arrow2D.__init__(self)              Arrow2D.__init__(self)
314              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
315                      Arrow2D._getOutput(self))                      self._getActor2DOutput())
316          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(self.__arrow == Arrow.THREE_D): # Use 3D arrows.
317              Arrow3D.__init__(self)              Arrow3D.__init__(self)
318              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
319                      Arrow3D._getOutput(self))                      self._getArrow3DOutput())
320    
321          DataSetMapper.__init__(self, Glyph3D._getOutput(self),          self._setupDataSetMapper(self._getGlyph3DOutput(),
322                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
323    
324          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          self._setupActor3D(self._getDataSetMapper())
325              Glyph3D._setColorModeByVector(self)          scene._addActor3D(self.__viewport, self._getActor3D())
326              Glyph3D._setRange(self, data_collector._getVectorRange())      
327              DataSetMapper._setScalarRange(self,      def _isModified(self):  
328                      data_collector._getVectorRange())          """
329              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,          Return whether the VelocityOnPlaneCut or DataCollector has been
330                      ColorMode.VECTOR, DataSetMapper._getDataSetMapper(self),          modified.
                     Glyph3D._getGlyph3D(self))  
   
         elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.  
             Glyph3D._setColorModeByScalar(self)  
             Glyph3D._setRange(self, data_collector._getScalarRange())  
             DataSetMapper._setScalarRange(self,  
                     data_collector._getScalarRange())  
             data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,  
                     ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self),  
                     Glyph3D._getGlyph3D(self))  
331    
332          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          @rtype: Boolean
333          scene._addActor3D(viewport, Actor3D._getActor3D(self))          @return: True or False
334            """
335    
336            return self.__modified or self.__data_collector._isModified()
337    
338        def _render(self, scene):
339            """
340            Render the velocity cut using a plane.
341    
342            @type scene: L{Scene <scene.Scene>} object
343            @param scene: Scene in which objects are to be rendered on
344            """
345    
346            if (self._isModified() == True):
347                if(self.__data_collector._isVectorSet() == True):
348                    self.__data_collector._setActiveVector()
349                # Color velocity by vector.
350                if(self.__color_mode == ColorMode.VECTOR):              
351                    self._setColorModeByVector()
352    
353                    # self._isScalarRangeSet checks whether the scalar range has
354                    # been specified by the user. If it has, then the scalar range
355                    # read from the source will be ignored.
356                    if(not(self._isScalarRangeSet())):
357                        self._setRange(self.__data_collector._getVectorRange())
358                        self._setScalarRange(\
359                                self.__data_collector._getVectorRange())
360                    else:
361                        self._setRange(self._getDataSetMapperRange())
362    
363                # Color velocity by scalar.
364                elif(self.__color_mode == ColorMode.SCALAR):                
365                    self._setColorModeByScalar()
366    
367                    # self._isScalarRangeSet checks whether the scalar range has
368                    # been specified by the user. If it has, then the scalar range
369                    # read from the source will be ignored.
370                    if(not(self._isScalarRangeSet())):
371                        self._setRange(self.__data_collector._getScalarRange())
372                        self._setScalarRange(\
373                                self.__data_collector._getScalarRange())
374                    else:
375                        self._setRange(self._getDataSetMapperRange())
376    
377                self.__modified = False
378    
379    
380  ###############################################################################  ###############################################################################
# Line 315  class VelocityOnPlaneClip(DataSetMapper, Line 426  class VelocityOnPlaneClip(DataSetMapper,
426          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
427          """          """
428    
429          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__data_collector = data_collector
430          # As a result, when methods from Actor3D is invoked from the driver,          self.__arrow = arrow
431          # only the methods associated with the latest instance (which in this          self.__color_mode = color_mode
432          # case is the Actor3D for the Velocity) can be executed. Actor3D          self.__viewport = viewport
433          # methods associated with Outline cannot be invoked from the driver.          self.__lut = lut
434          # They can only be called within here, which is why Outline must be          self.__cell_to_point = cell_to_point
435          # place before Velocity as there is unlikely to be any changes          self.__outline = outline
436          # made to the Outline's Actor3D.          
437            # Keeps track whether VelocityOnPlaneCut has been modified.
438          # ----- Outline -----          self.__modified = True
439            Transform.__init__(self)
440          if(outline == True):          Plane.__init__(self)
441              outline = Outline(data_collector._getOutput())          Clipper.__init__(self)
442              DataSetMapper.__init__(self, outline._getOutput())          MaskPoints.__init__(self)
443            Glyph3D.__init__(self)
444            DataSetMapper.__init__(self)
445            Actor3D.__init__(self)
446            scene._addVisualizationModules(self)
447    
448            # ----- Outline -----
449    
450            # NOTE: Changes cannot be made to the Outline's properties from the
451            # driver.
452            if(self.__outline == True):
453                outline = Outline(self.__data_collector._getDataCollectorOutput())
454                mapper = DataSetMapper()
455                mapper._setupDataSetMapper(outline._getOutlineOutput())
456    
457              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              actor3D = Actor3D()
458                actor3D._setupActor3D(mapper._getDataSetMapper())
459              # Default outline color is black.              # Default outline color is black.
460              Actor3D.setColor(self, Color.BLACK)              actor3D.setColor(Color.BLACK)
461    
462              # Default line width is 1.              # Default line width is 1.
463              Actor3D._setLineWidth(self, 1)              actor3D._setLineWidth(1)
464              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(self.__viewport, actor3D._getActor3D())
465    
466          # ----- Velocity on a clipped plane -----          # ----- Velocity on a clipped plane -----
467    
468          # NOTE: Lookup table color mapping (color or grey scale) MUST be set          # NOTE: Lookup table color mapping (color or grey scale) MUST be set
469          # before DataSetMapper. If it is done after DataSetMapper, no effect          # before DataSetMapper. If it is done after DataSetMapper, no effect
470          # will take place.          # will take place.
471          if(lut == Lut.COLOR): # Colored lookup table.          if(self.__lut == Lut.COLOR): # Colored lookup table.
472              lookup_table = LookupTable()              lookup_table = LookupTable()
473              lookup_table._setTableValue()              lookup_table._setTableValue()
474          elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.          elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
475              lookup_table = LookupTable()              lookup_table = LookupTable()
476              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
477    
478          Transform.__init__(self)              self._setupPlane(self._getTransform())
         Plane.__init__(self, Transform._getTransform(self))  
479    
480          if(cell_to_point == True): # Converts cell data to point data.          if(self.__cell_to_point == True): # Converts cell data to point data.
481              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(
482              MaskPoints.__init__(self, c2p._getOutput())                      self.__data_collector._getDataCollectorOutput())
483          elif(cell_to_point == False): # No conversion happens.                self._setupMaskPoints(c2p._getCellToPointOutput())
484              MaskPoints.__init__(self, data_collector._getOutput())          elif(self.__cell_to_point == False): # No conversion happens.  
485                self._setupMaskPoints(
486                        self.__data_collector._getDataCollectorOutput())
487    
488          # NOTE: Glyph3D must come before Clipper. Otherwise clipping may not          # NOTE: Glyph3D must come before Clipper. Otherwise clipping may not
489          # work correctly.          # work correctly.
490          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
491              Arrow2D.__init__(self)              Arrow2D.__init__(self)
492              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
493                      Arrow2D._getOutput(self))                      self._getArrow2DOutput())
494          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(self.__arrow == Arrow.THREE_D): # Use 3D arrows.
495              Arrow3D.__init__(self)              Arrow3D.__init__(self)
496              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
497                      Arrow3D._getOutput(self))                      self._getArrow3DOutput())
498                    
499          Clipper.__init__(self, Glyph3D._getOutput(self),          self._setupClipper(self._getGlyph3DOutput(), self._getPlane())  
500                  Plane._getPlane(self))            self._setClipFunction()
         Clipper._setClipFunction(self)  
501    
502          # NOTE: Clipper must come after Glyph. Otherwise clipping          # NOTE: Clipper must come after Glyph. Otherwise clipping
503          # may not work correctly.          # may not work correctly.
504          DataSetMapper.__init__(self, Clipper._getOutput(self),          self._setupDataSetMapper(self._getClipperOutput(),
505                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
506    
507          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          self._setupActor3D(self._getDataSetMapper())
508              Glyph3D._setColorModeByVector(self)          scene._addActor3D(self.__viewport, self._getActor3D())
509              Glyph3D._setRange(self, data_collector._getVectorRange())      
510              DataSetMapper._setScalarRange(self,      def _isModified(self):  
511                      data_collector._getVectorRange())          """
512              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,          Return whether the VelocityOnPlaneClip or DataCollector has been
513                      ColorMode.VECTOR, DataSetMapper._getDataSetMapper(self),          modified.
514                      Glyph3D._getGlyph3D(self))  
515            @rtype: Boolean
516          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.          @return: True or False
517              Glyph3D._setColorModeByScalar(self)          """
518              Glyph3D._setRange(self, data_collector._getScalarRange())  
519              DataSetMapper._setScalarRange(self,          return self.__modified or self.__data_collector._isModified()
520                      data_collector._getScalarRange())  
521              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,      def _render(self, scene):
522                      ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self),          """
523                      Glyph3D._getGlyph3D(self))          Render the velocity clip using a plane..
524    
525            @type scene: L{Scene <scene.Scene>} object
526            @param scene: Scene in which objects are to be rendered on
527            """
528    
529            if (self._isModified() == True):
530                if(self.__data_collector._isVectorSet() == True):
531                    self.__data_collector._setActiveVector()
532                # Color velocity by vector.
533                if(self.__color_mode == ColorMode.VECTOR):              
534                    self._setColorModeByVector()
535    
536                    # self._isScalarRangeSet checks whether the scalar range has
537                    # been specified by the user. If it has, then the scalar range
538                    # read from the source will be ignored.
539                    if(not(self._isScalarRangeSet())):
540                        self._setRange(self.__data_collector._getVectorRange())
541                        self._setScalarRange(\
542                                self.__data_collector._getVectorRange())
543                    else:
544                        self._setRange(self._getDataSetMapperRange())
545    
546                # Color velocity by scalar.
547                elif(self.__color_mode == ColorMode.SCALAR):                
548                    self._setColorModeByScalar()
549    
550                    # self._isScalarRangeSet checks whether the scalar range has
551                    # been specified by the user. If it has, then the scalar range
552                    # read from the source will be ignored.
553                    if(not(self._isScalarRangeSet())):
554                        self._setRange(self.__data_collector._getScalarRange())
555                        self._setScalarRange(\
556                                self.__data_collector._getScalarRange())
557                    else:
558                        self._setRange(self._getDataSetMapperRange())
559    
560                self.__modified = False
561    
562    
         Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))  
         scene._addActor3D(viewport, Actor3D._getActor3D(self))  

Legend:
Removed from v.1147  
changed lines
  Added in v.1197

  ViewVC Help
Powered by ViewVC 1.1.26