1 |
""" |
2 |
@var __author__: name of author |
3 |
@var __copyright__: copyrights |
4 |
@var __license__: licence agreement |
5 |
@var __url__: url entry point on documentation |
6 |
@var __version__: version |
7 |
@var __date__: date of the version |
8 |
""" |
9 |
|
10 |
__author__="John Ngui, john.ngui@uq.edu.au" |
11 |
__copyright__=""" Copyright (c) 2006 by ACcESS MNRF |
12 |
http://www.access.edu.au |
13 |
Primary Business: Queensland, Australia""" |
14 |
__license__="""Licensed under the Open Software License version 3.0 |
15 |
http://www.opensource.org/licenses/osl-3.0.php""" |
16 |
__url__="http://www.iservo.edu.au/esys" |
17 |
__version__="$Revision$" |
18 |
__date__="$Date$" |
19 |
|
20 |
|
21 |
import vtk |
22 |
from mapper import DataSetMapper |
23 |
from actor import Actor3D |
24 |
from constant import Viewport |
25 |
from cube import CubeSource |
26 |
|
27 |
# NOTE: CubeSource, DataSetMapper and Actor3D were inherited to allow |
28 |
# access to their public methods from the driver. |
29 |
class Rectangle(CubeSource, DataSetMapper, Actor3D): |
30 |
""" |
31 |
Class that generates a rectangle box. |
32 |
""" |
33 |
|
34 |
# The SOUTH_WEST default viewport is used when there is only one viewport. |
35 |
# This saves the user from specifying the viewport when there is only one. |
36 |
def __init__(self, scene, viewport = Viewport.SOUTH_WEST): |
37 |
""" |
38 |
Initialise the Rectangle. |
39 |
|
40 |
@type scene: L{Scene <scene.Scene>} object |
41 |
@param scene: Scene in which objects are to be rendered on |
42 |
@type viewport: L{Viewport <constant.Viewport>} constant |
43 |
@param viewport: Viewport in which objects are to be rendered on |
44 |
""" |
45 |
|
46 |
self.__viewport = viewport |
47 |
|
48 |
CubeSource.__init__(self) |
49 |
DataSetMapper.__init__(self) |
50 |
Actor3D.__init__(self) |
51 |
|
52 |
# ----- Rectangle ----- |
53 |
|
54 |
self._setupDataSetMapper(self._getCubeSourceOutput()) |
55 |
|
56 |
self._setupActor3D(self._getDataSetMapper()) |
57 |
scene._addActor3D(self.__viewport, self._getActor3D()) |
58 |
|
59 |
|
60 |
|