1 |
jongui |
943 |
""" |
2 |
|
|
@author: John NGUI |
3 |
|
|
""" |
4 |
|
|
|
5 |
|
|
import vtk |
6 |
|
|
from mapper import DataSetMapper |
7 |
|
|
from actor import Actor3D |
8 |
|
|
from constant import Viewport |
9 |
|
|
from texture import Texture |
10 |
|
|
from plane import PlaneSource |
11 |
|
|
|
12 |
|
|
# NOTE: DataSetMapper, Actor3D, Texture and PlaneSource were inherited to |
13 |
|
|
# allow access to their public methods from the driver. |
14 |
|
|
class Image(DataSetMapper, Actor3D, Texture, PlaneSource): |
15 |
|
|
""" |
16 |
|
|
Class that displayes an image with interaction capability. |
17 |
|
|
""" |
18 |
|
|
|
19 |
|
|
# The SOUTH_WEST default viewport is used when there is only one viewport. |
20 |
|
|
# This saves the user from specifying the viewport when there is only one. |
21 |
|
|
def __init__(self, scene, image_reader, viewport = Viewport.SOUTH_WEST): |
22 |
|
|
""" |
23 |
|
|
@type scene: L{Scene <scene.Scene>} object |
24 |
|
|
@param scene: Scene in which objects are to be rendered on |
25 |
|
|
@type image_reader: L{ImageReader <datacollector.ImageReader>} |
26 |
|
|
object |
27 |
|
|
@param image_reader: Deal with source of image for visualisation |
28 |
|
|
@type viewport: L{Viewport <constant.Viewport>} constant |
29 |
|
|
@param viewport: Viewport in which the object is to be rendered on |
30 |
|
|
""" |
31 |
|
|
|
32 |
|
|
# ----- Image ----- |
33 |
|
|
print "image" |
34 |
|
|
Texture.__init__(self, image_reader._getOutput()) |
35 |
|
|
PlaneSource.__init__(self) |
36 |
|
|
DataSetMapper.__init__(self, PlaneSource._getOutput(self)) |
37 |
|
|
|
38 |
|
|
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
39 |
|
|
Actor3D._setTexture(self, Texture._getTexture(self)) |
40 |
|
|
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|