Canvas: allow removing placement factories.

This commit is contained in:
Thomas Geymayer 2013-11-24 15:37:36 +01:00
parent 01ace109ba
commit 6fe1433497
2 changed files with 17 additions and 1 deletions

View File

@ -588,12 +588,27 @@ namespace canvas
( (
SG_GENERAL, SG_GENERAL,
SG_WARN, SG_WARN,
"Canvas::addPlacementFactory: replace existing factor for type " << type "Canvas::addPlacementFactory: replace existing factory '" << type << "'"
); );
_placement_factories[type] = factory; _placement_factories[type] = factory;
} }
//----------------------------------------------------------------------------
void Canvas::removePlacementFactory(const std::string& type)
{
PlacementFactoryMap::iterator it = _placement_factories.find(type);
if( it == _placement_factories.end() )
SG_LOG
(
SG_GENERAL,
SG_WARN,
"Canvas::removePlacementFactory: no such factory '" << type << "'"
);
else
_placement_factories.erase(it);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void Canvas::setSelf(const PropertyBasedElementPtr& self) void Canvas::setSelf(const PropertyBasedElementPtr& self)
{ {

View File

@ -162,6 +162,7 @@ namespace canvas
void reloadPlacements( const std::string& type = std::string() ); void reloadPlacements( const std::string& type = std::string() );
static void addPlacementFactory( const std::string& type, static void addPlacementFactory( const std::string& type,
PlacementFactory factory ); PlacementFactory factory );
static void removePlacementFactory(const std::string& type);
protected: protected: