From af446655b419dab81f6ee1c94a0ff443ab62e84b Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 13 Jan 2009 13:07:24 +0000 Subject: [PATCH] 0019923: EDF 765 SMESH : default values of hypothesis improve SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, const QString& aServerLib ) const --- src/SMESHGUI/SMESHGUI_MeshOp.cxx | 45 ++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 01470b95b..6c29524ca 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -890,13 +890,14 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, !myIsMesh : myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ).count(':') > nbColonsInMeshEntry; + // get mesh and geom object + SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_nil(); + GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_nil(); + + QString anEntry; if ( isSubMesh ) { - // get mesh and geom object - SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_nil(); - GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_nil(); - - QString anEntry = myDlg->selectedObject + anEntry = myDlg->selectedObject ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj ); if ( _PTR(SObject) pObj = studyDS()->FindObjectID( anEntry.toLatin1().data() )) { @@ -917,13 +918,35 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, } } } - - if ( !aMeshVar->_is_nil() && !aGeomVar->_is_nil() ) - return SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(), - aServerLib.toLatin1().data(), - aMeshVar, - aGeomVar ); } + else // mesh + { + if ( !myToCreate ) // mesh to edit can be selected + { + anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); + if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( anEntry.toLatin1().data() )) + { + aMeshVar = SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() ); + if ( !aMeshVar->_is_nil() ) + aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pMesh ); + } + } + if ( aGeomVar->_is_nil() ) { + anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); + if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() )) + { + aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() ); + } + } + } + + if ( (!isSubMesh || !aMeshVar->_is_nil()) && !aGeomVar->_is_nil() ) + return SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(), + aServerLib.toLatin1().data(), + aMeshVar, + aGeomVar, + /*byMesh = */isSubMesh); + return SMESH::SMESH_Hypothesis::_nil(); } -- 2.39.2