fw4spl
fwRenderVTK/include/fwRenderVTK/IAdaptor.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
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 #pragma once
8 
9 #include "fwRenderVTK/config.hpp"
10 #include "fwRenderVTK/SRender.hpp"
11 
12 #include <fwCom/helper/SigSlotConnection.hpp>
13 
14 #include <fwServices/IHasServices.hpp>
15 #include <fwServices/IService.hpp>
16 
17 #include <string>
18 
19 class vtkProp;
20 class vtkPropCollection;
21 class vtkRenderer;
22 class vtkRenderWindowInteractor;
23 class vtkTransform;
24 
25 namespace fwRenderVTK
26 {
27 
31 class FWRENDERVTK_CLASS_API IAdaptor : public fwServices::IService,
33 {
34 friend class SRender;
35 public:
38 
40 
42  FWRENDERVTK_API void setRenderService( SRender::sptr service );
43 
45  FWRENDERVTK_API SRender::sptr getRenderService() const;
46 
48  FWRENDERVTK_API void setRendererId(SRender::RendererIdType newID);
49 
51  FWRENDERVTK_API SRender::RendererIdType getRendererId() const;
52 
54  FWRENDERVTK_API vtkRenderer* getRenderer();
55 
57  FWRENDERVTK_API void setPickerId(SRender::PickerIdType newID);
58 
60  FWRENDERVTK_API SRender::PickerIdType getPickerId() const;
61 
68  FWRENDERVTK_API vtkAbstractPropPicker* getPicker(std::string pickerId = "");
69 
71  FWRENDERVTK_API void setTransformId(SRender::VtkObjectIdType newID);
72 
74  FWRENDERVTK_API SRender::VtkObjectIdType getTransformId() const;
75 
77  FWRENDERVTK_API vtkTransform* getTransform();
78 
80  FWRENDERVTK_API vtkObject* getVtkObject(const SRender::VtkObjectIdType& objectId) const;
81 
83  FWRENDERVTK_API vtkRenderWindowInteractor* getInteractor();
84 
90  FWRENDERVTK_API IAdaptor::sptr getAssociatedAdaptor(vtkProp* prop, int depth);
91 
98  FWRENDERVTK_API void getAllSubProps(vtkPropCollection* propc, int depth = -1);
99 
101  FWRENDERVTK_API void setVtkPipelineModified();
102 
104  FWRENDERVTK_API bool getAutoRender() const;
105 
106 protected:
107 
111  FWRENDERVTK_API IAdaptor() noexcept;
112 
116  FWRENDERVTK_API virtual ~IAdaptor() noexcept;
117 
119  FWRENDERVTK_API void configureParams();
120 
122  FWRENDERVTK_API void initialize();
123 
125  FWRENDERVTK_API void registerProp(vtkProp* prop);
126 
128  FWRENDERVTK_API void unregisterProps();
129 
131  FWRENDERVTK_API void addToRenderer(vtkProp* prop);
132 
134  FWRENDERVTK_API void removeAllPropFromRenderer();
135 
141  FWRENDERVTK_API void addToPicker(vtkProp* prop, std::string pickerId = "");
142 
148  FWRENDERVTK_API void removeFromPicker(vtkProp* prop, std::string pickerId = "");
149 
155  FWRENDERVTK_API static void getProps(vtkPropCollection* outPropc, vtkProp* inProp);
156 
158  FWRENDERVTK_API void requestRender();
159 
161  bool m_vtkPipelineModified;
162  SRender::RendererIdType m_rendererId;
163  SRender::PickerIdType m_pickerId;
164  SRender::VtkObjectIdType m_transformId;
165  SRender::wptr m_renderService;
166 
167  vtkPropCollection* m_propCollection;
168 
169  ::fwCom::helper::SigSlotConnection m_connections;
170 };
171 
172 }
Base class for all services.
Definition: IService.hpp:61
Interface for objects that need to manage services.
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
STL namespace.
The generic scene service shows adaptors in a 3D VTK scene.
#define fwCoreAllowSharedFromThis()
Generate getSptr and getConstSptr methods.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace fwRenderVTK contains classes for rendering with VTK.