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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 834 by jongui, Thu Aug 31 05:41:09 2006 UTC revision 835 by jongui, Mon Sep 4 22:20:28 2006 UTC
# Line 1  Line 1 
1  """  """
2  class that shows scalar data by contour surfaces  Class that shows a scalar field by contour surfaces.
   
 @var __author__: name of author  
 @var __license__: licence agreement  
 @var __copyright__: copyrights  
 @var __url__: url entry point on documentation  
 @var __version__: version  
 @var __date__: date of the version  
3  """  """
 __copyright__="""  Copyright (c) 2006 by ACcESS MNRF  
                     http://www.access.edu.au  
                 Primary Business: Queensland, Australia"""  
 __license__="""Licensed under the Open Software License version 3.0  
              http://www.opensource.org/licenses/osl-3.0.php"""  
 __author__="Paul Cochrane, L. Gross"  
 __url__="http://www.iservo.edu.au/esys"  
 __version__="$Revision:$"  
 __date__="$Date:$"  
4    
5  import vtk  import vtk
6  from common import *  from common import *
7    
8  class Contour(Common):  class Contour(Common):
9        """
10        @author: John Ngui
11        @author: Lutz Gross
12        """
13            
14      def __init__(self, open_scene, data_collector):      def __init__(self, open_scene, data_collector):
15          Common.__init__(self, open_scene, data_collector)          """
16          #self.open_scene = open_scene          @type open_scene: L{OpenScene <openscene.OpenScene>} object
17          #self.data_collector = data_collector          @param open_scene: Scene in which components are to be added to
18          #self.vtk_contour = None          @type data_collector: L{DataCollector <datacollector.DataCollector>}
19          #self.vtk_contour_mapper = None              object
20          #self.vtk_contour_actor = None          @param data_collector: Source of data for visualization
21            """
22    
23            Common.__init__(self, open_scene, data_collector)
24          self.setContour()          self.setContour()
         #self.setMapper()  
         #self.setActor()  
25    
26          Common.setMapper(self, "self.vtk_contour.GetOutput()")          Common.setMapper(self, "self.vtk_contour.GetOutput()")
27          Common.setActor(self)          Common.setActor(self)
28          Common.addActor(self)          Common.addActor(self)
29    
     # set up the contour and specify the number and range  
30      def setContour(self):      def setContour(self):
31            """
32            Set up the contour and its input.
33            """
34    
35          self.vtk_contour = vtk.vtkContourFilter()          self.vtk_contour = vtk.vtkContourFilter()
36          self.vtk_contour.SetInput(self.data_collector.getReader().GetOutput())          self.vtk_contour.SetInput(self.data_collector.getReader().GetOutput())
37    
38      def setValue(self, contour_number, value):      def setValue(self, contour_number, value):
39            """
40            Set the contour number and its value.
41    
42            @type contour_number: Number
43            @param contour_number: Contour number
44            @type value: Number
45            @param value: Contour value
46            """
47    
48          self.vtk_contour.SetValue(contour_number, value)          self.vtk_contour.SetValue(contour_number, value)
49    
50      def generateValues(self, number_contours, min_range, max_range):      def generateValues(self, number_contours, min_range, max_range):
51          self.vtk_contour.GenerateValues(number_contours, min_range, max_range)          """
52            Generate the specified number of contours within the specified range.
53    
54      # set up the mapper and data              @type number_contours: Number
55      #def setMapper(self):          @param number_contours: Number of contours to generate  
56      #   self.vtk_contour_mapper = vtk.vtkPolyDataMapper()          @type min_range: Number
57      #   self.vtk_contour_mapper.SetInput(          @param min_range: Minimum contour value
58      #       self.vtk_contour.GetOutput())          @type max_range: Number
59                @param max_range: Maximum contour value
60      # set up the actor and add the actor to the scene          """
     #def setActor(self):  
     #   self.vtk_contour_actor = vtk.vtkActor()  
     #   self.vtk_contour_actor.SetMapper(self.vtk_contour_mapper)  
     #   self.vtk_contour_actor.GetProperty().SetOpacity(0.6)  
61    
62      #   self.open_scene.getRenderer().AddActor(self.vtk_contour_actor)          self.vtk_contour.GenerateValues(number_contours, min_range, max_range)
63    
64    
65  #class ContourOnPlane(Component):  #class ContourOnPlane(Component):

Legend:
Removed from v.834  
changed lines
  Added in v.835

  ViewVC Help
Powered by ViewVC 1.1.26