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