From 8155374ae7b134b27840994b13eb753aecd64318 Mon Sep 17 00:00:00 2001 From: mzn Date: Fri, 11 Jan 2008 14:52:34 +0000 Subject: [PATCH] Fix for bug NPAL18499 (EDF 641 STUDY : Performance problem). --- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 2 +- .../SALOMEDSImpl_StudyBuilder.cxx | 20 +++++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 3a3096d81..34ee8ed7b 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -57,7 +57,7 @@ SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc, _Saved = false ; _URL = ""; _StudyId = -1; - _autoFill = true; + _autoFill = false; _errorCode = ""; _useCaseBuilder = new SALOMEDSImpl_UseCaseBuilder(_doc); _builder = new SALOMEDSImpl_StudyBuilder(this); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index eeeed8ac1..6dcb7bdd6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -53,6 +53,8 @@ static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* dr SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner) { _errorCode = ""; + _callbackOnAdd=NULL; + _callbackOnRemove = NULL; _study = (SALOMEDSImpl_Study*)theOwner; _doc = _study->GetDocument(); } @@ -82,13 +84,7 @@ SALOMEDSImpl_SComponent SALOMEDSImpl_StudyBuilder::NewComponent(const string& Da //Always create component under main label. DF_Label L = _doc->Main(); - int imax = 0; - for (DF_ChildIterator it(L); it.More(); it.Next()) { - if (it.Value().Tag() > imax) - imax = it.Value().Tag(); - } - imax++; - DF_Label NL = L.FindChild(imax); + DF_Label NL = L.NewChild(); SALOMEDSImpl_AttributeComment::Set(NL, DataType); @@ -141,20 +137,14 @@ bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const SALOMEDSImpl_SComponent& a //============================================================================ SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObject(const SALOMEDSImpl_SObject& theFatherObject) { - _errorCode = ""; + _errorCode = ""; CheckLocked(); //Find label of father DF_Label Lab = theFatherObject.GetLabel(); //Create a new label - int imax = 0; - for (DF_ChildIterator it(Lab); it.More(); it.Next()) { - if (it.Value().Tag() > imax) - imax = it.Value().Tag(); - } - imax++; - DF_Label NewLab = Lab.FindChild(imax); + DF_Label NewLab = Lab.NewChild(); SALOMEDSImpl_SObject so = _study->GetSObject(NewLab); if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); -- 2.39.2