/[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 845 - (show annotations)
Fri Sep 8 07:13:01 2006 UTC (14 years ago) by jongui
File MIME type: text/x-python
File size: 1574 byte(s)
Display an image is partially completed.

1 """
2 @author: John Ngui
3 @author: Lutz Gross
4 """
5
6 import vtk
7 from common import *
8 from colormap import ColorMap
9
10 class DataCollector(Common):
11 """
12 Class that deals with data for the visualization.
13 """
14
15 def __init__(self, scene, outline = True):
16 """
17 Initialize all the instance variables.
18
19 @type scene: L{Scene <scene.Scene>} object
20 @param scene: Scene in which components are to be added to
21 @type outline: Boolean (I{True or False})
22 @param outline: Determines the outline for the rendered object
23 """
24
25 self.scene = scene
26 self.outline = True
27 self.file_name = None
28 self.vtk_outline = None
29 self.vtk_xml_reader = None
30 self.vtk_xml_reader_output = None
31
32 def setFileName(self, file_name):
33 """
34 Set up the file reader and set the file name.
35
36 @type file_name: String
37 @param file_name: Name of the file to be read.
38 """
39
40 self.file_name = file_name
41 self.vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()
42 self.vtk_xml_reader.SetFileName(self.file_name)
43
44 if(self.outline == True):
45 self.setOutline()
46 Common.setMapper(self, "self.vtk_outline.GetOutput()")
47 Common.setActor(self)
48 Common.addActor(self)
49 Common.setColor(self, 0, 0, 0) # Default outline is black
50
51 def getReader(self):
52 """
53 Return the file reader.
54
55 @rtype: vtkXMLUnstructuredGridReader
56 @return: VTK XML unstructured grid reader
57 """
58
59 return self.vtk_xml_reader
60
61 def setOutline(self):
62 """
63 Set the outline for the rendered object.
64 """
65
66 self.vtk_outline = vtk.vtkOutlineFilter()
67 self.vtk_outline.SetInput(self.vtk_xml_reader.GetOutput())
68
69

  ViewVC Help
Powered by ViewVC 1.1.26