Salome HOME
Merge multi-study removal branch. Before_python3_27062017
authorrnv <rnv@opencascade.com>
Thu, 8 Jun 2017 15:04:03 +0000 (18:04 +0300)
committerrnv <rnv@opencascade.com>
Thu, 8 Jun 2017 15:49:36 +0000 (18:49 +0300)
src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.hxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.hxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx

index d0ae0e408adbab5cdcad95feb95e7312320c3181..20b21ce927476cef686a47ea22fdcddfd7c08afe 100644 (file)
@@ -351,9 +351,8 @@ HYBRIDPluginGUI_HypothesisCreator::~HYBRIDPluginGUI_HypothesisCreator()
 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;
 }
@@ -899,7 +898,7 @@ void HYBRIDPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
       return;
     if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
       HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_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;
       
@@ -1278,7 +1277,7 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
   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();
   
@@ -1287,7 +1286,7 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
 //     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<SMESH::SMESH_IDSource>( aSObj );
       addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
@@ -1299,7 +1298,7 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
     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<SMESH::SMESH_IDSource>( aSObj );
         addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
@@ -1367,7 +1366,7 @@ void HYBRIDPluginGUI_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;
 
@@ -1952,7 +1951,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
     
     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);
index c477cbe76e8b9c8d4975d70811c28bbd069e2da0..de082694474e861b95e125c4d37274a34b476840 100644 (file)
@@ -101,8 +101,8 @@ static void removeFile( const std::string& fileName )
  */
 //=============================================================================
 
-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)
 {
   _name = Name();
   _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
@@ -110,15 +110,7 @@ HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID(int hypId, int studyId, SMESH_Gen* gen)
   _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);
-  
+  _requireShape = false; // can work without shape
   _computeCanceled = false;
 }
 
@@ -175,18 +167,18 @@ bool HYBRIDPlugin_HYBRID::CheckHypothesis ( SMESH_Mesh&         aMesh,
 
 TopoDS_Shape HYBRIDPlugin_HYBRID::entryToShape(std::string entry)
 {
-  if ( myStudy->_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;
 }
 
index 16f51958e4e665368bb3e84176615efe7a1e198d..3e10264d6b5138b44ec2eece9e6320a9d051905c 100644 (file)
@@ -43,7 +43,7 @@ class TopoDS_Shape;
 class HYBRIDPlugin_HYBRID: public SMESH_3D_Algo
 {
 public:
-  HYBRIDPlugin_HYBRID(int hypId, int studyId, SMESH_Gen* gen);
+  HYBRIDPlugin_HYBRID(int hypId, SMESH_Gen* gen);
   virtual ~HYBRIDPlugin_HYBRID();
 
   virtual bool CheckHypothesis(SMESH_Mesh&         aMesh,
@@ -89,8 +89,6 @@ private:
   bool _keepFiles;
   bool _removeLogOnSuccess;
   bool _logInStandardOutput;
-  SALOMEDS::Study_var myStudy;
-  SMESH_Gen_i* smeshGen_i;
 };
 
 /*!
index 0c671975f6ea1e8c29a4d36d186ae200d4da923e..3a745e1ae46ae767532e32f7db57454aacc980db 100644 (file)
 //=============================================================================
 
 HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYBRID_i (PortableServer::POA_ptr thePOA,
-                                          int                     theStudyId,
-                                          ::SMESH_Gen*            theGenImpl )
+                                              ::SMESH_Gen*            theGenImpl )
      : SALOME::GenericObj_i( thePOA ), 
        SMESH_Hypothesis_i( thePOA ), 
        SMESH_Algo_i( thePOA ),
        SMESH_3D_Algo_i( thePOA )
 {
   myBaseImpl = new ::HYBRIDPlugin_HYBRID (theGenImpl->GetANewId(),
-                                        theStudyId,
-                                        theGenImpl );
+                                          theGenImpl );
 }
 
 //=============================================================================
@@ -90,8 +88,8 @@ SMESH::SMESH_Mesh_ptr HYBRIDPlugin_HYBRID_i::importGMFMesh(const char* theGMFFil
 {
   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
index e92859e2986aa1b653505f171e3538f6324f5bf2..3caaa69a83dd2fd38d66b18cfcd9527900819c20 100644 (file)
@@ -44,7 +44,6 @@ class HYBRIDPlugin_HYBRID_i:
 public:
   // Constructor
   HYBRIDPlugin_HYBRID_i (PortableServer::POA_ptr thePOA,
-                         int                     theStudyId,
                          ::SMESH_Gen*            theGenImpl );
   // Destructor
   virtual ~HYBRIDPlugin_HYBRID_i();
index 3d99a624f9e033e64529c26747bc27db1ff85b01..daff0cdd2ad15470b866d2549a860d46ed41fab2 100644 (file)
@@ -38,8 +38,8 @@
 //function : HYBRIDPlugin_Hypothesis
 //=======================================================================
 
-HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
-  : SMESH_Hypothesis(hypId, studyId, gen),
+HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, SMESH_Gen * gen)
+  : SMESH_Hypothesis(hypId, gen),
   myToMeshHoles(DefaultMeshHoles()),
   myLayersOnAllWrap(DefaultLayersOnAllWrap()),
   myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
index f732da82eb0e173b8499dd52ec42f8d8690161b8..ddf1b3dfd2066ad67bc471644765fc69358b567e 100644 (file)
@@ -44,7 +44,7 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis: public SMESH_Hypothesis
 {
 public:
 
-  HYBRIDPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
+  HYBRIDPlugin_Hypothesis(int hypId, SMESH_Gen * gen);
 
   typedef std::map<std::vector<double>,double> THYBRIDEnforcedVertexCoordsValues;
   typedef std::map<std::string,double> THYBRIDEnforcedVertexEntryValues;
index d5422004e26950414c8037386a986664f7a7a13b..d4348f519259770e23888a401a0a65509c37a368 100644 (file)
 //function : HYBRIDPlugin_Hypothesis_i
 //=======================================================================
 HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
-                                                    int                     theStudyId,
-                                                    ::SMESH_Gen*            theGenImpl)
+                                                      ::SMESH_Gen*            theGenImpl)
   : SALOME::GenericObj_i( thePOA ), 
     SMESH_Hypothesis_i( thePOA )
 {
   myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(),
-                                              theStudyId,
                                               theGenImpl);
 }
 
@@ -775,7 +773,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV
   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()) {
     std::string aName;
     if (theVertex->GetShapeType() == GEOM::VERTEX) {
@@ -786,7 +783,7 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV
       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();
   }
@@ -794,7 +791,7 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV
     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;
     
@@ -819,7 +816,6 @@ bool HYBRIDPlugin_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()) {
     std::string aName;
     if (theVertex->GetShapeType() == GEOM::VERTEX) {
@@ -830,7 +826,7 @@ bool HYBRIDPlugin_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();
   }
@@ -838,7 +834,7 @@ bool HYBRIDPlugin_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;
     
@@ -967,14 +963,13 @@ CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object
   std::string theVertexEntry = theVertex->GetStudyEntry();
   if (theVertexEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     std::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();
   }
@@ -1082,14 +1077,13 @@ bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr t
   std::string theVertexEntry = theVertex->GetStudyEntry();
   if (theVertexEntry.empty()) {
     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
     std::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();
   }
@@ -1281,7 +1275,7 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS
 
 
   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<SMESH_Mesh_i*>( theSource);
   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
index 609888385477ed0c4b88ce8969f7611440814b05..965a7a858ff4d3f9a965028cd1d4bbf25128dccd 100644 (file)
@@ -45,7 +45,6 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i:
  public:
   // Constructor
   HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
-                             int                     theStudyId,
                              ::SMESH_Gen*            theGenImpl);
   // Destructor
   virtual ~HYBRIDPlugin_Hypothesis_i();