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

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

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

revision 802 by gross, Wed Aug 9 09:21:00 2006 UTC revision 828 by jongui, Wed Aug 30 07:52:35 2006 UTC
# Line 18  __url__="http://www.iservo.edu.au/esys" Line 18  __url__="http://www.iservo.edu.au/esys"
18  __version__="$Revision:$"  __version__="$Revision:$"
19  __date__="$Date:$"  __date__="$Date:$"
20    
21  class Property(object):  import vtk
22      def __init__(self,val=None):  
23         self.setValue(val)  class Common:
24    
25      def setValue(self,val):      def __init__(self, open_scene, data_collector):
26         self.__val=val          self.open_scene = open_scene
27         self.__altered=True          self.data_collector = data_collector
28            self.vtk_mapper = None
29      def getValue(self):          self.vtk_actor = None
30         return self.__val  
31        def setMapper(self, component):
32      def isAltered(self):          self.vtk_mapper = vtk.vtkDataSetMapper()
33         return self.__altered          eval("self.vtk_mapper.SetInput(%s)" % component)
34    
35      def markAsUsed(self):      def setActor(self):
36         self.__altered=False          self.vtk_actor = vtk.vtkActor()
37            self.vtk_actor.SetMapper(self.vtk_mapper)
38      
39  class Component(object):      def addActor(self):
40      """          self.open_scene.getRenderer().AddActor(self.vtk_actor)
41      shows a vector field by arrows  
42      """      def setOpacity(self, opacity):
43      def __init__(self):          self.getProperty().SetOpacity(opacity)
44         self.features={} # item must be a Component or Property  
45        def setColor(self, red, green, blue):
46      def render(self):          self.getProperty().SetColor(red, green, blue)
47         for i in self.features:  
48            if isinstance(self.features[i],Component):      def setRepresentation(self, representation):
49               self.features[i].render()          eval("self.getProperty().SetRepresentationTo%s()" % representation)
50         self._render()      
51        def getProperty(self):
52      def markFeaturesAsUsed(self):          return self.vtk_actor.GetProperty()
53         for i in self.features:  
54            if isinstance(self.features[i],Component):          
              self.features[i].markAsUsed()  
           else:  
              self.features[i].markFeaturesAsUsed()  

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

  ViewVC Help
Powered by ViewVC 1.1.26