return Base_i::GetID();
}
- void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy)
+ void VISU_Gen_i::SetCurrentStudy (SALOMEDS::Study_ptr theStudy)
{
+ class TEvent: public SALOME_Event {
+ std::string myStudyName;
+ public:
+ TEvent(const std::string theStudyName):myStudyName(theStudyName)
+ {}
+ virtual void Execute()
+ {
+ bool isActive = false;
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ SUIT_Application* aFirstApp = anIter.current();
+ while (SUIT_Application* anApp = anIter.current()) {
+ ++anIter;
+ if (SUIT_Study* aSStudy = anApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ MESSAGE("There is an application with active study : StudyId = "
+ << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'");
+ if (myStudyName == aCStudy->Name()) {
+ isActive = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!isActive) {
+ MESSAGE("!!! anApp->onLoadDoc(myStudyName) !!!");
+ // Has to be loaded in an empty or in a new application
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aFirstApp);
+ anApp->onLoadDoc(myStudyName);
+ }
+ }
+ };
+
if (!CORBA::is_nil(theStudy))
{
CORBA::String_var aName = theStudy->Name();
- QString aStudyName (aName.in());
- MESSAGE("VISU_Gen_i::SetCurrentStudy - StudyId = " <<
- theStudy->StudyId() << "; Name = '" << aName.in() << "'");
+ std::string aStudyName (aName.in());
+ MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'");
myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
- MESSAGE("Find application for study : " << aName.in());
- bool isActive = false;
- SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> anApplications = aSession->applications();
- QPtrListIterator<SUIT_Application> anIter (anApplications);
- SUIT_Application* aFirstApp = anIter.current();
- while (SUIT_Application* anApp = anIter.current()) {
- ++anIter;
- if (SUIT_Study* aSStudy = anApp->activeStudy()) {
- if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
- MESSAGE("There is an application with active study : " << aStudy->studyName());
- if (aStudyName == aStudy->studyName()) {
- isActive = true;
- break;
- }
- }
- }
- }
- if (!isActive) {
- // Has to be loaded in an empty or in a new application
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aFirstApp);
- anApp->onLoadDoc(aName.in());
- }
+ ProcessVoidEvent(new TEvent(aStudyName));
} else {
- MESSAGE("VISU_Gen_i::SetCurrentStudy : CORBA::is_nil(theStudy)");
+ MESSAGE("CORBA::is_nil(theStudy)");
}
}
return aResult._retn();
}
- Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){
- if(myStudyDocument->GetProperties()->IsLocked())
+ Result_ptr VISU_Gen_i::ImportMed (SALOMEDS::SObject_ptr theMedSObject)
+ {
+ if (myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
Mutex mt(myMutex);
Result_i* pResult = new Result_i(myStudyDocument,
Result_i::eComponent,
Result_i::eImportMed);
- if(pResult->Create(theMedSObject) != NULL)
+ if (pResult->Create(theMedSObject) != NULL) {
return pResult->_this();
- else{
+ } else {
pResult->_remove_ref();
return VISU::Result::_nil();
}
}
- Result_ptr VISU_Gen_i::ImportMedField(SALOME_MED::FIELD_ptr theField){
- if(myStudyDocument->GetProperties()->IsLocked())
+ Result_ptr VISU_Gen_i::ImportMedField (SALOME_MED::FIELD_ptr theField)
+ {
+ if (myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
Mutex mt(myMutex);
Result_i* pResult = new Result_i(myStudyDocument,
Result_i::eComponent,
Result_i::eImportMedField);
- if(pResult->Create(theField) != NULL)
+ if (pResult->Create(theField) != NULL) {
return pResult->_this();
- else{
+ } else {
pResult->_remove_ref();
return VISU::Result::_nil();
}
for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
if (it.Value()->hasEntry()) {
std::string aCurEntry (it.Value()->getEntry());
- if (aCurEntry != anEntry) {
+ if (aCurEntry != std::string( anEntry.in() ) ) {
aNewListIO.Append(it.Value());
}
}
anIOR->SetValue(anIORValue);
return aResultSO._retn();
}
-
}