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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 828 - (hide annotations)
Wed Aug 30 07:52:35 2006 UTC (14 years, 8 months ago) by jongui
File MIME type: text/x-python
File size: 1519 byte(s)
Tidy up the codes to include inheritance of common features for reusability. Also added options to change opacity, scale factor, color mode and contour values.

1 gross 802 """
2     class that shows a vector field by arrows
3    
4     @var __author__: name of author
5     @var __license__: licence agreement
6     @var __copyright__: copyrights
7     @var __url__: url entry point on documentation
8     @var __version__: version
9     @var __date__: date of the version
10     """
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     __author__="Paul Cochrane, L. Gross"
17     __url__="http://www.iservo.edu.au/esys"
18     __version__="$Revision:$"
19     __date__="$Date:$"
20    
21 jongui 827 import vtk
22 gross 802
23 jongui 828 class Common:
24 gross 802
25 jongui 828 def __init__(self, open_scene, data_collector):
26     self.open_scene = open_scene
27     self.data_collector = data_collector
28     self.vtk_mapper = None
29     self.vtk_actor = None
30 gross 802
31 jongui 827 def setMapper(self, component):
32     self.vtk_mapper = vtk.vtkDataSetMapper()
33 jongui 828 eval("self.vtk_mapper.SetInput(%s)" % component)
34 gross 802
35 jongui 828 def setActor(self):
36     self.vtk_actor = vtk.vtkActor()
37     self.vtk_actor.SetMapper(self.vtk_mapper)
38    
39     def addActor(self):
40     self.open_scene.getRenderer().AddActor(self.vtk_actor)
41    
42     def setOpacity(self, opacity):
43     self.getProperty().SetOpacity(opacity)
44    
45     def setColor(self, red, green, blue):
46     self.getProperty().SetColor(red, green, blue)
47    
48     def setRepresentation(self, representation):
49     eval("self.getProperty().SetRepresentationTo%s()" % representation)
50    
51     def getProperty(self):
52     return self.vtk_actor.GetProperty()
53    
54 jongui 827

  ViewVC Help
Powered by ViewVC 1.1.26