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);
357 if(aResult.IsNull()) _errorCode = "No object was found";
361 //============================================================================
362 /*! Function : FindObjectByPath
363 * Purpose : Find an Object by its path = thePath
365 //============================================================================
366 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollection_AsciiString& thePath)
370 TCollection_AsciiString aPath(thePath), aToken;
371 Handle(SALOMEDSImpl_SObject) aSO = NULL;
372 int i = 1, aLength = aPath.Length();
373 bool isRelative = false;
375 if(aLength == 0) { //Empty path - return the current context
376 return GetSObject(_current);
379 if(aPath.Value(1) != '/') //Relative path
382 TDF_ChildIterator anIterator;
384 Handle(SALOMEDSImpl_AttributeName) anAttr;
387 if(_current.IsNull()) return NULL;
388 anIterator.Initialize(_current, Standard_False);
391 if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root
392 return GetSObject(_doc->Main());
394 anIterator.Initialize(_doc->Main(), Standard_False);
397 while(i <= aLength) {
399 aToken = aPath.Token("/", i);
400 if(aToken.Length() == 0) break;
402 for ( ; anIterator.More(); anIterator.Next() ) {
403 aLabel = anIterator.Value();
404 if(aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) {
405 if(anAttr->Value() == aToken) {
406 aToken = aPath.Token("/", i+1); //Check if it was the last part of the path
407 if(aToken.Length() == 0) { //The searched label is found (no part of the path is left)
408 return GetSObject(aLabel);
411 anIterator.Initialize(aLabel, Standard_False);
420 if(aSO.IsNull()) _errorCode = "No object was found";
424 //============================================================================
425 /*! Function : GetObjectPath
428 //============================================================================
429 TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject)
433 TCollection_AsciiString aPath("");
434 if(theObject.IsNull()) {
435 _errorCode = "Null object";
436 return aPath.ToCString();
439 TCollection_AsciiString aName = theObject->GetName();
440 if(!aName.IsEmpty() && aName != "" ) {
441 TCollection_AsciiString aValue((char*)aName.ToCString());
445 Handle(SALOMEDSImpl_SObject) aFather = theObject->GetFather();
446 if(!aFather.IsNull()) {
447 aName = aFather->GetName();
448 if(!aName.IsEmpty() && aName != "") {
449 aValue = (char*)GetObjectPath(aFather).ToCString();
450 aPath = aValue + aPath;
459 //============================================================================
460 /*! Function : GetObjectPathByIOR
463 //============================================================================
464 TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR)
468 TCollection_AsciiString aPath;
469 Handle(SALOMEDSImpl_SObject) so = FindObjectIOR(theIOR);
471 _errorCode = "No SObject was found by IOR";
475 return GetObjectPath(so);
479 //============================================================================
480 /*! Function : SetContext
481 * Purpose : Sets the current context
483 //============================================================================
484 bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath)
487 if(thePath.IsEmpty()) {
488 _errorCode = "InvalidPath";
492 TCollection_AsciiString aPath(thePath), aContext("");
493 bool isInvalid = false;
494 Handle(SALOMEDSImpl_SObject) aSO;
496 if(aPath.Value(1) != '/') { //Relative path
497 aContext = GetContext();
505 aSO = FindObjectByPath(aContext.ToCString());
511 if(isInvalid || aSO.IsNull()) {
512 _errorCode = "InvalidContext";
516 TDF_Label aLabel = aSO->GetLabel();
517 if(aLabel.IsNull()) {
518 _errorCode = "InvalidContext";
522 _current = aLabel; //Set the current context
527 //============================================================================
528 /*! Function : GetContext
529 * Purpose : Gets the current context
531 //============================================================================
532 TCollection_AsciiString SALOMEDSImpl_Study::GetContext()
536 if(_current.IsNull()) {
537 _errorCode = "InvaidContext";
540 Handle(SALOMEDSImpl_SObject) so = GetSObject(_current);
541 return GetObjectPath(so);
544 //============================================================================
545 /*! Function : GetObjectNames
546 * Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
548 //============================================================================
549 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext)
553 Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
555 if (theContext.IsEmpty()) {
558 TDF_Label aTmp = _current;
559 SetContext(theContext);
563 if (aLabel.IsNull()) {
564 _errorCode = "InvalidContext";
568 TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels
569 for (; anIter.More(); anIter.Next()) {
570 TDF_Label aLabel = anIter.Value();
571 Handle(SALOMEDSImpl_AttributeName) aName;
572 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
578 //============================================================================
579 /*! Function : GetDirectoryNames
580 * Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
582 //============================================================================
583 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(const TCollection_AsciiString& theContext)
587 Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
589 if (theContext.IsEmpty()) {
592 TDF_Label aTmp = _current;
593 SetContext(theContext);
597 if (aLabel.IsNull()) {
598 _errorCode = "InvalidContext";
602 TDF_ChildIterator anIter (aLabel, Standard_True); // iterate first-level children at all sublevels
603 for (; anIter.More(); anIter.Next()) {
604 TDF_Label aLabel = anIter.Value();
605 Handle(SALOMEDSImpl_AttributeLocalID) anID;
606 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
607 if (anID->Value() == DIRECTORYID) {
608 Handle(SALOMEDSImpl_AttributeName) aName;
609 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) {
610 aResultSeq->Append(aName->Value());
619 //============================================================================
620 /*! Function : GetFileNames
621 * Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
623 //============================================================================
624 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TCollection_AsciiString& theContext)
628 Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
630 if (theContext.IsEmpty()) {
633 TDF_Label aTmp = _current;
634 SetContext(theContext);
638 if (aLabel.IsNull()) {
639 _errorCode = "InvalidContext";
643 TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels
644 for (; anIter.More(); anIter.Next()) {
645 TDF_Label aLabel = anIter.Value();
646 Handle(SALOMEDSImpl_AttributeLocalID) anID;
647 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
648 if (anID->Value() == FILELOCALID) {
649 Handle(SALOMEDSImpl_AttributePersistentRef) aName;
650 if (aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(), aName)) {
651 TCollection_ExtendedString aFileName = aName->Value();
652 if (aFileName.Length() > 0)
653 aResultSeq->Append(aFileName.Split(strlen(FILEID)));
662 //============================================================================
663 /*! Function : GetComponentNames
664 * Purpose : method to get all components names
666 //============================================================================
667 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext)
671 Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
672 TDF_ChildIterator anIter(_doc->Main(), Standard_False); // iterate all subchildren at first level
673 for(; anIter.More(); anIter.Next()) {
674 TDF_Label aLabel = anIter.Value();
675 Handle(SALOMEDSImpl_AttributeName) aName;
676 if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
682 //============================================================================
683 /*! Function : NewChildIterator
684 * Purpose : Create a ChildIterator from an SObject
686 //============================================================================
687 Handle(SALOMEDSImpl_ChildIterator) SALOMEDSImpl_Study::NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO)
690 return new SALOMEDSImpl_ChildIterator(aSO);
694 //============================================================================
695 /*! Function : NewComponentIterator
696 * Purpose : Create a SComponentIterator
698 //============================================================================
699 SALOMEDSImpl_SComponentIterator SALOMEDSImpl_Study::NewComponentIterator()
702 return SALOMEDSImpl_SComponentIterator(_doc);
706 //============================================================================
707 /*! Function : NewBuilder
708 * Purpose : Create a StudyBuilder
710 //============================================================================
711 Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder()
715 _builder->SetOnAddSObject(_cb);
716 _builder->SetOnRemoveSObject(_cb);
722 //============================================================================
724 * Purpose : get study name
726 //============================================================================
727 TCollection_AsciiString SALOMEDSImpl_Study::Name()
733 //============================================================================
735 * Purpose : set study name
737 //============================================================================
738 void SALOMEDSImpl_Study::Name(const TCollection_AsciiString& name)
744 //============================================================================
745 /*! Function : IsSaved
746 * Purpose : get if study has been saved
748 //============================================================================
749 bool SALOMEDSImpl_Study::IsSaved()
755 //============================================================================
756 /*! Function : IsSaved
757 * Purpose : set if study has been saved
759 //============================================================================
760 void SALOMEDSImpl_Study::IsSaved(bool save)
764 if(save) _doc->UnModify();
767 //============================================================================
768 /*! Function : IsModified
769 * Purpose : Detect if a Study has been modified since it has been saved
771 //============================================================================
772 bool SALOMEDSImpl_Study::IsModified()
776 // True if is modified
777 if (_doc->IsModified()) return true;
782 //============================================================================
784 * Purpose : get URL of the study (persistent reference of the study)
786 //============================================================================
787 TCollection_AsciiString SALOMEDSImpl_Study::URL()
793 //============================================================================
795 * Purpose : set URL of the study (persistent reference of the study)
797 //============================================================================
798 void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url)
803 /*jfa: Now name of SALOMEDS study will correspond to name of SalomeApp study
804 TCollection_AsciiString tmp(_URL);
806 char *aName = (char*)tmp.ToCString();
807 char *adr = strtok(aName, "/");
811 adr = strtok(NULL, "/");
818 //============================================================================
819 /*! Function : _FindObject
820 * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
822 //============================================================================
823 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
824 const TCollection_AsciiString& theObjectName,
827 if(SO.IsNull()) return NULL;
829 // Iterate on each objects and subobjects of the component
830 // If objectName find, stop the loop and get the object reference
831 Handle(SALOMEDSImpl_SObject) RefSO;
832 Handle(SALOMEDSImpl_AttributeName) anAttr;
834 TCollection_AsciiString soid = SO->GetID();
835 TDF_ChildIterator it(SO->GetLabel());
836 for (; it.More(); it.Next()){
839 if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr))
841 TCollection_AsciiString Val(anAttr->Value());
842 if (Val == theObjectName)
844 RefSO = GetSObject(it.Value());
848 if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find);
854 //============================================================================
855 /*! Function : _FindObjectIOR
856 * Purpose : Find an Object with SALOMEDSImpl_IOR = anObjectIOR
858 //============================================================================
859 Handle(SALOMEDSImpl_SObject)
860 SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO,
861 const TCollection_AsciiString& theObjectIOR,
864 if(SO.IsNull()) return NULL;
866 // Iterate on each objects and subobjects of the component
867 // If objectName find, stop the loop and get the object reference
868 Handle(SALOMEDSImpl_SObject) RefSO, aSO;
869 Handle(SALOMEDSImpl_AttributeIOR) anAttr;
871 TDF_ChildIterator it(SO->GetLabel());
872 for (; it.More();it.Next()){
875 if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
877 TCollection_AsciiString Val(anAttr->Value());
878 if (Val == theObjectIOR)
880 RefSO = GetSObject(it.Value());
884 aSO = GetSObject(it.Value());
885 if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find);
891 bool SALOMEDSImpl_Study::IsLocked()
894 return GetProperties()->IsLocked();
897 int SALOMEDSImpl_Study::StudyId()
903 void SALOMEDSImpl_Study::StudyId(int id)
909 void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry)
913 char* anEn = (char*)anEntry.ToCString();
914 char* IOR = (char*)anIOR.ToCString();
915 TDF_Tool::Label(_doc->GetData(),anEn, aLabel, Standard_True);
916 if (myIORLabels.IsBound(TCollection_ExtendedString(IOR))) myIORLabels.UnBind(TCollection_ExtendedString(IOR));
917 myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel);
920 Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel)
922 Handle(SALOMEDSImpl_StudyHandle) Att;
923 if (theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID(),Att)) {
924 return Att->GetHandle();
929 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::SObject(const TDF_Label& theLabel)
931 return GetStudy(theLabel)->GetSObject(theLabel);
934 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::SComponent(const TDF_Label& theLabel)
936 return GetStudy(theLabel)->GetSComponent(theLabel);
940 void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute)
942 TCollection_AsciiString aString;
943 TDF_Tool::Entry(theAttribute->Label(), aString);
944 GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString);
947 Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject)
950 Handle(TColStd_HSequenceOfTransient) aSeq;
952 Handle(SALOMEDSImpl_AttributeTarget) aTarget;
953 if (anObject->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) {
954 return aTarget->Get();
961 Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties()
964 return SALOMEDSImpl_AttributeStudyProperties::Set(_doc->Main());
967 TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate()
970 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
972 Handle(TColStd_HSequenceOfExtendedString) aNames;
973 Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
974 aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
976 int aLastIndex = aNames->Length();
978 sprintf(aResult, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
979 (int)(aDays->Value(aLastIndex)),(int)(aMonths->Value(aLastIndex)), (int)(aYears->Value(aLastIndex)),
980 (int)(aHours->Value(aLastIndex)), (int)(aMinutes->Value(aLastIndex)));
981 TCollection_AsciiString aResStr (aResult);
985 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate()
988 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
990 Handle(TColStd_HSequenceOfExtendedString) aNames;
991 Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
992 aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
994 int anIndex, aLength = aNames->Length();
995 Handle(TColStd_HSequenceOfAsciiString) aDates = new TColStd_HSequenceOfAsciiString;
997 for (anIndex = 2; anIndex <= aLength; anIndex++) {
999 sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
1000 (int)(aDays->Value(anIndex)), (int)(aMonths->Value(anIndex)), (int)(aYears->Value(anIndex)),
1001 (int)(aHours->Value(anIndex)), (int)(aMinutes->Value(anIndex)));
1002 aDates->Append(aDate);
1009 //============================================================================
1010 /*! Function : GetUseCaseBuilder
1011 * Purpose : Returns a UseCase builder
1013 //============================================================================
1014 Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder()
1017 return _useCaseBuilder;
1021 //============================================================================
1022 /*! Function : Close
1025 //============================================================================
1026 void SALOMEDSImpl_Study::Close()
1029 Handle(TDocStd_Application) anApp = Handle(TDocStd_Application)::DownCast(_doc->Application());
1030 if(!anApp.IsNull()) anApp->Close(_doc);
1036 //============================================================================
1037 /*! Function : AddPostponed
1040 //============================================================================
1041 void SALOMEDSImpl_Study::AddPostponed(const TCollection_AsciiString& theIOR)
1044 if (!NewBuilder()->HasOpenCommand()) return;
1045 TCollection_AsciiString anIOR(theIOR);
1047 myPostponedIORs.Append(anIOR); // add prefix: deleted
1048 myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
1051 //============================================================================
1052 /*! Function : AddCreatedPostponed
1055 //============================================================================
1056 void SALOMEDSImpl_Study::AddCreatedPostponed(const TCollection_AsciiString& theIOR)
1059 if (!NewBuilder()->HasOpenCommand()) return;
1060 TCollection_AsciiString anIOR(theIOR);
1062 myPostponedIORs.Append(anIOR); // add prefix: created
1063 myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
1066 //============================================================================
1067 /*! Function : RemovePostponed
1070 //============================================================================
1071 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const int theUndoLimit)
1078 int aUndoLimit = theUndoLimit;
1079 if (theUndoLimit < 0) aUndoLimit = 0;
1081 Handle(TColStd_HSequenceOfAsciiString) aSeq = new TColStd_HSequenceOfAsciiString;
1083 if (myNbUndos > 0) { // remove undone
1085 for(anIndex = 1; anIndex < myNbPostponed.Length() - myNbUndos; anIndex++)
1086 anOld += myNbPostponed(anIndex);
1087 int aNew = myPostponedIORs.Length() - myNbPostponed.Last();
1089 for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) {
1090 TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
1091 if (anIOR.Value(1) == 'c') {
1092 aSeq->Append(anIOR.Split(1).ToCString());
1095 if (anOld < aNew) myPostponedIORs.Remove(anOld + 1, aNew);
1096 if (myNbPostponed.Length() > 0) myNbPostponed.Remove(myNbPostponed.Length() - myNbUndos, myNbPostponed.Length() - 1);
1101 if (myNbPostponed.Length() > aUndoLimit) { // remove objects, that can not be undone
1103 for(anIndex = myNbPostponed.Length() - aUndoLimit; anIndex >= 1; anIndex--)
1104 anOld += myNbPostponed(anIndex);
1105 for(anIndex = 1; anIndex <= anOld; anIndex++) {
1106 TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
1107 if (anIOR.Value(1) == 'd') {
1108 aSeq->Append(anIOR.Split(1).ToCString());
1111 if (anOld > 0) myPostponedIORs.Remove(1, anOld);
1112 myNbPostponed.Remove(1, myNbPostponed.Length() - aUndoLimit);
1115 if (theUndoLimit == -1) { // remove all IORs from the study on the study close
1116 TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDSImpl_AttributeIOR::GetID(), Standard_True);
1117 for(; anIter.More(); anIter.Next()) {
1118 Handle(SALOMEDSImpl_AttributeIOR) anAttr = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anIter.Value());
1119 aSeq->Append(anAttr->Value());
1121 } else myNbPostponed.Append(0);
1126 //============================================================================
1127 /*! Function : UndoPostponed
1130 //============================================================================
1131 void SALOMEDSImpl_Study::UndoPostponed(const int theWay)
1135 myNbUndos += theWay;
1136 // remove current postponed
1137 if (myNbPostponed.Last() > 0)
1138 myPostponedIORs.Remove(myPostponedIORs.Length() - myNbPostponed.Last() + 1, myPostponedIORs.Length());
1139 myNbPostponed(myNbPostponed.Length()) = 0;
1143 //============================================================================
1144 /*! Function : GetSComponent
1147 //============================================================================
1148 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry)
1150 Handle(SALOMEDSImpl_SComponent) aSCO;
1151 if(_mapOfSCO.IsBound(theEntry))
1152 aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry));
1155 TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
1156 aSCO = new SALOMEDSImpl_SComponent(aLabel);
1157 _mapOfSCO.Bind(theEntry, aSCO);
1163 //============================================================================
1164 /*! Function : GetSComponent
1167 //============================================================================
1168 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel)
1170 TCollection_AsciiString anEntry;
1171 TDF_Tool::Entry(theLabel, anEntry);
1172 return GetSComponent(anEntry);
1175 //============================================================================
1176 /*! Function : GetSObject
1179 //============================================================================
1180 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry)
1182 Handle(SALOMEDSImpl_SObject) aSO;
1183 if(_mapOfSO.IsBound(theEntry))
1184 aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry));
1187 TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
1188 aSO = new SALOMEDSImpl_SObject(aLabel);
1189 _mapOfSO.Bind(theEntry, aSO);
1195 //============================================================================
1196 /*! Function : GetSObject
1199 //============================================================================
1200 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel)
1202 TCollection_AsciiString anEntry;
1203 TDF_Tool::Entry(theLabel, anEntry);
1204 return GetSObject(anEntry);
1207 //============================================================================
1208 /*! Function : GetAttribute
1211 //============================================================================
1212 Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry,
1213 const TCollection_AsciiString& theType)
1215 Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry);
1216 Handle(TDF_Attribute) anAttr;
1217 aSO->FindAttribute(anAttr, theType);
1221 //============================================================================
1222 /*! Function : DumpStudy
1225 //============================================================================
1226 bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
1227 const TCollection_AsciiString& theBaseName,
1229 SALOMEDSImpl_DriverFactory* theFactory)
1233 if(theFactory == NULL) {
1234 _errorCode = "Null factory for creation of Engines";
1238 TColStd_SequenceOfExtendedString aSeq;
1239 TCollection_AsciiString aCompType, aFactoryType;
1241 //Build a list of all components in the Study
1242 SALOMEDSImpl_SComponentIterator itcomponent = NewComponentIterator();
1244 for (; itcomponent.More(); itcomponent.Next()) {
1245 Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
1246 aCompType = sco->ComponentDataType();
1247 //GEOM and MED are independent components
1248 if (aCompType == "GEOM" || aCompType == "MED")
1249 aSeq.Prepend(TCollection_ExtendedString(aCompType));
1251 aSeq.Append(TCollection_ExtendedString(aCompType));
1255 TCollection_AsciiString aFileName =
1256 thePath + TCollection_AsciiString("\\") + theBaseName + TCollection_AsciiString(".py");
1258 TCollection_AsciiString aFileName =
1259 thePath + TCollection_AsciiString("/") + theBaseName + TCollection_AsciiString(".py");
1262 //Create a file that will contain a main Study script
1264 fp.open(aFileName.ToCString(), ios::out);
1267 bool isOpened = fp.is_open();
1269 bool isOpened = fp.rdbuf()->is_open();
1273 _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
1277 TCollection_AsciiString aBatchModeScript = "salome";
1279 //Output to the main Study script required Python modules import,
1280 //set sys.path and add a creation of the study.
1281 fp << GetDumpStudyComment().ToCString() << endl << endl;
1282 fp << "import sys" << endl;
1283 fp << "import " << aBatchModeScript << endl << endl;
1285 fp << aBatchModeScript << ".salome_init()" << endl << endl;
1287 fp << "sys.path.insert( 0, \'" << thePath << "\')" << endl << endl;
1290 //Check if it's necessary to dump visual parameters
1291 bool isDumpVisuals = SALOMEDSImpl_IParameters::isDumpPython(this);
1292 int lastSavePoint = -1;
1294 lastSavePoint = SALOMEDSImpl_IParameters::getLastSavePoint(this);
1295 if(lastSavePoint > 0) {
1296 fp << SALOMEDSImpl_IParameters::getStudyScript(this, lastSavePoint) << endl << endl;
1301 Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString;
1303 //Iterate all components and create the componponents specific scripts.
1305 int aLength = aSeq.Length();
1306 for(int i = 1; i <= aLength; i++) {
1308 aCompType = aSeq.Value(i);
1309 Handle(SALOMEDSImpl_SComponent) sco = FindComponent(aCompType);
1310 SALOMEDSImpl_Driver* aDriver = NULL;
1311 // if there is an associated Engine call its method for saving
1312 TCollection_AsciiString IOREngine;
1314 if (!sco->ComponentIOR(IOREngine)) {
1315 if (!aCompType.IsEmpty()) {
1317 aDriver = theFactory->GetDriverByType(aCompType);
1319 if (aDriver != NULL) {
1320 Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder();
1321 if(!SB->LoadWith(sco, aDriver)) {
1322 _errorCode = SB->GetErrorCode();
1330 aDriver = theFactory->GetDriverByIOR(IOREngine);
1333 _errorCode = "Can not restore information to dump it";
1337 if(aDriver == NULL) continue;
1340 long aStreamLength = 0;
1341 Handle(SALOMEDSImpl_TMPFile) aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
1342 if ( !isValidScript )
1345 //Create a file that will contain the component specific script
1348 aFileName=thePath+TCollection_AsciiString("\\");
1350 aFileName=thePath+TCollection_AsciiString("/");
1352 TCollection_AsciiString aScriptName;
1353 aScriptName += theBaseName;
1355 aScriptName += aCompType;
1357 aFileName += aScriptName+ TCollection_AsciiString(".py");
1358 aSeqOfFileNames->Append(aFileName);
1360 fp2.open(aFileName.ToCString(), ios::out);
1363 isOpened = fp2.is_open();
1365 isOpened = fp2.rdbuf()->is_open();
1369 _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
1370 SALOMEDSImpl_Tool::RemoveTemporaryFiles(thePath, aSeqOfFileNames, false);
1374 //Output the Python script generated by the component in the newly created file.
1375 fp2 << aStream->Data();
1378 //Add to the main script a call to RebuildData of the generated by the component the Python script
1379 fp << "import " << aScriptName << endl;
1380 fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl;
1384 fp << "if salome.sg.hasDesktop():" << endl;
1385 fp << "\tsalome.sg.updateObjBrowser(1)" << endl;
1387 if(isDumpVisuals) { //Output the call to Session's method restoreVisualState
1388 fp << "\tiparameters.getSession().restoreVisualState(1)" << endl;
1396 //=======================================================================
1397 //function : GetDumpStudyComment
1398 //purpose : return a header comment for a DumpStudy script
1399 //=======================================================================
1401 TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName)
1403 TCollection_AsciiString txt
1404 ("### This file is generated by SALOME automatically by dump python functionality");
1405 if ( theComponentName )
1406 txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component";
1410 void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
1412 const TCollection_AsciiString& Tab,
1413 const Handle(SALOMEDSImpl_Study) theStudy);
1414 //============================================================================
1418 //============================================================================
1419 void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName)
1421 //Create a file that will contain a main Study script
1423 fp.open(theFileName.ToCString(), ios::out);
1426 bool isOpened = fp.is_open();
1428 bool isOpened = fp.rdbuf()->is_open();
1432 _errorCode = TCollection_AsciiString("Can't create a file ")+theFileName;
1433 cout << "### SALOMEDSImpl_Study::dump Error: " << _errorCode << endl;
1437 Handle(SALOMEDSImpl_SObject) aSO = FindObjectID("0:1");
1438 fp << "0:1" << endl;
1439 Handle(SALOMEDSImpl_ChildIterator) Itr = NewChildIterator(aSO);
1440 TCollection_AsciiString aTab(" ");
1441 for(; Itr->More(); Itr->Next()) {
1442 dumpSO(Itr->Value(), fp, aTab, this);
1449 void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
1451 const TCollection_AsciiString& Tab,
1452 const Handle(SALOMEDSImpl_Study) theStudy)
1454 TCollection_AsciiString aTab(Tab), anID(theSO->GetID());
1455 fp << aTab << anID << endl;
1456 TDF_AttributeIterator anItr(theSO->GetLabel());
1457 for(; anItr.More(); anItr.Next()) {
1458 Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anItr.Value());
1460 if(anAttr.IsNull()) {
1461 fp << Tab << " -- " << anItr.Value()->DynamicType();
1465 TCollection_AsciiString aType = anAttr->GetClassType();
1466 fp << Tab << " -- " << aType;
1468 if(aType == "AttributeReal") {
1469 fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value();
1471 else if(aType == "AttributeInteger") {
1472 fp << " : " << Handle(SALOMEDSImpl_AttributeInteger)::DownCast(anAttr)->Value();
1474 else if(aType == "AttributeName") {
1475 fp << " : " << Handle(SALOMEDSImpl_AttributeName)::DownCast(anAttr)->Value();
1477 else if(aType == "AttributeComment") {
1478 fp << " : " << Handle(SALOMEDSImpl_AttributeComment)::DownCast(anAttr)->Value();
1480 else if(aType == "AttributeReference") {
1481 fp << " : " << Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Save();
1486 Handle(SALOMEDSImpl_ChildIterator) Itr = theStudy->NewChildIterator(theSO);
1487 TCollection_AsciiString aNewTab(" ");
1489 for(; Itr->More(); Itr->Next()) {
1490 dumpSO(Itr->Value(), fp, aNewTab, theStudy);
1496 void SALOMEDSImpl_Study::Modify()
1502 //============================================================================
1506 //============================================================================
1507 Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint)
1509 if (theSavePoint < 0) return NULL;
1510 Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
1511 Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID);
1512 if (so.IsNull()) so = builder->NewComponent((char*)theID);
1513 Handle(SALOMEDSImpl_AttributeParameter) attParam;
1515 if (theSavePoint > 0) { // Try to find SObject that contains attribute parameter ...
1516 TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 );
1517 if ( !savePointLabel.IsNull() )
1518 so = GetSObject( savePointLabel );
1519 else // ... if it does not exist - create a new one
1520 so = builder->NewObjectToTag( so, theSavePoint );
1524 builder->FindAttribute(so, attParam, "AttributeParameter");
1525 if ( attParam.IsNull() ) { // first call of GetCommonParameters on "Interface Applicative" component
1526 Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter");
1527 attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att );
1533 //============================================================================
1537 //============================================================================
1538 Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters(const char* theID,
1539 const char* theModuleName,
1542 if(theSavePoint <= 0) return NULL;
1543 Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint);
1544 Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject();
1545 Handle(SALOMEDSImpl_AttributeParameter) par;
1547 Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(main_so);
1548 string moduleName(theModuleName);
1549 for(; it->More(); it->Next()) {
1550 Handle(SALOMEDSImpl_SObject) so(it->Value());
1551 Handle(SALOMEDSImpl_GenericAttribute) ga;
1552 if(so->FindAttribute(ga, "AttributeParameter")) {
1553 par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(ga);
1554 if(!par->IsSet("AP_MODULE_NAME", (Parameter_Types)3)) continue; //3 -> PT_STRING
1555 if(par->GetString("AP_MODULE_NAME") == moduleName) return par;
1559 Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
1560 Handle(SALOMEDSImpl_SObject) so = builder->NewObject(main_so);
1561 par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(so, "AttributeParameter"));
1562 par->SetString("AP_MODULE_NAME", moduleName);
1566 //============================================================================
1567 /*! Function : SetStudyLock
1570 //============================================================================
1571 void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID)
1573 _lockers->Append(TCollection_AsciiString((char*)theLockerID));
1576 //============================================================================
1577 /*! Function : IsStudyLocked
1580 //============================================================================
1581 bool SALOMEDSImpl_Study::IsStudyLocked()
1583 return (_lockers->Length() > 0);
1586 //============================================================================
1587 /*! Function : UnLockStudy
1590 //============================================================================
1591 void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID)
1593 int length = _lockers->Length(), pos = -1;
1594 TCollection_AsciiString id((char*)theLockerID);
1595 for(int i = 1; i<=length; i++) {
1596 if(id == _lockers->Value(i)) {
1601 if(pos > 0) _lockers->Remove(pos);
1604 //============================================================================
1605 /*! Function : GetLockerID
1608 //============================================================================
1609 Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID()
1614 //============================================================================
1615 /*! Function : EnableUseCaseAutoFilling
1618 //============================================================================
1619 void SALOMEDSImpl_Study::EnableUseCaseAutoFilling(bool isEnabled)
1621 _errorCode = ""; _autoFill = isEnabled;
1623 _builder->SetOnAddSObject(_cb);
1624 _builder->SetOnRemoveSObject(_cb);
1627 _builder->SetOnAddSObject(NULL);
1628 _builder->SetOnRemoveSObject(NULL);