From 6fe14334973e2586432d73818372c0c71477838e Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 24 Nov 2013 15:37:36 +0100 Subject: [PATCH] Canvas: allow removing placement factories. --- simgear/canvas/Canvas.cxx | 17 ++++++++++++++++- simgear/canvas/Canvas.hxx | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/simgear/canvas/Canvas.cxx b/simgear/canvas/Canvas.cxx index a95964d6..a8eab722 100644 --- a/simgear/canvas/Canvas.cxx +++ b/simgear/canvas/Canvas.cxx @@ -588,12 +588,27 @@ namespace canvas ( SG_GENERAL, SG_WARN, - "Canvas::addPlacementFactory: replace existing factor for type " << type + "Canvas::addPlacementFactory: replace existing factory '" << type << "'" ); _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) { diff --git a/simgear/canvas/Canvas.hxx b/simgear/canvas/Canvas.hxx index dba28863..0173d8eb 100644 --- a/simgear/canvas/Canvas.hxx +++ b/simgear/canvas/Canvas.hxx @@ -162,6 +162,7 @@ namespace canvas void reloadPlacements( const std::string& type = std::string() ); static void addPlacementFactory( const std::string& type, PlacementFactory factory ); + static void removePlacementFactory(const std::string& type); protected: -- 2.39.5