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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 859 by jongui, Fri Sep 15 07:11:55 2006 UTC revision 860 by jongui, Thu Sep 28 08:17:29 2006 UTC
# Line 10  from style import Style Line 10  from style import Style
10    
11  class DataCollector(Common):  class DataCollector(Common):
12      """      """
13      Class that deals with data for the visualization.      Class that deals with data for visualization.
14      """      """
15    
16      def __init__(self, scene, outline = True, cube_axes = True):      def __init__(self, scene, outline = True, cube_axes = True):
17          """          """
         Initialize all the instance variables.  
   
18          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
19          @param scene: Scene in which components are to be added to          @param scene: Scene in which components are to be added to
20          @type outline: Boolean (I{True or False})          @type outline: Boolean (I{True or False})
21          @param outline: Determines the outline for the rendered object          @param outline: Places or removes an outline for the rendered object
22            @type cube_axes: Boolean ({True or False})
23            @param cube_axes: Places or removes a cube axes for the rendered object
24          """          """
25    
26          Common.__init__(self, scene)          Common.__init__(self, scene)
# Line 30  class DataCollector(Common): Line 30  class DataCollector(Common):
30    
31      def setFileName(self, file_name):      def setFileName(self, file_name):
32          """          """
33          Set up the file reader and set the file name.          Set up the file reader and file name from which data is to be read.
   
34          @type file_name: String          @type file_name: String
35          @param file_name: Name of the file to be read.          @param file_name: Name of the file to be read.
36          """          """
37    
38          self.vtk_xml_reader.SetFileName(file_name)          self.vtk_xml_reader.SetFileName(file_name)
39    
40            # Set up the outline and cube axes only if true.
41          if(self.outline == True):          if(self.outline == True):
42              self.setOutline()              self.setOutline()
   
43          if(self.cube_axes == True):          if(self.cube_axes == True):
44              self.setCubeAxes()              self.setCubeAxes()
45    
46      def setOutline(self):      def setOutline(self):
47          """          """
48          Set the outline for the rendered object.          Set up the outline for the rendered object.
49          """          """
50    
51          self.vtk_outline = vtk.vtkOutlineFilter()          self.vtk_outline = vtk.vtkOutlineFilter()
# Line 55  class DataCollector(Common): Line 54  class DataCollector(Common):
54          Common.setMapperInput(self, self.vtk_outline.GetOutput())          Common.setMapperInput(self, self.vtk_outline.GetOutput())
55          Common.setActorInput(self)          Common.setActorInput(self)
56          Common.addActor(self)          Common.addActor(self)
57          # Default outline is black color.            # Default outline is black.
58          Common.setActorColor(self, BLACK)          Common.setActorColor(self, BLACK)
59    
60      def setCubeAxes(self):      def setCubeAxes(self):
61            """
62            Set up the cube axes for the rendered object.
63            """
64    
65          vtk_cube_axes = vtk.vtkCubeAxesActor2D()          vtk_cube_axes = vtk.vtkCubeAxesActor2D()
66          vtk_cube_axes.SetInput(self.getReader().GetOutput())          vtk_cube_axes.SetInput(self.getReader().GetOutput())
67          vtk_cube_axes.SetCamera(self.scene.getRenderer().GetActiveCamera())          vtk_cube_axes.SetCamera(self.scene.getRenderer().GetActiveCamera())
68            # Formats the labes on the axes.
69          vtk_cube_axes.SetLabelFormat("%6.4g")          vtk_cube_axes.SetLabelFormat("%6.4g")
70            # Use the outer edges of the bounding box to draw the axes.
71          vtk_cube_axes.SetFlyModeToOuterEdges()          vtk_cube_axes.SetFlyModeToOuterEdges()
72          vtk_cube_axes.SetFontFactor(0.9)          vtk_cube_axes.SetFontFactor(0.9)
73    
74            # Style for the axes title and label.
75          style = Style()                  style = Style()        
76          style.setColor(BLACK)          style.setColor(BLACK)
77          style.setShadow()          style.shadowOn()
78    
79          vtk_cube_axes.SetAxisTitleTextProperty(style.getStyle())          vtk_cube_axes.SetAxisTitleTextProperty(style.getStyle())
80          vtk_cube_axes.SetAxisLabelTextProperty(style.getStyle())          vtk_cube_axes.SetAxisLabelTextProperty(style.getStyle())
# Line 80  class DataCollector(Common): Line 86  class DataCollector(Common):
86          Return the file reader.          Return the file reader.
87    
88          @rtype: vtkXMLUnstructuredGridReader          @rtype: vtkXMLUnstructuredGridReader
89          @return: VTK XML unstructured grid reader          @return: VTK XML unstructured grid reader that is used to read files.
90          """          """
91    
92          return self.vtk_xml_reader          return self.vtk_xml_reader

Legend:
Removed from v.859  
changed lines
  Added in v.860

  ViewVC Help
Powered by ViewVC 1.1.26