/[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 1108 - (show annotations)
Thu Apr 19 04:02:11 2007 UTC (15 years, 11 months ago) by jongui
File MIME type: text/x-python
File size: 1620 byte(s)
Added modules that allows logos (i.e. access logo) to be inserted together with the rendered object. An example on how to use the 'Logo' class has also been provided.

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 an image which can be scaled (upwards and downwards).
16 The image can also be translated and rotated along the X, Y and Z axes.
17
18 @bug: Translating an image works differently (opposite) compared to
19 translating a plane. For example, a positive translation along the
20 z-axis moves a plane up. However, if the identical translation is applied on
21 an image, the image moves down.
22 """
23
24 # The SOUTH_WEST default viewport is used when there is only one viewport.
25 # This saves the user from specifying the viewport when there is only one.
26 def __init__(self, scene, image_reader, viewport = Viewport.SOUTH_WEST):
27 """
28 @type scene: L{Scene <scene.Scene>} object
29 @param scene: Scene in which objects are to be rendered on
30 @type image_reader: L{ImageReader <imagereader.ImageReader>}
31 object
32 @param image_reader: Deal with source of image for vizualisation
33 @type viewport: L{Viewport <constant.Viewport>} constant
34 @param viewport: Viewport in which objects are to be rendered on
35 """
36
37 # ----- Image -----
38
39 ImageReslice.__init__(self, image_reader._getOutput())
40 ImageMapper.__init__(self, ImageReslice._getOutput(self))
41
42 Actor2D.__init__(self, ImageMapper._getImageMapper(self))
43 scene._addActor2D(viewport, Actor2D._getActor2D(self))
44

  ViewVC Help
Powered by ViewVC 1.1.26