From: rnv Date: Thu, 8 Jun 2017 15:04:03 +0000 (+0300) Subject: Merge multi-study removal branch. X-Git-Tag: Before_python3_27062017 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=78520ed35368b81ab003a3cf7d4377a9950fa592;p=plugins%2Fhybridplugin.git Merge multi-study removal branch. --- 78520ed35368b81ab003a3cf7d4377a9950fa592 diff --cc src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx index d0ae0e4,820bd43..20b21ce --- a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx @@@ -351,9 -350,9 +351,8 @@@ HYBRIDPluginGUI_HypothesisCreator::~HYB GeomSelectionTools* HYBRIDPluginGUI_HypothesisCreator::getGeomSelectionTool() { HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this; -- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); -- if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) { -- that->GeomToolSelected = new GeomSelectionTools(aStudy); ++ if (that->GeomToolSelected == NULL) { ++ that->GeomToolSelected = new GeomSelectionTools(); } return that->GeomToolSelected; } @@@ -1278,16 -1265,18 +1277,16 @@@ void HYBRIDPluginGUI_HypothesisCreator: int elementType = myEnfMeshConstraint->currentIndex(); -- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); ++ _PTR(Study) aStudy = SMESH::getStudy(); _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil; QString meshEntry = myEnfMeshWdg->GetValue(); - MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString()); if (selEnfMeshes == 1) { // myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >(); // std::string entry = myEnfMeshWdg->GetValue(); aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str()); -- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy); ++ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj); if (!CORBA::is_nil(anObj)) { // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface( aSObj ); addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName); @@@ -1299,7 -1289,7 +1298,7 @@@ QStringListIterator meshEntriesIt (meshEntries); while (meshEntriesIt.hasNext()) { aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str()); -- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy); ++ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj); if (!CORBA::is_nil(anObj)) { // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface( aSObj ); addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName); @@@ -1952,7 -1956,7 +1951,7 @@@ bool HYBRIDPluginGUI_HypothesisCreator: TEnfMeshList::const_iterator itEnfMesh; -- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); ++ _PTR(Study) aStudy = SMESH::getStudy(); for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) { TEnfMesh* enfMesh = (*itEnfMesh); diff --cc src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx index c477cbe,2fffeed..de08269 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx @@@ -101,24 -103,26 +101,16 @@@ static void removeFile( const std::stri */ //============================================================================= - HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID(int hypId, int studyId, SMESH_Gen* gen) - : SMESH_3D_Algo(hypId, studyId, gen) + HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID(int hypId, SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, gen) { - MESSAGE("HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID"); _name = Name(); _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type _onlyUnaryInput = true; // Compute() will be called on each solid _iShape=0; _nbShape=0; _compatibleHypothesis.push_back( HYBRIDPlugin_Hypothesis::GetHypType()); - _requireShape = false; // can work without shape_studyId - - smeshGen_i = SMESH_Gen_i::GetSMESHGen(); - CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager"); - SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject); - - myStudy = NULL; - myStudy = aStudyMgr->GetStudyByID(_studyId); - - //_compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() ); + _requireShape = false; // can work without shape - - smeshGen_i = SMESH_Gen_i::GetSMESHGen(); - CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/Study"); - - myStudy = SALOMEDS::Study::_narrow(anObject); - if (!myStudy->_is_nil()) - MESSAGE("Study not empty"); - _computeCanceled = false; } @@@ -175,18 -183,19 +167,18 @@@ bool HYBRIDPlugin_HYBRID::CheckHypothes TopoDS_Shape HYBRIDPlugin_HYBRID::entryToShape(std::string entry) { - MESSAGE("HYBRIDPlugin_HYBRID::entryToShape "<_is_nil() ) ++ if ( SMESH_Gen_i::getStudyServant()->_is_nil() ) throw SALOME_Exception("MG-HYBRID plugin can't work w/o publishing in the study"); GEOM::GEOM_Object_var aGeomObj; TopoDS_Shape S = TopoDS_Shape(); -- SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() ); ++ SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() ); if (!aSObj->_is_nil() ) { CORBA::Object_var obj = aSObj->GetObject(); aGeomObj = GEOM::GEOM_Object::_narrow(obj); aSObj->UnRegister(); } if ( !aGeomObj->_is_nil() ) -- S = smeshGen_i->GeomObjectToShape( aGeomObj.in() ); ++ S = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() ); return S; } diff --cc src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.hxx index 16f5195,17ea214..3e10264 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.hxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.hxx @@@ -89,8 -87,8 +89,6 @@@ private bool _keepFiles; bool _removeLogOnSuccess; bool _logInStandardOutput; -- SALOMEDS::Study_var myStudy; -- SMESH_Gen_i* smeshGen_i; }; /*! diff --cc src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx index 0c67197,9cdd92d..3a745e1 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx @@@ -48,9 -47,9 +47,8 @@@ HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYB SMESH_Algo_i( thePOA ), SMESH_3D_Algo_i( thePOA ) { - MESSAGE( "HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYBRID_i" ); myBaseImpl = new ::HYBRIDPlugin_HYBRID (theGenImpl->GetANewId(), - theStudyId, - theGenImpl ); + theGenImpl ); } //============================================================================= @@@ -88,10 -89,11 +86,10 @@@ HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HY SMESH::SMESH_Mesh_ptr HYBRIDPlugin_HYBRID_i::importGMFMesh(const char* theGMFFileName) { - MESSAGE( "HYBRIDPlugin_HYBRID_i::importGMFMesh" ); SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen(); SMESH::SMESH_Mesh_ptr theMesh = smeshGen->CreateEmptyMesh(); - smeshGen->RemoveLastFromPythonScript(smeshGen->GetCurrentStudy()->StudyId()); - SALOMEDS::SObject_ptr theSMesh = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(), theMesh); + smeshGen->RemoveLastFromPythonScript(); + SALOMEDS::SObject_ptr theSMesh = smeshGen->ObjectToSObject(theMesh); #ifdef WINNT #define SEP '\\' #else diff --cc src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx index d542200,2c8c30f..d4348f5 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx @@@ -54,8 -53,8 +53,7 @@@ HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ) { - MESSAGE( "HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i" ); myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(), - theStudyId, theGenImpl); }