/[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 827 by jongui, Wed Aug 30 00:08:02 2006 UTC revision 828 by jongui, Wed Aug 30 07:52:35 2006 UTC
# Line 19  __version__="$Revision:$" Line 19  __version__="$Revision:$"
19  __date__="$Date:$"  __date__="$Date:$"
20    
21  import vtk  import vtk
22    from common import *
23    
24  class Contour:  class Contour(Common):
25            
26      def __init__(self, open_scene, data_collector):      def __init__(self, open_scene, data_collector):
27          self.open_scene = open_scene          Common.__init__(self, open_scene, data_collector)
28          self.data_collector = data_collector          #self.open_scene = open_scene
29          self.vtk_contour = None          #self.data_collector = data_collector
30          self.vtk_contour_mapper = None          #self.vtk_contour = None
31          self.vtk_contour_actor = None          #self.vtk_contour_mapper = None
32            #self.vtk_contour_actor = None
33    
34          self.setContour()          self.setContour()
35          self.setMapper()          #self.setMapper()
36          self.setActor()          #self.setActor()
37    
38            Common.setMapper(self, "self.vtk_contour.GetOutput()")
39            Common.setActor(self)
40            Common.addActor(self)
41    
42      # set up the contour and specify the number and range      # set up the contour and specify the number and range
43      def setContour(self):      def setContour(self):
44          self.vtk_contour = vtk.vtkContourFilter()          self.vtk_contour = vtk.vtkContourFilter()
45          self.vtk_contour.SetInput(self.data_collector.getReader().GetOutput())          self.vtk_contour.SetInput(self.data_collector.getReader().GetOutput())
46          self.vtk_contour.GenerateValues(5, 0.0, 1.2)  
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      # set up the mapper and data          # set up the mapper and data    
54      def setMapper(self):      #def setMapper(self):
55          self.vtk_contour_mapper = vtk.vtkPolyDataMapper()      #   self.vtk_contour_mapper = vtk.vtkPolyDataMapper()
56          self.vtk_contour_mapper.SetInput(      #   self.vtk_contour_mapper.SetInput(
57              self.vtk_contour.GetOutput())      #       self.vtk_contour.GetOutput())
58            
59      # set up the actor and add the actor to the scene      # set up the actor and add the actor to the scene
60      def setActor(self):      #def setActor(self):
61          self.vtk_contour_actor = vtk.vtkActor()      #   self.vtk_contour_actor = vtk.vtkActor()
62          self.vtk_contour_actor.SetMapper(self.vtk_contour_mapper)      #   self.vtk_contour_actor.SetMapper(self.vtk_contour_mapper)
63          self.vtk_contour_actor.GetProperty().SetOpacity(0.6)      #   self.vtk_contour_actor.GetProperty().SetOpacity(0.6)
64    
65          self.open_scene.getRenderer().AddActor(self.vtk_contour_actor)      #   self.open_scene.getRenderer().AddActor(self.vtk_contour_actor)
66    
67    
68  #class ContourOnPlane(Component):  #class ContourOnPlane(Component):

Legend:
Removed from v.827  
changed lines
  Added in v.828

  ViewVC Help
Powered by ViewVC 1.1.26