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