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

Contents of /trunk/pyvisi/py_src/clipper.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1809 - (show annotations)
Thu Sep 25 06:43:44 2008 UTC (11 years, 1 month ago) by ksteube
File MIME type: text/x-python
File size: 2615 byte(s)
Copyright updated in all python files

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
34 import vtk
35
36 class Clipper:
37 """
38 Class that defines a clipper.
39 """
40
41 def __init__(self):
42 """
43 Initialise the clipper.
44 """
45
46 self.__vtk_clipper = vtk.vtkClipDataSet()
47
48 def _setupClipper(self, object, plane):
49 """
50 Setup the clipper.
51
52 @type object: vtkUnstructuredGrid, etc
53 @param object: Input for the clipper
54 @type plane: vtkPlane
55 @param plane: Plane to clip the object
56 """
57
58 self.__object = object
59 # True only if a plane is used to perform clipping. False for
60 # scalar clipping.
61 if(plane != None):
62 self.__plane = plane
63
64 self.__setInput()
65 # Due to this it's not possible to setInsideOutOff() when used with Rotation
66 # self.setInsideOutOn()
67
68 def __setInput(self):
69 """
70 Set the input for the clipper.
71 """
72
73 self.__vtk_clipper.SetInput(self.__object)
74
75 def _setClipFunction(self):
76 """
77 Set the clip function (using a plane) for the clipper.
78 """
79
80 self.__vtk_clipper.SetClipFunction(self.__plane)
81
82 def setInsideOutOn(self):
83 """
84 Clip one side of the rendered object.
85 """
86
87 self.__vtk_clipper.InsideOutOn()
88
89 def setInsideOutOff(self):
90 """
91 Clips the other side of the rendered object.
92 """
93
94 self.__vtk_clipper.InsideOutOff()
95
96 def setClipValue(self, value):
97 """
98 Set the scalar clip value (intead of using a plane) for the clipper.
99
100 @type value: Number
101 @param value: Scalar clip value
102 """
103
104 self.__vtk_clipper.SetValue(value)
105
106 def _getClipperOutput(self):
107 """
108 Return the output of the clipper.
109
110 @rtype: vtkUnstructuredGrid
111 @return: Unstructured grid
112 """
113
114 return self.__vtk_clipper.GetOutput()
115

  ViewVC Help
Powered by ViewVC 1.1.26