8 |
from lookuptable import LookupTable |
from lookuptable import LookupTable |
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 average import CellDataToPointData |
12 |
|
|
13 |
# NOTE: DataSetMapper and Actor3D were inherited to allow access to their |
# NOTE: DataSetMapper and Actor3D were inherited to allow access to their |
14 |
# public methods from the driver. |
# public methods from the driver. |
22 |
# 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. |
23 |
# If no lut is specified, the color scheme will be used. |
# If no lut is specified, the color scheme will be used. |
24 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
25 |
lut = Lut.COLOR, outline = True): |
lut = Lut.COLOR, cell_to_point = False, outline = True): |
26 |
""" |
""" |
27 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
28 |
@param scene: Scene in which objects are to be rendered on |
@param scene: Scene in which objects are to be rendered on |
33 |
@param viewport: Viewport in which objects are to be rendered on |
@param viewport: Viewport in which objects are to be rendered on |
34 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
35 |
@param lut: Lookup table color scheme |
@param lut: Lookup table color scheme |
36 |
|
@type cell_to_point: Boolean |
37 |
|
@param cell_to_point: Converts cell data to point data (by averaging) |
38 |
@type outline: Boolean |
@type outline: Boolean |
39 |
@param outline: Places an outline around the domain surface |
@param outline: Places an outline around the domain surface |
40 |
""" |
""" |
74 |
lookup_table = LookupTable() |
lookup_table = LookupTable() |
75 |
lookup_table._setLookupTableToGreyScale() |
lookup_table._setLookupTableToGreyScale() |
76 |
|
|
77 |
DataSetMapper.__init__(self, data_collector._getOutput(), |
if(cell_to_point == True): # Converts cell data to point data. |
78 |
lookup_table._getLookupTable()) |
c2p = CellDataToPointData(data_collector._getOutput()) |
79 |
|
DataSetMapper.__init__(self, c2p._getOutput(), |
80 |
|
lookup_table._getLookupTable()) |
81 |
|
elif(cell_to_point == False): # No conversion happens. |
82 |
|
DataSetMapper.__init__(self, data_collector._getOutput(), |
83 |
|
lookup_table._getLookupTable()) |
84 |
|
|
85 |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
86 |
|
|
87 |
data_collector._paramForUpdatingMultipleSources(VizType.MAP, |
data_collector._paramForUpdatingMultipleSources(VizType.MAP, |
111 |
# 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. |
112 |
# If no lut is specified, the color scheme will be used. |
# If no lut is specified, the color scheme will be used. |
113 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
114 |
lut = Lut.COLOR, outline = True): |
lut = Lut.COLOR, cell_to_point = False, outline = True): |
115 |
""" |
""" |
116 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
117 |
@param scene: Scene in which objects are to be rendered on |
@param scene: Scene in which objects are to be rendered on |
122 |
@param viewport: Viewport in which objects are to be rendered on |
@param viewport: Viewport in which objects are to be rendered on |
123 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
124 |
@param lut: Lookup table color scheme |
@param lut: Lookup table color scheme |
125 |
|
@type cell_to_point: Boolean |
126 |
|
@param cell_to_point: Converts cell data to point data (by averaging) |
127 |
@type outline: Boolean |
@type outline: Boolean |
128 |
@param outline: Places an outline around the domain surface |
@param outline: Places an outline around the domain surface |
129 |
""" |
""" |
166 |
Transform.__init__(self) |
Transform.__init__(self) |
167 |
Plane.__init__(self, Transform._getTransform(self)) |
Plane.__init__(self, Transform._getTransform(self)) |
168 |
|
|
169 |
Cutter.__init__(self, data_collector._getOutput(), |
if(cell_to_point == True): # Converts cell data to point data. |
170 |
|
c2p = CellDataToPointData(data_collector._getOutput()) |
171 |
|
Cutter.__init__(self, c2p._getOutput(), Plane._getPlane(self)) |
172 |
|
elif(cell_to_point == False): # No conversion happens. |
173 |
|
Cutter.__init__(self, data_collector._getOutput(), |
174 |
Plane._getPlane(self)) |
Plane._getPlane(self)) |
175 |
|
|
176 |
DataSetMapper.__init__(self, Cutter._getOutput(self), |
DataSetMapper.__init__(self, Cutter._getOutput(self), |
177 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
178 |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
179 |
|
|
180 |
|
data_collector._paramForUpdatingMultipleSources(VizType.MAP, |
181 |
|
ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self)) |
182 |
|
|
183 |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
184 |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
185 |
|
|
186 |
|
|
187 |
########################################################################### |
############################################################################### |
188 |
|
|
189 |
|
|
190 |
from clipper import Clipper |
from clipper import Clipper |
201 |
# 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. |
202 |
# If no lut is specified, the color scheme will be used. |
# If no lut is specified, the color scheme will be used. |
203 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
204 |
lut = Lut.COLOR, outline = True): |
lut = Lut.COLOR, cell_to_point = False, outline = True): |
205 |
""" |
""" |
206 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
207 |
@param scene: Scene in which objects are to be rendered on |
@param scene: Scene in which objects are to be rendered on |
212 |
@param viewport: Viewport in which objects are to be rendered on |
@param viewport: Viewport in which objects are to be rendered on |
213 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
214 |
@param lut: Lookup table color scheme |
@param lut: Lookup table color scheme |
215 |
|
@type cell_to_point: Boolean |
216 |
|
@param cell_to_point: Converts cell data to point data (by averaging) |
217 |
@type outline: Boolean |
@type outline: Boolean |
218 |
@param outline: Places an outline around the domain surface |
@param outline: Places an outline around the domain surface |
219 |
""" |
""" |
256 |
Transform.__init__(self) |
Transform.__init__(self) |
257 |
Plane.__init__(self, Transform._getTransform(self)) |
Plane.__init__(self, Transform._getTransform(self)) |
258 |
|
|
259 |
Clipper.__init__(self, data_collector._getOutput(), |
if(cell_to_point == True): # Converts cell data to point data. |
260 |
Plane._getPlane(self)) |
c2p = CellDataToPointData(data_collector._getOutput()) |
261 |
|
Clipper.__init__(self, c2p._getOutput(), Plane._getPlane(self)) |
262 |
|
elif(cell_to_point == False): # No conversion happens. |
263 |
|
Clipper.__init__(self, data_collector._getOutput(), |
264 |
|
Plane._getPlane(self)) |
265 |
|
|
266 |
Clipper._setClipFunction(self) |
Clipper._setClipFunction(self) |
267 |
|
|
268 |
DataSetMapper.__init__(self, Clipper._getOutput(self), |
DataSetMapper.__init__(self, Clipper._getOutput(self), |
269 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
270 |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
271 |
|
|
272 |
|
data_collector._paramForUpdatingMultipleSources(VizType.MAP, |
273 |
|
ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self)) |
274 |
|
|
275 |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
276 |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
277 |
|
|
291 |
# 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. |
292 |
# If no lut is specified, the color scheme will be used. |
# If no lut is specified, the color scheme will be used. |
293 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
294 |
lut = Lut.COLOR, outline = True): |
lut = Lut.COLOR, cell_to_point = False, outline = True): |
295 |
""" |
""" |
296 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
297 |
@param scene: Scene in which objects are to be rendered on |
@param scene: Scene in which objects are to be rendered on |
302 |
@param viewport: Viewport in which objects are to be rendered on |
@param viewport: Viewport in which objects are to be rendered on |
303 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
304 |
@param lut: Lookup table color scheme |
@param lut: Lookup table color scheme |
305 |
|
@type cell_to_point: Boolean |
306 |
|
@param cell_to_point: Converts cell data to point data (by averaging) |
307 |
@type outline: Boolean |
@type outline: Boolean |
308 |
@param outline: Places an outline around the domain surface |
@param outline: Places an outline around the domain surface |
309 |
""" |
""" |
317 |
# be place before the map as there is unlikely to be any changes |
# be place before the map as there is unlikely to be any changes |
318 |
# made to the Outline's Actor3D. |
# made to the Outline's Actor3D. |
319 |
|
|
320 |
# ----- Outline ----- |
# ----- Outline ----- |
321 |
|
|
322 |
if(outline == True): |
if(outline == True): |
323 |
outline = Outline(data_collector._getOutput()) |
outline = Outline(data_collector._getOutput()) |
324 |
DataSetMapper.__init__(self, outline._getOutput()) |
DataSetMapper.__init__(self, outline._getOutput()) |
325 |
|
|
326 |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
327 |
# Default outline color is black. |
# Default outline color is black. |
328 |
Actor3D.setColor(self, Color.BLACK) |
Actor3D.setColor(self, Color.BLACK) |
329 |
|
|
330 |
# Default line width is 1. |
# Default line width is 1. |
331 |
Actor3D._setLineWidth(self, 1) |
Actor3D._setLineWidth(self, 1) |
332 |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
333 |
|
|
334 |
# ----- Map clipped using a scalar value ----- |
# ----- Map clipped using a scalar value ----- |
335 |
|
|
343 |
lookup_table = LookupTable() |
lookup_table = LookupTable() |
344 |
lookup_table._setLookupTableToGreyScale() |
lookup_table._setLookupTableToGreyScale() |
345 |
|
|
346 |
# None is used because a plane is not required when a scalar value is |
|
347 |
# used to perform the clipping. |
if(cell_to_point == True): # Converts cell data to point data. |
348 |
Clipper.__init__(self, data_collector._getOutput(), None) |
c2p = CellDataToPointData(data_collector._getOutput()) |
349 |
|
# None is used because a plane is not required when a scalar |
350 |
|
# value is used to perform the clipping. |
351 |
|
Clipper.__init__(self, c2p._getOutput(), None) |
352 |
|
elif(cell_to_point == False): # No conversion happens. |
353 |
|
Clipper.__init__(self, data_collector._getOutput(),None) |
354 |
|
|
355 |
DataSetMapper.__init__(self, Clipper._getOutput(self), |
DataSetMapper.__init__(self, Clipper._getOutput(self), |
356 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
357 |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
DataSetMapper._setScalarRange(self, data_collector._getScalarRange()) |
358 |
|
|
359 |
|
data_collector._paramForUpdatingMultipleSources(VizType.MAP, |
360 |
|
ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self)) |
361 |
|
|
362 |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
363 |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
364 |
|
|