/[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 859 by jongui, Fri Sep 15 07:11:55 2006 UTC revision 860 by jongui, Thu Sep 28 08:17:29 2006 UTC
# Line 18  class Arrows(Common): Line 18  class Arrows(Common):
18          @type data_collector: L{DataCollector <datacollector.DataCollector>}          @type data_collector: L{DataCollector <datacollector.DataCollector>}
19              object              object
20          @param data_collector: Source of data for visualization                  @param data_collector: Source of data for visualization        
21            @type lut: L{BlueToRed <colormap.BlueToRed>} or
22                L{RedToBlue <colormap.RedToBlue>} object
23            @param lut: Lookup table to be used by the mapper
24          """          """
25    
26          Common.__init__(self, scene, data_collector)          Common.__init__(self, scene, data_collector)
# Line 37  class Arrows(Common): Line 40  class Arrows(Common):
40                    
41          self.vtk_glyph.SetInput(self.data_collector.getReader().GetOutput())          self.vtk_glyph.SetInput(self.data_collector.getReader().GetOutput())
42          self.vtk_glyph.SetSource(vtk_arrows.GetOutput())          self.vtk_glyph.SetSource(vtk_arrows.GetOutput())
43            # Default vector mode is vector.
44          self.setVectorMode("Vector")          self.setVectorMode("Vector")
45            # Default scale mode is vector.
46          self.setScaleMode("Vector")          self.setScaleMode("Vector")
47            # Default color mode is scalar.
48          self.setColorMode("Scalar")          self.setColorMode("Scalar")
49          self.setScaleFactor(0.3)          self.setScaleFactor(0.2)
50    
51      def setVectorMode(self, vector_mode):      def setVectorMode(self, vector_mode):
52            """
53            Set the arrows vector mode.
54            @type vector_mode: String
55            @param vector_mode: Arrows vector mode
56            """
57    
58          eval("self.vtk_glyph.SetVectorModeToUse%s" % vector_mode)          eval("self.vtk_glyph.SetVectorModeToUse%s" % vector_mode)
59    
60      def setScaleMode(self, scale_mode):      def setScaleMode(self, scale_mode):
61            """
62            Set the arrows scale mode.
63            @type scale_mode: String
64            @param scale_mode: Arrows scale mode
65            """
66    
67          eval("self.vtk_glyph.SetScaleModeToScaleBy%s" % scale_mode)          eval("self.vtk_glyph.SetScaleModeToScaleBy%s" % scale_mode)
68    
69      def setScaleFactor(self, scale_factor):      def setScaleFactor(self, scale_factor):
70          """          """
71          Set the scale factor for the arrows.          Set the arrows scale factor.
   
72          @type scale_factor: Number          @type scale_factor: Number
73          @param scale_factor: Scale factor          @param scale_factor: Size of the arrows
74          """          """
75    
76          self.vtk_glyph.SetScaleFactor(scale_factor)          self.vtk_glyph.SetScaleFactor(scale_factor)
77    
78      def setColorMode(self, color_mode):      def setColorMode(self, color_mode):
79          """          """
80          Set the color mode for the arrows.            Set the arrows color mode.  
   
81          @type color_mode: String          @type color_mode: String
82          @param color_mode: Color mode for the arrows (I{Scalar or Vector})          @param color_mode: Arrows color mode
83          """          """
84            
85          eval("self.vtk_glyph.SetColorModeToColorBy%s()" % color_mode)          eval("self.vtk_glyph.SetColorModeToColorBy%s()" % color_mode)
# Line 77  class ArrowsOnPlane(Arrows, Plane): Line 93  class ArrowsOnPlane(Arrows, Plane):
93      Class that shows a vector field by arrows on a given plane.      Class that shows a vector field by arrows on a given plane.
94      """      """
95    
96      def __init__(self, scene, data_collector, lut = None):      def __init__(self, scene, data_collector, transform, lut = None):
97          """          """
98          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
99          @param scene: Scene in which components are to be added to          @param scene: Scene in which components are to be added to
100          @type data_collector: L{DataCollector <datacollector.DataCollector>}          @type data_collector: L{DataCollector <datacollector.DataCollector>}
101              object              object
   
102          @param data_collector: Source of data for visualization          @param data_collector: Source of data for visualization
103            @type transform: L{Transform <geo.Transform>} object
104            @param transform: Orientation of the plane
105            @type lut: L{BlueToRed <colormap.BlueToRed>} or
106                L{RedToBlue <colormap.RedToBlue>} object
107            @param lut: Lookup table to be used by the mapper
108          """          """
109    
110            # Declared because they are needed by the setArrows method.
111          self.data_collector = data_collector          self.data_collector = data_collector
112          self.vtk_glyph = vtk.vtkGlyph3D()          self.vtk_glyph = vtk.vtkGlyph3D()
113            
114          Arrows.setArrows(self)          Arrows.setArrows(self)
115            # "Cut" is used to distinguish cutting from clipping.
116            Plane.__init__(self, scene, data_collector,
117                self.vtk_glyph.GetOutput(), transform, lut, "Cut")
118    
119    from arrows import Arrows
120    from plane import Plane
121    
122    class ArrowsOnClip(Arrows, Plane):
123        """
124        Class that shows a vector field by arrows on a clip.
125        """
126    
127        def __init__(self, scene, data_collector, transform, lut = None):
128            """
129            @type scene: L{Scene <scene.Scene>} object
130            @param scene: Scene in which components are to be added to
131            @type data_collector: L{DataCollector <datacollector.DataCollector>}
132                object
133            @param data_collector: Source of data for visualization
134            @type transform: L{Transform <geo.Transform>} object
135            @param transform: Orientation of the plane
136            @type lut: L{BlueToRed <colormap.BlueToRed>} or
137                L{RedToBlue <colormap.RedToBlue>} object
138            @param lut: Lookup table to be used by the mapper
139            """
140    
141            # Declared because they are needed by the setArrows method.
142            self.data_collector = data_collector
143            self.vtk_glyph = vtk.vtkGlyph3D()
144            
145            Arrows.setArrows(self)
146            # "Clip" is used to distinguish clipping from cutting.
147          Plane.__init__(self, scene, data_collector,          Plane.__init__(self, scene, data_collector,
148              self.vtk_glyph.GetOutput(), lut)              self.vtk_glyph.GetOutput(), transform, lut, "Clip")
149    

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

  ViewVC Help
Powered by ViewVC 1.1.26