/[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 2365 - (show annotations)
Mon Apr 6 01:25:25 2009 UTC (10 years, 4 months ago) by gross
File MIME type: text/x-python
File size: 3135 byte(s)
all tests passed under scons on 4 mpi processes with  openmpi on shake34
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__="https://launchpad.net/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 from mapper import ImageMapper
35 from imagereslice import ImageReslice
36 from actor import Actor2D
37 from constant import Viewport
38 from esys.escript import getMPISizeWorld
39 if getMPISizeWorld()==1: import vtk
40
41 # NOTE: ImageMapper, ImageReslice and Actor2D were inherited to allow access
42 # to their public methods from the driver.
43 class Logo(ImageMapper, ImageReslice, Actor2D):
44 """
45 Class that displays a static image, in particular a logo
46 (i.e. company symbol) and has NO interaction capability. The position and
47 size of the logo can be specified.
48 """
49
50 # The SOUTH_WEST default viewport is used when there is only one viewport.
51 # This saves the user from specifying the viewport when there is only one.
52 def __init__(self, scene, image_reader, viewport = Viewport.SOUTH_WEST):
53 """
54 @type scene: L{Scene <scene.Scene>} object
55 @param scene: Scene in which the logo is to be displayed
56 @type image_reader: L{ImageReader <imagereader.ImageReader>}
57 object
58 @param image_reader: Deal with source of data for vizualisation
59 @type viewport: L{Viewport <constant.Viewport>} constant
60 @param viewport: Viewport in which the logo is to be displayed
61 """
62
63 self.__image_reader = image_reader
64 self.__viewport = viewport
65
66 self.__modified = True # Keeps track whether Logo has been modified.
67 ImageReslice.__init__(self)
68 ImageMapper.__init__(self)
69 Actor2D.__init__(self)
70 scene._addVisualizationModules(self)
71
72 # ----- Logo -----
73
74 self._setupImageReslice(self.__image_reader._getImageReaderOutput())
75 self._setupImageMapper(self._getImageResliceOutput())
76
77 self._setupActor2D(self._getImageMapper())
78 scene._addActor2D(self.__viewport, self._getActor2D())
79
80 def _isModified(self):
81 """
82 Return whether the Logo or DataCollector has been modified.
83
84 @rtype: Boolean
85 @return: True or False
86 """
87
88 return self.__modified or self.__data_collector._isModified()
89
90 def _render(self, scene):
91 """
92 Render the logo.
93
94 @type scene: L{Scene <scene.Scene>} object
95 @param scene: Scene in which the logo is to be displayed
96 """
97
98 if (self._isModified() == True):
99 self.__modified = False
100
101
102

  ViewVC Help
Powered by ViewVC 1.1.26