From 1e964bd525c3d7766e12d30aec1f3bec56fed33a Mon Sep 17 00:00:00 2001 From: imn Date: Fri, 14 Oct 2016 17:00:05 +0300 Subject: [PATCH] 0023299: [CEA] Finalize multi-study removal - delete study id parameter --- src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx | 16 ++++++---------- src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx | 2 +- src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.cxx | 6 ++---- src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.hxx | 1 - src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx | 4 ++-- src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx | 2 +- src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx | 20 +++++++------------- src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx | 1 - src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx | 4 ++-- 9 files changed, 21 insertions(+), 35 deletions(-) diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index 0a1091f..07620bb 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -132,8 +132,8 @@ static void removeFile( const TCollection_AsciiString& fileName ) */ //============================================================================= -GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen) - : SMESH_3D_Algo(hypId, studyId, gen), _isLibUsed( false ) +GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, gen), _isLibUsed( false ) { MESSAGE("GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D"); _name = Name(); @@ -143,18 +143,14 @@ GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen) _nbShape=0; _compatibleHypothesis.push_back( GHS3DPlugin_Hypothesis::GetHypType()); _compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() ); - _requireShape = false; // can work without shape_studyId + _requireShape = false; // can work without shape _smeshGen_i = SMESH_Gen_i::GetSMESHGen(); - CORBA::Object_var anObject = _smeshGen_i->GetNS()->Resolve("/myStudyManager"); - SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject); + CORBA::Object_var anObject = _smeshGen_i->GetNS()->Resolve("/Study"); + _study = SALOMEDS::Study::_narrow(anObject); - MESSAGE("studyid = " << _studyId); - - _study = NULL; - _study = aStudyMgr->GetStudyByID(_studyId); if (!_study->_is_nil()) - MESSAGE("_study->StudyId() = " << _study->StudyId()); + MESSAGE("Study not empty"); _computeCanceled = false; _progressAdvance = 1e-4; diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx index 7d9a359..def1503 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx @@ -50,7 +50,7 @@ class TopoDS_Shape; class GHS3DPlugin_GHS3D: public SMESH_3D_Algo { public: - GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen); + GHS3DPlugin_GHS3D(int hypId, SMESH_Gen* gen); virtual ~GHS3DPlugin_GHS3D(); virtual bool CheckHypothesis(SMESH_Mesh& aMesh, diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.cxx index 2ab6dc5..3215bef 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.cxx @@ -42,7 +42,6 @@ //============================================================================= GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl ) : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ), @@ -51,7 +50,6 @@ GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA, { MESSAGE( "GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i" ); myBaseImpl = new ::GHS3DPlugin_GHS3D (theGenImpl->GetANewId(), - theStudyId, theGenImpl ); } @@ -95,8 +93,8 @@ SMESH::SMESH_Mesh_ptr GHS3DPlugin_GHS3D_i::importGMFMesh(const char* theGMFFileN MESSAGE( "GHS3DPlugin_GHS3D_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 --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.hxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.hxx index dc27c27..b94b154 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D_i.hxx @@ -42,7 +42,6 @@ class GHS3DPlugin_GHS3D_i: public: // Constructor GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl ); // Destructor virtual ~GHS3DPlugin_GHS3D_i(); diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx index 0e480bc..2672ddc 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx @@ -40,8 +40,8 @@ using namespace std; //function : GHS3DPlugin_Hypothesis //======================================================================= -GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen) - : SMESH_Hypothesis(hypId, studyId, gen), +GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen) + : SMESH_Hypothesis(hypId, gen), myToMeshHoles(DefaultMeshHoles()), myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()), myMaximumMemory(-1), diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx index c6990a3..fcec94f 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx @@ -44,7 +44,7 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis: public SMESH_Hypothesis { public: - GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen); + GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen); typedef std::map,double> TGHS3DEnforcedVertexCoordsValues; typedef std::map TGHS3DEnforcedVertexEntryValues; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx index acc6472..557f742 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx @@ -51,14 +51,12 @@ using namespace std; //======================================================================= GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl) : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ) { MESSAGE( "GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i" ); myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(), - theStudyId, theGenImpl); } @@ -505,7 +503,6 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVe CORBA::Double x = 0, y = 0, z = 0; CORBA::Boolean isCompound = false; GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); - SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); if (theVertexEntry.empty()) { string aName; if (theVertex->GetShapeType() == GEOM::VERTEX) { @@ -516,7 +513,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVe isCompound = true; } aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -524,7 +521,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVe THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); if (theVertex->GetShapeType() == GEOM::VERTEX) { - GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() ); + GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(); if (CORBA::is_nil(measureOp)) return false; @@ -551,7 +548,6 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ CORBA::Double x = 0, y = 0, z = 0; CORBA::Boolean isCompound = false; GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); - SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); if (theVertexEntry.empty()) { string aName; if (theVertex->GetShapeType() == GEOM::VERTEX) { @@ -562,7 +558,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ isCompound = true; } aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -570,7 +566,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); if (theVertex->GetShapeType() == GEOM::VERTEX) { - GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() ); + GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(); if (CORBA::is_nil(measureOp)) return false; @@ -711,14 +707,13 @@ CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ string theVertexEntry = theVertex->GetStudyEntry(); if (theVertexEntry.empty()) { GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); - SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); string aName; if (theVertex->GetShapeType() == GEOM::VERTEX) aName = "Vertex_"; if (theVertex->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -826,14 +821,13 @@ bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr th string theVertexEntry = theVertex->GetStudyEntry(); if (theVertexEntry.empty()) { GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); - SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); string aName; if (theVertex->GetShapeType() == GEOM::VERTEX) aName = "Vertex_"; if (theVertex->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -1035,7 +1029,7 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); - SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource); + SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(theSource); SMESH_Mesh_i* theMesh_i = SMESH::DownCast( theSource); SMESH_Group_i* theGroup_i = SMESH::DownCast( theSource); diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx index d48a49d..3787dba 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx @@ -45,7 +45,6 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: public: // Constructor GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl); // Destructor virtual ~GHS3DPlugin_Hypothesis_i(); diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index f66769e..4ffc77c 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -746,7 +746,7 @@ void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex() { return; if (myEnfVertex->GetShapeType() == GEOM::VERTEX) { GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this; - GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() ); + GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( ); if (CORBA::is_nil(measureOp)) return; @@ -1254,7 +1254,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex() if ( CORBA::is_nil(getGeomEngine())) return; - GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() ); + GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( ); if (CORBA::is_nil(measureOp)) return; -- 2.39.2