Salome HOME
Correct bugs, connected with 0D Elements implementation (IMP 20089, BUG 21300)
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshOp.cxx
index c578defe32fd16ceb86aeaaa112b1d0f55e73f8a..35dcb43bab4e2b490942d53eb175ccab031ac676 100644 (file)
@@ -22,8 +22,8 @@
 // SMESH SMESHGUI : GUI for SMESH component
 // File   : SMESHGUI_MeshOp.cxx
 // Author : Sergey LITONIN, Open CASCADE S.A.S.
+
 // SMESH includes
-//
 #include "SMESHGUI_MeshOp.h"
 
 #include "SMESHGUI.h"
@@ -1053,7 +1053,9 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
     SMESH::CreateHypothesis(theTypeName, aHypName, false);
   } else {
     // Get hypotheses creator client (GUI)
-    SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
+    // BUG 0020378
+    //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
+    SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(theTypeName);
 
     // Create hypothesis
     if (aCreator) {
@@ -1063,6 +1065,18 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
 
       int obj = myDlg->getActiveObject();
       removeCustomFilters(); // Issue 0020170
+
+      // Get Entry of the Geom object
+      QString anObjEntry = "";
+      anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
+      if ( anObjEntry == "" ) {
+       anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+        _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+        GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
+       anObjEntry = aGeomVar->GetStudyEntry();
+      }
+
+      aCreator->setShapeEntry( anObjEntry );
       myDlg->setEnabled( false );
       aCreator->create(initParamHyp, aHypName, myDlg);
       onActivateObject( obj ); // Issue 0020170. Restore filters
@@ -1108,7 +1122,9 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
   if ( aHyp->_is_nil() )
     return;
 
-  SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aHyp->GetName() );
+  // BUG 0020378
+  //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
+  SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
   if ( aCreator )
   {
     // Get initial parameters
@@ -1116,6 +1132,17 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
       getInitParamsHypothesis( aHyp->GetName(), aHyp->GetLibName());
     aCreator->setInitParamsHypothesis( initParamHyp );
 
+    // Get Entry of the Geom object
+    QString anObjEntry = "";
+    anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
+    if ( anObjEntry == "" ) {
+      anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+      _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
+      GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
+      anObjEntry = aGeomVar->GetStudyEntry();
+    }
+
+    aCreator->setShapeEntry( anObjEntry );
     int obj = myDlg->getActiveObject();
     removeCustomFilters(); // Issue 0020170
     myDlg->setEnabled( false );
@@ -1585,7 +1612,7 @@ int SMESHGUI_MeshOp::currentHyp( const int theDim, const int theHypType ) const
 //================================================================================
 bool SMESHGUI_MeshOp::isAccessibleDim( const int theDim ) const
 {
-  return myDlg->tab( theDim )->isEnabled();
+  return myDlg->isTabEnabled( theDim );
 }
 
 //================================================================================
@@ -1682,11 +1709,14 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
         SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
       } else {
         // Get hypotheses creator client (GUI)
-        SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
+        // BUG 0020378
+        //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
+        SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypName);
 
         // Create algorithm
-        if (aCreator)
+        if (aCreator) {
           aCreator->create(true, aHypName, myDlg);
+        }
         else
           SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
       }