/[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 1189 by jongui, Thu Jun 7 05:31:25 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    
157                    # self._isScalarRangeSet checks whether the scalar range has
158                    # been specified by the user. If it has, then the scalar range
159                    # read from the source will be ignored.
160                    if(not(self._isScalarRangeSet())):
161                        self._setRange(self.__data_collector._getVectorRange())
162                        self._setScalarRange(\
163                                self.__data_collector._getVectorRange())
164                    else:
165                        self._setRange(self._getDataSetMapperRange())
166                        
167                # Color velocity by scalar.
168                elif(self.__color_mode == ColorMode.SCALAR):                
169                    self._setColorModeByScalar()
170    
171                    # self._isScalarRangeSet checks whether the scalar range has
172                    # been specified by the user. If it has, then the scalar range
173                    # read from the source will be ignored.
174                    if(not(self._isScalarRangeSet())):
175                        self._setRange(self.__data_collector._getScalarRange())
176                        self._setScalarRange(\
177                                self.__data_collector._getScalarRange())
178                    else:
179                        self._setRange(self._getDataSetMapperRange())
180    
181          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              self.__modified = False
         scene._addActor3D(viewport, Actor3D._getActor3D(self))  
182    
183    
184  ###############################################################################  ###############################################################################
# Line 148  class VelocityOnPlaneCut(DataSetMapper, Line 195  class VelocityOnPlaneCut(DataSetMapper,
195          Glyph3D, Transform, Plane, Cutter, MaskPoints):          Glyph3D, Transform, Plane, Cutter, MaskPoints):
196      """      """
197      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},
198      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.
199      """      """
200    
201      # 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 232  class VelocityOnPlaneCut(DataSetMapper,
232          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
233          """          """
234    
235          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__data_collector = data_collector
236          # As a result, when methods from Actor3D is invoked from the driver,          self.__arrow = arrow
237          # only the methods associated with the latest instance (which in this          self.__color_mode = color_mode
238          # case is the Actor3D for the Velocity) can be executed. Actor3D          self.__viewport = viewport
239          # methods associated with Outline cannot be invoked from the driver.          self.__lut = lut
240          # They can only be called within here, which is why Outline must be          self.__cell_to_point = cell_to_point
241          # place before Velocity as there is unlikely to be any changes          self.__outline = outline
242          # made to the Outline's Actor3D.          
243            # Keeps track whether VelocityOnPlaneCut has been modified.
244          # ----- Outline -----          self.__modified = True
245            Transform.__init__(self)
246          if(outline == True):          Plane.__init__(self)
247              outline = Outline(data_collector._getOutput())          Cutter.__init__(self)
248              DataSetMapper.__init__(self, outline._getOutput())          MaskPoints.__init__(self)
249            Glyph3D.__init__(self)
250            DataSetMapper.__init__(self)
251            Actor3D.__init__(self)
252            scene._addVisualizationModules(self)
253    
254            # ----- Outline -----
255    
256            # NOTE: Changes cannot be made to the Outline's properties from the
257            # driver.
258            if(self.__outline == True):
259                outline = Outline(self.__data_collector._getDataCollectorOutput())
260                mapper = DataSetMapper()
261                mapper._setupDataSetMapper(outline._getOutlineOutput())
262    
263              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              actor3D = Actor3D()
264                actor3D._setupActor3D(mapper._getDataSetMapper())
265              # Default outline color is black.              # Default outline color is black.
266              Actor3D.setColor(self, Color.BLACK)              actor3D.setColor(Color.BLACK)
267    
268              # Default line width is 1.              # Default line width is 1.
269              Actor3D._setLineWidth(self, 1)              actor3D._setLineWidth(1)
270              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(self.__viewport, actor3D._getActor3D())
271    
272          # ----- Velocity on a cut plane -----          # ----- Velocity on a cut plane -----
273    
# Line 220  class VelocityOnPlaneCut(DataSetMapper, Line 281  class VelocityOnPlaneCut(DataSetMapper,
281              lookup_table = LookupTable()              lookup_table = LookupTable()
282              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
283    
284          Transform.__init__(self)              self._setupPlane(self._getTransform())
         Plane.__init__(self, Transform._getTransform(self))  
285    
286          if(cell_to_point == True): # Converts cell data to point data.          if(self.__cell_to_point == True): # Converts cell data to point data.
287              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(
288              Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self))                        self.__data_collector._getDataCollectorOutput())
289          elif(cell_to_point == False): # No conversion happens.                self._setupCutter(c2p._getCellToPointOutput(), self._getPlane())    
290              Cutter.__init__(self, data_collector._getOutput(),          elif(self.__cell_to_point == False): # No conversion happens.  
291                      Plane._getPlane(self))                self._setupCutter(self.__data_collector._getDataCollectorOutput(),
292                        self._getPlane())  
293    
294          MaskPoints.__init__(self, Cutter._getOutput(self))          self._setupMaskPoints(self._getCutterOutput())
295    
296          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
297              Arrow2D.__init__(self)              Arrow2D.__init__(self)
298              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
299                      Arrow2D._getOutput(self))                      self._getActor2DOutput())
300          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(self.__arrow == Arrow.THREE_D): # Use 3D arrows.
301              Arrow3D.__init__(self)              Arrow3D.__init__(self)
302              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
303                      Arrow3D._getOutput(self))                      self._getArrow3DOutput())
304    
305          DataSetMapper.__init__(self, Glyph3D._getOutput(self),          self._setupDataSetMapper(self._getGlyph3DOutput(),
306                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
307    
308          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          self._setupActor3D(self._getDataSetMapper())
309              Glyph3D._setColorModeByVector(self)          scene._addActor3D(self.__viewport, self._getActor3D())
310              Glyph3D._setRange(self, data_collector._getVectorRange())      
311              DataSetMapper._setScalarRange(self,      def _isModified(self):  
312                      data_collector._getVectorRange())          """
313              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,          Return whether the VelocityOnPlaneCut or DataCollector has been
314                      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))  
315    
316          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          @rtype: Boolean
317          scene._addActor3D(viewport, Actor3D._getActor3D(self))          @return: True or False
318            """
319    
320            return self.__modified or self.__data_collector._isModified()
321    
322        def _render(self, scene):
323            """
324            Render the velocity cut using a plane.
325    
326            @type scene: L{Scene <scene.Scene>} object
327            @param scene: Scene in which objects are to be rendered on
328            """
329    
330            if (self._isModified() == True):
331                if(self.__data_collector._isVectorSet() == True):
332                    self.__data_collector._setActiveVector()
333                # Color velocity by vector.
334                if(self.__color_mode == ColorMode.VECTOR):              
335                    self._setColorModeByVector()
336    
337                    # self._isScalarRangeSet checks whether the scalar range has
338                    # been specified by the user. If it has, then the scalar range
339                    # read from the source will be ignored.
340                    if(not(self._isScalarRangeSet())):
341                        self._setRange(self.__data_collector._getVectorRange())
342                        self._setScalarRange(\
343                                self.__data_collector._getVectorRange())
344                    else:
345                        self._setRange(self._getDataSetMapperRange())
346    
347                # Color velocity by scalar.
348                elif(self.__color_mode == ColorMode.SCALAR):                
349                    self._setColorModeByScalar()
350    
351                    # self._isScalarRangeSet checks whether the scalar range has
352                    # been specified by the user. If it has, then the scalar range
353                    # read from the source will be ignored.
354                    if(not(self._isScalarRangeSet())):
355                        self._setRange(self.__data_collector._getScalarRange())
356                        self._setScalarRange(\
357                                self.__data_collector._getScalarRange())
358                    else:
359                        self._setRange(self._getDataSetMapperRange())
360    
361                self.__modified = False
362    
363    
364  ###############################################################################  ###############################################################################
# Line 315  class VelocityOnPlaneClip(DataSetMapper, Line 410  class VelocityOnPlaneClip(DataSetMapper,
410          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
411          """          """
412    
413          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__data_collector = data_collector
414          # As a result, when methods from Actor3D is invoked from the driver,          self.__arrow = arrow
415          # only the methods associated with the latest instance (which in this          self.__color_mode = color_mode
416          # case is the Actor3D for the Velocity) can be executed. Actor3D          self.__viewport = viewport
417          # methods associated with Outline cannot be invoked from the driver.          self.__lut = lut
418          # They can only be called within here, which is why Outline must be          self.__cell_to_point = cell_to_point
419          # place before Velocity as there is unlikely to be any changes          self.__outline = outline
420          # made to the Outline's Actor3D.          
421            # Keeps track whether VelocityOnPlaneCut has been modified.
422          # ----- Outline -----          self.__modified = True
423            Transform.__init__(self)
424          if(outline == True):          Plane.__init__(self)
425              outline = Outline(data_collector._getOutput())          Clipper.__init__(self)
426              DataSetMapper.__init__(self, outline._getOutput())          MaskPoints.__init__(self)
427            Glyph3D.__init__(self)
428            DataSetMapper.__init__(self)
429            Actor3D.__init__(self)
430            scene._addVisualizationModules(self)
431    
432            # ----- Outline -----
433    
434            # NOTE: Changes cannot be made to the Outline's properties from the
435            # driver.
436            if(self.__outline == True):
437                outline = Outline(self.__data_collector._getDataCollectorOutput())
438                mapper = DataSetMapper()
439                mapper._setupDataSetMapper(outline._getOutlineOutput())
440    
441              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              actor3D = Actor3D()
442                actor3D._setupActor3D(mapper._getDataSetMapper())
443              # Default outline color is black.              # Default outline color is black.
444              Actor3D.setColor(self, Color.BLACK)              actor3D.setColor(Color.BLACK)
445    
446              # Default line width is 1.              # Default line width is 1.
447              Actor3D._setLineWidth(self, 1)              actor3D._setLineWidth(1)
448              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(self.__viewport, actor3D._getActor3D())
449    
450          # ----- Velocity on a clipped plane -----          # ----- Velocity on a clipped plane -----
451    
452          # NOTE: Lookup table color mapping (color or grey scale) MUST be set          # NOTE: Lookup table color mapping (color or grey scale) MUST be set
453          # before DataSetMapper. If it is done after DataSetMapper, no effect          # before DataSetMapper. If it is done after DataSetMapper, no effect
454          # will take place.          # will take place.
455          if(lut == Lut.COLOR): # Colored lookup table.          if(self.__lut == Lut.COLOR): # Colored lookup table.
456              lookup_table = LookupTable()              lookup_table = LookupTable()
457              lookup_table._setTableValue()              lookup_table._setTableValue()
458          elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.          elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
459              lookup_table = LookupTable()              lookup_table = LookupTable()
460              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
461    
462          Transform.__init__(self)              self._setupPlane(self._getTransform())
         Plane.__init__(self, Transform._getTransform(self))  
463    
464          if(cell_to_point == True): # Converts cell data to point data.          if(self.__cell_to_point == True): # Converts cell data to point data.
465              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(
466              MaskPoints.__init__(self, c2p._getOutput())                      self.__data_collector._getDataCollectorOutput())
467          elif(cell_to_point == False): # No conversion happens.                self._setupMaskPoints(c2p._getCellToPointOutput())
468              MaskPoints.__init__(self, data_collector._getOutput())          elif(self.__cell_to_point == False): # No conversion happens.  
469                self._setupMaskPoints(
470                        self.__data_collector._getDataCollectorOutput())
471    
472          # NOTE: Glyph3D must come before Clipper. Otherwise clipping may not          # NOTE: Glyph3D must come before Clipper. Otherwise clipping may not
473          # work correctly.          # work correctly.
474          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
475              Arrow2D.__init__(self)              Arrow2D.__init__(self)
476              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
477                      Arrow2D._getOutput(self))                      self._getArrow2DOutput())
478          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(self.__arrow == Arrow.THREE_D): # Use 3D arrows.
479              Arrow3D.__init__(self)              Arrow3D.__init__(self)
480              Glyph3D.__init__(self, MaskPoints._getOutput(self),              self._setupGlyph3D(self._getMaskPointsOutput(),
481                      Arrow3D._getOutput(self))                      self._getArrow3DOutput())
482                    
483          Clipper.__init__(self, Glyph3D._getOutput(self),          self._setupClipper(self._getGlyph3DOutput(), self._getPlane())  
484                  Plane._getPlane(self))            self._setClipFunction()
         Clipper._setClipFunction(self)  
485    
486          # NOTE: Clipper must come after Glyph. Otherwise clipping          # NOTE: Clipper must come after Glyph. Otherwise clipping
487          # may not work correctly.          # may not work correctly.
488          DataSetMapper.__init__(self, Clipper._getOutput(self),          self._setupDataSetMapper(self._getClipperOutput(),
489                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
490    
491          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          self._setupActor3D(self._getDataSetMapper())
492              Glyph3D._setColorModeByVector(self)          scene._addActor3D(self.__viewport, self._getActor3D())
493              Glyph3D._setRange(self, data_collector._getVectorRange())      
494              DataSetMapper._setScalarRange(self,      def _isModified(self):  
495                      data_collector._getVectorRange())          """
496              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,          Return whether the VelocityOnPlaneClip or DataCollector has been
497                      ColorMode.VECTOR, DataSetMapper._getDataSetMapper(self),          modified.
498                      Glyph3D._getGlyph3D(self))  
499            @rtype: Boolean
500          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.          @return: True or False
501              Glyph3D._setColorModeByScalar(self)          """
502              Glyph3D._setRange(self, data_collector._getScalarRange())  
503              DataSetMapper._setScalarRange(self,          return self.__modified or self.__data_collector._isModified()
504                      data_collector._getScalarRange())  
505              data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY,      def _render(self, scene):
506                      ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self),          """
507                      Glyph3D._getGlyph3D(self))          Render the velocity clip using a plane..
508    
509            @type scene: L{Scene <scene.Scene>} object
510            @param scene: Scene in which objects are to be rendered on
511            """
512    
513            if (self._isModified() == True):
514                if(self.__data_collector._isVectorSet() == True):
515                    self.__data_collector._setActiveVector()
516                # Color velocity by vector.
517                if(self.__color_mode == ColorMode.VECTOR):              
518                    self._setColorModeByVector()
519    
520                    # self._isScalarRangeSet checks whether the scalar range has
521                    # been specified by the user. If it has, then the scalar range
522                    # read from the source will be ignored.
523                    if(not(self._isScalarRangeSet())):
524                        self._setRange(self.__data_collector._getVectorRange())
525                        self._setScalarRange(\
526                                self.__data_collector._getVectorRange())
527                    else:
528                        self._setRange(self._getDataSetMapperRange())
529    
530                # Color velocity by scalar.
531                elif(self.__color_mode == ColorMode.SCALAR):                
532                    self._setColorModeByScalar()
533    
534                    # self._isScalarRangeSet checks whether the scalar range has
535                    # been specified by the user. If it has, then the scalar range
536                    # read from the source will be ignored.
537                    if(not(self._isScalarRangeSet())):
538                        self._setRange(self.__data_collector._getScalarRange())
539                        self._setScalarRange(\
540                                self.__data_collector._getScalarRange())
541                    else:
542                        self._setRange(self._getDataSetMapperRange())
543    
544                self.__modified = False
545    
546    
         Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))  
         scene._addActor3D(viewport, Actor3D._getActor3D(self))  

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

  ViewVC Help
Powered by ViewVC 1.1.26