1 |
""" |
2 |
@author: John NGUI |
3 |
""" |
4 |
|
5 |
import vtk |
6 |
|
7 |
class Arrow2D: |
8 |
""" |
9 |
Class that defines 2D arrow. |
10 |
""" |
11 |
|
12 |
def __init__(self): |
13 |
""" |
14 |
Initialise the 2D arrow. |
15 |
""" |
16 |
|
17 |
self.__vtk_arrow2D = vtk.vtkGlyphSource2D() |
18 |
self.__setupArrow2D() |
19 |
|
20 |
def __setupArrow2D(self): |
21 |
""" |
22 |
Setup the 2D arrow. |
23 |
""" |
24 |
|
25 |
# Set to use arrows instead of cone, sphere, etc. |
26 |
self.__vtk_arrow2D.SetGlyphTypeToArrow() |
27 |
# Fill the inside of the arrow. |
28 |
self.__vtk_arrow2D.SetFilled(0) |
29 |
self.__output = self.__vtk_arrow2D.GetOutput() |
30 |
|
31 |
def _getOutput(self): |
32 |
""" |
33 |
Return the 2D arrow. |
34 |
|
35 |
@rtype: vtkPolyData |
36 |
@return: Polygonal data |
37 |
""" |
38 |
|
39 |
return self.__output |
40 |
|
41 |
class Arrow3D: |
42 |
""" |
43 |
Class that defines 3D arrow. |
44 |
""" |
45 |
|
46 |
def __init__(self): |
47 |
""" |
48 |
Initialise the 3D arrow. |
49 |
""" |
50 |
|
51 |
self.__vtk_arrow3D = vtk.vtkArrowSource() |
52 |
self.__output = self.__vtk_arrow3D.GetOutput() |
53 |
|
54 |
def _getOutput(self): |
55 |
""" |
56 |
Return the 3D arrow. |
57 |
|
58 |
@rtype: vtkPolyData |
59 |
@return Polygonal data |
60 |
""" |
61 |
|
62 |
return self.__output |
63 |
|
64 |
|