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

Annotation of /trunk/pyvisi/py_src/logo.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1158 - (hide annotations)
Tue May 22 04:24:01 2007 UTC (12 years, 3 months ago) by jongui
File MIME type: text/x-python
File size: 2076 byte(s)
Made some changes to fix the memory leak problem. However, the problem still persists for run_escript_with_lazy_evaluation.py, run_streamline.py and run_streamline_with_lazy_evaluation.py.

1 ksteube 1147 """
2     @author: John NGUI
3     """
4    
5     import vtk
6     from mapper import ImageMapper
7     from imagereslice import ImageReslice
8     from actor import Actor2D
9     from constant import Viewport
10    
11     # NOTE: ImageMapper, ImageReslice and Actor2D were inherited to allow access
12     # to their public methods from the driver.
13     class Logo(ImageMapper, ImageReslice, Actor2D):
14     """
15 jongui 1154 Class that displays a static image, in particular a logo
16     (i.e. company symbol) and has NO interaction capability. The position and
17     size of the logo can be specified.
18 ksteube 1147 """
19    
20     # The SOUTH_WEST default viewport is used when there is only one viewport.
21     # This saves the user from specifying the viewport when there is only one.
22     def __init__(self, scene, image_reader, viewport = Viewport.SOUTH_WEST):
23     """
24     @type scene: L{Scene <scene.Scene>} object
25     @param scene: Scene in which the logo is to be displayed
26     @type image_reader: L{ImageReader <imagereader.ImageReader>}
27 jongui 1148 object
28 ksteube 1147 @param image_reader: Deal with source of data for vizualisation
29     @type viewport: L{Viewport <constant.Viewport>} constant
30     @param viewport: Viewport in which the logo is to be displayed
31     """
32    
33 jongui 1148 self.__image_reader = image_reader
34     self.__viewport = viewport
35    
36     self.__modified = True # Keeps track whether Logo has been modified.
37     ImageReslice.__init__(self)
38     ImageMapper.__init__(self)
39     Actor2D.__init__(self)
40     scene._addVisualizationModules(self)
41    
42 ksteube 1147 # ----- Logo -----
43    
44 jongui 1148 self._setupImageReslice(self.__image_reader._getImageReaderOutput())
45     self._setupImageMapper(self._getImageResliceOutput())
46 ksteube 1147
47 jongui 1148 self._setupActor2D(self._getImageMapper())
48 jongui 1158 scene._addActor2D(self.__viewport, self._getActor2D())
49 ksteube 1147
50 jongui 1148 def _isModified(self):
51     """
52     Return whether the Logo or DataCollector has been modified.
53    
54     @rtype: Boolean
55     @return: True or False
56     """
57    
58     return self.__modified or self.__data_collector._isModified()
59    
60 jongui 1158 def _render(self, scene):
61 jongui 1148 """
62     Render the logo.
63 jongui 1158
64     @type scene: L{Scene <scene.Scene>} object
65     @param scene: Scene in which the logo is to be displayed
66 jongui 1148 """
67    
68     if (self._isModified() == True):
69     self.__modified = False
70    
71    
72    

  ViewVC Help
Powered by ViewVC 1.1.26