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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1154 - (show annotations)
Fri May 18 02:46:32 2007 UTC (15 years, 10 months ago) by jongui
File MIME type: text/x-python
File size: 1994 byte(s)
Updated the in-line documentation and guide.
1 """
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. The position and
17 size of the logo can be specified.
18 """
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 object
28 @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 self.__scene = scene
34 self.__image_reader = image_reader
35 self.__viewport = viewport
36
37 self.__modified = True # Keeps track whether Logo has been modified.
38 ImageReslice.__init__(self)
39 ImageMapper.__init__(self)
40 Actor2D.__init__(self)
41 scene._addVisualizationModules(self)
42
43 # ----- Logo -----
44
45 self._setupImageReslice(self.__image_reader._getImageReaderOutput())
46 self._setupImageMapper(self._getImageResliceOutput())
47
48 self._setupActor2D(self._getImageMapper())
49 self.__scene._addActor2D(self.__viewport, self._getActor2D())
50
51 def _isModified(self):
52 """
53 Return whether the Logo or DataCollector has been modified.
54
55 @rtype: Boolean
56 @return: True or False
57 """
58
59 return self.__modified or self.__data_collector._isModified()
60
61 def _render(self):
62 """
63 Render the logo.
64 """
65
66 if (self._isModified() == True):
67 self.__modified = False
68
69
70

  ViewVC Help
Powered by ViewVC 1.1.26