/[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 792 by gross, Fri Jul 28 10:37:16 2006 UTC revision 827 by jongui, Wed Aug 30 00:08:02 2006 UTC
# Line 18  __url__="http://www.iservo.edu.au/esys" Line 18  __url__="http://www.iservo.edu.au/esys"
18  __version__="$Revision:$"  __version__="$Revision:$"
19  __date__="$Date:$"  __date__="$Date:$"
20    
21  from common import Component  import vtk
22    
23  class Arrows(Component):  class Arrows:
24      """  
25      shows a vector field by arrows      def __init__(self, open_scene, data_collector):
26      """          self.open_scene = open_scene
27      pass          self.data_collector = data_collector
28            self.vtk_glyph = None
29  class ArrowsOnPlane(Component):          self.vtk_arrows_mapper = None
30      """          self.vtk_arrows_actor = None        
31      shows a vector field by arrows on a plane  
32      """          self.setArrows()
33      pass          self.setMapper()
34            self.setActor()
35        
36        # set up the glyph and use arrows as the source
37        def setArrows(self):
38            vtk_arrows = vtk.vtkArrowSource()
39            
40            self.vtk_glyph = vtk.vtkGlyph3D()
41            self.vtk_glyph.SetInput(self.data_collector.getReader().GetOutput())
42            self.vtk_glyph.SetSource(vtk_arrows.GetOutput())
43            self.vtk_glyph.SetVectorModeToUseVector()
44            self.vtk_glyph.SetScaleModeToScaleByVector()
45            self.vtk_glyph.SetColorModeToColorByScalar()
46            self.vtk_glyph.SetScaleFactor(0.2)
47        
48        # set up the mapper and data    
49        def setMapper(self):
50            self.vtk_arrows_mapper = vtk.vtkPolyDataMapper()
51            self.vtk_arrows_mapper.SetInput(
52                self.vtk_glyph.GetOutput())
53        
54        # set up the actor and add the actor to the scene  
55        def setActor(self):
56            self.vtk_arrows_actor = vtk.vtkActor()
57            self.vtk_arrows_actor.SetMapper(self.vtk_arrows_mapper)
58    
59            self.open_scene.getRenderer().AddActor(self.vtk_arrows_actor)      
60    
61    
62    
63    
64    #class ArrowsOnPlane:
65    """
66    shows a vector field by arrows on a plane
67    """
68    pass

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

  ViewVC Help
Powered by ViewVC 1.1.26