26 |
# If no vector field is specified, the first encountered in the file will |
# If no vector field is specified, the first encountered in the file will |
27 |
# be loaded automatically. If no lut is specified, the color scheme will |
# be loaded automatically. If no lut is specified, the color scheme will |
28 |
# be used. |
# be used. |
29 |
def __init__(self, scene, data_collector, vector = None, |
def __init__(self, scene, data_collector, vector = None, scalar = None, |
30 |
arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR, |
arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR, |
31 |
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True): |
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True): |
32 |
|
|
38 |
@param data_collector: Deal with source of data for visualisation |
@param data_collector: Deal with source of data for visualisation |
39 |
@type vector: String |
@type vector: String |
40 |
@param vector: Vector field to load from the source file |
@param vector: Vector field to load from the source file |
41 |
|
@type scalar: String |
42 |
|
@param scalar: Scalar field to load from the source file |
43 |
@type arrow: L{Arrow <constant.Arrow>} constant |
@type arrow: L{Arrow <constant.Arrow>} constant |
44 |
@param arrow: Type of arrow (two dimensional or three dimensional) |
@param arrow: Type of arrow (two dimensional or three dimensional) |
45 |
@type color_mode: L{ColorMode <constant.ColorMode>} constant |
@type color_mode: L{ColorMode <constant.ColorMode>} constant |
77 |
|
|
78 |
# ----- Velocity ----- |
# ----- Velocity ----- |
79 |
|
|
80 |
|
# NOTE: Two 'ifs' were used instead of an if-elif because an active |
81 |
|
# scalar and an active vector attribute may be specified at the same |
82 |
|
# time. One may be for the color mode and the other for the |
83 |
|
# scaling mode. |
84 |
if(vector != None): |
if(vector != None): |
85 |
data_collector._setActiveVector(vector) |
data_collector._setActiveVector(vector) |
86 |
|
if(scalar != None): |
87 |
|
data_collector._setActiveScalar(scalar) |
88 |
|
|
89 |
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
90 |
# before DataSetMapper. If it is done after DataSetMapper, no effect |
# before DataSetMapper. If it is done after DataSetMapper, no effect |
103 |
if(arrow == Arrow.TWO_D): # Use 2D arrows. |
if(arrow == Arrow.TWO_D): # Use 2D arrows. |
104 |
Arrow2D.__init__(self) |
Arrow2D.__init__(self) |
105 |
Glyph3D.__init__(self, Probe._getOutput(self), |
Glyph3D.__init__(self, Probe._getOutput(self), |
106 |
Arrow2D._getOutput(self), data_collector._getScalarRange()) |
Arrow2D._getOutput(self)) |
107 |
elif(arrow == Arrow.THREE_D): # Use 3D arrows. |
elif(arrow == Arrow.THREE_D): # Use 3D arrows. |
108 |
Arrow3D.__init__(self) |
Arrow3D.__init__(self) |
109 |
Glyph3D.__init__(self, Probe._getOutput(self), |
Glyph3D.__init__(self, Probe._getOutput(self), |
110 |
Arrow3D._getOutput(self), data_collector._getScalarRange()) |
Arrow3D._getOutput(self)) |
111 |
|
|
112 |
DataSetMapper.__init__(self, Glyph3D._getOutput(self), |
DataSetMapper.__init__(self, Glyph3D._getOutput(self), |
113 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
114 |
|
|
115 |
if(color_mode == ColorMode.VECTOR): # Color velocity by vector. |
if(color_mode == ColorMode.VECTOR): # Color velocity by vector. |
116 |
Glyph3D._setColorModeByVector(self) |
Glyph3D._setColorModeByVector(self) |
117 |
|
Glyph3D._setRange(self, data_collector._getVectorRange()) |
118 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
119 |
data_collector._getVectorRange()) |
data_collector._getVectorRange()) |
120 |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
121 |
Glyph3D._setColorModeByScalar(self) |
Glyph3D._setColorModeByScalar(self) |
122 |
|
Glyph3D._setRange(self, data_collector._getVectorRange()) |
123 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
124 |
data_collector._getScalarRange()) |
data_collector._getScalarRange()) |
125 |
|
|
148 |
# If no vector field is specified, the first encountered in the file will |
# If no vector field is specified, the first encountered in the file will |
149 |
# be loaded automatically. If no lut is specified, the color scheme will |
# be loaded automatically. If no lut is specified, the color scheme will |
150 |
# be used. |
# be used. |
151 |
def __init__(self, scene, data_collector, vector = None, |
def __init__(self, scene, data_collector, vector = None, scalar = None, |
152 |
arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR, |
arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR, |
153 |
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True): |
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True): |
154 |
""" |
""" |
159 |
@param data_collector: Deal with source of data for visualisation |
@param data_collector: Deal with source of data for visualisation |
160 |
@type vector: String |
@type vector: String |
161 |
@param vector: Vector field to load from the source file |
@param vector: Vector field to load from the source file |
162 |
|
@type scalar: String |
163 |
|
@param scalar: Scalar field to load from the source file |
164 |
@type arrow: L{Arrow <constant.Arrow>} constant |
@type arrow: L{Arrow <constant.Arrow>} constant |
165 |
@param arrow: Type of arrow (two dimensional or three dimensional) |
@param arrow: Type of arrow (two dimensional or three dimensional) |
166 |
@type color_mode: L{ColorMode <constant.ColorMode>} constant |
@type color_mode: L{ColorMode <constant.ColorMode>} constant |
198 |
|
|
199 |
# ----- Velocity on a cut plane ----- |
# ----- Velocity on a cut plane ----- |
200 |
|
|
201 |
|
# NOTE: Two 'ifs' were used instead of an if-elif because an active |
202 |
|
# scalar and an active vector attribute may be specified at the same |
203 |
|
# time. One may be for the color mode and the other for the |
204 |
|
# scaling mode. |
205 |
if(vector != None): |
if(vector != None): |
206 |
data_collector._setActiveVector(vector) |
data_collector._setActiveVector(vector) |
207 |
|
if(scalar != None): |
208 |
|
data_collector._setActiveScalar(scalar) |
209 |
|
|
210 |
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
211 |
# before DataSetMapper. If it is done after DataSetMapper, no effect |
# before DataSetMapper. If it is done after DataSetMapper, no effect |
230 |
if(arrow == Arrow.TWO_D): # Use 2D arrows. |
if(arrow == Arrow.TWO_D): # Use 2D arrows. |
231 |
Arrow2D.__init__(self) |
Arrow2D.__init__(self) |
232 |
Glyph3D.__init__(self, Cutter._getOutput(self), |
Glyph3D.__init__(self, Cutter._getOutput(self), |
233 |
Arrow2D._getOutput(self), data_collector._getScalarRange()) |
Arrow2D._getOutput(self)) |
234 |
elif(arrow == Arrow.THREE_D): # Use 3D arrows. |
elif(arrow == Arrow.THREE_D): # Use 3D arrows. |
235 |
Arrow3D.__init__(self) |
Arrow3D.__init__(self) |
236 |
Glyph3D.__init__(self, Cutter._getOutput(self), |
Glyph3D.__init__(self, Cutter._getOutput(self), |
237 |
Arrow3D._getOutput(self), data_collector._getScalarRange()) |
Arrow3D._getOutput(self)) |
238 |
|
|
239 |
DataSetMapper.__init__(self, Glyph3D._getOutput(self), |
DataSetMapper.__init__(self, Glyph3D._getOutput(self), |
240 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
241 |
|
|
242 |
if(color_mode == ColorMode.VECTOR): # Color velocity by vector. |
if(color_mode == ColorMode.VECTOR): # Color velocity by vector. |
243 |
Glyph3D._setColorModeByVector(self) |
Glyph3D._setColorModeByVector(self) |
244 |
|
Glyph3D._setRange(self, data_collector._getVectorRange()) |
245 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
246 |
data_collector._getVectorRange()) |
data_collector._getVectorRange()) |
247 |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
248 |
Glyph3D._setColorModeByScalar(self) |
Glyph3D._setColorModeByScalar(self) |
249 |
|
Glyph3D._setRange(self, data_collector._getVectorRange()) |
250 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
251 |
data_collector._getScalarRange()) |
data_collector._getScalarRange()) |
252 |
|
|
273 |
# If no vector field is specified, the first encountered in the file will |
# If no vector field is specified, the first encountered in the file will |
274 |
# be loaded automatically. If no lut is specified, the color scheme will |
# be loaded automatically. If no lut is specified, the color scheme will |
275 |
# be used. |
# be used. |
276 |
def __init__(self, scene, data_collector, vector = None, |
def __init__(self, scene, data_collector, vector = None, scalar = None, |
277 |
arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR, |
arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR, |
278 |
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True): |
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True): |
279 |
""" |
""" |
284 |
@param data_collector: Deal with source of data for visualisation |
@param data_collector: Deal with source of data for visualisation |
285 |
@type vector: String |
@type vector: String |
286 |
@param vector: Vector field to load from the source file |
@param vector: Vector field to load from the source file |
287 |
|
@type scalar: String |
288 |
|
@param scalar: Scalar field to load from the source file |
289 |
@type arrow: L{Arrow <constant.Arrow>} constant |
@type arrow: L{Arrow <constant.Arrow>} constant |
290 |
@param arrow: Type of arrow (two dimensional or three dimensional) |
@param arrow: Type of arrow (two dimensional or three dimensional) |
291 |
@type color_mode: L{ColorMode <constant.ColorMode>} constant |
@type color_mode: L{ColorMode <constant.ColorMode>} constant |
323 |
|
|
324 |
# ----- Velocity on a clipped plane ----- |
# ----- Velocity on a clipped plane ----- |
325 |
|
|
326 |
|
# NOTE: Two 'ifs' were used instead of an if-elif because an active |
327 |
|
# scalar and an active vector attribute may be specified at the same |
328 |
|
# time. One may be for the color mode and the other for the |
329 |
|
# scaling mode. |
330 |
if(vector != None): |
if(vector != None): |
331 |
data_collector._setActiveVector(vector) |
data_collector._setActiveVector(vector) |
332 |
|
if(scalar != None): |
333 |
|
data_collector._setActiveScalar(scalar) |
334 |
|
|
335 |
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
336 |
# before DataSetMapper. If it is done after DataSetMapper, no effect |
# before DataSetMapper. If it is done after DataSetMapper, no effect |
355 |
Arrow2D.__init__(self) |
Arrow2D.__init__(self) |
356 |
#Glyph3D.__init__(self, data_collector._getOutput(), |
#Glyph3D.__init__(self, data_collector._getOutput(), |
357 |
Glyph3D.__init__(self, Probe._getOutput(self), |
Glyph3D.__init__(self, Probe._getOutput(self), |
358 |
Arrow2D._getOutput(self), data_collector._getScalarRange()) |
Arrow2D._getOutput(self)) |
359 |
elif(arrow == Arrow.THREE_D): # Use 3D arrows. |
elif(arrow == Arrow.THREE_D): # Use 3D arrows. |
360 |
Arrow3D.__init__(self) |
Arrow3D.__init__(self) |
361 |
Glyph3D.__init__(self, Probe._getOutput(self), |
Glyph3D.__init__(self, Probe._getOutput(self), |
362 |
Arrow3D._getOutput(self), data_collector._getScalarRange()) |
Arrow3D._getOutput(self)) |
363 |
|
|
364 |
# NOTE: Clipper must come after Glyph3D. Otherwise, the output will |
# NOTE: Clipper must come after Glyph3D. Otherwise, the output will |
365 |
# be incorrect. |
# be incorrect. |
372 |
|
|
373 |
if(color_mode == ColorMode.VECTOR): # Color velocity by vector. |
if(color_mode == ColorMode.VECTOR): # Color velocity by vector. |
374 |
Glyph3D._setColorModeByVector(self) |
Glyph3D._setColorModeByVector(self) |
375 |
|
Glyph3D._setRange(self, data_collector._getVectorRange()) |
376 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
377 |
data_collector._getVectorRange()) |
data_collector._getVectorRange()) |
378 |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
379 |
Glyph3D._setColorModeByScalar(self) |
Glyph3D._setColorModeByScalar(self) |
380 |
|
Glyph3D._setRange(self, data_collector._getVectorRange()) |
381 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
382 |
data_collector._getScalarRange()) |
data_collector._getScalarRange()) |
383 |
|
|