/[escript]/tags/trunk_2172_checkpoint/pyvisi/py_src/tube.py
ViewVC logotype

Contents of /tags/trunk_2172_checkpoint/pyvisi/py_src/tube.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2175 - (show annotations)
Wed Dec 17 09:22:40 2008 UTC (12 years, 2 months ago) by phornby
File MIME type: text/x-python
File size: 2621 byte(s)
Try again at conforming to naming convention.
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 """
23 @var __author__: name of author
24 @var __copyright__: copyrights
25 @var __license__: licence agreement
26 @var __url__: url entry point on documentation
27 @var __version__: version
28 @var __date__: date of the version
29 """
30
31 __author__="John Ngui, john.ngui@uq.edu.au"
32
33 import vtk
34
35 class Tube:
36 """
37 Class that defines the tube wrapped around the streamlines.
38 """
39
40 def __init__(self):
41 """
42 Initialise the tube.
43 """
44
45 self.__vtk_tube = vtk.vtkTubeFilter()
46
47 def _setupTube(self, object):
48 """
49 Setup the tube.
50
51 @type object: vtkPolyData, etc
52 @param object: Input for the tube
53 """
54
55 self.__object = object
56
57 self.__setInput()
58 # Default radius of the tube is 0.02.
59 self.setTubeRadius(0.02)
60 # Default number of sides for the tube is 12.
61 self.setTubeNumberOfSides(12)
62 self.setTubeRadiusToVaryByVector()
63
64 def __setInput(self):
65 """
66 Set the input for the tube.
67 """
68
69 self.__vtk_tube.SetInput(self.__object)
70
71 def setTubeRadius(self, radius):
72 """
73 Set the radius of the tube.
74
75 @type radius: Number
76 @param radius: Radius of the tube
77 """
78
79 self.__vtk_tube.SetRadius(radius)
80
81 def setTubeNumberOfSides(self, sides):
82 """
83 Set the number of sides for the tube. Minimum number of sides is 3.
84 The larger the number of sides, the higher the quality.
85
86 @type sides: Number
87 @param sides: Number of sides for the tube
88 """
89
90 self.__vtk_tube.SetNumberOfSides(sides)
91
92 def setTubeRadiusToVaryByVector(self):
93 """
94 Set the radius to vary by vector data.
95 """
96
97 self.__vtk_tube.SetVaryRadiusToVaryRadiusByVector()
98
99 def setTubeRadiusToVaryByScalar(self):
100 """
101 Set the radius to vary by scalar data.
102 """
103
104 self.__vtk_tube.SetVaryRadiusToVaryRadiusByScalar()
105
106 def _getTubeOutput(self):
107 """
108 Return the output of the tube.
109
110 @rtype: vtkPolyData
111 @return: Polygonal data
112 """
113
114 return self.__vtk_tube.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26