/[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 848 by jongui, Fri Sep 8 07:13:01 2006 UTC revision 849 by jongui, Fri Sep 15 07:11:55 2006 UTC
# Line 4  Line 4 
4  """  """
5    
6  import vtk  import vtk
7  from common import *  from common import Common
8    
9  class Arrows(Common):  class Arrows(Common):
10      """      """
# Line 21  class Arrows(Common): Line 21  class Arrows(Common):
21          """          """
22    
23          Common.__init__(self, scene, data_collector)          Common.__init__(self, scene, data_collector)
24          self.vtk_glyph = None          self.vtk_glyph = vtk.vtkGlyph3D()
25          self.setArrows()          self.setArrows()
26    
27          Common.setMapper(self, "self.vtk_glyph.GetOutput()", lut)          Common.setMapperInput(self, self.vtk_glyph.GetOutput(), lut)
28          Common.setActor(self)          Common.setActorInput(self)
29          Common.addActor(self)                Common.addActor(self)      
30            
31      def setArrows(self):      def setArrows(self):
# Line 35  class Arrows(Common): Line 35  class Arrows(Common):
35    
36          vtk_arrows = vtk.vtkArrowSource()          vtk_arrows = vtk.vtkArrowSource()
37                    
         self.vtk_glyph = vtk.vtkGlyph3D()  
38          self.vtk_glyph.SetInput(self.data_collector.getReader().GetOutput())          self.vtk_glyph.SetInput(self.data_collector.getReader().GetOutput())
39          self.vtk_glyph.SetSource(vtk_arrows.GetOutput())          self.vtk_glyph.SetSource(vtk_arrows.GetOutput())
40          self.vtk_glyph.SetVectorModeToUseVector() # Default vector mode          self.setVectorMode("Vector")
41          self.vtk_glyph.SetScaleModeToScaleByVector() # Default scale mode          self.setScaleMode("Vector")
42          self.setColorMode("Scalar") # Default color mode          self.setColorMode("Scalar")
43          self.setScaleFactor(0.2) # Default scale factor          self.setScaleFactor(0.3)
44    
45        def setVectorMode(self, vector_mode):
46            eval("self.vtk_glyph.SetVectorModeToUse%s" % vector_mode)
47    
48        def setScaleMode(self, scale_mode):
49            eval("self.vtk_glyph.SetScaleModeToScaleBy%s" % scale_mode)
50    
51      def setScaleFactor(self, scale_factor):      def setScaleFactor(self, scale_factor):
52          """          """
# Line 65  class Arrows(Common): Line 70  class Arrows(Common):
70    
71    
72  from arrows import Arrows  from arrows import Arrows
73  from geo import Plane  from plane import Plane
74            
75  class ArrowsOnPlane(Arrows, Plane):  class ArrowsOnPlane(Arrows, Plane):
76      """      """
# Line 82  class ArrowsOnPlane(Arrows, Plane): Line 87  class ArrowsOnPlane(Arrows, Plane):
87          @param data_collector: Source of data for visualization          @param data_collector: Source of data for visualization
88          """          """
89    
90          Common.__init__(self, scene, data_collector)                  self.data_collector = data_collector
91          self.vtk_glyph = None          self.vtk_glyph = vtk.vtkGlyph3D()
92          self.setArrows()          Arrows.setArrows(self)
93    
94          Plane.__init__(self, scene, data_collector,          Plane.__init__(self, scene, data_collector,
95              "self.vtk_glyph.GetOutput()")              self.vtk_glyph.GetOutput(), lut)
96    

Legend:
Removed from v.848  
changed lines
  Added in v.849

  ViewVC Help
Powered by ViewVC 1.1.26