fw4spl
SCube.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include "visuVTKAdaptor/SCube.hpp"
8 
9 #include <fwServices/macros.hpp>
10 
11 #include <vtkActor.h>
12 #include <vtkCubeSource.h>
13 #include <vtkPolyDataMapper.h>
14 #include <vtkRenderer.h>
15 
16 fwServicesRegisterMacro( ::fwRenderVTK::IAdaptor, ::visuVTKAdaptor::SCube);
17 
18 namespace visuVTKAdaptor
19 {
20 
21 //------------------------------------------------------------------------------
22 
23 SCube::SCube() noexcept
24 {
25 
26 }
27 
28 //------------------------------------------------------------------------------
29 
30 SCube::~SCube() noexcept
31 {
32 
33 }
34 
35 //------------------------------------------------------------------------------
36 
38 {
39  this->configureParams();
40 }
41 
42 //------------------------------------------------------------------------------
43 
45 {
46  this->initialize();
47 
48  vtkCubeSource* cube = vtkCubeSource::New();
49  vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
50  mapper->SetInputConnection(cube->GetOutputPort());
51  vtkActor* actor = vtkActor::New();
52  actor->SetMapper(mapper);
53  this->addToRenderer(actor);
54  this->setVtkPipelineModified();
55  this->requestRender();
56 }
57 
58 //------------------------------------------------------------------------------
59 
61 {
62 
63 }
64 
65 //------------------------------------------------------------------------------
66 
68 {
70  this->requestRender();
71 }
72 
73 //------------------------------------------------------------------------------
74 
75 } //namespace visuVTKAdaptor
FWRENDERVTK_API void addToRenderer(vtkProp *prop)
Adds the vtkProp to the renderer.
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
FWRENDERVTK_API void configureParams()
Parse the xml configuration for renderer, picker and transform.
FWRENDERVTK_API void requestRender()
notify a render request iff vtkPipeline is modified
FWRENDERVTK_API void setVtkPipelineModified()
End-user have to call this method when a vtk structure has been modified, thus a render request will ...
FWRENDERVTK_API void removeAllPropFromRenderer()
Removes all the vtkProp from the renderer.
Render a cube on the generic scene.
Definition: SCube.hpp:31
VISUVTKADAPTOR_API void starting() override
Initialize the service activity.
Definition: SCube.cpp:44
VISUVTKADAPTOR_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
Definition: SCube.cpp:67
VISUVTKADAPTOR_API void configuring() override
Configure the service before starting. Apply the configuration to service.
Definition: SCube.cpp:37
FWRENDERVTK_API void initialize()
Initialize the adaptor with the associated render service. (must be call in starting).
VISUVTKADAPTOR_API void updating() override
Perform some computations according to object (this service is attached to) attribute values and its ...
Definition: SCube.cpp:60