1 |
ksteube |
1147 |
""" |
2 |
jongui |
1197 |
@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 |
ksteube |
1147 |
""" |
9 |
|
|
|
10 |
jongui |
1197 |
__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 |
ksteube |
1147 |
import vtk |
22 |
|
|
from mapper import DataSetMapper |
23 |
|
|
from lookuptable import LookupTable |
24 |
|
|
from actor import Actor3D |
25 |
jongui |
1148 |
from constant import Viewport, Color, Lut, ColorMode |
26 |
ksteube |
1147 |
from sphere import Sphere |
27 |
|
|
from normals import Normals |
28 |
|
|
from glyph import TensorGlyph |
29 |
|
|
from outline import Outline |
30 |
|
|
from point import MaskPoints |
31 |
|
|
from average import CellDataToPointData |
32 |
|
|
|
33 |
|
|
# NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph |
34 |
|
|
# and MaskPoints were inherited to allow access to their |
35 |
|
|
# public methods from the driver. |
36 |
|
|
class Ellipsoid(DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, |
37 |
|
|
MaskPoints): |
38 |
|
|
""" |
39 |
|
|
Class that shows a tensor field using ellipsoids. The ellipsoids can either |
40 |
|
|
be colored or grey-scaled, depending on the lookup table used. |
41 |
|
|
""" |
42 |
|
|
|
43 |
|
|
# The SOUTH_WEST default viewport is used when there is only one viewport. |
44 |
|
|
# This saves the user from specifying the viewport when there is only one. |
45 |
|
|
# If no lut is specified, the color scheme will be used. |
46 |
|
|
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
47 |
|
|
lut = Lut.COLOR, cell_to_point = False, outline = True): |
48 |
|
|
""" |
49 |
|
|
Initialise the Ellipsoid. |
50 |
|
|
|
51 |
|
|
@attention: The source can either be point or cell data. If the |
52 |
|
|
source is cell data, a conversion to point data may or may not be |
53 |
|
|
required, in order for the object to be rendered correctly. |
54 |
|
|
If a conversion is needed, the 'cell_to_point' flag must be set to |
55 |
jongui |
1199 |
'True', otherwise 'False' (which is the default). On occasions, an |
56 |
|
|
inaccurate object may be rendered from cell data even after conversion. |
57 |
ksteube |
1147 |
|
58 |
|
|
@type scene: L{Scene <scene.Scene>} object |
59 |
|
|
@param scene: Scene in which objects are to be rendered on |
60 |
|
|
@type data_collector: L{DataCollector <datacollector.DataCollector>} |
61 |
|
|
object |
62 |
|
|
@param data_collector: Deal with source of data for vizualisation |
63 |
|
|
@type viewport: L{Viewport <constant.Viewport>} constant |
64 |
|
|
@param viewport: Viewport in which objects are to be rendered on |
65 |
|
|
@type lut : L{Lut <constant.Lut>} constant |
66 |
|
|
@param lut: Lookup table color scheme |
67 |
|
|
@type cell_to_point: Boolean |
68 |
|
|
@param cell_to_point: Converts cell data to point data (by averaging) |
69 |
|
|
@type outline: Boolean |
70 |
|
|
@param outline: Places an outline around the domain surface |
71 |
|
|
""" |
72 |
|
|
|
73 |
jongui |
1148 |
self.__data_collector = data_collector |
74 |
|
|
self.__viewport = viewport |
75 |
|
|
self.__lut = lut |
76 |
|
|
self.__cell_to_point = cell_to_point |
77 |
|
|
self.__outline = outline |
78 |
ksteube |
1147 |
|
79 |
jongui |
1148 |
# Keeps track whether Ellipsoid has been modified. |
80 |
|
|
self.__modified = True |
81 |
|
|
MaskPoints.__init__(self) |
82 |
|
|
Sphere.__init__(self) |
83 |
|
|
TensorGlyph.__init__(self) |
84 |
|
|
Normals.__init__(self) |
85 |
|
|
DataSetMapper.__init__(self) |
86 |
|
|
Actor3D.__init__(self) |
87 |
|
|
scene._addVisualizationModules(self) |
88 |
ksteube |
1147 |
|
89 |
jongui |
1148 |
# ----- Outline ----- |
90 |
ksteube |
1147 |
|
91 |
jongui |
1148 |
# NOTE: Changes cannot be made to the Outline's properties from the |
92 |
|
|
# driver. |
93 |
|
|
if(self.__outline == True): |
94 |
|
|
outline = Outline(self.__data_collector._getDataCollectorOutput()) |
95 |
|
|
mapper = DataSetMapper() |
96 |
|
|
mapper._setupDataSetMapper(outline._getOutlineOutput()) |
97 |
|
|
|
98 |
|
|
actor3D = Actor3D() |
99 |
|
|
actor3D._setupActor3D(mapper._getDataSetMapper()) |
100 |
ksteube |
1147 |
# Default outline color is black. |
101 |
jongui |
1148 |
actor3D.setColor(Color.BLACK) |
102 |
ksteube |
1147 |
|
103 |
|
|
# Default line width is 1. |
104 |
jongui |
1148 |
actor3D._setLineWidth(1) |
105 |
jongui |
1158 |
scene._addActor3D(self.__viewport, actor3D._getActor3D()) |
106 |
ksteube |
1147 |
|
107 |
|
|
# ----- Ellipsoid ----- |
108 |
|
|
|
109 |
|
|
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
110 |
|
|
# before DataSetMapper. If it is done after DataSetMapper, no effect |
111 |
|
|
# will take place. |
112 |
jongui |
1148 |
if(self.__lut == Lut.COLOR): # Colored lookup table. |
113 |
ksteube |
1147 |
lookup_table = LookupTable() |
114 |
|
|
lookup_table._setTableValue() |
115 |
jongui |
1148 |
elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table. |
116 |
ksteube |
1147 |
lookup_table = LookupTable() |
117 |
|
|
lookup_table._setLookupTableToGreyScale() |
118 |
|
|
|
119 |
jongui |
1148 |
if(self.__cell_to_point == True): # Converts cell data to point data. |
120 |
|
|
c2p = CellDataToPointData( |
121 |
|
|
self.__data_collector._getDataCollectorOutput()) |
122 |
|
|
self._setupMaskPoints(c2p._getCellToPointOutput()) |
123 |
|
|
elif(self.__cell_to_point == False): # No conversion happens. |
124 |
|
|
self._setupMaskPoints( |
125 |
|
|
self.__data_collector._getDataCollectorOutput()) |
126 |
ksteube |
1147 |
|
127 |
jongui |
1148 |
self._setupTensorGlyph(self._getMaskPointsOutput(), |
128 |
|
|
self._getSphereOutput()) |
129 |
|
|
self._setupNormals(self._getTensorGlyphOutput()) |
130 |
ksteube |
1147 |
|
131 |
jongui |
1148 |
self._setupDataSetMapper(self._getNormalsOutput(), |
132 |
ksteube |
1147 |
lookup_table._getLookupTable()) |
133 |
|
|
|
134 |
jongui |
1148 |
self._setupActor3D(self._getDataSetMapper()) |
135 |
jongui |
1158 |
scene._addActor3D(self.__viewport, self._getActor3D()) |
136 |
ksteube |
1147 |
|
137 |
jongui |
1148 |
def _isModified(self): |
138 |
|
|
""" |
139 |
|
|
Return whether the Ellipsoid or DataCollector has been modified. |
140 |
ksteube |
1147 |
|
141 |
jongui |
1148 |
@rtype: Boolean |
142 |
|
|
@return: True or False |
143 |
|
|
""" |
144 |
ksteube |
1147 |
|
145 |
jongui |
1148 |
return self.__modified or self.__data_collector._isModified() |
146 |
|
|
|
147 |
jongui |
1158 |
def _render(self, scene): |
148 |
jongui |
1148 |
""" |
149 |
|
|
Render the ellipsoids. |
150 |
jongui |
1158 |
|
151 |
|
|
@type scene: L{Scene <scene.Scene>} object |
152 |
|
|
@param scene: Scene in which objects are to be rendered on |
153 |
jongui |
1148 |
""" |
154 |
|
|
|
155 |
|
|
if (self._isModified() == True): |
156 |
|
|
if(self.__data_collector._isScalarSet() == True): |
157 |
|
|
self.__data_collector._setActiveScalar() |
158 |
|
|
if(self.__data_collector._isTensorSet() == True): |
159 |
|
|
self.__data_collector._setActiveTensor() |
160 |
|
|
|
161 |
jongui |
1189 |
# self._isScalarRangeSet checks whether the scalar range has been |
162 |
|
|
# specified by the user. If it has, then the scalar range |
163 |
|
|
# read from the source will be ignored. |
164 |
|
|
if(not(self._isScalarRangeSet())): |
165 |
|
|
self._setScalarRange(self.__data_collector._getScalarRange()) |
166 |
jongui |
1148 |
self.__modified = False |
167 |
|
|
|
168 |
|
|
|
169 |
ksteube |
1147 |
############################################################################### |
170 |
|
|
|
171 |
|
|
|
172 |
|
|
from transform import Transform |
173 |
|
|
from plane import Plane |
174 |
|
|
from cutter import Cutter |
175 |
|
|
|
176 |
|
|
# NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane, |
177 |
|
|
# Cutter and MaskPoints were inherited to allow access to |
178 |
|
|
# their public methods from the driver. |
179 |
|
|
class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals, |
180 |
|
|
TensorGlyph, Transform, Plane, Cutter, MaskPoints): |
181 |
|
|
""" |
182 |
|
|
This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>}, |
183 |
|
|
except that it shows a tensor field using ellipsoids cut using a plane. |
184 |
|
|
""" |
185 |
|
|
|
186 |
|
|
# The SOUTH_WEST default viewport is used when there is only one viewport. |
187 |
|
|
# This saves the user from specifying the viewport when there is only one. |
188 |
|
|
# If no lut is specified, the color scheme will be used. |
189 |
|
|
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
190 |
|
|
lut = Lut.COLOR, cell_to_point = False, outline = True): |
191 |
|
|
""" |
192 |
|
|
Initialise the EllipsoidOnPlaneCut. |
193 |
|
|
|
194 |
|
|
@attention: The source can either be point or cell data. If the |
195 |
|
|
source is cell data, a conversion to point data may or may not be |
196 |
|
|
required, in order for the object to be rendered correctly. |
197 |
|
|
If a conversion is needed, the 'cell_to_point' flag must be set to |
198 |
|
|
'True', otherwise 'False' (which is the default). |
199 |
|
|
|
200 |
|
|
@type scene: L{Scene <scene.Scene>} object |
201 |
|
|
@param scene: Scene in which objects are to be rendered on |
202 |
|
|
@type data_collector: L{DataCollector <datacollector.DataCollector>} |
203 |
|
|
object |
204 |
|
|
@param data_collector: Deal with source of data for vizualisation |
205 |
|
|
@type viewport: L{Viewport <constant.Viewport>} constant |
206 |
|
|
@param viewport: Viewport in which objects are to be rendered on |
207 |
|
|
@type lut : L{Lut <constant.Lut>} constant |
208 |
|
|
@param lut: Lookup table color scheme |
209 |
|
|
@type cell_to_point: Boolean |
210 |
|
|
@param cell_to_point: Converts cell data to point data (by averaging) |
211 |
|
|
@type outline: Boolean |
212 |
|
|
@param outline: Places an outline around the domain surface |
213 |
|
|
""" |
214 |
|
|
|
215 |
jongui |
1148 |
self.__data_collector = data_collector |
216 |
|
|
self.__viewport = viewport |
217 |
|
|
self.__lut = lut |
218 |
|
|
self.__cell_to_point = cell_to_point |
219 |
|
|
self.__outline = outline |
220 |
ksteube |
1147 |
|
221 |
jongui |
1148 |
# Keeps track whether EllipsoidOnPlaneCut has been modified. |
222 |
|
|
self.__modified = True |
223 |
|
|
Transform.__init__(self) |
224 |
|
|
Plane.__init__(self) |
225 |
|
|
Cutter.__init__(self) |
226 |
|
|
MaskPoints.__init__(self) |
227 |
|
|
Sphere.__init__(self) |
228 |
|
|
TensorGlyph.__init__(self) |
229 |
|
|
Normals.__init__(self) |
230 |
|
|
DataSetMapper.__init__(self) |
231 |
|
|
Actor3D.__init__(self) |
232 |
|
|
scene._addVisualizationModules(self) |
233 |
|
|
|
234 |
ksteube |
1147 |
# ----- Outline ----- |
235 |
|
|
|
236 |
jongui |
1148 |
# NOTE: Changes cannot be made to the Outline's properties from the |
237 |
|
|
# driver. |
238 |
|
|
if(self.__outline == True): |
239 |
|
|
outline = Outline(self.__data_collector._getDataCollectorOutput()) |
240 |
|
|
mapper = DataSetMapper() |
241 |
|
|
mapper._setupDataSetMapper(outline._getOutlineOutput()) |
242 |
ksteube |
1147 |
|
243 |
jongui |
1148 |
actor3D = Actor3D() |
244 |
|
|
actor3D._setupActor3D(mapper._getDataSetMapper()) |
245 |
ksteube |
1147 |
# Default outline color is black. |
246 |
jongui |
1148 |
actor3D.setColor(Color.BLACK) |
247 |
ksteube |
1147 |
|
248 |
|
|
# Default line width is 1. |
249 |
jongui |
1148 |
actor3D._setLineWidth(1) |
250 |
jongui |
1158 |
scene._addActor3D(self.__viewport, actor3D._getActor3D()) |
251 |
ksteube |
1147 |
|
252 |
|
|
# ----- Ellipsoid on a cut plane ----- |
253 |
|
|
|
254 |
|
|
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
255 |
|
|
# before DataSetMapper. If it is done after DataSetMapper, no effect |
256 |
|
|
# will take place. |
257 |
jongui |
1148 |
if(self.__lut == Lut.COLOR): # Colored lookup table. |
258 |
ksteube |
1147 |
lookup_table = LookupTable() |
259 |
|
|
lookup_table._setTableValue() |
260 |
jongui |
1148 |
elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table. |
261 |
ksteube |
1147 |
lookup_table = LookupTable() |
262 |
|
|
lookup_table._setLookupTableToGreyScale() |
263 |
|
|
|
264 |
jongui |
1148 |
self._setupPlane(self._getTransform()) |
265 |
ksteube |
1147 |
|
266 |
jongui |
1148 |
if(self.__cell_to_point == True): # Converts cell data to point data. |
267 |
|
|
c2p = CellDataToPointData( |
268 |
|
|
self.__data_collector._getDataCollectorOutput()) |
269 |
|
|
self._setupCutter(c2p._getCellToPointOutput(), self._getPlane()) |
270 |
|
|
elif(self.__cell_to_point == False): # No conversion happens. |
271 |
|
|
self._setupCutter(self.__data_collector._getDataCollectorOutput(), |
272 |
|
|
self._getPlane()) |
273 |
ksteube |
1147 |
|
274 |
jongui |
1148 |
self._setupMaskPoints(self._getCutterOutput()) |
275 |
ksteube |
1147 |
|
276 |
jongui |
1148 |
self._setupTensorGlyph(self._getMaskPointsOutput(), |
277 |
|
|
self._getSphereOutput()) |
278 |
|
|
self._setupNormals(self._getTensorGlyphOutput()) |
279 |
ksteube |
1147 |
|
280 |
jongui |
1148 |
self._setupDataSetMapper(self._getNormalsOutput(), |
281 |
ksteube |
1147 |
lookup_table._getLookupTable()) |
282 |
|
|
|
283 |
jongui |
1148 |
self._setupActor3D(self._getDataSetMapper()) |
284 |
jongui |
1158 |
scene._addActor3D(self.__viewport, self._getActor3D()) |
285 |
ksteube |
1147 |
|
286 |
jongui |
1148 |
def _isModified(self): |
287 |
|
|
""" |
288 |
|
|
Return whether the EllipsoidOnPlaneCut or DataCollector has been |
289 |
|
|
modified. |
290 |
ksteube |
1147 |
|
291 |
jongui |
1148 |
@rtype: Boolean |
292 |
|
|
@return: True or False |
293 |
|
|
""" |
294 |
ksteube |
1147 |
|
295 |
jongui |
1148 |
return self.__modified or self.__data_collector._isModified() |
296 |
|
|
|
297 |
jongui |
1158 |
def _render(self, scene): |
298 |
jongui |
1148 |
""" |
299 |
|
|
Render the ellipsoids cut using a plane. |
300 |
jongui |
1158 |
|
301 |
|
|
@type scene: L{Scene <scene.Scene>} object |
302 |
|
|
@param scene: Scene in which objects are to be rendered on |
303 |
jongui |
1148 |
""" |
304 |
|
|
|
305 |
|
|
if (self._isModified() == True): |
306 |
|
|
if(self.__data_collector._isScalarSet() == True): |
307 |
|
|
self.__data_collector._setActiveScalar() |
308 |
|
|
if(self.__data_collector._isTensorSet() == True): |
309 |
|
|
self.__data_collector._setActiveTensor() |
310 |
jongui |
1189 |
|
311 |
|
|
# self._isScalarRangeSet checks whether the scalar range has been |
312 |
|
|
# specified by the user. If it has, then the scalar range |
313 |
|
|
# read from the source will be ignored. |
314 |
|
|
if(not(self._isScalarRangeSet())): |
315 |
|
|
self._setScalarRange(self.__data_collector._getScalarRange()) |
316 |
jongui |
1148 |
self.__modified = False |
317 |
|
|
|
318 |
|
|
|
319 |
ksteube |
1147 |
############################################################################### |
320 |
|
|
|
321 |
|
|
|
322 |
|
|
from clipper import Clipper |
323 |
|
|
|
324 |
|
|
# NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane, |
325 |
|
|
# Clipper and MaskPoints were inherited to allow access to |
326 |
|
|
# their public methods from the driver. |
327 |
|
|
class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals, |
328 |
|
|
TensorGlyph, Transform, Plane, Clipper, MaskPoints): |
329 |
|
|
""" |
330 |
|
|
This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>}, |
331 |
|
|
except that it shows a tensor field using ellipsoids clipped using a plane. |
332 |
|
|
""" |
333 |
|
|
|
334 |
|
|
# The SOUTH_WEST default viewport is used when there is only one viewport. |
335 |
|
|
# This saves the user from specifying the viewport when there is only one. |
336 |
|
|
# If no lut is specified, the color scheme will be used. |
337 |
|
|
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
338 |
|
|
lut = Lut.COLOR, cell_to_point = False, outline = True): |
339 |
|
|
""" |
340 |
|
|
Initialise the EllipsoidOnPlaneClip. |
341 |
|
|
|
342 |
|
|
@attention: The source can either be point or cell data. If the |
343 |
|
|
source is cell data, a conversion to point data may or may not be |
344 |
|
|
required, in order for the object to be rendered correctly. |
345 |
|
|
If a conversion is needed, the 'cell_to_point' flag must be set to |
346 |
|
|
'True', otherwise 'False' (which is the default). |
347 |
|
|
|
348 |
|
|
@type scene: L{Scene <scene.Scene>} object |
349 |
|
|
@param scene: Scene in which objects are to be rendered on |
350 |
|
|
@type data_collector: L{DataCollector <datacollector.DataCollector>} |
351 |
|
|
object |
352 |
|
|
@param data_collector: Deal with source of data for visualisation |
353 |
|
|
@type viewport: L{Viewport <constant.Viewport>} constant |
354 |
|
|
@param viewport: Viewport in which object are to be rendered on |
355 |
|
|
@type lut : L{Lut <constant.Lut>} constant |
356 |
|
|
@param lut: Lookup table color scheme |
357 |
|
|
@type cell_to_point: Boolean |
358 |
|
|
@param cell_to_point: Converts cell data to point data (by averaging) |
359 |
|
|
@type outline: Boolean |
360 |
|
|
@param outline: Places an outline around the domain surface |
361 |
|
|
""" |
362 |
|
|
|
363 |
jongui |
1148 |
self.__data_collector = data_collector |
364 |
|
|
self.__viewport = viewport |
365 |
|
|
self.__lut = lut |
366 |
|
|
self.__cell_to_point = cell_to_point |
367 |
|
|
self.__outline = outline |
368 |
ksteube |
1147 |
|
369 |
jongui |
1148 |
# Keeps track whether EllipsoidOnPlaneClip has been modified. |
370 |
|
|
self.__modified = True |
371 |
|
|
Transform.__init__(self) |
372 |
|
|
Plane.__init__(self) |
373 |
|
|
Clipper.__init__(self) |
374 |
|
|
MaskPoints.__init__(self) |
375 |
|
|
Sphere.__init__(self) |
376 |
|
|
TensorGlyph.__init__(self) |
377 |
|
|
Normals.__init__(self) |
378 |
|
|
DataSetMapper.__init__(self) |
379 |
|
|
Actor3D.__init__(self) |
380 |
|
|
scene._addVisualizationModules(self) |
381 |
|
|
|
382 |
ksteube |
1147 |
# ----- Outline ----- |
383 |
|
|
|
384 |
jongui |
1148 |
# NOTE: Changes cannot be made to the Outline's properties from the |
385 |
|
|
# driver. |
386 |
|
|
if(self.__outline == True): |
387 |
|
|
outline = Outline(self.__data_collector._getDataCollectorOutput()) |
388 |
|
|
mapper = DataSetMapper() |
389 |
|
|
mapper._setupDataSetMapper(outline._getOutlineOutput()) |
390 |
ksteube |
1147 |
|
391 |
jongui |
1148 |
actor3D = Actor3D() |
392 |
|
|
actor3D._setupActor3D(mapper._getDataSetMapper()) |
393 |
ksteube |
1147 |
# Default outline color is black. |
394 |
jongui |
1148 |
actor3D.setColor(Color.BLACK) |
395 |
ksteube |
1147 |
|
396 |
|
|
# Default line width is 1. |
397 |
jongui |
1148 |
actor3D._setLineWidth(1) |
398 |
jongui |
1158 |
scene._addActor3D(self.__viewport, actor3D._getActor3D()) |
399 |
ksteube |
1147 |
|
400 |
|
|
# ----- Ellipsoid on a clipped plane ----- |
401 |
|
|
|
402 |
|
|
# NOTE: Lookup table color mapping (color or grey scale) MUST be set |
403 |
|
|
# before DataSetMapper. If it is done after DataSetMapper, no effect |
404 |
|
|
# will take place. |
405 |
jongui |
1148 |
if(self.__lut == Lut.COLOR): # Colored lookup table. |
406 |
ksteube |
1147 |
lookup_table = LookupTable() |
407 |
|
|
lookup_table._setTableValue() |
408 |
jongui |
1148 |
elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table. |
409 |
ksteube |
1147 |
lookup_table = LookupTable() |
410 |
|
|
lookup_table._setLookupTableToGreyScale() |
411 |
|
|
|
412 |
jongui |
1148 |
self._setupPlane(self._getTransform()) |
413 |
ksteube |
1147 |
|
414 |
jongui |
1148 |
if(self.__cell_to_point == True): # Converts cell data to point data. |
415 |
|
|
c2p = CellDataToPointData( |
416 |
|
|
self.__data_collector._getDataCollectorOutput()) |
417 |
|
|
self._setupMaskPoints(c2p._getCellToPointOutput()) |
418 |
|
|
elif(self.__cell_to_point == False): # No conversion happens. |
419 |
|
|
self._setupMaskPoints( |
420 |
|
|
self.__data_collector._getDataCollectorOutput()) |
421 |
ksteube |
1147 |
|
422 |
|
|
# NOTE: TensorGlyph must come before Clipper. Otherwise clipping |
423 |
|
|
# may not work correctly. |
424 |
jongui |
1148 |
self._setupTensorGlyph(self._getMaskPointsOutput(), |
425 |
|
|
self._getSphereOutput()) |
426 |
|
|
self._setupNormals(self._getTensorGlyphOutput()) |
427 |
ksteube |
1147 |
|
428 |
|
|
# NOTE: Clipper must come after TensorGlyph. Otherwise clipping |
429 |
|
|
# may not work correctly. |
430 |
jongui |
1148 |
self._setupClipper(self._getNormalsOutput(), |
431 |
|
|
self._getPlane()) |
432 |
|
|
self._setClipFunction() |
433 |
ksteube |
1147 |
|
434 |
jongui |
1148 |
self._setupDataSetMapper(self._getClipperOutput(), |
435 |
|
|
lookup_table._getLookupTable()) |
436 |
ksteube |
1147 |
|
437 |
jongui |
1148 |
self._setupActor3D(self._getDataSetMapper()) |
438 |
jongui |
1158 |
scene._addActor3D(self.__viewport, self._getActor3D()) |
439 |
ksteube |
1147 |
|
440 |
jongui |
1148 |
def _isModified(self): |
441 |
|
|
""" |
442 |
|
|
Return whether the EllipsoidOnPlaneClip or DataCollector has been |
443 |
|
|
modified. |
444 |
ksteube |
1147 |
|
445 |
jongui |
1148 |
@rtype: Boolean |
446 |
|
|
@return: True or False |
447 |
|
|
""" |
448 |
|
|
|
449 |
|
|
return self.__modified or self.__data_collector._isModified() |
450 |
|
|
|
451 |
jongui |
1158 |
def _render(self, scene): |
452 |
jongui |
1148 |
""" |
453 |
|
|
Render the ellipsoids clip using a plane. |
454 |
jongui |
1158 |
|
455 |
|
|
@type scene: L{Scene <scene.Scene>} object |
456 |
|
|
@param scene: Scene in which objects are to be rendered on |
457 |
jongui |
1148 |
""" |
458 |
|
|
|
459 |
|
|
if (self._isModified() == True): |
460 |
|
|
if(self.__data_collector._isScalarSet() == True): |
461 |
|
|
self.__data_collector._setActiveScalar() |
462 |
|
|
if(self.__data_collector._isTensorSet() == True): |
463 |
|
|
self.__data_collector._setActiveTensor() |
464 |
jongui |
1189 |
|
465 |
|
|
# self._isScalarRangeSet checks whether the scalar range has been |
466 |
|
|
# specified by the user. If it has, then the scalar range |
467 |
|
|
# read from the source will be ignored. |
468 |
|
|
if(not(self._isScalarRangeSet())): |
469 |
|
|
self._setScalarRange(self.__data_collector._getScalarRange()) |
470 |
jongui |
1148 |
self.__modified = False |
471 |
|
|
|
472 |
|
|
|