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 DataSetMapper |
36 |
from actor import Actor3D |
37 |
from constant import Viewport |
38 |
from cube import CubeSource |
39 |
|
40 |
# NOTE: CubeSource, DataSetMapper and Actor3D were inherited to allow |
41 |
# access to their public methods from the driver. |
42 |
class Rectangle(CubeSource, DataSetMapper, Actor3D): |
43 |
""" |
44 |
Class that generates a rectangle box. |
45 |
""" |
46 |
|
47 |
# The SOUTH_WEST default viewport is used when there is only one viewport. |
48 |
# This saves the user from specifying the viewport when there is only one. |
49 |
def __init__(self, scene, viewport = Viewport.SOUTH_WEST): |
50 |
""" |
51 |
Initialise the Rectangle. |
52 |
|
53 |
@type scene: L{Scene <scene.Scene>} object |
54 |
@param scene: Scene in which objects are to be rendered on |
55 |
@type viewport: L{Viewport <constant.Viewport>} constant |
56 |
@param viewport: Viewport in which objects are to be rendered on |
57 |
""" |
58 |
|
59 |
self.__viewport = viewport |
60 |
|
61 |
CubeSource.__init__(self) |
62 |
DataSetMapper.__init__(self) |
63 |
Actor3D.__init__(self) |
64 |
|
65 |
# ----- Rectangle ----- |
66 |
|
67 |
self._setupDataSetMapper(self._getCubeSourceOutput()) |
68 |
|
69 |
self._setupActor3D(self._getDataSetMapper()) |
70 |
scene._addActor3D(self.__viewport, self._getActor3D()) |
71 |
|
72 |
|
73 |
|