Commit c7a72d36 authored by arnaud.charnoz@gmail.com's avatar arnaud.charnoz@gmail.com
Browse files

scene 2D Adaptor can now manage sub adaptor

--HG--
branch : fw4spl_0.8.3
parent 9d20c4de
......@@ -146,9 +146,22 @@ protected:
// viewport is the same as preceding.
ViewportSizeRatio m_viewportInitialSize;
typedef std::pair< ::scene2D::adaptor::IAdaptor::wptr, ::fwServices::ComChannelService::wptr > AdaptorAndComType;
typedef std::vector< AdaptorAndComType > ManagedAdaptorVector;
/// Return all managed adaptor
SCENE2D_API ManagedAdaptorVector & getRegisteredServices() { return m_managedAdaptors; };
/// Register new adaptor and create his communication channel
SCENE2D_API void registerService( ::fwData::Object::sptr obj, ::scene2D::adaptor::IAdaptor::sptr srv );
/// Unregister all adaptors
SCENE2D_API void unregisterServices();
private:
// All managed adaptors & their communication channel
ManagedAdaptorVector m_managedAdaptors;
/// The render that manage the IAdaptor.
::scene2D::Render::wptr m_scene2DRender;
......
......@@ -307,6 +307,33 @@ void IAdaptor::processInteraction( ::scene2D::data::Event::sptr _event )
//-----------------------------------------------------------------------------
void IAdaptor::registerService( ::fwData::Object::sptr obj, ::scene2D::adaptor::IAdaptor::sptr srv )
{
::fwServices::ComChannelService::sptr comSrv;
comSrv = ::fwServices::registerCommunicationChannel( obj, srv );
comSrv->start();
AdaptorAndComType info = std::make_pair( srv, comSrv );
m_managedAdaptors.push_back( info );
}
//-----------------------------------------------------------------------------
void IAdaptor::unregisterServices()
{
BOOST_FOREACH( ManagedAdaptorVector::value_type info, m_managedAdaptors )
{
info.second.lock()->stop();
::fwServices::OSR::unregisterService( info.second.lock() );
info.first.lock()->stop();
::fwServices::OSR::unregisterService(info.first.lock());
}
m_managedAdaptors.clear();
}
//-----------------------------------------------------------------------------
}
} // namespace scene2D
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment