23 |
|
|
24 |
self.scene = scene |
self.scene = scene |
25 |
self.data_collector = data_collector |
self.data_collector = data_collector |
26 |
self.vtk_mapper = None |
self.vtk_mapper = vtk.vtkDataSetMapper() |
27 |
self.vtk_actor = None |
self.vtk_actor = vtk.vtkActor() |
28 |
|
|
29 |
def setMapper(self, component, lut = None): |
def setMapperInput(self, component, lut = None): |
30 |
""" |
""" |
31 |
Set up the mapper and its input. |
Set up the mapper and its input. |
32 |
|
|
37 |
@param lut: Color lookup table to be used by the mapper |
@param lut: Color lookup table to be used by the mapper |
38 |
""" |
""" |
39 |
|
|
40 |
self.vtk_mapper = vtk.vtkDataSetMapper() |
self.vtk_mapper.SetInput(component) |
41 |
eval("self.vtk_mapper.SetInput(%s)" % component) |
#eval("self.vtk_mapper.SetInput(%s)" % component) |
42 |
|
|
43 |
if(lut != None): |
if(lut != None): |
44 |
self.vtk_mapper.SetLookupTable(lut.getLut()) |
self.vtk_mapper.SetLookupTable(lut.getLut()) |
45 |
|
|
46 |
def setActor(self): |
def setMapperTexture(self, texture): |
|
""" |
|
|
Set up the actor and its mapper. |
|
|
""" |
|
|
|
|
|
self.vtk_actor = vtk.vtkActor() |
|
|
self.vtk_actor.SetMapper(self.vtk_mapper) |
|
|
|
|
|
def setTexture(self, texture): |
|
47 |
""" |
""" |
48 |
Set the texture of the actor. |
Set the texture of the actor. |
49 |
|
|
52 |
""" |
""" |
53 |
self.vtk_actor.SetTexture(texture) |
self.vtk_actor.SetTexture(texture) |
54 |
|
|
55 |
|
def setActorInput(self): |
56 |
|
""" |
57 |
|
Set up the actor and its mapper. |
58 |
|
""" |
59 |
|
self.vtk_actor.SetMapper(self.vtk_mapper) |
60 |
|
|
61 |
|
|
62 |
def addActor(self): |
def addActor(self): |
63 |
""" |
""" |
64 |
Add the actor to the renderer. |
Add the actor to the renderer. |
66 |
|
|
67 |
self.scene.getRenderer().AddActor(self.vtk_actor) |
self.scene.getRenderer().AddActor(self.vtk_actor) |
68 |
|
|
69 |
def setOpacity(self, opacity): |
def setActorOpacity(self, opacity): |
70 |
""" |
""" |
71 |
Set the opacity (transparency) of the actor. |
Set the opacity (transparency) of the actor. |
72 |
|
|
74 |
@param opacity: Opacity (transparency) of the actor |
@param opacity: Opacity (transparency) of the actor |
75 |
""" |
""" |
76 |
|
|
77 |
self.getProperty().SetOpacity(opacity) |
self.vtk_actor.GetProperty().SetOpacity(opacity) |
78 |
|
|
79 |
def setColor(self, red, green, blue): |
def setActorColor(self, color): |
80 |
self.getProperty().SetColor(red, green, blue) |
self.vtk_actor.GetProperty().SetColor(color[0], color[1], |
81 |
|
color[2]) |
82 |
|
|
83 |
def setRepresentation(self, representation): |
def setActorRepresentation(self, representation): |
84 |
""" |
""" |
85 |
Set the representation of the actor. |
Set the representation of the actor. |
86 |
|
|
88 |
@param representation: Representation type (I{i.e. Wireframe}) |
@param representation: Representation type (I{i.e. Wireframe}) |
89 |
""" |
""" |
90 |
|
|
91 |
eval("self.getProperty().SetRepresentationTo%s()" % representation) |
eval("self.vtk_actor.GetProperty().SetRepresentationTo%s()" % |
92 |
|
representation) |
93 |
|
|
|
def getProperty(self): |
|
|
""" |
|
|
Return the property of the actor. |
|
|
|
|
|
@rtype: vtkProperty |
|
|
@return: VTK property |
|
|
""" |
|
94 |
|
|
|
return self.vtk_actor.GetProperty() |
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
class Component: |
class Component: |
96 |
pass |
pass |