Commit d92b15dc authored by FPoupon's avatar FPoupon
Browse files

Add a method to unregister an object from Anatomist

parent 209dc9b2
......@@ -8,6 +8,7 @@
#include <anatomist/commands/cCreateWindow.h>
#include <anatomist/commands/cCloseWindow.h>
#include <anatomist/commands/cDeleteAll.h>
#include <anatomist/commands/cRemoveObject.h>
#include <anatomist/commands/cAddObject.h>
#include <anatomist/commands/cCamera.h>
#include <anatomist/commands/cSetObjectPalette.h>
......@@ -392,15 +393,10 @@ void gkg::AnatomistServer::removeAllObjects()
while ( o != oe )
{
if ( *o )
if ( theAnatomist->hasObject( *o ) && (*o)->CanBeDestroyed() )
{
if ( (*o)->CanBeDestroyed() )
{
n += theAnatomist->destroyObject( *o );
}
n += theAnatomist->destroyObject( *o );
}
......@@ -684,7 +680,7 @@ void gkg::AnatomistServer::addObject( anatomist::AObject* aObject,
}
theAnatomist->registerObject( aObject );
theAnatomist->registerObject( aObject, 0 );
}
......@@ -696,6 +692,42 @@ void gkg::AnatomistServer::addObject( anatomist::AObject* aObject,
}
void gkg::AnatomistServer::removeObject( const std::string& name )
{
try
{
if ( name.empty() )
{
throw std::runtime_error( "object name must be specified" );
}
if ( theAnatomist )
{
std::map< std::string, anatomist::AObject* >::iterator
o = _objects.find( name );
if ( o != _objects.end() )
{
theAnatomist->unregisterObject( o->second );
_objects.erase( o );
}
}
}
GKG_CATCH( "void gkg::AnatomistServer::removeObject( "
"const std::string& name )" );
}
void gkg::AnatomistServer::fusion2D( const std::string& vol1,
const std::string& vol2,
const std::string& method,
......
......@@ -82,6 +82,7 @@ class AnatomistServer : public Singleton< AnatomistServer >
bool absmode = false );
void addObject( anatomist::AObject* aObject, const std::string& name );
void removeObject( const std::string& name );
void fusion2D( const std::string& vol1,
const std::string& vol2,
......
Markdown is supported
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