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

Annotation of /trunk/pyvisi/py_src/tube.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1029 - (hide annotations)
Wed Mar 14 05:01:13 2007 UTC (12 years, 6 months ago) by jongui
File MIME type: text/x-python
File size: 1623 byte(s)
Fixed problems in relation to updates propagating when multiple files/sources are read.
1 jongui 943 """
2     @author: John NGUI
3     """
4    
5     import vtk
6    
7     class Tube:
8     """
9 jongui 1004 Class that defines the tubes that are wrapped around the streamlines.
10 jongui 943 """
11    
12     def __init__(self, object):
13     """
14     Initialise the tube.
15     """
16    
17     self.__object = object
18     self.__vtk_tube = vtk.vtkTubeFilter()
19    
20     self.__setupTube()
21    
22     def __setupTube(self):
23     """
24     Setup the tube.
25     """
26    
27     self.__setInput()
28     # Default radius of the tube is 0.02.
29     self.setTubeRadius(0.02)
30     # Default number of sides for the tube is 12.
31 jongui 946 self.setTubeNumberOfSides(12)
32 jongui 1029 self.setTubeRadiusToVaryByVector()
33 jongui 943 self.__vtk_tube.Update()
34    
35     def __setInput(self):
36     """
37     Set the input for the tube.
38     """
39    
40     self.__vtk_tube.SetInput(self.__object)
41    
42     def setTubeRadius(self, radius):
43     """
44     Set the radius of the tube.
45    
46     @type radius: Number
47     @param radius: Radius of the tube
48     """
49    
50     self.__vtk_tube.SetRadius(radius)
51    
52 jongui 946 def setTubeNumberOfSides(self, sides):
53 jongui 943 """
54     Set the number of sides for the tube. Minimum number of sides is 3.
55 jongui 949 The larger the number of sides, the higher quality the steramlines are.
56 jongui 943
57     @type sides: Number
58     @param sides: Number of sides for the tube
59     """
60    
61     self.__vtk_tube.SetNumberOfSides(sides)
62    
63 jongui 946 def setTubeRadiusToVaryByVector(self):
64 jongui 943 """
65 jongui 949 Set the radius to vary by vector data.
66 jongui 943 """
67    
68     self.__vtk_tube.SetVaryRadiusToVaryRadiusByVector()
69    
70 jongui 946 def setTubeRadiusToVaryByScalar(self):
71 jongui 943 """
72 jongui 949 Set the radius to vary by scalar data.
73 jongui 943 """
74    
75     self.__vtk_tube.SetVaryRadiusToVaryRadiusByScalar()
76    
77     def _getOutput(self):
78     """
79 jongui 949 Return the output of the tube.
80 jongui 943
81     @rtype: vtkPolyData
82     @return: Polygonal data
83     """
84    
85     return self.__vtk_tube.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26