25 |
# 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 |
26 |
# be loaded automatically. If no lut is specified, the color scheme will |
# be loaded automatically. If no lut is specified, the color scheme will |
27 |
# be used. |
# be used. |
28 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, scalar = None, vector = None, |
29 |
lut = Lut.COLOR, color_mode = ColorMode.VECTOR, outline = True): |
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, |
30 |
|
color_mode = ColorMode.VECTOR, outline = True): |
31 |
""" |
""" |
32 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
33 |
@param scene: Scene in which objects are to be rendered on |
@param scene: Scene in which objects are to be rendered on |
34 |
@type data_collector: L{DataCollector <datacollector.DataCollector>} |
@type data_collector: L{DataCollector <datacollector.DataCollector>} |
35 |
object |
object |
36 |
@param data_collector: Deal with source of data for visualisation |
@param data_collector: Deal with source of data for visualisation |
37 |
|
@type vector: String |
38 |
|
@param vector: Vector field to load from the source file |
39 |
|
@type scalar: String |
40 |
|
@param scalar: Scalar field to load from the source file |
41 |
@type viewport: L{Viewport <constant.Viewport>} constant |
@type viewport: L{Viewport <constant.Viewport>} constant |
42 |
@param viewport: Viewport in which the object is to be rendered on |
@param viewport: Viewport in which the object is to be rendered on |
43 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
72 |
|
|
73 |
# ----- Streamline ----- |
# ----- Streamline ----- |
74 |
|
|
75 |
|
if(vector != None): |
76 |
|
print "vector" |
77 |
|
data_collector._setActiveVector(vector) |
78 |
|
elif(scalar != None): |
79 |
|
print "scalar" |
80 |
|
data_collector._setActiveScalar(scalar) |
81 |
|
|
82 |
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
83 |
# before DataSetMapper. If it is done after DataSetMapper, no effect |
# before DataSetMapper. If it is done after DataSetMapper, no effect |
84 |
# will take place. |
# will take place. |
98 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
99 |
|
|
100 |
if(color_mode == ColorMode.VECTOR): # Color velocity by vector. |
if(color_mode == ColorMode.VECTOR): # Color velocity by vector. |
101 |
|
print "vectro mode" |
102 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
103 |
data_collector._getVectorRange()) |
data_collector._getVectorRange()) |
104 |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
105 |
|
print "scalar mode" |
106 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
107 |
data_collector._getScalarRange()) |
data_collector._getScalarRange()) |
108 |
|
|