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

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

  ViewVC Help
Powered by ViewVC 1.1.26