/[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 845 - (hide annotations)
Fri Sep 8 07:13:01 2006 UTC (14 years, 1 month ago) by jongui
File MIME type: text/x-python
File size: 2242 byte(s)
Display an image is partially completed.

1 gross 792 """
2 jongui 839 @author: John Ngui
3     @author: Lutz Gross
4 gross 792 """
5    
6 jongui 827 import vtk
7 jongui 828 from common import *
8 gross 792
9 jongui 828 class Contour(Common):
10 jongui 839 """
11     Class that shows a scalar field by contour surfaces.
12 jongui 835 """
13 jongui 839
14 jongui 845 def __init__(self, scene, data_collector, lut = None):
15 jongui 835 """
16 jongui 845 @type scene: L{Scene <scene.Scene>} object
17 jongui 839 @param scene: Scene in which components are to be added to
18 jongui 835 @type data_collector: L{DataCollector <datacollector.DataCollector>}
19     object
20     @param data_collector: Source of data for visualization
21     """
22    
23 jongui 839 Common.__init__(self, scene, data_collector)
24 jongui 845 self.vtk_contour = None
25 jongui 827 self.setContour()
26 gross 792
27 jongui 845 Common.setMapper(self, "self.vtk_contour.GetOutput()", lut)
28 jongui 828 Common.setActor(self)
29     Common.addActor(self)
30    
31 jongui 827 def setContour(self):
32 jongui 835 """
33     Set up the contour and its input.
34     """
35    
36 jongui 827 self.vtk_contour = vtk.vtkContourFilter()
37     self.vtk_contour.SetInput(self.data_collector.getReader().GetOutput())
38 jongui 828
39     def setValue(self, contour_number, value):
40 jongui 835 """
41     Set the contour number and its value.
42    
43     @type contour_number: Number
44     @param contour_number: Contour number
45     @type value: Number
46     @param value: Contour value
47     """
48    
49 jongui 828 self.vtk_contour.SetValue(contour_number, value)
50    
51 jongui 830 def generateValues(self, number_contours, min_range, max_range):
52 jongui 835 """
53     Generate the specified number of contours within the specified range.
54 jongui 828
55 jongui 835 @type number_contours: Number
56     @param number_contours: Number of contours to generate
57     @type min_range: Number
58     @param min_range: Minimum contour value
59     @type max_range: Number
60     @param max_range: Maximum contour value
61     """
62 jongui 827
63 jongui 835 self.vtk_contour.GenerateValues(number_contours, min_range, max_range)
64 jongui 827
65 jongui 845 from contour import Contour
66     from geo import Plane
67 jongui 827
68 jongui 845 class ContourOnPlane(Contour, Plane):
69     """
70     Class that shows a scalar field by contour surfaces on a given plane.
71     """
72    
73     def __init__(self, scene, data_collector, lut = None):
74     """
75     @type scene: L{Scene <scene.Scene>} object
76     @param scene: Scene in which components rae to be added to
77     @type data_collector: L{DataCollector <datacollector.DataCollector>}
78     object
79     @param data_collector: Source of data for visualization
80     """
81    
82     Common.__init__(self, scene, data_collector)
83     self.setContour()
84    
85     Plane.__init__(self, scene, data_collector,
86     "self.vtk_contour.GetOutput()")

  ViewVC Help
Powered by ViewVC 1.1.26