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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 839 - (hide annotations)
Wed Sep 6 04:53:50 2006 UTC (14 years, 5 months ago) by jongui
File MIME type: text/x-python
File size: 1576 byte(s)
- Added lookup table spectrum from blue to red and red to blue.
- Updated open scene to scene

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

  ViewVC Help
Powered by ViewVC 1.1.26