From: jfa Date: Thu, 9 Apr 2009 08:31:44 +0000 (+0000) Subject: Bug 0020229: Perf of MakeSphere and RemoveObject. Allow to re-use empty label, follow... X-Git-Tag: V5_1_2rc1~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=85bed9f0cb71f58c3deed9bb91779ddd9e0d6eee;p=modules%2Fgeom.git Bug 0020229: Perf of MakeSphere and RemoveObject. Allow to re-use empty label, following the _lastCleared one. --- diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index a8917f10b..a47aec8cd 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -233,7 +233,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) { @@ -273,7 +279,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) {