/[escript]/tags/trunk_2172_checkpoint/pyvisi/py_src/logo.py
ViewVC logotype

Contents of /tags/trunk_2172_checkpoint/pyvisi/py_src/logo.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2175 - (show annotations)
Wed Dec 17 09:22:40 2008 UTC (12 years, 2 months ago) by phornby
File MIME type: text/x-python
File size: 3074 byte(s)
Try again at conforming to naming convention.
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 """
23 @var __author__: name of author
24 @var __copyright__: copyrights
25 @var __license__: licence agreement
26 @var __url__: url entry point on documentation
27 @var __version__: version
28 @var __date__: date of the version
29 """
30
31 __author__="John Ngui, john.ngui@uq.edu.au"
32
33
34 import vtk
35 from mapper import ImageMapper
36 from imagereslice import ImageReslice
37 from actor import Actor2D
38 from constant import Viewport
39
40 # NOTE: ImageMapper, ImageReslice and Actor2D were inherited to allow access
41 # to their public methods from the driver.
42 class Logo(ImageMapper, ImageReslice, Actor2D):
43 """
44 Class that displays a static image, in particular a logo
45 (i.e. company symbol) and has NO interaction capability. The position and
46 size of the logo can be specified.
47 """
48
49 # The SOUTH_WEST default viewport is used when there is only one viewport.
50 # This saves the user from specifying the viewport when there is only one.
51 def __init__(self, scene, image_reader, viewport = Viewport.SOUTH_WEST):
52 """
53 @type scene: L{Scene <scene.Scene>} object
54 @param scene: Scene in which the logo is to be displayed
55 @type image_reader: L{ImageReader <imagereader.ImageReader>}
56 object
57 @param image_reader: Deal with source of data for vizualisation
58 @type viewport: L{Viewport <constant.Viewport>} constant
59 @param viewport: Viewport in which the logo is to be displayed
60 """
61
62 self.__image_reader = image_reader
63 self.__viewport = viewport
64
65 self.__modified = True # Keeps track whether Logo has been modified.
66 ImageReslice.__init__(self)
67 ImageMapper.__init__(self)
68 Actor2D.__init__(self)
69 scene._addVisualizationModules(self)
70
71 # ----- Logo -----
72
73 self._setupImageReslice(self.__image_reader._getImageReaderOutput())
74 self._setupImageMapper(self._getImageResliceOutput())
75
76 self._setupActor2D(self._getImageMapper())
77 scene._addActor2D(self.__viewport, self._getActor2D())
78
79 def _isModified(self):
80 """
81 Return whether the Logo or DataCollector has been modified.
82
83 @rtype: Boolean
84 @return: True or False
85 """
86
87 return self.__modified or self.__data_collector._isModified()
88
89 def _render(self, scene):
90 """
91 Render the logo.
92
93 @type scene: L{Scene <scene.Scene>} object
94 @param scene: Scene in which the logo is to be displayed
95 """
96
97 if (self._isModified() == True):
98 self.__modified = False
99
100
101

  ViewVC Help
Powered by ViewVC 1.1.26