1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_Study.cxx
21 // Author : Sergey RUIN
25 #include "SALOMEDSImpl_Study.hxx"
29 #include <TColStd_SequenceOfExtendedString.hxx>
30 #include <TCollection_ExtendedString.hxx>
32 #include <TColStd_HSequenceOfAsciiString.hxx>
33 #include <TDocStd_Application.hxx>
34 #include <TDocStd_Owner.hxx>
35 #include <TDF_LabelList.hxx>
36 #include <TDF_ListIteratorOfLabelList.hxx>
37 #include <CDM_Document.hxx>
38 #include <CDM_Application.hxx>
39 #include <TDF_ChildIDIterator.hxx>
40 #include <TDF_ChildIterator.hxx>
41 #include <TDF_AttributeIterator.hxx>
43 #include "SALOMEDSImpl_ChildNodeIterator.hxx"
44 #include "SALOMEDSImpl_Attributes.hxx"
45 #include "SALOMEDSImpl_UseCaseIterator.hxx"
46 #include "SALOMEDSImpl_AttributeReference.hxx"
47 #include "SALOMEDSImpl_StudyHandle.hxx"
48 #include "SALOMEDSImpl_Tool.hxx"
49 #include "SALOMEDSImpl_IParameters.hxx"
51 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
52 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared )
54 #define DIRECTORYID 16661
55 #define FILELOCALID 26662
56 #define FILEID "FILE: "
58 //============================================================================
59 /*! Function : SALOMEDSImpl_Study
60 * Purpose : SALOMEDSImpl_Study constructor
62 //============================================================================
63 SALOMEDSImpl_Study::SALOMEDSImpl_Study(const Handle(TDocStd_Document)& doc,
64 const TCollection_AsciiString& study_name)
66 doc->SetUndoLimit(1); // mpv (IPAL9237): if there is no undo limit, operations mechanism couldn't work
73 myNbPostponed.Append(0);
76 _useCaseBuilder = new SALOMEDSImpl_UseCaseBuilder(_doc);
77 _builder = new SALOMEDSImpl_StudyBuilder(this);
78 _cb = new SALOMEDSImpl_Callback(_useCaseBuilder);
79 //Put on the root label a StudyHandle attribute to store the address of this object
80 //It will be used to retrieve the study object by TDF_Label that belongs to the study
81 SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this);
82 _lockers = new TColStd_HSequenceOfAsciiString();
86 //============================================================================
87 /*! Function : ~SALOMEDSImpl_Study
88 * Purpose : SALOMEDSImpl_Study destructor
90 //============================================================================
91 SALOMEDSImpl_Study::~SALOMEDSImpl_Study()
94 //============================================================================
95 /*! Function : GetPersistentReference
96 * Purpose : Get persistent reference of study (idem URL())
98 //============================================================================
99 TCollection_AsciiString SALOMEDSImpl_Study::GetPersistentReference()
104 //============================================================================
105 /*! Function : GetTransientReference
106 * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root)
108 //============================================================================
109 TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference()
112 TCollection_AsciiString IOR = "";
114 Handle(SALOMEDSImpl_AttributeIOR) Att;
115 TDF_Label _lab = _doc->GetData()->Root();
116 if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)) {
120 _errorCode = "IOR is empty";
126 void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& theIOR)
130 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
131 int aLocked = aProp->IsLocked();
132 if (aLocked) aProp->SetLocked(Standard_False);
134 // Assign the value of the IOR in the study->root
135 SALOMEDSImpl_AttributeIOR::Set(_doc->Main().Root(), theIOR);
137 if (aLocked) aProp->SetLocked(Standard_True);
140 //============================================================================
141 /*! Function : IsEmpty
142 * Purpose : Detect if study is empty
144 //============================================================================
145 bool SALOMEDSImpl_Study::IsEmpty()
148 if (_doc.IsNull()) return true;
149 return _doc->IsEmpty();
152 //============================================================================
153 /*! Function : FindComponent
154 * Purpose : Find a Component with ComponentDataType = aComponentName
156 //============================================================================
157 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollection_AsciiString& aComponentName)
161 TCollection_AsciiString name;
162 SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator();
163 Handle(SALOMEDSImpl_SComponent) compo;
165 for (; itcomp.More(); itcomp.Next()) {
166 Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
167 name = SC->ComponentDataType();
168 if(aComponentName == name) {
176 _errorCode = "No component was found";
182 //============================================================================
183 /*! Function : FindComponentID
184 * Purpose : Find a Component from it's ID
186 //============================================================================
187 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TCollection_AsciiString& aComponentID)
191 // Iterate on each components defined in the study
192 // Get the component ID and compare with aComponentID
194 TCollection_AsciiString ID;
195 Handle(SALOMEDSImpl_SComponent) compo;
197 SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator();
198 for (; itcomp.More(); itcomp.Next()) {
199 Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
201 if(aComponentID == ID)
210 _errorCode = "No component was found";
217 //============================================================================
218 /*! Function : FindObject
219 * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
221 //============================================================================
222 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_AsciiString& anObjectName)
226 // Iterate to all components defined in the study
227 // After testing the component name, iterate in all objects defined under
228 // components (function _FindObject)
230 Handle(SALOMEDSImpl_SObject) RefSO = NULL;
232 SALOMEDSImpl_SComponentIterator it = NewComponentIterator();
233 for (; it.More();it.Next()){
236 Handle(SALOMEDSImpl_SComponent) SC = it.Value();
237 if (SC->GetName() == anObjectName)
243 if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
246 if(RefSO.IsNull()) _errorCode = "No object was found";
250 //============================================================================
251 /*! Function : FindObjectID
252 * Purpose : Find an Object with ID = anObjectID
254 //============================================================================
255 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_AsciiString& anObjectID)
259 // Convert aSO->GetID in TDF_Label.
261 TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab);
264 _errorCode = "No label was found by ID";
267 return GetSObject(Lab);
271 //============================================================================
272 /*! Function : CreateObjectID
273 * Purpose : Creates an Object with ID = anObjectID
275 //============================================================================
276 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollection_AsciiString& anObjectID)
280 // Convert aSO->GetID in TDF_Label.
282 TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab, Standard_True);
285 _errorCode = "Can not create a label";
288 return GetSObject(Lab);
292 //============================================================================
293 /*! Function : FindObjectByName
294 * Purpose : Find Objects with SALOMEDSImpl_Name = anObjectName in a Component
295 * : with ComponentDataType = aComponentName
297 //============================================================================
298 Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const TCollection_AsciiString& anObjectName,
299 const TCollection_AsciiString& aComponentName)
303 Handle(TColStd_HSequenceOfTransient) listSO = new TColStd_HSequenceOfTransient();
305 Handle(SALOMEDSImpl_SComponent) compo = FindComponent(aComponentName) ;
306 if ( compo.IsNull() ) {
307 _errorCode = "Can not find the component";
311 // Iterate on each object and subobject of the component
312 // If objectName is found add it to the list of SObjects
313 TCollection_AsciiString childName ;
315 TCollection_AsciiString compoId = compo->GetID();
316 Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(compo);
317 for ( ; it->More(); it->Next() ) {
319 Handle(SALOMEDSImpl_SObject) CSO = it->Value();
320 if ( CSO->GetName() == anObjectName ) {
322 listSO->Append(CSO) ;
325 /* looks also for eventual children */
327 CSO = _FindObject( CSO, anObjectName, found ) ;
329 listSO->Append(CSO) ;
338 //============================================================================
339 /*! Function : FindObjectIOR
340 * Purpose : Find an Object with IOR = anObjectIOR
342 //============================================================================
343 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection_AsciiString& anObjectIOR)
347 Handle(SALOMEDSImpl_SObject) aResult = NULL;
349 // searching in the datamap for optimization
350 if (myIORLabels.IsBound(anObjectIOR)) {
351 aResult = GetSObject(myIORLabels.Find(anObjectIOR));
352 // 11 oct 2002: forbidden attributes must be checked here
353 if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) {
354 myIORLabels.UnBind(anObjectIOR);
359 if (aResult.IsNull()) _errorCode = "No object was found";
363 //============================================================================
364 /*! Function : FindObjectByPath
365 * Purpose : Find an Object by its path = thePath
367 //============================================================================
368 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollection_AsciiString& thePath)
372 TCollection_AsciiString aPath(thePath), aToken;
373 Handle(SALOMEDSImpl_SObject) aSO = NULL;
374 int i = 1, aLength = aPath.Length();
375 bool isRelative = false;
377 if(aLength == 0) { //Empty path - return the current context
378 return GetSObject(_current);
381 if(aPath.Value(1) != '/') //Relative path
384 TDF_ChildIterator anIterator;
386 Handle(SALOMEDSImpl_AttributeName) anAttr;
389 if(_current.IsNull()) return NULL;
390 anIterator.Initialize(_current, Standard_False);
393 if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root
394 return GetSObject(_doc->Main());
396 anIterator.Initialize(_doc->Main(), Standard_False);
399 while(i <= aLength) {
401 aToken = aPath.Token("/", i);
402 if(aToken.Length() == 0) break;
404 for ( ; anIterator.More(); anIterator.Next() ) {
405 aLabel = anIterator.Value();
406 if(aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) {
407 if(anAttr->Value() == aToken) {
408 aToken = aPath.Token("/", i+1); //Check if it was the last part of the path
409 if(aToken.Length() == 0) { //The searched label is found (no part of the path is left)
410 return GetSObject(aLabel);
413 anIterator.Initialize(aLabel, Standard_False);
422 if(aSO.IsNull()) _errorCode = "No object was found";
426 //============================================================================
427 /*! Function : GetObjectPath
430 //============================================================================
431 TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject)
435 TCollection_AsciiString aPath("");
436 if(theObject.IsNull()) {
437 _errorCode = "Null object";
438 return aPath.ToCString();
441 TCollection_AsciiString aName = theObject->GetName();
442 if(!aName.IsEmpty() && aName != "" ) {
443 TCollection_AsciiString aValue((char*)aName.ToCString());
447 Handle(SALOMEDSImpl_SObject) aFather = theObject->GetFather();
448 if(!aFather.IsNull()) {
449 aName = aFather->GetName();
450 if(!aName.IsEmpty() && aName != "") {
451 aValue = (char*)GetObjectPath(aFather).ToCString();
452 aPath = aValue + aPath;
461 //============================================================================
462 /*! Function : GetObjectPathByIOR
465 //============================================================================
466 TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR)
470 TCollection_AsciiString aPath;
471 Handle(SALOMEDSImpl_SObject) so = FindObjectIOR(theIOR);
473 _errorCode = "No SObject was found by IOR";
477 return GetObjectPath(so);
481 //============================================================================
482 /*! Function : SetContext
483 * Purpose : Sets the current context
485 //============================================================================
486 bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath)
489 if(thePath.IsEmpty()) {
490 _errorCode = "InvalidPath";
494 TCollection_AsciiString aPath(thePath), aContext("");
495 bool isInvalid = false;
496 Handle(SALOMEDSImpl_SObject) aSO;
498 if(aPath.Value(1) != '/') { //Relative path
499 aContext = GetContext();
507 aSO = FindObjectByPath(aContext.ToCString());
513 if(isInvalid || aSO.IsNull()) {
514 _errorCode = "InvalidContext";
518 TDF_Label aLabel = aSO->GetLabel();
519 if(aLabel.IsNull()) {
520 _errorCode = "InvalidContext";
524 _current = aLabel; //Set the current context
529 //============================================================================
530 /*! Function : GetContext
531 * Purpose : Gets the current context
533 //============================================================================
534 TCollection_AsciiString SALOMEDSImpl_Study::GetContext()
538 if(_current.IsNull()) {
539 _errorCode = "InvaidContext";
542 Handle(SALOMEDSImpl_SObject) so = GetSObject(_current);
543 return GetObjectPath(so);
546 //============================================================================
547 /*! Function : GetObjectNames
548 * Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
550 //============================================================================
551 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext)
555 Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
557 if (theContext.IsEmpty()) {
560 TDF_Label aTmp = _current;
561 SetContext(theContext);
565 if (aLabel.IsNull()) {
566 _errorCode = "InvalidContext";
570 TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels
571 for (; anIter.More(); anIter.Next()) {
572 TDF_Label aLabel = anIter.Value();
573 Handle(SALOMEDSImpl_AttributeName) aName;
574 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
580 //============================================================================
581 /*! Function : GetDirectoryNames
582 * Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
584 //============================================================================
585 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(const TCollection_AsciiString& theContext)
589 Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
591 if (theContext.IsEmpty()) {
594 TDF_Label aTmp = _current;
595 SetContext(theContext);
599 if (aLabel.IsNull()) {
600 _errorCode = "InvalidContext";
604 TDF_ChildIterator anIter (aLabel, Standard_True); // iterate first-level children at all sublevels
605 for (; anIter.More(); anIter.Next()) {
606 TDF_Label aLabel = anIter.Value();
607 Handle(SALOMEDSImpl_AttributeLocalID) anID;
608 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
609 if (anID->Value() == DIRECTORYID) {
610 Handle(SALOMEDSImpl_AttributeName) aName;
611 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) {
612 aResultSeq->Append(aName->Value());
621 //============================================================================
622 /*! Function : GetFileNames
623 * Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
625 //============================================================================
626 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TCollection_AsciiString& theContext)
630 Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
632 if (theContext.IsEmpty()) {
635 TDF_Label aTmp = _current;
636 SetContext(theContext);
640 if (aLabel.IsNull()) {
641 _errorCode = "InvalidContext";
645 TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels
646 for (; anIter.More(); anIter.Next()) {
647 TDF_Label aLabel = anIter.Value();
648 Handle(SALOMEDSImpl_AttributeLocalID) anID;
649 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
650 if (anID->Value() == FILELOCALID) {
651 Handle(SALOMEDSImpl_AttributePersistentRef) aName;
652 if (aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(), aName)) {
653 TCollection_ExtendedString aFileName = aName->Value();
654 if (aFileName.Length() > 0)
655 aResultSeq->Append(aFileName.Split(strlen(FILEID)));
664 //============================================================================
665 /*! Function : GetComponentNames
666 * Purpose : method to get all components names
668 //============================================================================
669 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext)
673 Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
674 TDF_ChildIterator anIter(_doc->Main(), Standard_False); // iterate all subchildren at first level
675 for(; anIter.More(); anIter.Next()) {
676 TDF_Label aLabel = anIter.Value();
677 Handle(SALOMEDSImpl_AttributeName) aName;
678 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
684 //============================================================================
685 /*! Function : NewChildIterator
686 * Purpose : Create a ChildIterator from an SObject
688 //============================================================================
689 Handle(SALOMEDSImpl_ChildIterator) SALOMEDSImpl_Study::NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO)
692 return new SALOMEDSImpl_ChildIterator(aSO);
696 //============================================================================
697 /*! Function : NewComponentIterator
698 * Purpose : Create a SComponentIterator
700 //============================================================================
701 SALOMEDSImpl_SComponentIterator SALOMEDSImpl_Study::NewComponentIterator()
704 return SALOMEDSImpl_SComponentIterator(_doc);
708 //============================================================================
709 /*! Function : NewBuilder
710 * Purpose : Create a StudyBuilder
712 //============================================================================
713 Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder()
717 _builder->SetOnAddSObject(_cb);
718 _builder->SetOnRemoveSObject(_cb);
724 //============================================================================
726 * Purpose : get study name
728 //============================================================================
729 TCollection_AsciiString SALOMEDSImpl_Study::Name()
735 //============================================================================
737 * Purpose : set study name
739 //============================================================================
740 void SALOMEDSImpl_Study::Name(const TCollection_AsciiString& name)
746 //============================================================================
747 /*! Function : IsSaved
748 * Purpose : get if study has been saved
750 //============================================================================
751 bool SALOMEDSImpl_Study::IsSaved()
757 //============================================================================
758 /*! Function : IsSaved
759 * Purpose : set if study has been saved
761 //============================================================================
762 void SALOMEDSImpl_Study::IsSaved(bool save)
766 if(save) _doc->UnModify();
769 //============================================================================
770 /*! Function : IsModified
771 * Purpose : Detect if a Study has been modified since it has been saved
773 //============================================================================
774 bool SALOMEDSImpl_Study::IsModified()
778 // True if is modified
779 if (_doc->IsModified()) return true;
784 //============================================================================
786 * Purpose : get URL of the study (persistent reference of the study)
788 //============================================================================
789 TCollection_AsciiString SALOMEDSImpl_Study::URL()
795 //============================================================================
797 * Purpose : set URL of the study (persistent reference of the study)
799 //============================================================================
800 void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url)
805 /*jfa: Now name of SALOMEDS study will correspond to name of SalomeApp study
806 TCollection_AsciiString tmp(_URL);
808 char *aName = (char*)tmp.ToCString();
809 char *adr = strtok(aName, "/");
813 adr = strtok(NULL, "/");
820 //============================================================================
821 /*! Function : _FindObject
822 * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
824 //============================================================================
825 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
826 const TCollection_AsciiString& theObjectName,
829 if(SO.IsNull()) return NULL;
831 // Iterate on each objects and subobjects of the component
832 // If objectName find, stop the loop and get the object reference
833 Handle(SALOMEDSImpl_SObject) RefSO;
834 Handle(SALOMEDSImpl_AttributeName) anAttr;
836 TCollection_AsciiString soid = SO->GetID();
837 TDF_ChildIterator it(SO->GetLabel());
838 for (; it.More(); it.Next()){
841 if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr))
843 TCollection_AsciiString Val(anAttr->Value());
844 if (Val == theObjectName)
846 RefSO = GetSObject(it.Value());
850 if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find);
856 //============================================================================
857 /*! Function : _FindObjectIOR
858 * Purpose : Find an Object with SALOMEDSImpl_IOR = anObjectIOR
860 //============================================================================
861 Handle(SALOMEDSImpl_SObject)
862 SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO,
863 const TCollection_AsciiString& theObjectIOR,
866 if(SO.IsNull()) return NULL;
868 // Iterate on each objects and subobjects of the component
869 // If objectName find, stop the loop and get the object reference
870 Handle(SALOMEDSImpl_SObject) RefSO, aSO;
871 Handle(SALOMEDSImpl_AttributeIOR) anAttr;
873 TDF_ChildIterator it(SO->GetLabel());
874 for (; it.More();it.Next()){
877 if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
879 TCollection_AsciiString Val(anAttr->Value());
880 if (Val == theObjectIOR)
882 RefSO = GetSObject(it.Value());
886 aSO = GetSObject(it.Value());
887 if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find);
893 bool SALOMEDSImpl_Study::IsLocked()
896 return GetProperties()->IsLocked();
899 int SALOMEDSImpl_Study::StudyId()
905 void SALOMEDSImpl_Study::StudyId(int id)
911 void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry)
915 char* anEn = (char*)anEntry.ToCString();
916 char* IOR = (char*)anIOR.ToCString();
917 TDF_Tool::Label(_doc->GetData(),anEn, aLabel, Standard_True);
918 if (myIORLabels.IsBound(TCollection_ExtendedString(IOR))) myIORLabels.UnBind(TCollection_ExtendedString(IOR));
919 myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel);
922 Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel)
924 Handle(SALOMEDSImpl_StudyHandle) Att;
925 if (theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID(),Att)) {
926 return Att->GetHandle();
931 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::SObject(const TDF_Label& theLabel)
933 return GetStudy(theLabel)->GetSObject(theLabel);
936 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::SComponent(const TDF_Label& theLabel)
938 return GetStudy(theLabel)->GetSComponent(theLabel);
942 void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute)
944 TCollection_AsciiString aString;
945 TDF_Tool::Entry(theAttribute->Label(), aString);
946 GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString);
949 Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject)
952 Handle(TColStd_HSequenceOfTransient) aSeq;
954 Handle(SALOMEDSImpl_AttributeTarget) aTarget;
955 if (anObject->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) {
956 return aTarget->Get();
963 Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties()
966 return SALOMEDSImpl_AttributeStudyProperties::Set(_doc->Main());
969 TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate()
972 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
974 Handle(TColStd_HSequenceOfExtendedString) aNames;
975 Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
976 aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
978 int aLastIndex = aNames->Length();
980 sprintf(aResult, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
981 (int)(aDays->Value(aLastIndex)),(int)(aMonths->Value(aLastIndex)), (int)(aYears->Value(aLastIndex)),
982 (int)(aHours->Value(aLastIndex)), (int)(aMinutes->Value(aLastIndex)));
983 TCollection_AsciiString aResStr (aResult);
987 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate()
990 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
992 Handle(TColStd_HSequenceOfExtendedString) aNames;
993 Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
994 aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
996 int anIndex, aLength = aNames->Length();
997 Handle(TColStd_HSequenceOfAsciiString) aDates = new TColStd_HSequenceOfAsciiString;
999 for (anIndex = 2; anIndex <= aLength; anIndex++) {
1001 sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
1002 (int)(aDays->Value(anIndex)), (int)(aMonths->Value(anIndex)), (int)(aYears->Value(anIndex)),
1003 (int)(aHours->Value(anIndex)), (int)(aMinutes->Value(anIndex)));
1004 aDates->Append(aDate);
1011 //============================================================================
1012 /*! Function : GetUseCaseBuilder
1013 * Purpose : Returns a UseCase builder
1015 //============================================================================
1016 Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder()
1019 return _useCaseBuilder;
1023 //============================================================================
1024 /*! Function : Close
1027 //============================================================================
1028 void SALOMEDSImpl_Study::Close()
1031 Handle(TDocStd_Application) anApp = Handle(TDocStd_Application)::DownCast(_doc->Application());
1032 if(!anApp.IsNull()) anApp->Close(_doc);
1038 //============================================================================
1039 /*! Function : AddPostponed
1042 //============================================================================
1043 void SALOMEDSImpl_Study::AddPostponed(const TCollection_AsciiString& theIOR)
1046 if (!NewBuilder()->HasOpenCommand()) return;
1047 TCollection_AsciiString anIOR(theIOR);
1049 myPostponedIORs.Append(anIOR); // add prefix: deleted
1050 myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
1053 //============================================================================
1054 /*! Function : AddCreatedPostponed
1057 //============================================================================
1058 void SALOMEDSImpl_Study::AddCreatedPostponed(const TCollection_AsciiString& theIOR)
1061 if (!NewBuilder()->HasOpenCommand()) return;
1062 TCollection_AsciiString anIOR(theIOR);
1064 myPostponedIORs.Append(anIOR); // add prefix: created
1065 myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
1068 //============================================================================
1069 /*! Function : RemovePostponed
1072 //============================================================================
1073 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const int theUndoLimit)
1080 int aUndoLimit = theUndoLimit;
1081 if (theUndoLimit < 0) aUndoLimit = 0;
1083 Handle(TColStd_HSequenceOfAsciiString) aSeq = new TColStd_HSequenceOfAsciiString;
1085 if (myNbUndos > 0) { // remove undone
1087 for(anIndex = 1; anIndex < myNbPostponed.Length() - myNbUndos; anIndex++)
1088 anOld += myNbPostponed(anIndex);
1089 int aNew = myPostponedIORs.Length() - myNbPostponed.Last();
1091 for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) {
1092 TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
1093 if (anIOR.Value(1) == 'c') {
1094 aSeq->Append(anIOR.Split(1).ToCString());
1097 if (anOld < aNew) myPostponedIORs.Remove(anOld + 1, aNew);
1098 if (myNbPostponed.Length() > 0) myNbPostponed.Remove(myNbPostponed.Length() - myNbUndos, myNbPostponed.Length() - 1);
1103 if (myNbPostponed.Length() > aUndoLimit) { // remove objects, that can not be undone
1105 for(anIndex = myNbPostponed.Length() - aUndoLimit; anIndex >= 1; anIndex--)
1106 anOld += myNbPostponed(anIndex);
1107 for(anIndex = 1; anIndex <= anOld; anIndex++) {
1108 TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
1109 if (anIOR.Value(1) == 'd') {
1110 aSeq->Append(anIOR.Split(1).ToCString());
1113 if (anOld > 0) myPostponedIORs.Remove(1, anOld);
1114 myNbPostponed.Remove(1, myNbPostponed.Length() - aUndoLimit);
1117 if (theUndoLimit == -1) { // remove all IORs from the study on the study close
1118 TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDSImpl_AttributeIOR::GetID(), Standard_True);
1119 for(; anIter.More(); anIter.Next()) {
1120 Handle(SALOMEDSImpl_AttributeIOR) anAttr = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anIter.Value());
1121 aSeq->Append(anAttr->Value());
1123 } else myNbPostponed.Append(0);
1128 //============================================================================
1129 /*! Function : UndoPostponed
1132 //============================================================================
1133 void SALOMEDSImpl_Study::UndoPostponed(const int theWay)
1137 myNbUndos += theWay;
1138 // remove current postponed
1139 if (myNbPostponed.Last() > 0)
1140 myPostponedIORs.Remove(myPostponedIORs.Length() - myNbPostponed.Last() + 1, myPostponedIORs.Length());
1141 myNbPostponed(myNbPostponed.Length()) = 0;
1145 //============================================================================
1146 /*! Function : GetSComponent
1149 //============================================================================
1150 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry)
1152 Handle(SALOMEDSImpl_SComponent) aSCO;
1153 if(_mapOfSCO.IsBound(theEntry))
1154 aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry));
1157 TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
1158 aSCO = new SALOMEDSImpl_SComponent(aLabel);
1159 _mapOfSCO.Bind(theEntry, aSCO);
1165 //============================================================================
1166 /*! Function : GetSComponent
1169 //============================================================================
1170 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel)
1172 TCollection_AsciiString anEntry;
1173 TDF_Tool::Entry(theLabel, anEntry);
1174 return GetSComponent(anEntry);
1177 //============================================================================
1178 /*! Function : GetSObject
1181 //============================================================================
1182 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry)
1184 Handle(SALOMEDSImpl_SObject) aSO;
1185 if(_mapOfSO.IsBound(theEntry))
1186 aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry));
1189 TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
1190 aSO = new SALOMEDSImpl_SObject(aLabel);
1191 _mapOfSO.Bind(theEntry, aSO);
1197 //============================================================================
1198 /*! Function : GetSObject
1201 //============================================================================
1202 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel)
1204 TCollection_AsciiString anEntry;
1205 TDF_Tool::Entry(theLabel, anEntry);
1206 return GetSObject(anEntry);
1209 //============================================================================
1210 /*! Function : GetAttribute
1213 //============================================================================
1214 Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry,
1215 const TCollection_AsciiString& theType)
1217 Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry);
1218 Handle(TDF_Attribute) anAttr;
1219 aSO->FindAttribute(anAttr, theType);
1223 //============================================================================
1224 /*! Function : DumpStudy
1227 //============================================================================
1228 bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
1229 const TCollection_AsciiString& theBaseName,
1231 SALOMEDSImpl_DriverFactory* theFactory)
1235 if(theFactory == NULL) {
1236 _errorCode = "Null factory for creation of Engines";
1240 TColStd_SequenceOfExtendedString aSeq;
1241 TCollection_AsciiString aCompType, aFactoryType;
1243 //Build a list of all components in the Study
1244 SALOMEDSImpl_SComponentIterator itcomponent = NewComponentIterator();
1246 for (; itcomponent.More(); itcomponent.Next()) {
1247 Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
1248 aCompType = sco->ComponentDataType();
1249 //GEOM and MED are independent components
1250 if (aCompType == "GEOM" || aCompType == "MED")
1251 aSeq.Prepend(TCollection_ExtendedString(aCompType));
1253 aSeq.Append(TCollection_ExtendedString(aCompType));
1257 TCollection_AsciiString aFileName =
1258 thePath + TCollection_AsciiString("\\") + theBaseName + TCollection_AsciiString(".py");
1260 TCollection_AsciiString aFileName =
1261 thePath + TCollection_AsciiString("/") + theBaseName + TCollection_AsciiString(".py");
1264 //Create a file that will contain a main Study script
1266 fp.open(aFileName.ToCString(), ios::out);
1269 bool isOpened = fp.is_open();
1271 bool isOpened = fp.rdbuf()->is_open();
1275 _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
1279 TCollection_AsciiString aBatchModeScript = "salome";
1281 //Output to the main Study script required Python modules import,
1282 //set sys.path and add a creation of the study.
1283 fp << GetDumpStudyComment().ToCString() << endl << endl;
1284 fp << "import sys" << endl;
1285 fp << "import " << aBatchModeScript << endl << endl;
1287 fp << aBatchModeScript << ".salome_init()" << endl << endl;
1289 fp << "sys.path.insert( 0, \'" << thePath << "\')" << endl << endl;
1292 //Check if it's necessary to dump visual parameters
1293 bool isDumpVisuals = SALOMEDSImpl_IParameters::isDumpPython(this);
1294 int lastSavePoint = -1;
1296 lastSavePoint = SALOMEDSImpl_IParameters::getLastSavePoint(this);
1297 if(lastSavePoint > 0) {
1298 fp << SALOMEDSImpl_IParameters::getStudyScript(this, lastSavePoint) << endl << endl;
1303 Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString;
1305 //Iterate all components and create the componponents specific scripts.
1307 int aLength = aSeq.Length();
1308 for(int i = 1; i <= aLength; i++) {
1310 aCompType = aSeq.Value(i);
1311 Handle(SALOMEDSImpl_SComponent) sco = FindComponent(aCompType);
1312 SALOMEDSImpl_Driver* aDriver = NULL;
1313 // if there is an associated Engine call its method for saving
1314 TCollection_AsciiString IOREngine;
1316 if (!sco->ComponentIOR(IOREngine)) {
1317 if (!aCompType.IsEmpty()) {
1319 aDriver = theFactory->GetDriverByType(aCompType);
1321 if (aDriver != NULL) {
1322 Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder();
1323 if(!SB->LoadWith(sco, aDriver)) {
1324 _errorCode = SB->GetErrorCode();
1332 aDriver = theFactory->GetDriverByIOR(IOREngine);
1335 _errorCode = "Can not restore information to dump it";
1339 if(aDriver == NULL) continue;
1342 long aStreamLength = 0;
1343 Handle(SALOMEDSImpl_TMPFile) aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
1344 if ( !isValidScript )
1347 //Create a file that will contain the component specific script
1350 aFileName=thePath+TCollection_AsciiString("\\");
1352 aFileName=thePath+TCollection_AsciiString("/");
1354 TCollection_AsciiString aScriptName;
1355 aScriptName += theBaseName;
1357 aScriptName += aCompType;
1359 aFileName += aScriptName+ TCollection_AsciiString(".py");
1360 aSeqOfFileNames->Append(aFileName);
1362 fp2.open(aFileName.ToCString(), ios::out);
1365 isOpened = fp2.is_open();
1367 isOpened = fp2.rdbuf()->is_open();
1371 _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
1372 SALOMEDSImpl_Tool::RemoveTemporaryFiles(thePath, aSeqOfFileNames, false);
1376 //Output the Python script generated by the component in the newly created file.
1377 fp2 << aStream->Data();
1380 //Add to the main script a call to RebuildData of the generated by the component the Python script
1381 fp << "import " << aScriptName << endl;
1382 fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl;
1386 fp << "if salome.sg.hasDesktop():" << endl;
1387 fp << "\tsalome.sg.updateObjBrowser(1)" << endl;
1389 if(isDumpVisuals) { //Output the call to Session's method restoreVisualState
1390 fp << "\tiparameters.getSession().restoreVisualState(1)" << endl;
1398 //=======================================================================
1399 //function : GetDumpStudyComment
1400 //purpose : return a header comment for a DumpStudy script
1401 //=======================================================================
1403 TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName)
1405 TCollection_AsciiString txt
1406 ("### This file is generated by SALOME automatically by dump python functionality");
1407 if ( theComponentName )
1408 txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component";
1412 void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
1414 const TCollection_AsciiString& Tab,
1415 const Handle(SALOMEDSImpl_Study) theStudy);
1416 //============================================================================
1420 //============================================================================
1421 void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName)
1423 //Create a file that will contain a main Study script
1425 fp.open(theFileName.ToCString(), ios::out);
1428 bool isOpened = fp.is_open();
1430 bool isOpened = fp.rdbuf()->is_open();
1434 _errorCode = TCollection_AsciiString("Can't create a file ")+theFileName;
1435 cout << "### SALOMEDSImpl_Study::dump Error: " << _errorCode << endl;
1439 Handle(SALOMEDSImpl_SObject) aSO = FindObjectID("0:1");
1440 fp << "0:1" << endl;
1441 Handle(SALOMEDSImpl_ChildIterator) Itr = NewChildIterator(aSO);
1442 TCollection_AsciiString aTab(" ");
1443 for(; Itr->More(); Itr->Next()) {
1444 dumpSO(Itr->Value(), fp, aTab, this);
1451 void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
1453 const TCollection_AsciiString& Tab,
1454 const Handle(SALOMEDSImpl_Study) theStudy)
1456 TCollection_AsciiString aTab(Tab), anID(theSO->GetID());
1457 fp << aTab << anID << endl;
1458 TDF_AttributeIterator anItr(theSO->GetLabel());
1459 for(; anItr.More(); anItr.Next()) {
1460 Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anItr.Value());
1462 if(anAttr.IsNull()) {
1463 fp << Tab << " -- " << anItr.Value()->DynamicType();
1467 TCollection_AsciiString aType = anAttr->GetClassType();
1468 fp << Tab << " -- " << aType;
1470 if(aType == "AttributeReal") {
1471 fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value();
1473 else if(aType == "AttributeInteger") {
1474 fp << " : " << Handle(SALOMEDSImpl_AttributeInteger)::DownCast(anAttr)->Value();
1476 else if(aType == "AttributeName") {
1477 fp << " : " << Handle(SALOMEDSImpl_AttributeName)::DownCast(anAttr)->Value();
1479 else if(aType == "AttributeComment") {
1480 fp << " : " << Handle(SALOMEDSImpl_AttributeComment)::DownCast(anAttr)->Value();
1482 else if(aType == "AttributeReference") {
1483 fp << " : " << Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Save();
1488 Handle(SALOMEDSImpl_ChildIterator) Itr = theStudy->NewChildIterator(theSO);
1489 TCollection_AsciiString aNewTab(" ");
1491 for(; Itr->More(); Itr->Next()) {
1492 dumpSO(Itr->Value(), fp, aNewTab, theStudy);
1498 void SALOMEDSImpl_Study::Modify()
1504 //============================================================================
1508 //============================================================================
1509 Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint)
1511 if (theSavePoint < 0) return NULL;
1512 Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
1513 Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID);
1514 if (so.IsNull()) so = builder->NewComponent((char*)theID);
1515 Handle(SALOMEDSImpl_AttributeParameter) attParam;
1517 if (theSavePoint > 0) { // Try to find SObject that contains attribute parameter ...
1518 TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 );
1519 if ( !savePointLabel.IsNull() )
1520 so = GetSObject( savePointLabel );
1521 else // ... if it does not exist - create a new one
1522 so = builder->NewObjectToTag( so, theSavePoint );
1526 builder->FindAttribute(so, attParam, "AttributeParameter");
1527 if ( attParam.IsNull() ) { // first call of GetCommonParameters on "Interface Applicative" component
1528 Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter");
1529 attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att );
1535 //============================================================================
1539 //============================================================================
1540 Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters(const char* theID,
1541 const char* theModuleName,
1544 if(theSavePoint <= 0) return NULL;
1545 Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint);
1546 Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject();
1547 Handle(SALOMEDSImpl_AttributeParameter) par;
1549 Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(main_so);
1550 string moduleName(theModuleName);
1551 for(; it->More(); it->Next()) {
1552 Handle(SALOMEDSImpl_SObject) so(it->Value());
1553 Handle(SALOMEDSImpl_GenericAttribute) ga;
1554 if(so->FindAttribute(ga, "AttributeParameter")) {
1555 par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(ga);
1556 if(!par->IsSet("AP_MODULE_NAME", (Parameter_Types)3)) continue; //3 -> PT_STRING
1557 if(par->GetString("AP_MODULE_NAME") == moduleName) return par;
1561 Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
1562 Handle(SALOMEDSImpl_SObject) so = builder->NewObject(main_so);
1563 par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(so, "AttributeParameter"));
1564 par->SetString("AP_MODULE_NAME", moduleName);
1568 //============================================================================
1569 /*! Function : SetStudyLock
1572 //============================================================================
1573 void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID)
1575 _lockers->Append(TCollection_AsciiString((char*)theLockerID));
1578 //============================================================================
1579 /*! Function : IsStudyLocked
1582 //============================================================================
1583 bool SALOMEDSImpl_Study::IsStudyLocked()
1585 return (_lockers->Length() > 0);
1588 //============================================================================
1589 /*! Function : UnLockStudy
1592 //============================================================================
1593 void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID)
1595 int length = _lockers->Length(), pos = -1;
1596 TCollection_AsciiString id((char*)theLockerID);
1597 for(int i = 1; i<=length; i++) {
1598 if(id == _lockers->Value(i)) {
1603 if(pos > 0) _lockers->Remove(pos);
1606 //============================================================================
1607 /*! Function : GetLockerID
1610 //============================================================================
1611 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID()
1616 //============================================================================
1617 /*! Function : EnableUseCaseAutoFilling
1620 //============================================================================
1621 void SALOMEDSImpl_Study::EnableUseCaseAutoFilling(bool isEnabled)
1623 _errorCode = ""; _autoFill = isEnabled;
1625 _builder->SetOnAddSObject(_cb);
1626 _builder->SetOnRemoveSObject(_cb);
1629 _builder->SetOnAddSObject(NULL);
1630 _builder->SetOnRemoveSObject(NULL);