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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2365 - (hide annotations)
Mon Apr 6 01:25:25 2009 UTC (10 years, 4 months ago) by gross
File MIME type: text/x-python
File size: 21060 byte(s)
all tests passed under scons on 4 mpi processes with  openmpi on shake34
1 ksteube 1809
2     ########################################################
3     #
4     # Copyright (c) 2003-2008 by University of Queensland
5     # Earth Systems Science Computational Center (ESSCC)
6     # http://www.uq.edu.au/esscc
7     #
8     # Primary Business: Queensland, Australia
9     # Licensed under the Open Software License version 3.0
10     # http://www.opensource.org/licenses/osl-3.0.php
11     #
12     ########################################################
13    
14     __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15     Earth Systems Science Computational Center (ESSCC)
16     http://www.uq.edu.au/esscc
17     Primary Business: Queensland, Australia"""
18     __license__="""Licensed under the Open Software License version 3.0
19     http://www.opensource.org/licenses/osl-3.0.php"""
20 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
21 ksteube 1809
22 ksteube 1147 """
23 jongui 1197 @var __author__: name of author
24     @var __copyright__: copyrights
25     @var __license__: licence agreement
26     @var __url__: url entry point on documentation
27     @var __version__: version
28     @var __date__: date of the version
29 ksteube 1147 """
30    
31 jongui 1197 __author__="John Ngui, john.ngui@uq.edu.au"
32    
33    
34 ksteube 1147 from mapper import DataSetMapper
35     from lookuptable import LookupTable
36     from actor import Actor3D
37 jongui 1148 from constant import Viewport, Color, Arrow, ColorMode, Lut
38 ksteube 1147 from arrow import Arrow2D, Arrow3D
39     from glyph import Glyph3D
40     from outline import Outline
41     from point import MaskPoints
42     from average import CellDataToPointData
43 gross 2313 from esys.escript import getMPISizeWorld
44 gross 2365 if getMPISizeWorld()==1: import vtk
45 ksteube 1147
46     # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D and
47     # MaskPoints were inherited to allow access to their public
48     # methods from the driver.
49     class Velocity(DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, MaskPoints):
50     """
51     Class that shows a vector field using arrows. The arrows can either be
52     colored or grey-scaled, depending on the lookup table used. If the arrows
53     are colored, there are two possible coloring modes, either using vector data
54     or scalar data. Similarly, there are two possible types of
55     arrows, either using two-dimensional or three-dimensional.
56     """
57    
58     # The SOUTH_WEST default viewport is used when there is only one viewport.
59     # This saves the user from specifying the viewport when there is only one.
60     # If no lut is specified, the color scheme will be used.
61 jongui 1148 def __init__(self, scene, data_collector, arrow = Arrow.TWO_D,
62     color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,
63 ksteube 1147 lut = Lut.COLOR, cell_to_point = False, outline = True):
64     """
65     Initialise the Velocity.
66    
67     @attention: The source can either be point or cell data. If the
68     source is cell data, a conversion to point data may or may not be
69     required, in order for the object to be rendered correctly.
70     If a conversion is needed, the 'cell_to_point' flag must be set to
71 jongui 1199 'True', otherwise 'False' (which is the default). On occasions, an
72     inaccurate object may be rendered from cell data even after conversion.
73 ksteube 1147
74     @type scene: L{Scene <scene.Scene>} object
75     @param scene: Scene in which objects are to be rendered on
76     @type data_collector: L{DataCollector <datacollector.DataCollector>}
77     object
78     @param data_collector: Deal with source of data for visualisation
79 jongui 1148 @type arrow: L{Arrow <constant.Arrow>} constant
80     @param arrow: Type of arrow (two dimensional or three dimensional)
81     @type color_mode: L{ColorMode <constant.ColorMode>} constant
82     @param color_mode: Type of color mode
83 ksteube 1147 @type viewport: L{Viewport <constant.Viewport>} constant
84     @param viewport: Viewport in which objects are to be rendered on
85     @type lut : L{Lut <constant.Lut>} constant
86     @param lut: Lookup table color scheme
87     @type cell_to_point: Boolean
88     @param cell_to_point: Converts cell data to point data (by averaging)
89     @type outline: Boolean
90     @param outline: Places an outline around the domain surface
91     """
92    
93 jongui 1148 self.__data_collector = data_collector
94     self.__arrow = arrow
95     self.__color_mode = color_mode
96     self.__viewport = viewport
97     self.__lut = lut
98     self.__cell_to_point = cell_to_point
99     self.__outline = outline
100    
101     self.__modified = True # Keeps track whether Velocity has been modified.
102     MaskPoints.__init__(self)
103     Glyph3D.__init__(self)
104     DataSetMapper.__init__(self)
105     Actor3D.__init__(self)
106     scene._addVisualizationModules(self)
107 ksteube 1147
108 jongui 1148 # ----- Outline -----
109 ksteube 1147
110 jongui 1148 # NOTE: Changes cannot be made to the Outline's properties from the
111     # driver.
112     if(self.__outline == True):
113     outline = Outline(self.__data_collector._getDataCollectorOutput())
114     mapper = DataSetMapper()
115     mapper._setupDataSetMapper(outline._getOutlineOutput())
116 ksteube 1147
117 jongui 1148 actor3D = Actor3D()
118     actor3D._setupActor3D(mapper._getDataSetMapper())
119 ksteube 1147 # Default outline color is black.
120 jongui 1148 actor3D.setColor(Color.BLACK)
121 ksteube 1147
122     # Default line width is 1.
123 jongui 1148 actor3D._setLineWidth(1)
124 jongui 1158 scene._addActor3D(self.__viewport, actor3D._getActor3D())
125 ksteube 1147
126     # ----- Velocity -----
127    
128     # NOTE: Lookup table color mapping (color or grey scale) MUST be set
129     # before DataSetMapper. If it is done after DataSetMapper, no effect
130     # will take place.
131 jongui 1148 if(self.__lut == Lut.COLOR): # Colored lookup table.
132 ksteube 1147 lookup_table = LookupTable()
133     lookup_table._setTableValue()
134 jongui 1148 elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
135 ksteube 1147 lookup_table = LookupTable()
136     lookup_table._setLookupTableToGreyScale()
137    
138 jongui 1148 if(self.__cell_to_point == True): # Converts cell data to point data.
139     c2p = CellDataToPointData(
140     self.__data_collector._getDataCollectorOutput())
141     self._setupMaskPoints(c2p._getCellToPointOutput())
142     elif(self.__cell_to_point == False): # No conversion happens.
143     self._setupMaskPoints(data_collector._getDataCollectorOutput())
144 ksteube 1147
145 jongui 1148 if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
146 ksteube 1147 Arrow2D.__init__(self)
147 jongui 1148 self._setupGlyph3D(self._getMaskPointsOutput(),
148     self._getArrow2DOutput())
149 ksteube 1147 elif(arrow == Arrow.THREE_D): # Use 3D arrows.
150     Arrow3D.__init__(self)
151 jongui 1148 self._setupGlyph3D(self._getMaskPointsOutput(),
152     self._getArrow3DOutput())
153 ksteube 1147
154 jongui 1148 self._setupDataSetMapper(self._getGlyph3DOutput(),
155 ksteube 1147 lookup_table._getLookupTable())
156    
157 jongui 1148 self._setupActor3D(self._getDataSetMapper())
158 jongui 1158 scene._addActor3D(self.__viewport, self._getActor3D())
159 ksteube 1147
160 jongui 1148 def _isModified(self):
161     """
162     Return whether the Velocity or DataCollector has been modified.
163 ksteube 1147
164 jongui 1148 @rtype: Boolean
165     @return: True or False
166     """
167 ksteube 1147
168 jongui 1148 return self.__modified or self.__data_collector._isModified()
169 ksteube 1147
170 jongui 1158 def _render(self, scene):
171 jongui 1148 """
172     Render the velocity.
173 jongui 1158
174     @type scene: L{Scene <scene.Scene>} object
175     @param scene: Scene in which objects are to be rendered on
176 jongui 1148 """
177    
178     if (self._isModified() == True):
179     if(self.__data_collector._isScalarSet() == True):
180     self.__data_collector._setActiveScalar()
181     if(self.__data_collector._isVectorSet() == True):
182     self.__data_collector._setActiveVector()
183    
184     # Color velocity by vector.
185     if(self.__color_mode == ColorMode.VECTOR):
186     self._setColorModeByVector()
187 jongui 1189
188     # self._isScalarRangeSet checks whether the scalar range has
189     # been specified by the user. If it has, then the scalar range
190     # read from the source will be ignored.
191     if(not(self._isScalarRangeSet())):
192     self._setRange(self.__data_collector._getVectorRange())
193     self._setScalarRange(\
194     self.__data_collector._getVectorRange())
195     else:
196     self._setRange(self._getDataSetMapperRange())
197    
198 jongui 1148 # Color velocity by scalar.
199     elif(self.__color_mode == ColorMode.SCALAR):
200     self._setColorModeByScalar()
201    
202 jongui 1189 # self._isScalarRangeSet checks whether the scalar range has
203     # been specified by the user. If it has, then the scalar range
204     # read from the source will be ignored.
205     if(not(self._isScalarRangeSet())):
206     self._setRange(self.__data_collector._getScalarRange())
207     self._setScalarRange(\
208     self.__data_collector._getScalarRange())
209     else:
210     self._setRange(self._getDataSetMapperRange())
211    
212 jongui 1148 self.__modified = False
213    
214    
215 ksteube 1147 ###############################################################################
216    
217    
218     from transform import Transform
219     from plane import Plane
220     from cutter import Cutter
221    
222     # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, Transform, Plane,
223     # Cutter and MaskPoints were inherited to allow access to
224     # their public methods from the driver.
225     class VelocityOnPlaneCut(DataSetMapper, Actor3D, Arrow2D, Arrow3D,
226     Glyph3D, Transform, Plane, Cutter, MaskPoints):
227     """
228     This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},
229 jongui 1148 except that it shows a vector field using arrows cut using a plane.
230 ksteube 1147 """
231    
232     # The SOUTH_WEST default viewport is used when there is only one viewport.
233     # This saves the user from specifying the viewport when there is only one.
234     # If no lut is specified, the color scheme willbe used.
235     def __init__(self, scene, data_collector, arrow = Arrow.TWO_D,
236     color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,
237     lut = Lut.COLOR, cell_to_point = False, outline = True):
238     """
239     Initialise the VelocityOnPlaneCut.
240    
241     @attention: The source can either be point or cell data. If the
242     source is cell data, a conversion to point data may or may not be
243     required, in order for the object to be rendered correctly.
244     If a conversion is needed, the 'cell_to_point' flag must be set to
245 jongui 1199 'True', otherwise 'False' (which is the default). On occasions, an
246     inaccurate object may be rendered from cell data even after conversion.
247 ksteube 1147
248     @type scene: L{Scene <scene.Scene>} object
249     @param scene: Scene in which objects are to be rendered on
250     @type data_collector: L{DataCollector <datacollector.DataCollector>}
251     object
252     @param data_collector: Deal with source of data for visualisation
253     @type arrow: L{Arrow <constant.Arrow>} constant
254     @param arrow: Type of arrow (two dimensional or three dimensional)
255     @type color_mode: L{ColorMode <constant.ColorMode>} constant
256     @param color_mode: Type of color mode
257     @type viewport: L{Viewport <constant.Viewport>} constant
258     @param viewport: Viewport in which objects are to be rendered on
259     @type lut : L{Lut <constant.Lut>} constant
260     @param lut: Lookup table color scheme
261     @type cell_to_point: Boolean
262     @param cell_to_point: Converts cell data to point data (by averaging)
263     @type outline: Boolean
264     @param outline: Places an outline around the domain surface
265     """
266    
267 jongui 1148 self.__data_collector = data_collector
268     self.__arrow = arrow
269     self.__color_mode = color_mode
270     self.__viewport = viewport
271     self.__lut = lut
272     self.__cell_to_point = cell_to_point
273     self.__outline = outline
274    
275     # Keeps track whether VelocityOnPlaneCut has been modified.
276     self.__modified = True
277     Transform.__init__(self)
278     Plane.__init__(self)
279     Cutter.__init__(self)
280     MaskPoints.__init__(self)
281     Glyph3D.__init__(self)
282     DataSetMapper.__init__(self)
283     Actor3D.__init__(self)
284     scene._addVisualizationModules(self)
285 ksteube 1147
286 jongui 1148 # ----- Outline -----
287 ksteube 1147
288 jongui 1148 # NOTE: Changes cannot be made to the Outline's properties from the
289     # driver.
290     if(self.__outline == True):
291     outline = Outline(self.__data_collector._getDataCollectorOutput())
292     mapper = DataSetMapper()
293     mapper._setupDataSetMapper(outline._getOutlineOutput())
294 ksteube 1147
295 jongui 1148 actor3D = Actor3D()
296     actor3D._setupActor3D(mapper._getDataSetMapper())
297 ksteube 1147 # Default outline color is black.
298 jongui 1148 actor3D.setColor(Color.BLACK)
299 ksteube 1147
300     # Default line width is 1.
301 jongui 1148 actor3D._setLineWidth(1)
302 jongui 1158 scene._addActor3D(self.__viewport, actor3D._getActor3D())
303 ksteube 1147
304     # ----- Velocity on a cut plane -----
305    
306     # NOTE: Lookup table color mapping (color or grey scale) MUST be set
307     # before DataSetMapper. If it is done after DataSetMapper, no effect
308     # will take place.
309     if(lut == Lut.COLOR): # Colored lookup table.
310     lookup_table = LookupTable()
311     lookup_table._setTableValue()
312     elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.
313     lookup_table = LookupTable()
314     lookup_table._setLookupTableToGreyScale()
315    
316 jongui 1148 self._setupPlane(self._getTransform())
317 ksteube 1147
318 jongui 1148 if(self.__cell_to_point == True): # Converts cell data to point data.
319     c2p = CellDataToPointData(
320     self.__data_collector._getDataCollectorOutput())
321     self._setupCutter(c2p._getCellToPointOutput(), self._getPlane())
322     elif(self.__cell_to_point == False): # No conversion happens.
323     self._setupCutter(self.__data_collector._getDataCollectorOutput(),
324     self._getPlane())
325 ksteube 1147
326 jongui 1148 self._setupMaskPoints(self._getCutterOutput())
327 ksteube 1147
328 jongui 1148 if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
329 ksteube 1147 Arrow2D.__init__(self)
330 jongui 1148 self._setupGlyph3D(self._getMaskPointsOutput(),
331 jongui 1205 self._getArrow2DOutput())
332 jongui 1148 elif(self.__arrow == Arrow.THREE_D): # Use 3D arrows.
333 ksteube 1147 Arrow3D.__init__(self)
334 jongui 1148 self._setupGlyph3D(self._getMaskPointsOutput(),
335     self._getArrow3DOutput())
336 ksteube 1147
337 jongui 1148 self._setupDataSetMapper(self._getGlyph3DOutput(),
338 ksteube 1147 lookup_table._getLookupTable())
339    
340 jongui 1148 self._setupActor3D(self._getDataSetMapper())
341 jongui 1158 scene._addActor3D(self.__viewport, self._getActor3D())
342 jongui 1148
343     def _isModified(self):
344     """
345     Return whether the VelocityOnPlaneCut or DataCollector has been
346     modified.
347 ksteube 1147
348 jongui 1148 @rtype: Boolean
349     @return: True or False
350     """
351 ksteube 1147
352 jongui 1148 return self.__modified or self.__data_collector._isModified()
353 ksteube 1147
354 jongui 1158 def _render(self, scene):
355 jongui 1148 """
356 jongui 1158 Render the velocity cut using a plane.
357    
358     @type scene: L{Scene <scene.Scene>} object
359     @param scene: Scene in which objects are to be rendered on
360 jongui 1148 """
361 ksteube 1147
362 jongui 1148 if (self._isModified() == True):
363     if(self.__data_collector._isVectorSet() == True):
364     self.__data_collector._setActiveVector()
365     # Color velocity by vector.
366     if(self.__color_mode == ColorMode.VECTOR):
367     self._setColorModeByVector()
368 jongui 1189
369     # self._isScalarRangeSet checks whether the scalar range has
370     # been specified by the user. If it has, then the scalar range
371     # read from the source will be ignored.
372     if(not(self._isScalarRangeSet())):
373     self._setRange(self.__data_collector._getVectorRange())
374     self._setScalarRange(\
375     self.__data_collector._getVectorRange())
376     else:
377     self._setRange(self._getDataSetMapperRange())
378    
379 jongui 1148 # Color velocity by scalar.
380     elif(self.__color_mode == ColorMode.SCALAR):
381     self._setColorModeByScalar()
382    
383 jongui 1189 # self._isScalarRangeSet checks whether the scalar range has
384     # been specified by the user. If it has, then the scalar range
385     # read from the source will be ignored.
386     if(not(self._isScalarRangeSet())):
387     self._setRange(self.__data_collector._getScalarRange())
388     self._setScalarRange(\
389     self.__data_collector._getScalarRange())
390     else:
391     self._setRange(self._getDataSetMapperRange())
392    
393 jongui 1148 self.__modified = False
394    
395    
396 ksteube 1147 ###############################################################################
397    
398    
399     from clipper import Clipper
400    
401     # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, Transform, Plane,
402     # Clipper and MaskPoints were inherited to allow access to
403     # their public methods from the driver.
404     class VelocityOnPlaneClip(DataSetMapper, Actor3D, Arrow2D, Arrow3D,
405     Glyph3D, Transform, Plane, Clipper, MaskPoints):
406     """
407     This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>}
408     , except that it shows a vector field using arrows clipped using a plane.
409     """
410    
411     # The SOUTH_WEST default viewport is used when there is only one viewport.
412     # This saves the user from specifying the viewport when there is only one.
413     # If no lut is specified, the color scheme will be used.
414     def __init__(self, scene, data_collector, arrow = Arrow.TWO_D,
415     color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,
416     lut = Lut.COLOR, cell_to_point = False, outline = True):
417     """
418     Initialise the VelocityOnPlaneClip.
419    
420     @attention: The source can either be point or cell data. If the
421     source is cell data, a conversion to point data may or may not be
422     required, in order for the object to be rendered correctly.
423     If a conversion is needed, the 'cell_to_point' flag must be set to
424 jongui 1199 'True', otherwise 'False' (which is the default). On occasions, an
425     inaccurate object may be rendered from cell data even after conversion.
426 ksteube 1147
427     @type scene: L{Scene <scene.Scene>} object
428     @param scene: Scene in which objects are to be rendered on
429     @type data_collector: L{DataCollector <datacollector.DataCollector>}
430     object
431     @param data_collector: Deal with source of data for visualisation
432     @type arrow: L{Arrow <constant.Arrow>} constant
433     @param arrow: Type of arrow (two dimensional or three dimensional)
434     @type color_mode: L{ColorMode <constant.ColorMode>} constant
435     @param color_mode: Type of color mode
436     @type viewport: L{Viewport <constant.Viewport>} constant
437     @param viewport: Viewport in which objects are to be rendered on
438     @type lut : L{Lut <constant.Lut>} constant
439     @param lut: Lookup table color scheme
440     @type cell_to_point: Boolean
441     @param cell_to_point: Converts cell data to point data (by averaging)
442     @type outline: Boolean
443     @param outline: Places an outline around the domain surface
444     """
445    
446 jongui 1148 self.__data_collector = data_collector
447     self.__arrow = arrow
448     self.__color_mode = color_mode
449     self.__viewport = viewport
450     self.__lut = lut
451     self.__cell_to_point = cell_to_point
452     self.__outline = outline
453    
454     # Keeps track whether VelocityOnPlaneCut has been modified.
455     self.__modified = True
456     Transform.__init__(self)
457     Plane.__init__(self)
458     Clipper.__init__(self)
459     MaskPoints.__init__(self)
460     Glyph3D.__init__(self)
461     DataSetMapper.__init__(self)
462     Actor3D.__init__(self)
463     scene._addVisualizationModules(self)
464 ksteube 1147
465 jongui 1148 # ----- Outline -----
466 ksteube 1147
467 jongui 1148 # NOTE: Changes cannot be made to the Outline's properties from the
468     # driver.
469     if(self.__outline == True):
470     outline = Outline(self.__data_collector._getDataCollectorOutput())
471     mapper = DataSetMapper()
472     mapper._setupDataSetMapper(outline._getOutlineOutput())
473 ksteube 1147
474 jongui 1148 actor3D = Actor3D()
475     actor3D._setupActor3D(mapper._getDataSetMapper())
476 ksteube 1147 # Default outline color is black.
477 jongui 1148 actor3D.setColor(Color.BLACK)
478 ksteube 1147
479     # Default line width is 1.
480 jongui 1148 actor3D._setLineWidth(1)
481 jongui 1158 scene._addActor3D(self.__viewport, actor3D._getActor3D())
482 ksteube 1147
483     # ----- Velocity on a clipped plane -----
484    
485     # NOTE: Lookup table color mapping (color or grey scale) MUST be set
486     # before DataSetMapper. If it is done after DataSetMapper, no effect
487     # will take place.
488 jongui 1148 if(self.__lut == Lut.COLOR): # Colored lookup table.
489 ksteube 1147 lookup_table = LookupTable()
490     lookup_table._setTableValue()
491 jongui 1148 elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
492 ksteube 1147 lookup_table = LookupTable()
493     lookup_table._setLookupTableToGreyScale()
494    
495 jongui 1148 self._setupPlane(self._getTransform())
496 ksteube 1147
497 jongui 1148 if(self.__cell_to_point == True): # Converts cell data to point data.
498     c2p = CellDataToPointData(
499     self.__data_collector._getDataCollectorOutput())
500     self._setupMaskPoints(c2p._getCellToPointOutput())
501     elif(self.__cell_to_point == False): # No conversion happens.
502     self._setupMaskPoints(
503     self.__data_collector._getDataCollectorOutput())
504 ksteube 1147
505     # NOTE: Glyph3D must come before Clipper. Otherwise clipping may not
506     # work correctly.
507 jongui 1148 if(self.__arrow == Arrow.TWO_D): # Use 2D arrows.
508 ksteube 1147 Arrow2D.__init__(self)
509 jongui 1148 self._setupGlyph3D(self._getMaskPointsOutput(),
510     self._getArrow2DOutput())
511     elif(self.__arrow == Arrow.THREE_D): # Use 3D arrows.
512 ksteube 1147 Arrow3D.__init__(self)
513 jongui 1148 self._setupGlyph3D(self._getMaskPointsOutput(),
514     self._getArrow3DOutput())
515 ksteube 1147
516 jongui 1148 self._setupClipper(self._getGlyph3DOutput(), self._getPlane())
517     self._setClipFunction()
518 ksteube 1147
519     # NOTE: Clipper must come after Glyph. Otherwise clipping
520     # may not work correctly.
521 jongui 1148 self._setupDataSetMapper(self._getClipperOutput(),
522 ksteube 1147 lookup_table._getLookupTable())
523    
524 jongui 1148 self._setupActor3D(self._getDataSetMapper())
525 jongui 1158 scene._addActor3D(self.__viewport, self._getActor3D())
526 jongui 1148
527     def _isModified(self):
528     """
529     Return whether the VelocityOnPlaneClip or DataCollector has been
530     modified.
531 ksteube 1147
532 jongui 1148 @rtype: Boolean
533     @return: True or False
534     """
535 ksteube 1147
536 jongui 1148 return self.__modified or self.__data_collector._isModified()
537    
538 jongui 1158 def _render(self, scene):
539 jongui 1148 """
540     Render the velocity clip using a plane..
541 jongui 1158
542     @type scene: L{Scene <scene.Scene>} object
543     @param scene: Scene in which objects are to be rendered on
544 jongui 1148 """
545    
546     if (self._isModified() == True):
547     if(self.__data_collector._isVectorSet() == True):
548     self.__data_collector._setActiveVector()
549     # Color velocity by vector.
550     if(self.__color_mode == ColorMode.VECTOR):
551     self._setColorModeByVector()
552 jongui 1189
553     # self._isScalarRangeSet checks whether the scalar range has
554     # been specified by the user. If it has, then the scalar range
555     # read from the source will be ignored.
556     if(not(self._isScalarRangeSet())):
557     self._setRange(self.__data_collector._getVectorRange())
558     self._setScalarRange(\
559     self.__data_collector._getVectorRange())
560     else:
561     self._setRange(self._getDataSetMapperRange())
562    
563 jongui 1148 # Color velocity by scalar.
564     elif(self.__color_mode == ColorMode.SCALAR):
565     self._setColorModeByScalar()
566    
567 jongui 1189 # self._isScalarRangeSet checks whether the scalar range has
568     # been specified by the user. If it has, then the scalar range
569     # read from the source will be ignored.
570     if(not(self._isScalarRangeSet())):
571     self._setRange(self.__data_collector._getScalarRange())
572     self._setScalarRange(\
573     self.__data_collector._getScalarRange())
574     else:
575     self._setRange(self._getDataSetMapperRange())
576    
577 jongui 1148 self.__modified = False
578    
579    

  ViewVC Help
Powered by ViewVC 1.1.26