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)
1  2 
src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.hxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx

index d0ae0e408adbab5cdcad95feb95e7312320c3181,820bd432b5813b2d0ffa04c606b718c7ad5ffc63..20b21ce927476cef686a47ea22fdcddfd7c08afe
@@@ -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<SMESH::SMESH_IDSource>( aSObj );
        addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
      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);
@@@ -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);
index c477cbe76e8b9c8d4975d70811c28bbd069e2da0,2fffeed12e5a2457186998cfac0052f1cad02f69..de082694474e861b95e125c4d37274a34b476840
@@@ -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 "<<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,17ea214558e0e33a44cef3b988bb6a7b1a965efb..3e10264d6b5138b44ec2eece9e6320a9d051905c
@@@ -89,8 -87,8 +89,6 @@@ private
    bool _keepFiles;
    bool _removeLogOnSuccess;
    bool _logInStandardOutput;
--  SALOMEDS::Study_var myStudy;
--  SMESH_Gen_i* smeshGen_i;
  };
  
  /*!
index 0c671975f6ea1e8c29a4d36d186ae200d4da923e,9cdd92ddbaee09326d98271832ba61c27b5ae5f3..3a745e1ae46ae767532e32f7db57454aacc980db
@@@ -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
index d5422004e26950414c8037386a986664f7a7a13b,2c8c30f5c3d8b2bcd4c57c987ecfc8b203973883..d4348f519259770e23888a401a0a65509c37a368
@@@ -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);
  }