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

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

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

revision 851 by jongui, Fri Sep 15 07:11:55 2006 UTC revision 852 by jongui, Wed Sep 20 03:23:16 2006 UTC
# Line 5  Line 5 
5    
6  import vtk  import vtk
7  from style import Style  from style import Style
 #from colormap import *  
8    
9  class Text:  class Text:
10      """      """
# Line 19  class Text: Line 18  class Text:
18          """          """
19    
20          self.scene = scene          self.scene = scene
21          self.vtk_text_mapper = None          self.vtk_text_mapper = vtk.vtkTextMapper()
22          self.vtk_text_actor = None          self.vtk_text_actor = vtk.vtkScaledTextActor()
23    
24      def setText(self, text):      def setText(self, text):
25          """          """
# Line 30  class Text: Line 29  class Text:
29          @param text: Text to be displayed            @param text: Text to be displayed  
30          """          """
31    
         self.vtk_text_mapper = vtk.vtkTextMapper()  
32          self.vtk_text_mapper.SetInput(text)          self.vtk_text_mapper.SetInput(text)
33                    
34          self.setActor()          self.setActor()
35          self.addActor()          self.addActor()
36    
     def setPosition(self, x_coor, y_coor):  
         self.vtk_text_actor.SetDisplayPosition(x_coor, y_coor)  
   
     def setStyle(self, style):  
         self.vtk_text_mapper.SetTextProperty(style.getStyle())        
   
   
37      def setActor(self):      def setActor(self):
38          """          """
39          Set up the 2D text actor, its mapper and its display position.          Set up the 2D text actor, its mapper and its display position.
40          """          """
41    
         self.vtk_text_actor = vtk.vtkScaledTextActor()  
42          self.vtk_text_actor.SetMapper(self.vtk_text_mapper)          self.vtk_text_actor.SetMapper(self.vtk_text_mapper)
43          self.vtk_text_actor.SetDisplayPosition(50, 20)          self.setPosition(50, 20) # Default text position
44    
45      def addActor(self):      def addActor(self):
46          """          """
# Line 59  class Text: Line 49  class Text:
49    
50          self.scene.getRenderer().AddActor2D(self.vtk_text_actor)          self.scene.getRenderer().AddActor2D(self.vtk_text_actor)
51    
52        def setPosition(self, x_coor, y_coor):
53            self.vtk_text_actor.SetDisplayPosition(x_coor, y_coor)
54    
55        def setStyle(self, style):
56            self.vtk_text_mapper.SetTextProperty(style.getStyle())      
57    
58    
59    
60    
61    
62            

Legend:
Removed from v.851  
changed lines
  Added in v.852

  ViewVC Help
Powered by ViewVC 1.1.26