1 |
""" |
""" |
2 |
|
Class that deals with data for the visualization. |
|
classes dealing with data for the visualization |
|
|
|
|
|
@var __author__: name of author |
|
|
@var __license__: licence agreement |
|
|
@var __copyright__: copyrights |
|
|
@var __url__: url entry point on documentation |
|
|
@var __version__: version |
|
|
@var __date__: date of the version |
|
3 |
""" |
""" |
4 |
|
|
|
__copyright__=""" Copyright (c) 2006 by ACcESS MNRF |
|
|
http://www.access.edu.au |
|
|
Primary Business: Queensland, Australia""" |
|
|
__license__="""Licensed under the Open Software License version 3.0 |
|
|
http://www.opensource.org/licenses/osl-3.0.php""" |
|
|
__author__="Paul Cochrane, L. Gross" |
|
|
__url__="http://www.iservo.edu.au/esys" |
|
|
__version__="$Revision:$" |
|
|
__date__="$Date:$" |
|
|
|
|
5 |
import vtk |
import vtk |
6 |
from common import * |
from common import * |
7 |
|
|
8 |
class DataCollector(Common): |
class DataCollector(Common): |
9 |
|
""" |
10 |
|
@author: John Ngui |
11 |
|
@author: Lutz Gross |
12 |
|
""" |
13 |
|
|
14 |
def __init__(self, open_scene, outline = True): |
def __init__(self, open_scene, outline = True): |
15 |
|
""" |
16 |
|
Initialize all the instance variables. |
17 |
|
|
18 |
|
@type open_scene: L{OpenScene <openscene.OpenScene>} object |
19 |
|
@param open_scene: Scene in which components are to be added to |
20 |
|
@type outline: Boolean (I{True or False}) |
21 |
|
@param outline: Determines the outline for the rendered object |
22 |
|
""" |
23 |
|
|
24 |
self.open_scene = open_scene |
self.open_scene = open_scene |
25 |
self.outline = True |
self.outline = True |
26 |
self.file_name = None |
self.file_name = None |
28 |
self.vtk_xml_reader = None |
self.vtk_xml_reader = None |
29 |
self.vtk_xml_reader_output = None |
self.vtk_xml_reader_output = None |
30 |
|
|
|
# set up the file reader and set the file name |
|
31 |
def setSource(self, file_name): |
def setSource(self, file_name): |
32 |
|
""" |
33 |
|
Set up the file reader and set the file name. |
34 |
|
|
35 |
|
@type file_name: String |
36 |
|
@param file_name: Name of the file to be read. |
37 |
|
""" |
38 |
|
|
39 |
self.file_name = file_name |
self.file_name = file_name |
40 |
self.vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader() |
self.vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader() |
41 |
self.vtk_xml_reader.SetFileName(self.file_name) |
self.vtk_xml_reader.SetFileName(self.file_name) |
45 |
Common.setMapper(self, "self.vtk_outline.GetOutput()") |
Common.setMapper(self, "self.vtk_outline.GetOutput()") |
46 |
Common.setActor(self) |
Common.setActor(self) |
47 |
Common.addActor(self) |
Common.addActor(self) |
48 |
Common.setColor(self, 0, 0, 0) |
Common.setColor(self, 0, 0, 0) # Default outline is black |
|
|
|
|
|
|
49 |
|
|
|
# return the file reader output |
|
50 |
def getReader(self): |
def getReader(self): |
51 |
|
""" |
52 |
|
Return the file reader. |
53 |
|
|
54 |
|
@rtype: vtkXMLUnstructuredGridReader |
55 |
|
@return: VTK XML unstructured grid reader |
56 |
|
""" |
57 |
|
|
58 |
return self.vtk_xml_reader |
return self.vtk_xml_reader |
59 |
|
|
|
# set the outline |
|
60 |
def setOutline(self): |
def setOutline(self): |
61 |
|
""" |
62 |
|
Set the outline for the rendered object. |
63 |
|
""" |
64 |
|
|
65 |
self.vtk_outline = vtk.vtkOutlineFilter() |
self.vtk_outline = vtk.vtkOutlineFilter() |
66 |
self.vtk_outline.SetInput(self.vtk_xml_reader.GetOutput()) |
self.vtk_outline.SetInput(self.vtk_xml_reader.GetOutput()) |
|
|
|
|
#vtk_outline_mapper = vtk.vtkPolyDataMapper() |
|
|
#vtk_outline_mapper.SetInput(vtk_outline.GetOutput()) |
|
|
|
|
|
#vtk_outline_actor = vtk.vtkActor() |
|
|
#vtk_outline_actor.SetMapper(vtk_outline_mapper) |
|
|
#vtk_outline_actor.GetProperty().SetColor(0, 0, 0) |
|
|
|
|
|
#self.open_scene.getRenderer().AddActor(vtk_outline_actor) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
|
68 |
|
|