/[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 2881 - (show annotations)
Thu Jan 28 02:03:15 2010 UTC (11 years, 1 month ago) by jfenwick
File MIME type: text/x-python
File size: 3055 byte(s)
Don't panic.
Updating copyright stamps

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2010 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-2010 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: `Scene` object
55 :param scene: Scene in which the logo is to be displayed
56 :type image_reader: `ImageReader` object
57 :param image_reader: Deal with source of data for vizualisation
58 :type viewport: `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: `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