From: mpa Date: Fri, 3 Feb 2017 13:21:39 +0000 (+0300) Subject: Deleted Study parameter X-Git-Tag: Before_python3_27062017~1^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c5ed03d62fe895f9159c33f44259126887b786e2;p=modules%2Fmed.git Deleted Study parameter --- diff --git a/doc/dev/sphinx/fr/medop-prototype-develguide.rst b/doc/dev/sphinx/fr/medop-prototype-develguide.rst index 60e09a3b8..643ffe88c 100644 --- a/doc/dev/sphinx/fr/medop-prototype-develguide.rst +++ b/doc/dev/sphinx/fr/medop-prototype-develguide.rst @@ -561,7 +561,6 @@ donnée du servant ``SALOME_MED::FIELD`` qui lui est associé import VISU visuComp = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") - visuComp.SetCurrentStudy(salome.myStudy) # Then we can import the specified field in the VISU module. This # creates an study entry in the VISU folder. diff --git a/doc/dev/sphinx/fr/medop-prototype-medmem.rst b/doc/dev/sphinx/fr/medop-prototype-medmem.rst index 3e825e8cb..8a9901bfc 100644 --- a/doc/dev/sphinx/fr/medop-prototype-medmem.rst +++ b/doc/dev/sphinx/fr/medop-prototype-medmem.rst @@ -478,7 +478,6 @@ les exemples précédents): # Get the VISU component import VISU visuComp = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") - visuComp.SetCurrentStudy(salome.myStudy) # Get the sobject associated to the med object named "Med" aSObject = salome.myStudy.FindObject("Med") diff --git a/doc/dev/sphinx/medop-prototype-develguide.rst b/doc/dev/sphinx/medop-prototype-develguide.rst index 0bc2eae90..524911f70 100644 --- a/doc/dev/sphinx/medop-prototype-develguide.rst +++ b/doc/dev/sphinx/medop-prototype-develguide.rst @@ -561,7 +561,6 @@ donnée du servant ``SALOME_MED::FIELD`` qui lui est associé import VISU visuComp = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") - visuComp.SetCurrentStudy(salome.myStudy) # Then we can import the specified field in the VISU module. This # creates an study entry in the VISU folder. diff --git a/doc/dev/sphinx/medop-prototype-medmem.rst b/doc/dev/sphinx/medop-prototype-medmem.rst index 9c29fee19..dd70c5d2a 100644 --- a/doc/dev/sphinx/medop-prototype-medmem.rst +++ b/doc/dev/sphinx/medop-prototype-medmem.rst @@ -478,7 +478,6 @@ les exemples précédents): # Get the VISU component import VISU visuComp = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") - visuComp.SetCurrentStudy(salome.myStudy) # Get the sobject associated to the med object named "Med" aSObject = salome.myStudy.FindObject("Med") diff --git a/idl/MED_Gen.idl b/idl/MED_Gen.idl index 7b13765e5..c720a3e6b 100644 --- a/idl/MED_Gen.idl +++ b/idl/MED_Gen.idl @@ -39,40 +39,34 @@ module MED_ORB interface MED_Gen : Engines::EngineComponent { - status addDatasourceToStudy(in SALOMEDS::Study study, - in MEDCALC::DatasourceHandler datasourceHandler) + status addDatasourceToStudy(in MEDCALC::DatasourceHandler datasourceHandler) raises (SALOME::SALOME_Exception); - status registerPresentationField(in SALOMEDS::Study study, - in long fieldId, - in string name, - in string type, - in string ico, - in long presentationId) + status registerPresentationField(in long fieldId, + in string name, + in string type, + in string ico, + in long presentationId) raises (SALOME::SALOME_Exception); - status registerPresentationMesh(in SALOMEDS::Study study, - in long meshId, + status registerPresentationMesh(in long meshId, in string name, in string type, in string ico, in long presentationId) raises (SALOME::SALOME_Exception); - status unregisterPresentation(in SALOMEDS::Study study, - in long presentationId) + status unregisterPresentation(in long presentationId) raises (SALOME::SALOME_Exception); -// PresentationsList getSiblingPresentations(in SALOMEDS::Study study, -// in long presentationId) +// PresentationsList getSiblingPresentations(in long presentationId) // raises (SALOME::SALOME_Exception); // Get all presentations in study: - PresentationsList getStudyPresentations(in SALOMEDS::Study study) + PresentationsList getStudyPresentations() raises (SALOME::SALOME_Exception); - string getStudyPresentationEntry(in SALOMEDS::Study study, - in long presentationId) + string getStudyPresentationEntry(in long presentationId) raises (SALOME::SALOME_Exception); void cleanUp(); diff --git a/resources/MEDCatalog.xml.in b/resources/MEDCatalog.xml.in index 1eda374d3..e7bab563e 100644 --- a/resources/MEDCatalog.xml.in +++ b/resources/MEDCatalog.xml.in @@ -79,7 +79,6 @@ Guillaume Boulant @SALOMEMED_VERSION@ Factory of SALOME components for MED Field operations - 0 @@ -88,7 +87,6 @@ MED @SALOMEMED_VERSION@ MED component engine - 0 diff --git a/src/MEDCalc/cmp/MED.cxx b/src/MEDCalc/cmp/MED.cxx index 3ec7bbe09..65fe2b326 100644 --- a/src/MEDCalc/cmp/MED.cxx +++ b/src/MEDCalc/cmp/MED.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -63,27 +64,27 @@ MED::~MED() } MED_ORB::status -MED::addDatasourceToStudy(SALOMEDS::Study_ptr study, - const MEDCALC::DatasourceHandler& datasourceHandler) +MED::addDatasourceToStudy(const MEDCALC::DatasourceHandler& datasourceHandler) { // set exception handler to catch unexpected CORBA exceptions Unexpect aCatch(SALOME_SalomeException); + SALOMEDS::Study_var aStudy = KERNEL::getStudyServant(); // check if reference to study is valid - if (!CORBA::is_nil(study)) { + if (!CORBA::is_nil(aStudy)) { // get full object path std::string fullName = CORBA::string_dup(datasourceHandler.name); // check if the object with the same name is already registered in the study - SALOMEDS::SObject_var sobj = study->FindObjectByPath(fullName.c_str()); + SALOMEDS::SObject_var sobj = aStudy->FindObjectByPath(fullName.c_str()); if (CORBA::is_nil(sobj)) { // object is not registered yet -> register SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeParameter_var aParam; - SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); - SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); + SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder(); + SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder(); // find MED component; create it if not found - SALOMEDS::SComponent_var father = study->FindComponent("MED"); + SALOMEDS::SComponent_var father = aStudy->FindComponent("MED"); if (CORBA::is_nil(father)) { // create component father = studyBuilder->NewComponent("MED"); @@ -159,12 +160,11 @@ MED::addDatasourceToStudy(SALOMEDS::Study_ptr study, } MED_ORB::status -MED::registerPresentationField(SALOMEDS::Study_ptr study, - CORBA::Long fieldId, - const char* name, - const char* type, - const char* ico, - CORBA::Long presentationId) +MED::registerPresentationField(CORBA::Long fieldId, + const char* name, + const char* type, + const char* ico, + CORBA::Long presentationId) { // set exception handler to catch unexpected CORBA exceptions Unexpect aCatch(SALOME_SalomeException); @@ -181,7 +181,8 @@ MED::registerPresentationField(SALOMEDS::Study_ptr study, return MED_ORB::OP_ERROR ; } std::string entry = _fieldSeriesEntries[fieldSeriesId]; - SALOMEDS::SObject_var sobject = study->FindObjectID(entry.c_str()); + SALOMEDS::Study_var aStudy = KERNEL::getStudyServant(); + SALOMEDS::SObject_var sobject = aStudy->FindObjectID(entry.c_str()); SALOMEDS::SObject_ptr soFieldseries = sobject._retn(); if (soFieldseries->IsNull()) { @@ -189,8 +190,8 @@ MED::registerPresentationField(SALOMEDS::Study_ptr study, return MED_ORB::OP_ERROR; } - SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); - SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); + SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder(); + SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder(); SALOMEDS::SObject_var soPresentation = studyBuilder->NewObject(soFieldseries); useCaseBuilder->AppendTo(soPresentation->GetFather(), soPresentation); @@ -210,12 +211,11 @@ MED::registerPresentationField(SALOMEDS::Study_ptr study, } MED_ORB::status -MED::registerPresentationMesh(SALOMEDS::Study_ptr study, - CORBA::Long meshId, - const char* name, - const char* type, - const char* ico, - CORBA::Long presentationId) +MED::registerPresentationMesh(CORBA::Long meshId, + const char* name, + const char* type, + const char* ico, + CORBA::Long presentationId) { // set exception handler to catch unexpected CORBA exceptions Unexpect aCatch(SALOME_SalomeException); @@ -231,7 +231,8 @@ MED::registerPresentationMesh(SALOMEDS::Study_ptr study, return MED_ORB::OP_ERROR ; } std::string entry = _meshEntries[meshHandler->id]; - SALOMEDS::SObject_var sobject = study->FindObjectID(entry.c_str()); + SALOMEDS::Study_var aStudy = KERNEL::getStudyServant(); + SALOMEDS::SObject_var sobject = aStudy->FindObjectID(entry.c_str()); SALOMEDS::SObject_ptr soMesh = sobject._retn(); if (soMesh->IsNull()) { @@ -239,8 +240,8 @@ MED::registerPresentationMesh(SALOMEDS::Study_ptr study, return MED_ORB::OP_ERROR; } - SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); - SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); + SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder(); + SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder(); SALOMEDS::SObject_var soPresentation = studyBuilder->NewObject(soMesh); useCaseBuilder->AppendTo(soPresentation->GetFather(), soPresentation); @@ -261,18 +262,18 @@ MED::registerPresentationMesh(SALOMEDS::Study_ptr study, MED_ORB::status -MED::unregisterPresentation(SALOMEDS::Study_ptr study, - CORBA::Long presentationId) +MED::unregisterPresentation(CORBA::Long presentationId) { // set exception handler to catch unexpected CORBA exceptions Unexpect aCatch(SALOME_SalomeException); - SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); - SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); + SALOMEDS::Study_var aStudy = KERNEL::getStudyServant(); + SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder(); + SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder(); SALOMEDS::GenericAttribute_var anAttribute; - SALOMEDS::SComponent_var father = study->FindComponent("MED"); - SALOMEDS::ChildIterator_var it = study->NewChildIterator(father); + SALOMEDS::SComponent_var father = aStudy->FindComponent("MED"); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(father); for (it->InitEx(true); it->More(); it->Next()) { SALOMEDS::SObject_var child(it->Value()); @@ -294,19 +295,20 @@ MED::unregisterPresentation(SALOMEDS::Study_ptr study, } MED_ORB::PresentationsList* -MED::getStudyPresentations(SALOMEDS::Study_ptr study) +MED::getStudyPresentations() { // set exception handler to catch unexpected CORBA exceptions Unexpect aCatch(SALOME_SalomeException); MED_ORB::PresentationsList* presList = new MED_ORB::PresentationsList; - SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); - SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); + SALOMEDS::Study_var aStudy = KERNEL::getStudyServant(); + SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder(); + SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder(); SALOMEDS::GenericAttribute_var anAttribute; - SALOMEDS::SComponent_var father = study->FindComponent("MED"); - SALOMEDS::ChildIterator_var it = study->NewChildIterator(father); + SALOMEDS::SComponent_var father = aStudy->FindComponent("MED"); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(father); for (it->InitEx(true); it->More(); it->Next()) { SALOMEDS::SObject_var child(it->Value()); @@ -325,19 +327,20 @@ MED::getStudyPresentations(SALOMEDS::Study_ptr study) } char* -MED::getStudyPresentationEntry(SALOMEDS::Study_ptr study, CORBA::Long presentationId) +MED::getStudyPresentationEntry(CORBA::Long presentationId) { // set exception handler to catch unexpected CORBA exceptions Unexpect aCatch(SALOME_SalomeException); MED_ORB::PresentationsList* presList = new MED_ORB::PresentationsList; - SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); - SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); + SALOMEDS::Study_var aStudy = KERNEL::getStudyServant(); + SALOMEDS::StudyBuilder_var studyBuilder = aStudy->NewBuilder(); + SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder(); SALOMEDS::GenericAttribute_var anAttribute; - SALOMEDS::SComponent_var father = study->FindComponent("MED"); - SALOMEDS::ChildIterator_var it = study->NewChildIterator(father); + SALOMEDS::SComponent_var father = aStudy->FindComponent("MED"); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(father); for (it->InitEx(true); it->More(); it->Next()) { SALOMEDS::SObject_var child(it->Value()); @@ -360,15 +363,7 @@ MED::DumpPython(CORBA::Boolean isPublished, CORBA::Boolean isMultiFile, CORBA::Boolean& isValidScript) { - SALOME_LifeCycleCORBA lcc; - CORBA::Object_var theStudy = lcc.namingService()->Resolve("/Study"); - SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy); - if(CORBA::is_nil(aStudy)) { - std::cerr << "Error: Cannot find the study\n"; - return new Engines::TMPFile(0); - } - - SALOMEDS::SObject_var aSO = aStudy->FindComponent("MED"); + SALOMEDS::SObject_var aSO = KERNEL::getStudyServant()->FindComponent("MED"); if(CORBA::is_nil(aSO)) { std::cerr << "Error: Cannot find component MED\n"; return new Engines::TMPFile(0); @@ -402,10 +397,7 @@ MED::hasObjectInfo() char* MED::getObjectInfo(const char* entry) { - SALOME_LifeCycleCORBA lcc; - CORBA::Object_var aStudyObject = lcc.namingService()->Resolve("/Study"); - SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( aStudyObject ); - SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( entry ); + SALOMEDS::SObject_var aSObj = KERNEL::getStudyServant()->FindObjectID( entry ); SALOMEDS::SObject_var aResultSObj; if (aSObj->ReferencedObject(aResultSObj)) aSObj = aResultSObj; diff --git a/src/MEDCalc/cmp/MED.hxx b/src/MEDCalc/cmp/MED.hxx index 69a625390..c8e9d213e 100644 --- a/src/MEDCalc/cmp/MED.hxx +++ b/src/MEDCalc/cmp/MED.hxx @@ -35,7 +35,6 @@ #include CORBA_SERVER_HEADER(MEDDataManager) #include CORBA_CLIENT_HEADER(SALOMEDS) #include -#include #include #include @@ -52,34 +51,29 @@ public: const char* interfaceName); virtual ~MED(); - MED_ORB::status addDatasourceToStudy(SALOMEDS::Study_ptr study, - const MEDCALC::DatasourceHandler& datasourceHandler); + MED_ORB::status addDatasourceToStudy(const MEDCALC::DatasourceHandler& datasourceHandler); - MED_ORB::status registerPresentationField(SALOMEDS::Study_ptr study, - CORBA::Long fieldId, - const char* name, - const char* type, - const char* ico, - CORBA::Long presentationId); + MED_ORB::status registerPresentationField(CORBA::Long fieldId, + const char* name, + const char* type, + const char* ico, + CORBA::Long presentationId); - MED_ORB::status registerPresentationMesh(SALOMEDS::Study_ptr study, - CORBA::Long meshId, - const char* name, - const char* type, - const char* ico, - CORBA::Long presentationId); + MED_ORB::status registerPresentationMesh(CORBA::Long meshId, + const char* name, + const char* type, + const char* ico, + CORBA::Long presentationId); - MED_ORB::status unregisterPresentation(SALOMEDS::Study_ptr study, - CORBA::Long presentationId); + MED_ORB::status unregisterPresentation(CORBA::Long presentationId); // // Caller owns the returned list, and is responsible for the list deletion. -// MED_ORB::PresentationsList* getSiblingPresentations(SALOMEDS::Study_ptr study, -// CORBA::Long presentationId); +// MED_ORB::PresentationsList* getSiblingPresentations(CORBA::Long presentationId); // Get all presentations registered in the study - MED_ORB::PresentationsList* getStudyPresentations(SALOMEDS::Study_ptr study); + MED_ORB::PresentationsList* getStudyPresentations(); - char* getStudyPresentationEntry(SALOMEDS::Study_ptr study, CORBA::Long presentationId); + char* getStudyPresentationEntry(CORBA::Long presentationId); void cleanUp(); diff --git a/src/MEDCalc/gui/DatasourceController.cxx b/src/MEDCalc/gui/DatasourceController.cxx index 3797c1b09..4aec2a40f 100644 --- a/src/MEDCalc/gui/DatasourceController.cxx +++ b/src/MEDCalc/gui/DatasourceController.cxx @@ -138,10 +138,7 @@ DatasourceController::updateTreeViewWithNewDatasource(const MEDCALC::DatasourceH return; } - SalomeApp_Study* study = dynamic_cast(_salomeModule->application()->activeStudy()); - _PTR(Study) studyDS = study->studyDS(); - - _salomeModule->engine()->addDatasourceToStudy(_CAST(Study, studyDS)->GetStudy(), *datasourceHandler); + _salomeModule->engine()->addDatasourceToStudy(*datasourceHandler); // update Object browser _salomeModule->getApp()->updateObjectBrowser(true); diff --git a/src/MEDCalc/gui/PresentationController.cxx b/src/MEDCalc/gui/PresentationController.cxx index 5372aa1b6..d223b066e 100644 --- a/src/MEDCalc/gui/PresentationController.cxx +++ b/src/MEDCalc/gui/PresentationController.cxx @@ -701,24 +701,19 @@ PresentationController::updateTreeViewWithNewPresentation(long dataId, long pres name = tr(name.c_str()).toStdString(); oss << name << " (" << presentationId << ")"; - SalomeApp_Study* study = dynamic_cast(_salomeModule->application()->activeStudy()); - _PTR(Study) studyDS = study->studyDS(); - // Mesh views are always registered at the mesh level: if (type == MEDPresentationMeshView::TYPE_NAME) { - _salomeModule->engine()->registerPresentationMesh(_CAST(Study, studyDS)->GetStudy(), dataId, - oss.str().c_str(), type.c_str(),ico.c_str(), presentationId); + _salomeModule->engine()->registerPresentationMesh(dataId, oss.str().c_str(), type.c_str(),ico.c_str(), presentationId); } else - _salomeModule->engine()->registerPresentationField(_CAST(Study, studyDS)->GetStudy(), dataId, - oss.str().c_str(), type.c_str(),ico.c_str(), presentationId); + _salomeModule->engine()->registerPresentationField(dataId, oss.str().c_str(), type.c_str(),ico.c_str(), presentationId); // update Object browser _salomeModule->getApp()->updateObjectBrowser(true); // auto-select new presentation - std::string entry = _salomeModule->engine()->getStudyPresentationEntry(_CAST(Study, studyDS)->GetStudy(), presentationId); + std::string entry = _salomeModule->engine()->getStudyPresentationEntry(presentationId); SALOME_ListIO selectedObjects; LightApp_Study* lightStudy = dynamic_cast( _salomeModule->application()->activeStudy() ); QString component = lightStudy->componentDataType( entry.c_str() ); @@ -744,10 +739,7 @@ PresentationController::updateTreeViewForPresentationRemoval(long presentationId return; } - SalomeApp_Study* study = dynamic_cast(_salomeModule->application()->activeStudy()); - _PTR(Study) studyDS = study->studyDS(); - - _salomeModule->engine()->unregisterPresentation(_CAST(Study, studyDS)->GetStudy(), presentationId); + _salomeModule->engine()->unregisterPresentation(presentationId); // update Object browser _salomeModule->getApp()->updateObjectBrowser(true); @@ -757,11 +749,9 @@ void PresentationController::_dealWithReplaceMode() { // Deal with replace mode: presentations with invalid IDs have to be removed: - SalomeApp_Study* study = dynamic_cast(_salomeModule->application()->activeStudy()); - _PTR(Study) studyDS = study->studyDS(); MEDCALC::PresentationsList * lstManager = _presManager->getAllPresentations(); - MED_ORB::PresentationsList * lstModule = _salomeModule->engine()->getStudyPresentations(_CAST(Study, studyDS)->GetStudy()); + MED_ORB::PresentationsList * lstModule = _salomeModule->engine()->getStudyPresentations(); // The IDs not in the intersection needs deletion: CORBA::Long * last = lstManager->get_buffer() + lstManager->length(); for (unsigned i = 0; i < lstModule->length(); i++) {