9 |
from outline import Outline |
from outline import Outline |
10 |
from constant import Viewport, Color, Lut, VizType, ColorMode |
from constant import Viewport, Color, Lut, VizType, ColorMode |
11 |
from contourmodule import ContourModule |
from contourmodule import ContourModule |
12 |
|
from average import CellDataToPointData |
13 |
|
|
14 |
# NOTE: DataSetMapper, Actor3D and ContourModule were inherited to allow |
# NOTE: DataSetMapper, Actor3D and ContourModule were inherited to allow |
15 |
# access to their public methods from the driver. |
# access to their public methods from the driver. |
24 |
# This saves the user from specifying the viewport when there is only one. |
# This saves the user from specifying the viewport when there is only one. |
25 |
# If no lut is specified, the color scheme will be used. |
# If no lut is specified, the color scheme will be used. |
26 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
27 |
lut = Lut.COLOR, outline = True): |
lut = Lut.COLOR, cell_to_point = False, outline = True): |
28 |
""" |
""" |
29 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
30 |
@param scene: Scene in which objects are to be rendered on |
@param scene: Scene in which objects are to be rendered on |
35 |
@param viewport: Viewport in which objects are to be rendered on |
@param viewport: Viewport in which objects are to be rendered on |
36 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
37 |
@param lut: Lookup table color scheme |
@param lut: Lookup table color scheme |
38 |
|
@type cell_to_point: Boolean |
39 |
|
@param cell_to_point: Converts cell data to point data (by averaging) |
40 |
@type outline: Boolean |
@type outline: Boolean |
41 |
@param outline: Places an outline around the domain surface |
@param outline: Places an outline around the domain surface |
42 |
""" |
""" |
76 |
lookup_table = LookupTable() |
lookup_table = LookupTable() |
77 |
lookup_table._setLookupTableToGreyScale() |
lookup_table._setLookupTableToGreyScale() |
78 |
|
|
79 |
ContourModule.__init__(self, data_collector._getOutput()) |
if(cell_to_point == True): # Converts cell data to point data. |
80 |
|
c2p = CellDataToPointData(data_collector._getOutput()) |
81 |
|
ContourModule.__init__(self, c2p._getOutput()) |
82 |
|
elif(cell_to_point == False): # No conversion happens. |
83 |
|
ContourModule.__init__(self, data_collector._getOutput()) |
84 |
|
|
85 |
# By default 10 contours are generated and the scalar range is based |
# By default 10 contours are generated and the scalar range is based |
86 |
# on the scalar data range. |
# on the scalar data range. |
87 |
ContourModule.generateContours(self, 10, |
ContourModule.generateContours(self, 10, |
120 |
# This saves the user from specifying the viewport when there is only one. |
# This saves the user from specifying the viewport when there is only one. |
121 |
# If no lut is specified, the color scheme will be used. |
# If no lut is specified, the color scheme will be used. |
122 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
123 |
lut = Lut.COLOR, outline = True): |
lut = Lut.COLOR, cell_to_point = False, outline = True): |
124 |
|
|
125 |
""" |
""" |
126 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
132 |
@param viewport: Viewport in which objects are to be rendered on |
@param viewport: Viewport in which objects are to be rendered on |
133 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
134 |
@param lut: Lookup table color scheme |
@param lut: Lookup table color scheme |
135 |
|
@type cell_to_point: Boolean |
136 |
|
@param cell_to_point: Converts cell data to point data (by averaging) |
137 |
@type outline: Boolean |
@type outline: Boolean |
138 |
@param outline: Places an outline around the domain surface |
@param outline: Places an outline around the domain surface |
139 |
""" |
""" |
176 |
Transform.__init__(self) |
Transform.__init__(self) |
177 |
Plane.__init__(self, Transform._getTransform(self)) |
Plane.__init__(self, Transform._getTransform(self)) |
178 |
|
|
179 |
Cutter.__init__(self, data_collector._getOutput(), |
if(cell_to_point == True): # Converts cell data to point data. |
180 |
Plane._getPlane(self)) |
c2p = CellDataToPointData(data_collector._getOutput()) |
181 |
|
Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self)) |
182 |
|
elif(cell_to_point == False): # No conversion happens. |
183 |
|
Cutter.__init__(self, data_collector._getOutput(), |
184 |
|
Plane._getPlane(self)) |
185 |
|
|
186 |
ContourModule.__init__(self, Cutter._getOutput(self)) |
ContourModule.__init__(self, Cutter._getOutput(self)) |
187 |
|
|
188 |
# By default 10 contours are generated and the scalar range is based |
# By default 10 contours are generated and the scalar range is based |
195 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
196 |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
197 |
|
|
198 |
|
data_collector._paramForUpdatingMultipleSources(VizType.CONTOUR, |
199 |
|
ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self), |
200 |
|
ContourModule._getContour(self)) |
201 |
|
|
202 |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
203 |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
204 |
|
|
222 |
# This saves the user from specifying the viewport when there is only one. |
# This saves the user from specifying the viewport when there is only one. |
223 |
# If no lut is specified, the color scheme will be used. |
# If no lut is specified, the color scheme will be used. |
224 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
225 |
lut = Lut.COLOR, outline = True): |
lut = Lut.COLOR, cell_to_point = False, outline = True): |
226 |
|
|
227 |
""" |
""" |
228 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
234 |
@param viewport: Viewport in which objects are to be rendered on |
@param viewport: Viewport in which objects are to be rendered on |
235 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
236 |
@param lut: Lookup table color scheme |
@param lut: Lookup table color scheme |
237 |
|
@type cell_to_point: Boolean |
238 |
|
@param cell_to_point: Converts cell data to point data (by averaging) |
239 |
@type outline: Boolean |
@type outline: Boolean |
240 |
@param outline: Places an outline around the domain surface |
@param outline: Places an outline around the domain surface |
241 |
""" |
""" |
278 |
Transform.__init__(self) |
Transform.__init__(self) |
279 |
Plane.__init__(self, Transform._getTransform(self)) |
Plane.__init__(self, Transform._getTransform(self)) |
280 |
|
|
281 |
Clipper.__init__(self, data_collector._getOutput(), |
if(cell_to_point == True): # Converts cell data to point data. |
282 |
Plane._getPlane(self)) |
c2p = CellDataToPointData(data_collector._getOutput()) |
283 |
|
Clipper.__init__(self, c2p._getOutput(), Plane._getPlane(self)) |
284 |
|
elif(cell_to_point == False): # No conversion happens. |
285 |
|
Clipper.__init__(self, data_collector._getOutput(), |
286 |
|
Plane._getPlane(self)) |
287 |
|
|
288 |
Clipper._setClipFunction(self) |
Clipper._setClipFunction(self) |
289 |
|
|
290 |
ContourModule.__init__(self, Clipper._getOutput(self)) |
ContourModule.__init__(self, Clipper._getOutput(self)) |
298 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
299 |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
300 |
|
|
301 |
|
data_collector._paramForUpdatingMultipleSources(VizType.CONTOUR, |
302 |
|
ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self), |
303 |
|
ContourModule._getContour(self)) |
304 |
|
|
305 |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
306 |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
307 |
|
|