Index: src/Shapes/Shape.hpp
===================================================================
--- src/Shapes/Shape.hpp	(revision 8f6a27114a45faed529524ec253583f7c4a78a20)
+++ src/Shapes/Shape.hpp	(revision 1c95882265b58588cd99b3ea7195b86467099a6b)
@@ -27,5 +27,4 @@
 class LineSegmentSet;
 class Line;
-class ShapeFactoryTest;
 
 class Shape
@@ -34,5 +33,4 @@
   typedef boost::shared_ptr<Shape_impl> impl_ptr;
   friend impl_ptr getShapeImpl(const Shape&);
-  friend class ShapeFactoryTest;
 
   Shape(impl_ptr);
Index: src/Shapes/ShapeFactory.cpp
===================================================================
--- src/Shapes/ShapeFactory.cpp	(revision 8f6a27114a45faed529524ec253583f7c4a78a20)
+++ src/Shapes/ShapeFactory.cpp	(revision 1c95882265b58588cd99b3ea7195b86467099a6b)
@@ -44,18 +44,18 @@
 #include "LinearAlgebra/RealSpaceMatrix.hpp"
 
-const char *ShapeFactory::shapeNames[ShapeFactory::SHAPETYPES_MAX] = {"nowhere", "everywhere", "sphere", "cube", "cylinder"};
+const char *ShapeFactory::shapeNames[MAX_ShapeType] = {"nowhere", "everywhere", "sphere", "cube", "polygon", "combined", "cylinder"};
 
 ShapeFactory::ShapeFactory()
 {
   // Create map (type -> name).
-  for (int i=0; i<SHAPETYPES_MAX; i++)
+  for (int i=0; i<MAX_ShapeType; i++)
     shapeNameMap.insert(std::pair<ShapeType, std::string>((ShapeType)i, shapeNames[i]));
 
   // Create inverse map.
-  for (int i=0; i<SHAPETYPES_MAX; i++)
+  for (int i=0; i<MAX_ShapeType; i++)
     nameShapeMap.insert(std::pair<std::string, ShapeType>(shapeNames[i], (ShapeType)i));
 
   // Init state.
-  type = SPHERE;
+  type = SphereType;
   translation.Zero();
   stretch = Vector(1.,1.,1.);
@@ -64,5 +64,5 @@
 }
 
-ShapeFactory::ShapeType ShapeFactory::getShapeByName(const std::string& name)
+ShapeType ShapeFactory::getShapeByName(const std::string& name)
 {
   NameShapeMap::iterator iter = nameShapeMap.find(name);
@@ -112,13 +112,13 @@
   // Create the basic shape.
   Shape s = Nowhere();
-  if (type == NOWHERE){
+  if (type == NowhereType){
     s = Nowhere();
-  }else if (type == EVERYWHERE){
+  }else if (type == EverywhereType){
     s = Everywhere();
-  }else if (type == CUBE){
+  }else if (type == CuboidType){
     s = Cuboid();
-  }else if (type == SPHERE){
+  }else if (type == SphereType){
     s = Sphere();
-  }else if (type == CYLINDER){
+  }else if (type == CylinderType){
     s = Cylinder();
   }else{
Index: src/Shapes/ShapeFactory.hpp
===================================================================
--- src/Shapes/ShapeFactory.hpp	(revision 8f6a27114a45faed529524ec253583f7c4a78a20)
+++ src/Shapes/ShapeFactory.hpp	(revision 1c95882265b58588cd99b3ea7195b86467099a6b)
@@ -25,7 +25,4 @@
 
 public:
-  enum ShapeType{
-    NOWHERE, EVERYWHERE, SPHERE, CUBE, CYLINDER, SHAPETYPES_MAX
-  };
 
   ShapeType getShapeByName(const std::string &name);
Index: src/Shapes/ShapeRegistry.cpp
===================================================================
--- src/Shapes/ShapeRegistry.cpp	(revision 8f6a27114a45faed529524ec253583f7c4a78a20)
+++ src/Shapes/ShapeRegistry.cpp	(revision 1c95882265b58588cd99b3ea7195b86467099a6b)
@@ -41,4 +41,6 @@
 #include "CodePatterns/Observer/Channels.hpp"
 
+#include "ShapeFactory.hpp"
+
 ShapeRegistry::ShapeRegistry() :
   Observable::Observable("ShapeRegistry")
@@ -56,4 +58,17 @@
 }
 
+std::string ShapeRegistry::getDefaultNameForShape(Shape s) const
+{
+  std::string baseName = ShapeFactory::getInstance().getShapeName(s.getType());
+  int n = 1;
+  while(true){
+    std::string name = baseName + toString(n);
+    if (!isPresentByName(name))
+      return name;
+    n ++;
+  }
+  return "";
+}
+
 void ShapeRegistry::addShape(Shape s)
 {
@@ -64,4 +79,13 @@
 }
 
+void ShapeRegistry::removeShape(const std::string &name)
+{
+  OBSERVE;
+  Shape *instance = getByName(name);
+  unregisterInstance(instance);
+  delete(instance);
+  NOTIFY(ShapeRemoved);
+}
+
 CONSTRUCT_SINGLETON(ShapeRegistry)
 CONSTRUCT_REGISTRY(Shape)
Index: src/Shapes/ShapeRegistry.hpp
===================================================================
--- src/Shapes/ShapeRegistry.hpp	(revision 8f6a27114a45faed529524ec253583f7c4a78a20)
+++ src/Shapes/ShapeRegistry.hpp	(revision 1c95882265b58588cd99b3ea7195b86467099a6b)
@@ -27,6 +27,8 @@
 public:
   void addShape(Shape s);
+  void removeShape(const std::string &name);
   Shape* getShapeByName(const std::string name);
   bool isShapePresentByName(const std::string name) const;
+  std::string getDefaultNameForShape(Shape s) const;
 
   enum NotificationType {
Index: src/Shapes/ShapeType.hpp
===================================================================
--- src/Shapes/ShapeType.hpp	(revision 8f6a27114a45faed529524ec253583f7c4a78a20)
+++ src/Shapes/ShapeType.hpp	(revision 1c95882265b58588cd99b3ea7195b86467099a6b)
@@ -22,6 +22,6 @@
 	PolygonType,
 	CombinedType,
-	MAX_ShapeType,
-    CylinderType
+  CylinderType,
+	MAX_ShapeType
 };
 
Index: src/Shapes/unittests/ShapeFactoryUnitTest.cpp
===================================================================
--- src/Shapes/unittests/ShapeFactoryUnitTest.cpp	(revision 8f6a27114a45faed529524ec253583f7c4a78a20)
+++ src/Shapes/unittests/ShapeFactoryUnitTest.cpp	(revision 1c95882265b58588cd99b3ea7195b86467099a6b)
@@ -75,23 +75,23 @@
   ShapeFactory::getInstance().setTranslation(Vector(0., 0., 0.));
 
-  ShapeFactory::getInstance().setType(ShapeFactory::NOWHERE);
-  CPPUNIT_ASSERT( dynamic_cast<Nowhere_impl*>(ShapeFactory::getInstance().produce().getImpl().get()) );
+  ShapeFactory::getInstance().setType(NowhereType);
+  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().produce().getType(), NowhereType );
 
-  ShapeFactory::getInstance().setType(ShapeFactory::EVERYWHERE);
-  CPPUNIT_ASSERT( dynamic_cast<Everywhere_impl*>(ShapeFactory::getInstance().produce().getImpl().get()) );
+  ShapeFactory::getInstance().setType(EverywhereType);
+  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().produce().getType(), EverywhereType );
 
-  ShapeFactory::getInstance().setType(ShapeFactory::SPHERE);
-  CPPUNIT_ASSERT( dynamic_cast<Sphere_impl*>(ShapeFactory::getInstance().produce().getImpl().get()) );
+  ShapeFactory::getInstance().setType(SphereType);
+  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().produce().getType(), SphereType );
 
-  ShapeFactory::getInstance().setType(ShapeFactory::CUBE);
-  CPPUNIT_ASSERT( dynamic_cast<Cuboid_impl*>(ShapeFactory::getInstance().produce().getImpl().get()) );
+  ShapeFactory::getInstance().setType(CuboidType);
+  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().produce().getType(), CuboidType );
 
-  ShapeFactory::getInstance().setType(ShapeFactory::CYLINDER);
-  CPPUNIT_ASSERT( dynamic_cast<Cylinder_impl*>(ShapeFactory::getInstance().produce().getImpl().get()) );
+  ShapeFactory::getInstance().setType(CylinderType);
+  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().produce().getType(), CylinderType );
 }
 
 void ShapeFactoryTest::resizeTest()
 {
-  ShapeFactory::getInstance().setType(ShapeFactory::SPHERE);
+  ShapeFactory::getInstance().setType(SphereType);
   ShapeFactory::getInstance().setAngle(0., 0., 0.);
   ShapeFactory::getInstance().setStretch(Vector(2., 2., 2.));
@@ -109,5 +109,5 @@
 void ShapeFactoryTest::translateTest()
 {
-  ShapeFactory::getInstance().setType(ShapeFactory::SPHERE);
+  ShapeFactory::getInstance().setType(SphereType);
   ShapeFactory::getInstance().setAngle(0., 0., 0.);
   ShapeFactory::getInstance().setStretch(Vector(1., 1., 1.));
@@ -128,5 +128,5 @@
 void ShapeFactoryTest::stretchTest()
 {
-  ShapeFactory::getInstance().setType(ShapeFactory::SPHERE);
+  ShapeFactory::getInstance().setType(SphereType);
   ShapeFactory::getInstance().setAngle(0., 0., 0.);
   ShapeFactory::getInstance().setStretch(Vector(2., 1., 1.));
@@ -144,5 +144,5 @@
 void ShapeFactoryTest::transformTest()
 {
-  ShapeFactory::getInstance().setType(ShapeFactory::SPHERE);
+  ShapeFactory::getInstance().setType(SphereType);
   ShapeFactory::getInstance().setAngle(45., 0., 0.);
   ShapeFactory::getInstance().setStretch(Vector(1., 1., 1.));
@@ -160,10 +160,10 @@
 void ShapeFactoryTest::getterSetterTest()
 {
-  ShapeFactory::getInstance().setType(ShapeFactory::SPHERE);
-  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().getType(), ShapeFactory::SPHERE );
-  ShapeFactory::getInstance().setType(ShapeFactory::CUBE);
-  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().getType(), ShapeFactory::CUBE );
+  ShapeFactory::getInstance().setType(SphereType);
+  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().getType(), SphereType );
+  ShapeFactory::getInstance().setType(CuboidType);
+  CPPUNIT_ASSERT_EQUAL( ShapeFactory::getInstance().getType(), CuboidType );
 #ifndef NDEBUG
-  CPPUNIT_ASSERT_THROW( ShapeFactory::getInstance().setType((ShapeFactory::ShapeType)-1), Assert::AssertionFailure );
+  CPPUNIT_ASSERT_THROW( ShapeFactory::getInstance().setType((ShapeType)-1), Assert::AssertionFailure );
 #endif
 
