From: Thomas Geymayer Date: Sun, 24 Nov 2013 14:37:36 +0000 (+0100) Subject: Canvas: allow removing placement factories. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6fe14334973e2586432d73818372c0c71477838e;p=simgear.git Canvas: allow removing placement factories. --- 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: