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

Diff of /trunk/pyvisi/py_src/common.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 12  class Common: Line 12  class Common:
12    
13      def __init__(self, scene, data_collector = None):      def __init__(self, scene, data_collector = None):
14          """          """
         Initialize all the instance variables.  
   
15          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
16          @param scene: Scene in which components are to be added to          @param scene: Scene in which components are to be added to
17          @type data_collector: L{DataCollector <datacollector.DataCollector>}          @type data_collector: L{DataCollector <datacollector.DataCollector>}
# Line 28  class Common: Line 26  class Common:
26    
27      def setMapperInput(self, component, lut = None):      def setMapperInput(self, component, lut = None):
28          """          """
29          Set up the mapper and its input.          Set up the mapper.
   
30          @type component: String          @type component: String
31          @param component: Component to be mapped          @param component: Component to be mapped
32          @type lut: L{BlueToRed <colormap.BlueToRed>} or          @type lut: L{BlueToRed <colormap.BlueToRed>} or
33              L{RedToBlue <colormap.RedToBlue>} object              L{RedToBlue <colormap.RedToBlue>} object
34          @param lut: Color lookup table to be used by the mapper          @param lut: Lookup table to be used by the mapper
35          """          """
36    
37          self.vtk_mapper.SetInput(component)          # Convert unstructured grid data to polygonal data.
38          #eval("self.vtk_mapper.SetInput(%s)" % component)          vtk_geometry = vtk.vtkGeometryFilter()
39                    vtk_geometry.SetInput(component)
40    
41            # Compute normals to ensure consistent orientation across neighbours.
42            # This results in a better object being rendered.
43            vtk_normals = vtk.vtkPolyDataNormals()
44            vtk_normals.SetInput(vtk_geometry.GetOutput())
45    
46            self.vtk_mapper.SetInput(vtk_normals.GetOutput())
47        
48            # Mapper uses the customized lookup table only if it is specified.
49            # Otherwise, the default one is used.
50          if(lut != None):          if(lut != None):
51              self.vtk_mapper.SetLookupTable(lut.getLut())                  self.vtk_mapper.SetLookupTable(lut.getLut())    
52    
53      def setMapperTexture(self, texture):      def setActorTexture(self, texture):
54          """          """
55          Set the texture of the actor.          Set the texture of the actor.
   
56          @type texture: vtkTexture          @type texture: vtkTexture
57          @param texture: Texture map of the image          @param texture: Texture map of the image
58          """          """
59    
60          self.vtk_actor.SetTexture(texture)          self.vtk_actor.SetTexture(texture)
61    
62      def setActorInput(self):      def setActorInput(self):
63          """          """
64          Set up the actor and its mapper.          Set up the actor.
65          """          """
66    
67          self.vtk_actor.SetMapper(self.vtk_mapper)          self.vtk_actor.SetMapper(self.vtk_mapper)
68    
69    
# Line 69  class Common: Line 77  class Common:
77      def setActorOpacity(self, opacity):      def setActorOpacity(self, opacity):
78          """          """
79          Set the opacity (transparency) of the actor.          Set the opacity (transparency) of the actor.
   
80          @type opacity: Number          @type opacity: Number
81          @param opacity: Opacity (transparency) of the actor          @param opacity: Opacity (transparency) of the actor
82          """          """
# Line 77  class Common: Line 84  class Common:
84          self.vtk_actor.GetProperty().SetOpacity(opacity)          self.vtk_actor.GetProperty().SetOpacity(opacity)
85    
86      def setActorColor(self, color):      def setActorColor(self, color):
87            """
88            Set the color of the actor.
89            @type color: RGB list
90            @param color: Color of the actor
91            """
92            
93          self.vtk_actor.GetProperty().SetColor(color[0], color[1],          self.vtk_actor.GetProperty().SetColor(color[0], color[1],
94              color[2])              color[2])
95    
96      def setActorRepresentation(self, representation):      def setActorRepresentation(self, representation):
97          """          """
98          Set the representation of the actor.          Set the representation of the actor.
   
99          @type representation: String          @type representation: String
100          @param representation: Representation type (I{i.e. Wireframe})          @param representation: Actor representation type (I{i.e. Wireframe})
101          """          """
102    
103          eval("self.vtk_actor.GetProperty().SetRepresentationTo%s()" %          eval("self.vtk_actor.GetProperty().SetRepresentationTo%s()" %

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

  ViewVC Help
Powered by ViewVC 1.1.26