]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Bug 0020229: Perf of MakeSphere and RemoveObject. Allow to re-use empty label, follow...
authorjfa <jfa@opencascade.com>
Thu, 9 Apr 2009 09:08:39 +0000 (09:08 +0000)
committerjfa <jfa@opencascade.com>
Thu, 9 Apr 2009 09:08:39 +0000 (09:08 +0000)
src/GEOM/GEOM_Engine.cxx

index 101c994eaabc304b5cb3489a07de20b651282787..3b700a01d37160ec7894933cda5428f93de0b9c7 100644 (file)
@@ -210,7 +210,13 @@ Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType)
     if (_lastCleared.Root() == aDoc->Main().Root()) {
       useExisting = true;
       aChild = _lastCleared;
-      _lastCleared.Nullify();
+      // 0020229: if next label exists and is empty, try to reuse it
+      Standard_Integer aNextTag = aChild.Tag() + 1;
+      TDF_Label aNextL = aDoc->Main().FindChild(aNextTag, Standard_False);
+      if (!aNextL.IsNull() && !aNextL.HasAttribute())
+        _lastCleared = aNextL;
+      else
+        _lastCleared.Nullify();
     }
   }
   if (!useExisting) {
@@ -250,7 +256,13 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
     if (_lastCleared.Root() == aDoc->Main().Root()) {
       useExisting = true;
       aChild = _lastCleared;
-      _lastCleared.Nullify();
+      // 0020229: if next label exists and is empty, try to reuse it
+      Standard_Integer aNextTag = aChild.Tag() + 1;
+      TDF_Label aNextL = aDoc->Main().FindChild(aNextTag, Standard_False);
+      if (!aNextL.IsNull() && !aNextL.HasAttribute())
+        _lastCleared = aNextL;
+      else
+        _lastCleared.Nullify();
     }
   }
   if (!useExisting) {