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