/[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 1158 by jongui, Tue May 22 04:24:01 2007 UTC
# Line 6  import vtk Line 6  import vtk
6  from mapper import DataSetMapper  from mapper import DataSetMapper
7  from lookuptable import LookupTable  from lookuptable import LookupTable
8  from actor import Actor3D  from actor import Actor3D
9  from constant import Viewport, Color, Arrow, ColorMode, Lut, VizType  from constant import Viewport, Color, Arrow, ColorMode, Lut
10  from arrow import Arrow2D, Arrow3D  from arrow import Arrow2D, Arrow3D
11  from glyph import  Glyph3D  from glyph import  Glyph3D
12  from outline import Outline  from outline import Outline
# Line 28  class Velocity(DataSetMapper, Actor3D, A Line 28  class Velocity(DataSetMapper, Actor3D, A
28      # 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.
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, arrow = Arrow.TWO_D,
32              color_mode = ColorMode.VECTOR, arrow = Arrow.TWO_D,                color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,  
33              lut = Lut.COLOR, cell_to_point = False, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
34          """          """
35          Initialise the Velocity.          Initialise the Velocity.
# Line 45  class Velocity(DataSetMapper, Actor3D, A Line 45  class Velocity(DataSetMapper, Actor3D, A
45          @type data_collector: L{DataCollector <datacollector.DataCollector>}          @type data_collector: L{DataCollector <datacollector.DataCollector>}
46                  object                  object
47          @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  
48          @type arrow: L{Arrow <constant.Arrow>} constant          @type arrow: L{Arrow <constant.Arrow>} constant
49          @param arrow: Type of arrow (two dimensional or three dimensional)          @param arrow: Type of arrow (two dimensional or three dimensional)
50            @type color_mode: L{ColorMode <constant.ColorMode>} constant
51            @param color_mode: Type of color mode
52            @type viewport: L{Viewport <constant.Viewport>} constant
53            @param viewport: Viewport in which objects are to be rendered on
54          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
55          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
56          @type cell_to_point: Boolean          @type cell_to_point: Boolean
# Line 59  class Velocity(DataSetMapper, Actor3D, A Line 59  class Velocity(DataSetMapper, Actor3D, A
59          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
60          """          """
61    
62          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__data_collector = data_collector
63          # As a result, when methods from Actor3D is invoked from the driver,          self.__arrow = arrow
64          # only the methods associated with the latest instance (which in this          self.__color_mode = color_mode
65          # case is the Actor3D for the Velocity) can be executed. Actor3D          self.__viewport = viewport
66          # methods associated with Outline cannot be invoked from the driver.          self.__lut = lut
67          # They can only be called within here, which is why Outline must be          self.__cell_to_point = cell_to_point
68          # place before Velocity as there is unlikely to be any changes          self.__outline = outline
69          # made to the Outline's Actor3D.          
70            self.__modified = True # Keeps track whether Velocity has been modified.
71          # ----- Outline -----          MaskPoints.__init__(self)
72            Glyph3D.__init__(self)
73          if(outline == True):          DataSetMapper.__init__(self)
74              outline = Outline(data_collector._getOutput())          Actor3D.__init__(self)
75              DataSetMapper.__init__(self, outline._getOutput())          scene._addVisualizationModules(self)
76    
77            # ----- Outline -----
78    
79            # NOTE: Changes cannot be made to the Outline's properties from the
80            # driver.
81            if(self.__outline == True):
82                outline = Outline(self.__data_collector._getDataCollectorOutput())
83                mapper = DataSetMapper()
84                mapper._setupDataSetMapper(outline._getOutlineOutput())
85    
86              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              actor3D = Actor3D()
87                actor3D._setupActor3D(mapper._getDataSetMapper())
88              # Default outline color is black.              # Default outline color is black.
89              Actor3D.setColor(self, Color.BLACK)              actor3D.setColor(Color.BLACK)
90    
91              # Default line width is 1.              # Default line width is 1.
92              Actor3D._setLineWidth(self, 1)              actor3D._setLineWidth(1)
93              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(self.__viewport, actor3D._getActor3D())
94    
95          # ----- Velocity -----          # ----- Velocity -----
96    
97          # NOTE: Lookup table color mapping (color or grey scale) MUST be set          # NOTE: Lookup table color mapping (color or grey scale) MUST be set
98          # before DataSetMapper. If it is done after DataSetMapper, no effect          # before DataSetMapper. If it is done after DataSetMapper, no effect
99          # will take place.          # will take place.
100          if(lut == Lut.COLOR): # Colored lookup table.          if(self.__lut == Lut.COLOR): # Colored lookup table.
101              lookup_table = LookupTable()              lookup_table = LookupTable()
102              lookup_table._setTableValue()              lookup_table._setTableValue()
103          elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.          elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
104              lookup_table = LookupTable()              lookup_table = LookupTable()
105              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
106                    
107          if(cell_to_point == True): # Converts cell data to point data.          if(self.__cell_to_point == True): # Converts cell data to point data.
108              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(
109              MaskPoints.__init__(self, c2p._getOutput())                      self.__data_collector._getDataCollectorOutput())
110          elif(cell_to_point == False): # No conversion happens.                self._setupMaskPoints(c2p._getCellToPointOutput())
111              MaskPoints.__init__(self, data_collector._getOutput())          elif(self.__cell_to_point == False): # No conversion happens.  
112                self._setupMaskPoints(data_collector._getDataCollectorOutput())
113            
114          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
115              Arrow2D.__init__(self)              Arrow2D.__init__(self)
116              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
117                      Arrow2D._getOutput(self))                      self._getArrow2DOutput())
118          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(arrow == Arrow.THREE_D): # Use 3D arrows.
119              Arrow3D.__init__(self)              Arrow3D.__init__(self)
120              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
121                      Arrow3D._getOutput(self))                      self._getArrow3DOutput())
122    
123          DataSetMapper.__init__(self, Glyph3D._getOutput(self),          self._setupDataSetMapper(self._getGlyph3DOutput(),
124                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
125    
126          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          self._setupActor3D(self._getDataSetMapper())
127              Glyph3D._setColorModeByVector(self)          scene._addActor3D(self.__viewport, self._getActor3D())
128              Glyph3D._setRange(self, data_collector._getVectorRange())  
129              DataSetMapper._setScalarRange(self,      def _isModified(self):  
130                      data_collector._getVectorRange())          """
131              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,          Return whether the Velocity or DataCollector has been modified.
132                      ColorMode.VECTOR, DataSetMapper._getDataSetMapper(self),  
133                      Glyph3D._getGlyph3D(self))          @rtype: Boolean
134            @return: True or False
135          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.          """
136              Glyph3D._setColorModeByScalar(self)  
137              Glyph3D._setRange(self, data_collector._getScalarRange())          return self.__modified or self.__data_collector._isModified()
138              DataSetMapper._setScalarRange(self,  
139                      data_collector._getScalarRange())      def _render(self, scene):
140              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,          """
141                      ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self),          Render the velocity.
142                      Glyph3D._getGlyph3D(self))  
143            @type scene: L{Scene <scene.Scene>} object
144            @param scene: Scene in which objects are to be rendered on
145            """
146    
147            if (self._isModified() == True):
148                if(self.__data_collector._isScalarSet() == True):
149                    self.__data_collector._setActiveScalar()
150                if(self.__data_collector._isVectorSet() == True):
151                    self.__data_collector._setActiveVector()
152    
153                # Color velocity by vector.
154                if(self.__color_mode == ColorMode.VECTOR):              
155                    self._setColorModeByVector()
156                    self._setRange(self.__data_collector._getVectorRange())
157                    self._setScalarRange(self.__data_collector._getVectorRange())
158                # Color velocity by scalar.
159                elif(self.__color_mode == ColorMode.SCALAR):                
160                    self._setColorModeByScalar()
161                    self._setRange(self.__data_collector._getScalarRange())
162                    self._setScalarRange(self.__data_collector._getScalarRange())
163    
164          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              self.__modified = False
         scene._addActor3D(viewport, Actor3D._getActor3D(self))  
165    
166    
167  ###############################################################################  ###############################################################################
# Line 148  class VelocityOnPlaneCut(DataSetMapper, Line 178  class VelocityOnPlaneCut(DataSetMapper,
178          Glyph3D, Transform, Plane, Cutter, MaskPoints):          Glyph3D, Transform, Plane, Cutter, MaskPoints):
179      """      """
180      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},
181      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.
182      """      """
183    
184      # 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 215  class VelocityOnPlaneCut(DataSetMapper,
215          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
216          """          """
217    
218          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__data_collector = data_collector
219          # As a result, when methods from Actor3D is invoked from the driver,          self.__arrow = arrow
220          # only the methods associated with the latest instance (which in this          self.__color_mode = color_mode
221          # case is the Actor3D for the Velocity) can be executed. Actor3D          self.__viewport = viewport
222          # methods associated with Outline cannot be invoked from the driver.          self.__lut = lut
223          # They can only be called within here, which is why Outline must be          self.__cell_to_point = cell_to_point
224          # place before Velocity as there is unlikely to be any changes          self.__outline = outline
225          # made to the Outline's Actor3D.          
226            # Keeps track whether VelocityOnPlaneCut has been modified.
227          # ----- Outline -----          self.__modified = True
228            Transform.__init__(self)
229          if(outline == True):          Plane.__init__(self)
230              outline = Outline(data_collector._getOutput())          Cutter.__init__(self)
231              DataSetMapper.__init__(self, outline._getOutput())          MaskPoints.__init__(self)
232            Glyph3D.__init__(self)
233            DataSetMapper.__init__(self)
234            Actor3D.__init__(self)
235            scene._addVisualizationModules(self)
236    
237            # ----- Outline -----
238    
239            # NOTE: Changes cannot be made to the Outline's properties from the
240            # driver.
241            if(self.__outline == True):
242                outline = Outline(self.__data_collector._getDataCollectorOutput())
243                mapper = DataSetMapper()
244                mapper._setupDataSetMapper(outline._getOutlineOutput())
245    
246              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              actor3D = Actor3D()
247                actor3D._setupActor3D(mapper._getDataSetMapper())
248              # Default outline color is black.              # Default outline color is black.
249              Actor3D.setColor(self, Color.BLACK)              actor3D.setColor(Color.BLACK)
250    
251              # Default line width is 1.              # Default line width is 1.
252              Actor3D._setLineWidth(self, 1)              actor3D._setLineWidth(1)
253              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(self.__viewport, actor3D._getActor3D())
254    
255          # ----- Velocity on a cut plane -----          # ----- Velocity on a cut plane -----
256    
# Line 220  class VelocityOnPlaneCut(DataSetMapper, Line 264  class VelocityOnPlaneCut(DataSetMapper,
264              lookup_table = LookupTable()              lookup_table = LookupTable()
265              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
266    
267          Transform.__init__(self)              self._setupPlane(self._getTransform())
         Plane.__init__(self, Transform._getTransform(self))  
268    
269          if(cell_to_point == True): # Converts cell data to point data.          if(self.__cell_to_point == True): # Converts cell data to point data.
270              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(
271              Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self))                        self.__data_collector._getDataCollectorOutput())
272          elif(cell_to_point == False): # No conversion happens.                self._setupCutter(c2p._getCellToPointOutput(), self._getPlane())    
273              Cutter.__init__(self, data_collector._getOutput(),          elif(self.__cell_to_point == False): # No conversion happens.  
274                      Plane._getPlane(self))                self._setupCutter(self.__data_collector._getDataCollectorOutput(),
275                        self._getPlane())  
276    
277          MaskPoints.__init__(self, Cutter._getOutput(self))          self._setupMaskPoints(self._getCutterOutput())
278    
279          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
280              Arrow2D.__init__(self)              Arrow2D.__init__(self)
281              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
282                      Arrow2D._getOutput(self))                      self._getActor2DOutput())
283          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(self.__arrow == Arrow.THREE_D): # Use 3D arrows.
284              Arrow3D.__init__(self)              Arrow3D.__init__(self)
285              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
286                      Arrow3D._getOutput(self))                      self._getArrow3DOutput())
287    
288          DataSetMapper.__init__(self, Glyph3D._getOutput(self),          self._setupDataSetMapper(self._getGlyph3DOutput(),
289                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
290    
291          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          self._setupActor3D(self._getDataSetMapper())
292              Glyph3D._setColorModeByVector(self)          scene._addActor3D(self.__viewport, self._getActor3D())
293              Glyph3D._setRange(self, data_collector._getVectorRange())      
294              DataSetMapper._setScalarRange(self,      def _isModified(self):  
295                      data_collector._getVectorRange())          """
296              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,          Return whether the VelocityOnPlaneCut or DataCollector has been
297                      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))  
298    
299          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          @rtype: Boolean
300          scene._addActor3D(viewport, Actor3D._getActor3D(self))          @return: True or False
301            """
302    
303            return self.__modified or self.__data_collector._isModified()
304    
305        def _render(self, scene):
306            """
307            Render the velocity cut using a plane.
308    
309            @type scene: L{Scene <scene.Scene>} object
310            @param scene: Scene in which objects are to be rendered on
311            """
312    
313            if (self._isModified() == True):
314                if(self.__data_collector._isVectorSet() == True):
315                    self.__data_collector._setActiveVector()
316                # Color velocity by vector.
317                if(self.__color_mode == ColorMode.VECTOR):              
318                    self._setColorModeByVector()
319                    self._setRange(self.__data_collector._getVectorRange())
320                    self._setScalarRange(self.__data_collector._getVectorRange())
321                # Color velocity by scalar.
322                elif(self.__color_mode == ColorMode.SCALAR):                
323                    self._setColorModeByScalar()
324                    self._setRange(self.__data_collector._getScalarRange())
325                    self._setScalarRange(self.__data_collector._getScalarRange())
326    
327                self.__modified = False
328    
329    
330  ###############################################################################  ###############################################################################
# Line 315  class VelocityOnPlaneClip(DataSetMapper, Line 376  class VelocityOnPlaneClip(DataSetMapper,
376          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
377          """          """
378    
379          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__data_collector = data_collector
380          # As a result, when methods from Actor3D is invoked from the driver,          self.__arrow = arrow
381          # only the methods associated with the latest instance (which in this          self.__color_mode = color_mode
382          # case is the Actor3D for the Velocity) can be executed. Actor3D          self.__viewport = viewport
383          # methods associated with Outline cannot be invoked from the driver.          self.__lut = lut
384          # They can only be called within here, which is why Outline must be          self.__cell_to_point = cell_to_point
385          # place before Velocity as there is unlikely to be any changes          self.__outline = outline
386          # made to the Outline's Actor3D.          
387            # Keeps track whether VelocityOnPlaneCut has been modified.
388          # ----- Outline -----          self.__modified = True
389            Transform.__init__(self)
390          if(outline == True):          Plane.__init__(self)
391              outline = Outline(data_collector._getOutput())          Clipper.__init__(self)
392              DataSetMapper.__init__(self, outline._getOutput())          MaskPoints.__init__(self)
393            Glyph3D.__init__(self)
394            DataSetMapper.__init__(self)
395            Actor3D.__init__(self)
396            scene._addVisualizationModules(self)
397    
398            # ----- Outline -----
399    
400            # NOTE: Changes cannot be made to the Outline's properties from the
401            # driver.
402            if(self.__outline == True):
403                outline = Outline(self.__data_collector._getDataCollectorOutput())
404                mapper = DataSetMapper()
405                mapper._setupDataSetMapper(outline._getOutlineOutput())
406    
407              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              actor3D = Actor3D()
408                actor3D._setupActor3D(mapper._getDataSetMapper())
409              # Default outline color is black.              # Default outline color is black.
410              Actor3D.setColor(self, Color.BLACK)              actor3D.setColor(Color.BLACK)
411    
412              # Default line width is 1.              # Default line width is 1.
413              Actor3D._setLineWidth(self, 1)              actor3D._setLineWidth(1)
414              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(self.__viewport, actor3D._getActor3D())
415    
416          # ----- Velocity on a clipped plane -----          # ----- Velocity on a clipped plane -----
417    
418          # NOTE: Lookup table color mapping (color or grey scale) MUST be set          # NOTE: Lookup table color mapping (color or grey scale) MUST be set
419          # before DataSetMapper. If it is done after DataSetMapper, no effect          # before DataSetMapper. If it is done after DataSetMapper, no effect
420          # will take place.          # will take place.
421          if(lut == Lut.COLOR): # Colored lookup table.          if(self.__lut == Lut.COLOR): # Colored lookup table.
422              lookup_table = LookupTable()              lookup_table = LookupTable()
423              lookup_table._setTableValue()              lookup_table._setTableValue()
424          elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.          elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
425              lookup_table = LookupTable()              lookup_table = LookupTable()
426              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
427    
428          Transform.__init__(self)              self._setupPlane(self._getTransform())
         Plane.__init__(self, Transform._getTransform(self))  
429    
430          if(cell_to_point == True): # Converts cell data to point data.          if(self.__cell_to_point == True): # Converts cell data to point data.
431              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(
432              MaskPoints.__init__(self, c2p._getOutput())                      self.__data_collector._getDataCollectorOutput())
433          elif(cell_to_point == False): # No conversion happens.                self._setupMaskPoints(c2p._getCellToPointOutput())
434              MaskPoints.__init__(self, data_collector._getOutput())          elif(self.__cell_to_point == False): # No conversion happens.  
435                self._setupMaskPoints(
436                        self.__data_collector._getDataCollectorOutput())
437    
438          # NOTE: Glyph3D must come before Clipper. Otherwise clipping may not          # NOTE: Glyph3D must come before Clipper. Otherwise clipping may not
439          # work correctly.          # work correctly.
440          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
441              Arrow2D.__init__(self)              Arrow2D.__init__(self)
442              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
443                      Arrow2D._getOutput(self))                      self._getArrow2DOutput())
444          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(self.__arrow == Arrow.THREE_D): # Use 3D arrows.
445              Arrow3D.__init__(self)              Arrow3D.__init__(self)
446              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
447                      Arrow3D._getOutput(self))                      self._getArrow3DOutput())
448                    
449          Clipper.__init__(self, Glyph3D._getOutput(self),          self._setupClipper(self._getGlyph3DOutput(), self._getPlane())  
450                  Plane._getPlane(self))            self._setClipFunction()
         Clipper._setClipFunction(self)  
451    
452          # NOTE: Clipper must come after Glyph. Otherwise clipping          # NOTE: Clipper must come after Glyph. Otherwise clipping
453          # may not work correctly.          # may not work correctly.
454          DataSetMapper.__init__(self, Clipper._getOutput(self),          self._setupDataSetMapper(self._getClipperOutput(),
455                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
456    
457          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          self._setupActor3D(self._getDataSetMapper())
458              Glyph3D._setColorModeByVector(self)          scene._addActor3D(self.__viewport, self._getActor3D())
459              Glyph3D._setRange(self, data_collector._getVectorRange())      
460              DataSetMapper._setScalarRange(self,      def _isModified(self):  
461                      data_collector._getVectorRange())          """
462              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,          Return whether the VelocityOnPlaneClip or DataCollector has been
463                      ColorMode.VECTOR, DataSetMapper._getDataSetMapper(self),          modified.
464                      Glyph3D._getGlyph3D(self))  
465            @rtype: Boolean
466          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.          @return: True or False
467              Glyph3D._setColorModeByScalar(self)          """
468              Glyph3D._setRange(self, data_collector._getScalarRange())  
469              DataSetMapper._setScalarRange(self,          return self.__modified or self.__data_collector._isModified()
470                      data_collector._getScalarRange())  
471              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,      def _render(self, scene):
472                      ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self),          """
473                      Glyph3D._getGlyph3D(self))          Render the velocity clip using a plane..
474    
475            @type scene: L{Scene <scene.Scene>} object
476            @param scene: Scene in which objects are to be rendered on
477            """
478    
479            if (self._isModified() == True):
480                if(self.__data_collector._isVectorSet() == True):
481                    self.__data_collector._setActiveVector()
482                # Color velocity by vector.
483                if(self.__color_mode == ColorMode.VECTOR):              
484                    self._setColorModeByVector()
485                    self._setRange(self.__data_collector._getVectorRange())
486                    self._setScalarRange(self.__data_collector._getVectorRange())
487                # Color velocity by scalar.
488                elif(self.__color_mode == ColorMode.SCALAR):                
489                    self._setColorModeByScalar()
490                    self._setRange(self.__data_collector._getScalarRange())
491                    self._setScalarRange(self.__data_collector._getScalarRange())
492    
493                self.__modified = False
494    
495    
         Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))  
         scene._addActor3D(viewport, Actor3D._getActor3D(self))  

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

  ViewVC Help
Powered by ViewVC 1.1.26