/[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 1148 - (hide annotations)
Wed May 16 22:45:33 2007 UTC (12 years, 3 months ago) by jongui
File MIME type: text/x-python
File size: 1941 byte(s)
Added the updated files for pyvisi and removed some incorrect reference images.
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     Class that displays a static image in particular a logo
16     (i.e. company symbol) and has NO interaction capability.
17     """
18    
19     # The SOUTH_WEST default viewport is used when there is only one viewport.
20     # This saves the user from specifying the viewport when there is only one.
21     def __init__(self, scene, image_reader, viewport = Viewport.SOUTH_WEST):
22     """
23     @type scene: L{Scene <scene.Scene>} object
24     @param scene: Scene in which the logo is to be displayed
25     @type image_reader: L{ImageReader <imagereader.ImageReader>}
26 jongui 1148 object
27 ksteube 1147 @param image_reader: Deal with source of data for vizualisation
28     @type viewport: L{Viewport <constant.Viewport>} constant
29     @param viewport: Viewport in which the logo is to be displayed
30     """
31    
32 jongui 1148 self.__scene = scene
33     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     self.__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     def _render(self):
61     """
62     Render the logo.
63     """
64    
65     if (self._isModified() == True):
66     self.__modified = False
67    
68    
69    

  ViewVC Help
Powered by ViewVC 1.1.26