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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 835 - (show annotations)
Mon Sep 4 22:20:28 2006 UTC (14 years, 10 months ago) by jongui
File MIME type: text/x-python
File size: 1580 byte(s)
Added more docstrings and updated the way positions, focal point and view angle are specified.


1 """
2 Class that deals with data for the visualization.
3 """
4
5 import vtk
6 from common import *
7
8 class DataCollector(Common):
9 """
10 @author: John Ngui
11 @author: Lutz Gross
12 """
13
14 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
25 self.outline = True
26 self.file_name = None
27 self.vtk_outline = None
28 self.vtk_xml_reader = None
29 self.vtk_xml_reader_output = None
30
31 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
40 self.vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()
41 self.vtk_xml_reader.SetFileName(self.file_name)
42
43 if(self.outline == True):
44 self.setOutline()
45 Common.setMapper(self, "self.vtk_outline.GetOutput()")
46 Common.setActor(self)
47 Common.addActor(self)
48 Common.setColor(self, 0, 0, 0) # Default outline is black
49
50 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
59
60 def setOutline(self):
61 """
62 Set the outline for the rendered object.
63 """
64
65 self.vtk_outline = vtk.vtkOutlineFilter()
66 self.vtk_outline.SetInput(self.vtk_xml_reader.GetOutput())
67
68

  ViewVC Help
Powered by ViewVC 1.1.26