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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1809 - (hide annotations)
Thu Sep 25 06:43:44 2008 UTC (10 years, 10 months ago) by ksteube
File MIME type: text/x-python
File size: 2287 byte(s)
Copyright updated in all python files

1 ksteube 1809
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 ksteube 1147 """
23 jongui 1197 @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 ksteube 1147 """
30    
31 jongui 1197 __author__="John Ngui, john.ngui@uq.edu.au"
32    
33    
34 ksteube 1147 import vtk
35     from constant import WarpMode
36    
37     class Warp:
38     """
39     Class that defines the deformation of a scalar field.
40     """
41    
42 jongui 1148 def __init__(self, warp_mode):
43 ksteube 1147 """
44     Initialise the warp scalar/vector.
45    
46     @type warp_mode: L{WarpMode <constant.WarpMode>} constant
47     @param warp_mode: Mode in which to deform the data
48     """
49    
50     if(warp_mode == WarpMode.SCALAR): # Deform data with scalar data.
51     self.__vtk_warp = vtk.vtkWarpScalar()
52     elif(warp_mode == WarpMode.VECTOR): # Deform data with vector data.
53     self.__vtk_warp = vtk.vtkWarpVector()
54    
55 jongui 1148 def _setupWarp(self, object):
56     """
57     Setup the warp.
58    
59     @type object: vtkPolyData, etc
60 jongui 1199 @param object: Input for the warp scalar or warp vector
61 jongui 1148 """
62    
63     self.__object = object
64 ksteube 1147 self.__setInput()
65    
66     def __setInput(self):
67     """
68     Set the input for the warp scalar/vector.
69     """
70    
71     self.__vtk_warp.SetInput(self.__object)
72    
73     def setScaleFactor(self, scale_factor):
74     """
75     Set the displacement scale factor.
76    
77     @type scale_factor: Number
78 jongui 1199 @param scale_factor: Scale factor for the displacement
79 ksteube 1147 """
80    
81     self.__vtk_warp.SetScaleFactor(scale_factor)
82    
83 jongui 1148 def _getWarpOutput(self):
84 ksteube 1147 """
85     Return the output of the deformed data.
86    
87     @rtype: vtkPointSet
88     @return: PointSet data
89     """
90    
91     return self.__vtk_warp.GetOutput()
92    

  ViewVC Help
Powered by ViewVC 1.1.26