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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 828 - (hide annotations)
Wed Aug 30 07:52:35 2006 UTC (12 years, 11 months ago) by jongui
File MIME type: text/x-python
File size: 2182 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 792 """
2     class that shows scalar data by contour surfaces
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 jongui 828 from common import *
23 gross 792
24 jongui 828 class Contour(Common):
25 jongui 827
26     def __init__(self, open_scene, data_collector):
27 jongui 828 Common.__init__(self, open_scene, data_collector)
28     #self.open_scene = open_scene
29     #self.data_collector = data_collector
30     #self.vtk_contour = None
31     #self.vtk_contour_mapper = None
32     #self.vtk_contour_actor = None
33 gross 792
34 jongui 827 self.setContour()
35 jongui 828 #self.setMapper()
36     #self.setActor()
37 gross 792
38 jongui 828 Common.setMapper(self, "self.vtk_contour.GetOutput()")
39     Common.setActor(self)
40     Common.addActor(self)
41    
42 jongui 827 # set up the contour and specify the number and range
43     def setContour(self):
44     self.vtk_contour = vtk.vtkContourFilter()
45     self.vtk_contour.SetInput(self.data_collector.getReader().GetOutput())
46 jongui 828
47     def setValue(self, contour_number, value):
48     self.vtk_contour.SetValue(contour_number, value)
49    
50     def generateValues(self, contour_number, min_range, max_range):
51     self.vtk_contour.GenerateValues(contour_number, min_range, max_range)
52    
53 jongui 827 # set up the mapper and data
54 jongui 828 #def setMapper(self):
55     # self.vtk_contour_mapper = vtk.vtkPolyDataMapper()
56     # self.vtk_contour_mapper.SetInput(
57     # self.vtk_contour.GetOutput())
58 jongui 827
59     # set up the actor and add the actor to the scene
60 jongui 828 #def setActor(self):
61     # self.vtk_contour_actor = vtk.vtkActor()
62     # self.vtk_contour_actor.SetMapper(self.vtk_contour_mapper)
63     # self.vtk_contour_actor.GetProperty().SetOpacity(0.6)
64 jongui 827
65 jongui 828 # self.open_scene.getRenderer().AddActor(self.vtk_contour_actor)
66 jongui 827
67    
68     #class ContourOnPlane(Component):
69     """
70     shows scalar data by contour surfaces on a given plane
71     """
72     pass

  ViewVC Help
Powered by ViewVC 1.1.26