/[escript]/trunk/pyvisi/py_src/map.py
ViewVC logotype

Contents of /trunk/pyvisi/py_src/map.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2881 - (show annotations)
Thu Jan 28 02:03:15 2010 UTC (11 years, 1 month ago) by jfenwick
File MIME type: text/x-python
File size: 25010 byte(s)
Don't panic.
Updating copyright stamps

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2010 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 """
23 :var __author__: name of author
24 :var __copyright__: copyrights
25 :var __license__: licence agreement
26 :var __url__: url entry point on documentation
27 :var __version__: version
28 :var __date__: date of the version
29 """
30
31 __author__="John Ngui, john.ngui@uq.edu.au"
32
33
34 from mapper import DataSetMapper
35 from actor import Actor3D
36 from lookuptable import LookupTable
37 from outline import Outline
38 from constant import Viewport, Color, Lut, ColorMode
39 from average import CellDataToPointData
40 from esys.escript import getMPISizeWorld
41 if getMPISizeWorld()==1: import vtk
42
43 # NOTE: DataSetMapper and Actor3D were inherited to allow access to their
44 # public methods from the driver.
45 class Map(DataSetMapper, Actor3D):
46 """
47 Class that shows a scalar field on a domain surface. The domain surface
48 can either be colored or grey-scaled, depending on the lookup table used.
49 """
50
51 # The SOUTH_WEST default viewport is used when there is only one viewport.
52 # This saves the user from specifying the viewport when there is only one.
53 # If no lut is specified, the color scheme will be used.
54 def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
55 lut = Lut.COLOR, cell_to_point = False, outline = True):
56 """
57 Initialise the Map.
58
59 :attention: The source can either be point or cell data. If the source is cell data, a conversion to point data may or may not be required, in order for the object to be rendered correctly. If a conversion is needed, the 'cell_to_point' flag must be set to 'True', otherwise 'False' (which is the default). On occasions, an inaccurate object may be rendered from cell data even after conversion.
60
61 :type scene: `Scene` object
62 :param scene: Scene in which objects are to be rendered on
63 :type data_collector: `DataCollector`
64 object
65 :param data_collector: Deal with source of data for vizualisation
66 :type viewport: `Viewport` constant
67 :param viewport: Viewport in which objects are to be rendered on
68 :type lut: `Lut` constant
69 :param lut: Lookup table color scheme
70 :type cell_to_point: Boolean
71 :param cell_to_point: Converts cell data to point data (by averaging)
72 :type outline: Boolean
73 :param outline: Places an outline around the domain surface
74 """
75
76 self.__data_collector = data_collector
77 self.__viewport = viewport
78 self.__lut = lut
79 self.__cell_to_point = cell_to_point
80 self.__outline = outline
81
82 self.__modified = True # Keeps track whether Map has been modified.
83 DataSetMapper.__init__(self)
84 Actor3D.__init__(self)
85 scene._addVisualizationModules(self)
86
87 # ----- Outline -----
88
89 # NOTE: Changes cannot be made to the Outline's properties from the
90 # driver.
91 if(self.__outline == True):
92 outline = Outline(self.__data_collector._getDataCollectorOutput())
93 mapper = DataSetMapper()
94 mapper._setupDataSetMapper(outline._getOutlineOutput())
95
96 actor3D = Actor3D()
97 actor3D._setupActor3D(mapper._getDataSetMapper())
98 # Default outline color is black.
99 actor3D.setColor(Color.BLACK)
100
101 # Default line width is 1.
102 actor3D._setLineWidth(1)
103 scene._addActor3D(self.__viewport, actor3D._getActor3D())
104
105 # ----- Map -----
106
107 # NOTE: Lookup table color mapping (color or grey scale) MUST be set
108 # before DataSetMapper. If it is done after DataSetMapper, no effect
109 # will take place.
110 if(self.__lut == Lut.COLOR): # Colored lookup table.
111 lookup_table = LookupTable()
112 lookup_table._setTableValue()
113 elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
114 lookup_table = LookupTable()
115 lookup_table._setLookupTableToGreyScale()
116
117 if(self.__cell_to_point == True): # Convert cell data to point data.
118 c2p = CellDataToPointData(
119 self.__data_collector._getDataCollectorOutput())
120 self._setupDataSetMapper(c2p._getCellToPointOutput(),
121 lookup_table._getLookupTable())
122 elif(self.__cell_to_point == False): # No conversion happens.
123 self._setupDataSetMapper(
124 self.__data_collector._getDataCollectorOutput(),
125 lookup_table._getLookupTable())
126
127 self._setupActor3D(self._getDataSetMapper())
128 scene._addActor3D(self.__viewport, self._getActor3D())
129
130 def _isModified(self):
131 """
132 Return whether the Map or DataCollector has been modified.
133
134 :rtype: Boolean
135 :return: True or False
136 """
137
138 return self.__modified or self.__data_collector._isModified()
139
140 def _render(self, scene):
141 """
142 Render the surface map.
143
144 :type scene: `Scene` object
145 :param scene: Scene in which objects are to be rendered on
146 """
147
148 if (self._isModified() == True):
149 if(self.__data_collector._isScalarSet() == True):
150 self.__data_collector._setActiveScalar()
151
152 # self._isScalarRangeSet checks whether the scalar range has been
153 # specified by the user. If it has, then the scalar range
154 # read from the source will be ignored.
155 if(not(self._isScalarRangeSet())):
156 self._setScalarRange(self.__data_collector._getScalarRange())
157 self.__modified = False
158
159
160 ###############################################################################
161
162
163 from transform import Transform
164 from plane import Plane
165 from cutter import Cutter
166
167 # NOTE: DataSetMapper, Actor3D, Transform, Plane and Cutter were inherited
168 # to allow access to their public methods from the driver.
169 class MapOnPlaneCut(DataSetMapper, Actor3D, Transform, Plane, Cutter):
170 """
171 This class works in a similar way to `Map`, except that it
172 shows a scalar field cut using a plane. The plane can be translated
173 and rotated along the X, Y and Z axes.
174 """
175
176 # The SOUTH_WEST default viewport is used when there is only one viewport.
177 # This saves the user from specifying the viewport when there is only one.
178 # If no lut is specified, the color scheme will be used.
179 def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
180 lut = Lut.COLOR, cell_to_point = False, outline = True):
181 """
182 Initialise the MapOnPlanceCut.
183
184 :attention: The source can either be point or cell data. If the source is cell data, a conversion to point data may or may not be required, in order for the object to be rendered correctly. If a conversion is needed, the 'cell_to_point' flag must be set to 'True', otherwise 'False' (which is the default). On occasions, an inaccurate object may be rendered from cell data even after conversion.
185
186 :type scene: `Scene` object
187 :param scene: Scene in which objects are to be rendered on
188 :type data_collector: `DataCollector` object
189 :param data_collector: Deal with source of data for visualisation
190 :type viewport: `Viewport` constant
191 :param viewport: Viewport in which objects are to be rendered on
192 :type lut: `Lut` constant
193 :param lut: Lookup table color scheme
194 :type cell_to_point: Boolean
195 :param cell_to_point: Converts cell data to point data (by averaging)
196 :type outline: Boolean
197 :param outline: Places an outline around the domain surface
198 """
199
200 self.__data_collector = data_collector
201 self.__viewport = viewport
202 self.__lut = lut
203 self.__cell_to_point = cell_to_point
204 self.__outline = outline
205
206 # Keeps track whether MapOnPlaneCut has been modified.
207 self.__modified = True
208 Transform.__init__(self)
209 Plane.__init__(self)
210 Cutter.__init__(self)
211 DataSetMapper.__init__(self)
212 Actor3D.__init__(self)
213 scene._addVisualizationModules(self)
214
215 # ----- Outline -----
216
217 # NOTE: Changes cannot be made to the Outline's properties from the
218 # driver.
219 if(self.__outline == True):
220 outline = Outline(self.__data_collector._getDataCollectorOutput())
221 mapper = DataSetMapper()
222 mapper._setupDataSetMapper(outline._getOutlineOutput())
223
224 actor3D = Actor3D()
225 actor3D._setupActor3D(mapper._getDataSetMapper())
226 # Default outline color is black.
227 actor3D.setColor(Color.BLACK)
228
229 # Default line width is 1.
230 actor3D._setLineWidth(1)
231 scene._addActor3D(self.__viewport, actor3D._getActor3D())
232
233 # ----- Map on a plane -----
234
235 # NOTE: Lookup table color mapping (color or grey scale) MUST be set
236 # before DataSetMapper. If it is done after DataSetMapper, no effect
237 # will take place.
238 if(self.__lut == Lut.COLOR): # Colored lookup table.
239 lookup_table = LookupTable()
240 lookup_table._setTableValue()
241 elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
242 lookup_table = LookupTable()
243 lookup_table._setLookupTableToGreyScale()
244
245 self._setupPlane(self._getTransform())
246
247 if(self.__cell_to_point == True): # Converts cell data to point data.
248 c2p = CellDataToPointData(
249 self.__data_collector._getDataCollectorOutput())
250 self._setupCutter(c2p._getCellToPointOutput(), self._getPlane())
251 elif(self.__cell_to_point == False): # No conversion happens.
252 c2p = CellDataToPointData(
253 self.__data_collector._getDataCollectorOutput())
254 self._setupCutter(self.__data_collector._getDataCollectorOutput(),
255 self._getPlane())
256
257 self._setupDataSetMapper(self._getCutterOutput(),
258 lookup_table._getLookupTable())
259
260 self._setupActor3D(self._getDataSetMapper())
261 scene._addActor3D(self.__viewport, self._getActor3D())
262
263 def _isModified(self):
264 """
265 Return whether the MapOnPlaneCut or DataCollector has been modified.
266
267 :rtype: Boolean
268 :return: True or False
269 """
270
271 return self.__modified or self.__data_collector._isModified()
272
273 def _render(self, scene):
274 """
275 Render the surface map cut using a plane.
276
277 :type scene: `Scene` object
278 :param scene: Scene in which objects are to be rendered on
279 """
280
281 if (self._isModified() == True):
282 if(self.__data_collector._isScalarSet() == True):
283 self.__data_collector._setActiveScalar()
284 # self._isScalarRangeSet checks whether the scalar range has been
285 # specified by the user. If it has, then the scalar range
286 # read from the source will be ignored.
287 if(not(self._isScalarRangeSet())):
288 self._setScalarRange(self.__data_collector._getScalarRange())
289 self.__modified = False
290
291
292 ###############################################################################
293
294
295 from clipper import Clipper
296
297 # NOTE: DataSetMapper, Actor3D, Transform, Plane and Clipper were inherited
298 # to allow access to their public methods from the driver.
299 class MapOnPlaneClip(DataSetMapper, Actor3D, Transform, Plane, Clipper):
300 """
301 This class works in a similar way to `MapOnPlaneCut`,
302 except that it shows a scalar field clipped using a plane.
303 """
304
305 # The SOUTH_WEST default viewport is used when there is only one viewport.
306 # This saves the user from specifying the viewport when there is only one.
307 # If no lut is specified, the color scheme will be used.
308 def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
309 lut = Lut.COLOR, cell_to_point = False, outline = True):
310 """
311 Initialise the MapOnPlaneClip.
312
313 :attention: The source can either be point or cell data. If the source is cell data, a conversion to point data may or may not be required, in order for the object to be rendered correctly. If a conversion is needed, the 'cell_to_point' flag must be set to 'True', otherwise 'False' (which is the default). On occasions, an inaccurate object may be rendered from cell data even after conversion.
314
315 :type scene: `Scene` object
316 :param scene: Scene in which objects are to be rendered on
317 :type data_collector: `DataCollector` object
318 :param data_collector: Deal with source of data for visualisation
319 :type viewport: `Viewport` constant
320 :param viewport: Viewport in which objects are to be rendered on
321 :type lut: `Lut` constant
322 :param lut: Lookup table color scheme
323 :type cell_to_point: Boolean
324 :param cell_to_point: Converts cell data to point data (by averaging)
325 :type outline: Boolean
326 :param outline: Places an outline around the domain surface
327 """
328
329 self.__data_collector = data_collector
330 self.__viewport = viewport
331 self.__lut = lut
332 self.__cell_to_point = cell_to_point
333 self.__outline = outline
334
335 # Keeps track whether MapOnPlaneClip has been modified.
336 self.__modified = True
337 Transform.__init__(self)
338 Plane.__init__(self)
339 Clipper.__init__(self)
340 DataSetMapper.__init__(self)
341 Actor3D.__init__(self)
342 scene._addVisualizationModules(self)
343
344 # ----- Outline -----
345
346 # NOTE: Changes cannot be made to the Outline's properties from the
347 # driver.
348 if(self.__outline == True):
349 outline = Outline(self.__data_collector._getDataCollectorOutput())
350 mapper = DataSetMapper()
351 mapper._setupDataSetMapper(outline._getOutlineOutput())
352
353 actor3D = Actor3D()
354 actor3D._setupActor3D(mapper._getDataSetMapper())
355 # Default outline color is black.
356 actor3D.setColor(Color.BLACK)
357
358 # Default line width is 1.
359 actor3D._setLineWidth(1)
360 scene._addActor3D(self.__viewport, actor3D._getActor3D())
361
362 # ----- Map on a clipped plane -----
363
364 # NOTE: Lookup table color mapping (color or grey scale) MUST be set
365 # before DataSetMapper. If it is done after DataSetMapper, no effect
366 # will take place.
367 if(self.__lut == Lut.COLOR): # Colored lookup table.
368 lookup_table = LookupTable()
369 lookup_table._setTableValue()
370 elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
371 lookup_table = LookupTable()
372 lookup_table._setLookupTableToGreyScale()
373
374 self._setupPlane(self._getTransform())
375
376 if(self.__cell_to_point == True): # Converts cell data to point data.
377 c2p = CellDataToPointData(data_collector._getDataCollectorOutput())
378 self._setupClipper(c2p._getCellToPointOutput(), self._getPlane())
379 elif(self.__cell_to_point == False): # No conversion happens.
380 self._setupClipper(data_collector._getDataCollectorOutput(),
381 self._getPlane())
382
383 self._setClipFunction()
384 self._setupDataSetMapper(self._getClipperOutput(),
385 lookup_table._getLookupTable())
386
387 self._setupActor3D(self._getDataSetMapper())
388 scene._addActor3D(self.__viewport, self._getActor3D())
389
390 def _isModified(self):
391 """
392 Return whether the MapOnPlaneClip or DataCollector has been modified.
393
394 :rtype: Boolean
395 :return: True or False
396 """
397
398 return self.__modified or self.__data_collector._isModified()
399
400 def _render(self, scene):
401 """
402 Render the surface map clip using a plane.
403
404 :type scene: `Scene` object
405 :param scene: Scene in which objects are to be rendered on
406 """
407
408 if (self._isModified() == True):
409 if(self.__data_collector._isScalarSet() == True):
410 self.__data_collector._setActiveScalar()
411 # self._isScalarRangeSet checks whether the scalar range has been
412 # specified by the user. If it has, then the scalar range
413 # read from the source will be ignored.
414 if(not(self._isScalarRangeSet())):
415 self._setScalarRange(self.__data_collector._getScalarRange())
416 self.__modified = False
417
418
419 #############################################################################
420
421
422 # NOTE: DataSetMapper, Actor3D and Clipper were inherited
423 # to allow access to their public methods from the driver.
424 class MapOnScalarClip(DataSetMapper, Actor3D, Clipper):
425 """
426 This class works in a similar way to `Map`, except that it
427 shows a scalar field clipped using a scalar value.
428 """
429
430 # The SOUTH_WEST default viewport is used when there is only one viewport.
431 # This saves the user from specifying the viewport when there is only one.
432 # If no lut is specified, the color scheme will be used.
433 def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
434 lut = Lut.COLOR, cell_to_point = False, outline = True):
435 """
436 Initialise the MapOnScalarClip.
437
438 :attention: The source can either be point or cell data. If the source is cell data, a conversion to point data may or may not be required, in order for the object to be rendered correctly. If a conversion is needed, the 'cell_to_point' flag must be set to 'True', otherwise 'False' (which is the default). On occasions, an inaccurate object may be rendered from cell data even after conversion.
439
440 :type scene: `Scene` object
441 :param scene: Scene in which objects are to be rendered on
442 :type data_collector: `DataCollector` object
443 :param data_collector: Deal with source of data for visualisation
444 :type viewport: `Viewport` constant
445 :param viewport: Viewport in which objects are to be rendered on
446 :type lut: `Lut` constant
447 :param lut: Lookup table color scheme
448 :type cell_to_point: Boolean
449 :param cell_to_point: Converts cell data to point data (by averaging)
450 :type outline: Boolean
451 :param outline: Places an outline around the domain surface
452 """
453
454 self.__data_collector = data_collector
455 self.__viewport = viewport
456 self.__lut = lut
457 self.__cell_to_point = cell_to_point
458 self.__outline = outline
459
460 # Keeps track whether MapOnScalarClip has been modified.
461 self.__modified = True
462 Clipper.__init__(self)
463 DataSetMapper.__init__(self)
464 Actor3D.__init__(self)
465 scene._addVisualizationModules(self)
466
467 # ----- Outline -----
468
469 # NOTE: Changes cannot be made to the Outline's properties from the
470 # driver.
471 if(self.__outline == True):
472 outline = Outline(self.__data_collector._getDataCollectorOutput())
473 mapper = DataSetMapper()
474 mapper._setupDataSetMapper(outline._getOutlineOutput())
475
476 actor3D = Actor3D()
477 actor3D._setupActor3D(mapper._getDataSetMapper())
478 # Default outline color is black.
479 actor3D.setColor(Color.BLACK)
480
481 # Default line width is 1.
482 actor3D._setLineWidth(1)
483 scene._addActor3D(self.__viewport, actor3D._getActor3D())
484
485 # ----- Map clipped using a scalar value -----
486
487 # NOTE: Lookup table color mapping (color or grey scale) MUST be set
488 # before DataSetMapper. If it is done after DataSetMapper, no effect
489 # will take place.
490 if(self.__lut == Lut.COLOR): # Colored lookup table.
491 lookup_table = LookupTable()
492 lookup_table._setTableValue()
493 elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
494 lookup_table = LookupTable()
495 lookup_table._setLookupTableToGreyScale()
496
497 if(self.__cell_to_point == True): # Converts cell data to point data.
498 c2p = CellDataToPointData(
499 self.__data_collector._getDataCollectorOutput())
500 # None is used because a plane is not required when a scalar
501 # value is used to perform the clipping.
502 self._setupClipper(c2p._getCellToPointOutput(), None)
503 elif(self.__cell_to_point == False): # No conversion happens.
504 self._setupClipper(
505 self.__data_collector._getDataCollectorOutput(),None)
506
507 self._setupDataSetMapper(self._getClipperOutput(),
508 lookup_table._getLookupTable())
509
510 self._setupActor3D(self._getDataSetMapper())
511 scene._addActor3D(self.__viewport, self._getActor3D())
512
513 def _isModified(self):
514 """
515 Return whether the MapOnScalarClip or DataCollector has been modified.
516
517 :rtype: Boolean
518 :return: True or False
519 """
520
521 return self.__modified or self.__data_collector._isModified()
522
523 def _render(self, scene):
524 """
525 Render the surface map clip using scalar data.
526
527 :type scene: `Scene` object
528 :param scene: Scene in which objects are to be rendered on
529 """
530
531 if (self._isModified() == True):
532 if(self.__data_collector._isScalarSet() == True):
533 self.__data_collector._setActiveScalar()
534 # self._isScalarRangeSet checks whether the scalar range has been
535 # specified by the user. If it has, then the scalar range
536 # read from the source will be ignored.
537 if(not(self._isScalarRangeSet())):
538 self._setScalarRange(self.__data_collector._getScalarRange())
539 self.__modified = False
540
541
542 ##############################################################################
543
544
545 from rotation import Rotation
546 from geometry import Geometry
547
548 # NOTE: DataSetMapper, Actor3D, Clipper and Rotation were inherited
549 # to allow access to their public methods from the driver.
550 class MapOnScalarClipWithRotation(DataSetMapper, Actor3D, Clipper, Rotation):
551 """
552 This class works in a similar way to `Map`, except that it
553 shows a 2D scalar field clipped using a scalar value and subsequently
554 rotated around the z-axis to create a 3D looking effect. This class should
555 only be used with 2D data sets and NOT 3D.
556 """
557
558 # The SOUTH_WEST default viewport is used when there is only one viewport.
559 # This saves the user from specifying the viewport when there is only one.
560 # If no lut is specified, the color scheme will be used.
561 def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST,
562 lut = Lut.COLOR, cell_to_point = False):
563 """
564 Initialise the MapOnScalarClipWithRotation.
565
566 :attention: The source can either be point or cell data. If the source is cell data, a conversion to point data may or may not be required, in order for the object to be rendered correctly. If a conversion is needed, the 'cell_to_point' flag must be set to 'True', otherwise 'False' (which is the default). On occasions, an inaccurate object may be rendered from cell data even after conversion.
567
568 :type scene: `Scene` object
569 :param scene: Scene in which objects are to be rendered on
570 :type data_collector: `DataCollector` object
571 :param data_collector: Deal with source of data for visualisation
572 :type viewport: `Viewport` constant
573 :param viewport: Viewport in which objects are to be rendered on
574 :type lut: `Lut` constant
575 :param lut: Lookup table color scheme
576 :type cell_to_point: Boolean
577 :param cell_to_point: Converts cell data to point data (by averaging)
578 """
579
580 self.__data_collector = data_collector
581 self.__viewport = viewport
582 self.__lut = lut
583 self.__cell_to_point = cell_to_point
584
585 # Keeps track whether MapOnScalarClipWithRotation has been modified.
586 self.__modified = True
587 Clipper.__init__(self)
588 Rotation.__init__(self)
589 DataSetMapper.__init__(self)
590 Actor3D.__init__(self)
591 scene._addVisualizationModules(self)
592
593 def _isModified(self):
594 """
595 Return whether the MapOnScalarClipWithRotation or DataCollector has
596 been modified.
597
598 :rtype: Boolean
599 :return: True or False
600 """
601
602 return self.__modified or self.__data_collector._isModified()
603
604 def _render(self, scene):
605 """
606 Render the surface map clip using scalar data and subsequently rotated.
607
608 :type scene: `Scene` object
609 :param scene: Scene in which objects are to be rendered on
610 """
611
612 # This entire 'if' section had to be moved from the __init__ method
613 # due to the use of 'GetPoints().GetNumberOfPoints()'. A source
614 # (i.e. xml file) must be
615 # supplied before 'GetPoints().GetNumberOfPoints()' is able to return
616 # the correct value
617 # when executed. This is to accommodate for lazy evaluation.
618 if (self._isModified() == True):
619
620 # Swaps the points from the y-axis to the z-axis and vice-versa.
621 # This is needed as VTK is only able to perform rotation along
622 # the z-axis.
623 output = self.__data_collector._getDataCollectorOutput()
624 num_points = output.GetPoints().GetNumberOfPoints()
625 for i in range (num_points):
626 point = output.GetPoints().GetPoint(i)
627 output.GetPoints().SetPoint(i, point[0], point[2], point[1])
628
629 # --- Map clipped using a scalar value and subsequently rotated ---
630
631 # NOTE: Lookup table color mapping (color or grey scale) MUST be set
632 # before DataSetMapper. If it is done after DataSetMapper, no effect
633 # will take place.
634 if(self.__lut == Lut.COLOR): # Colored lookup table.
635 lookup_table = LookupTable()
636 lookup_table._setTableValue()
637 elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
638 lookup_table = LookupTable()
639 lookup_table._setLookupTableToGreyScale()
640
641 if(self.__cell_to_point == True): #Converts cell data to point data.
642 c2p = CellDataToPointData(output)
643 # None is used because a plane is not required when a scalar
644 # value is used to perform the clipping.
645 self._setupClipper(c2p._getCellToPointOutput(), None)
646 elif(self.__cell_to_point == False): # No conversion happens.
647 self._setupClipper(output, None)
648
649 geometry = Geometry(self._getClipperOutput())
650
651 self._setupRotationExtrusionFilter(geometry._getGeometryOutput())
652 self._setupDataSetMapper(self._getRotationOutput(),
653 lookup_table._getLookupTable())
654
655 self._setupActor3D(self._getDataSetMapper())
656 scene._addActor3D(self.__viewport, self._getActor3D())
657
658 if(self.__data_collector._isScalarSet() == True):
659 self.__data_collector._setActiveScalar()
660 # self._isScalarRangeSet checks whether the scalar range has been
661 # specified by the user. If it has, then the scalar range
662 # read from the source will be ignored.
663 if(not(self._isScalarRangeSet())):
664 self._setScalarRange(self.__data_collector._getScalarRange())
665
666 self.__modified = False
667
668
669

  ViewVC Help
Powered by ViewVC 1.1.26