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

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

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

revision 827 by jongui, Wed Aug 30 00:08:02 2006 UTC revision 828 by jongui, Wed Aug 30 07:52:35 2006 UTC
# Line 19  __version__="$Revision:$" Line 19  __version__="$Revision:$"
19  __date__="$Date:$"  __date__="$Date:$"
20    
21  import vtk  import vtk
22    from common import *
23    
24  class Arrows:  class Arrows(Common):
25    
26      def __init__(self, open_scene, data_collector):      def __init__(self, open_scene, data_collector):
27          self.open_scene = open_scene          Common.__init__(self, open_scene, data_collector)
28          self.data_collector = data_collector          #self.open_scene = open_scene
29            #self.data_collector = data_collector
30          self.vtk_glyph = None          self.vtk_glyph = None
31          self.vtk_arrows_mapper = None          #self.vtk_arrows_mapper = None
32          self.vtk_arrows_actor = None                  #self.vtk_arrows_actor = None      
33    
34          self.setArrows()          self.setArrows()
35          self.setMapper()          #self.setMapper()
36          self.setActor()          #self.setActor()
37    
38            Common.setMapper(self, "self.vtk_glyph.GetOutput()")
39            Common.setActor(self)
40            Common.addActor(self)      
41            
42      # set up the glyph and use arrows as the source      # set up the glyph and use arrows as the source
43      def setArrows(self):      def setArrows(self):
# Line 44  class Arrows: Line 50  class Arrows:
50          self.vtk_glyph.SetScaleModeToScaleByVector()          self.vtk_glyph.SetScaleModeToScaleByVector()
51          self.vtk_glyph.SetColorModeToColorByScalar()          self.vtk_glyph.SetColorModeToColorByScalar()
52          self.vtk_glyph.SetScaleFactor(0.2)          self.vtk_glyph.SetScaleFactor(0.2)
53    
54        def setScaleFactor(self, scale_factor):
55            self.vtk_glyph.SetScaleFactor(scale_factor)
56    
57        def setColorMode(self, color_mode):
58            eval("self.vtk_glyph.SetColorModeToColorBy%s()" % color_mode)
59            
60      # set up the mapper and data          # set up the mapper and data    
61      def setMapper(self):      #def setMapper(self):
62          self.vtk_arrows_mapper = vtk.vtkPolyDataMapper()      #   self.vtk_arrows_mapper = vtk.vtkPolyDataMapper()
63          self.vtk_arrows_mapper.SetInput(      #   self.vtk_arrows_mapper.SetInput(
64              self.vtk_glyph.GetOutput())      #       self.vtk_glyph.GetOutput())
65            
66      # set up the actor and add the actor to the scene        # set up the actor and add the actor to the scene  
67      def setActor(self):      #def setActor(self):
68          self.vtk_arrows_actor = vtk.vtkActor()      #   self.vtk_arrows_actor = vtk.vtkActor()
69          self.vtk_arrows_actor.SetMapper(self.vtk_arrows_mapper)      #   self.vtk_arrows_actor.SetMapper(self.vtk_arrows_mapper)
70    
71          self.open_scene.getRenderer().AddActor(self.vtk_arrows_actor)            #   self.open_scene.getRenderer().AddActor(self.vtk_arrows_actor)      
72    
73    
74    

Legend:
Removed from v.827  
changed lines
  Added in v.828

  ViewVC Help
Powered by ViewVC 1.1.26