/[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 1292 - (show annotations)
Thu Sep 6 05:37:33 2007 UTC (12 years, 11 months ago) by ksteube
File MIME type: text/x-python
File size: 2221 byte(s)
Commented out setInsideOutOn call in setup because after that it's not
possible to use setInsideOutOff with rotation.

1 """
2 @var __author__: name of author
3 @var __copyright__: copyrights
4 @var __license__: licence agreement
5 @var __url__: url entry point on documentation
6 @var __version__: version
7 @var __date__: date of the version
8 """
9
10 __author__="John Ngui, john.ngui@uq.edu.au"
11 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
12 http://www.access.edu.au
13 Primary Business: Queensland, Australia"""
14 __license__="""Licensed under the Open Software License version 3.0
15 http://www.opensource.org/licenses/osl-3.0.php"""
16 __url__="http://www.iservo.edu.au/esys"
17 __version__="$Revision$"
18 __date__="$Date$"
19
20
21 import vtk
22
23 class Clipper:
24 """
25 Class that defines a clipper.
26 """
27
28 def __init__(self):
29 """
30 Initialise the clipper.
31 """
32
33 self.__vtk_clipper = vtk.vtkClipDataSet()
34
35 def _setupClipper(self, object, plane):
36 """
37 Setup the clipper.
38
39 @type object: vtkUnstructuredGrid, etc
40 @param object: Input for the clipper
41 @type plane: vtkPlane
42 @param plane: Plane to clip the object
43 """
44
45 self.__object = object
46 # True only if a plane is used to perform clipping. False for
47 # scalar clipping.
48 if(plane != None):
49 self.__plane = plane
50
51 self.__setInput()
52 # Due to this it's not possible to setInsideOutOff() when used with Rotation
53 # self.setInsideOutOn()
54
55 def __setInput(self):
56 """
57 Set the input for the clipper.
58 """
59
60 self.__vtk_clipper.SetInput(self.__object)
61
62 def _setClipFunction(self):
63 """
64 Set the clip function (using a plane) for the clipper.
65 """
66
67 self.__vtk_clipper.SetClipFunction(self.__plane)
68
69 def setInsideOutOn(self):
70 """
71 Clip one side of the rendered object.
72 """
73
74 self.__vtk_clipper.InsideOutOn()
75
76 def setInsideOutOff(self):
77 """
78 Clips the other side of the rendered object.
79 """
80
81 self.__vtk_clipper.InsideOutOff()
82
83 def setClipValue(self, value):
84 """
85 Set the scalar clip value (intead of using a plane) for the clipper.
86
87 @type value: Number
88 @param value: Scalar clip value
89 """
90
91 self.__vtk_clipper.SetValue(value)
92
93 def _getClipperOutput(self):
94 """
95 Return the output of the clipper.
96
97 @rtype: vtkUnstructuredGrid
98 @return: Unstructured grid
99 """
100
101 return self.__vtk_clipper.GetOutput()
102

  ViewVC Help
Powered by ViewVC 1.1.26