]> git.mxchange.org Git - simgear.git/commitdiff
Canvas: allow removing placement factories.
authorThomas Geymayer <tomgey@gmail.com>
Sun, 24 Nov 2013 14:37:36 +0000 (15:37 +0100)
committerThomas Geymayer <tomgey@gmail.com>
Sun, 24 Nov 2013 14:39:03 +0000 (15:39 +0100)
simgear/canvas/Canvas.cxx
simgear/canvas/Canvas.hxx

index a95964d6fd349fe0676af3be4326cf7dbd4568f7..a8eab7227e1905422e67b6edb87108500fa0b2bf 100644 (file)
@@ -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)
   {
index dba28863ba50caad18840ca9e75a3df23c6ba355..0173d8ebacfa583cb9682552c444d8c8b28ae9c1 100644 (file)
@@ -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: