7 #include "visuVTKAdaptor/SInteractorStyle.hpp" 9 #include <fwRenderVTK/IInteractorStyle.hpp> 11 #include <fwServices/macros.hpp> 13 #include <vtkInstantiator.h> 14 #include <vtkInteractorStyleImage.h> 15 #include <vtkRenderWindowInteractor.h> 24 SInteractorStyle::SInteractorStyle() noexcept :
25 m_interactorStyle(
nullptr)
31 SInteractorStyle::~SInteractorStyle() noexcept
33 SLM_ASSERT(
"SInteractorStyle should be NULL", !m_interactorStyle);
42 const ConfigType config = this->
getConfigTree().get_child(
"config.<xmlattr>");
44 SLM_ASSERT(
"Missing attribute 'style'", config.count(
"style"));
45 m_configuredStyle = config.get<std::string>(
"style");
54 vtkObject* objectStyle = vtkInstantiator::CreateInstance(m_configuredStyle.c_str());
55 vtkInteractorStyle* interactor = vtkInteractorStyle::SafeDownCast(objectStyle);
56 SLM_ASSERT(
"InsteractorStyle adaptor is waiting for a vtkInteractorStyle object, but '" 57 + m_configuredStyle +
"' has been given.", interactor);
58 this->setInteractorStyle(interactor);
71 this->setInteractorStyle(
nullptr);
76 void SInteractorStyle::setInteractorStyle(vtkInteractorStyle* interactor)
78 if ( m_interactorStyle !=
nullptr )
80 m_interactorStyle->Delete();
81 m_interactorStyle =
nullptr;
90 m_interactorStyle = interactor;
FWRENDERVTK_API vtkRenderWindowInteractor * getInteractor()
Returns the render interactor.
IInteractorStyle is an interface dedicated to hold some flags for class inherited from vtkInteractorS...
VISUVTKADAPTOR_API void starting() override
Initialize the service activity.
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
VISUVTKADAPTOR_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
VISUVTKADAPTOR_API void configuring() override
Configure the service before starting. Apply the configuration to service.
FWRENDERVTK_API void configureParams()
Parse the xml configuration for renderer, picker and transform.
FWRENDERVTK_API bool getAutoRender() const
Returns true if the service automatically triggers the rendering.
FWRENDERVTK_API void setVtkPipelineModified()
End-user have to call this method when a vtk structure has been modified, thus a render request will ...
void setAutoRender(bool _autoRender)
Set the autorender flag.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
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 ...
Managing vtk interactor style.
Base class for VTK adaptors.
FWSERVICES_API ConfigType getConfigTree() const
Return the configuration, in an boost property tree.