mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 17:20:33 +05:00
try/catch blocks added
This commit is contained in:
parent
bbfbac1990
commit
ee06fcf090
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <GEOM_SelectionFilter.h>
|
#include <GEOM_SelectionFilter.h>
|
||||||
|
|
||||||
|
#include <SalomeApp_Tools.h>
|
||||||
#include <SALOMEDSClient_Study.hxx>
|
#include <SALOMEDSClient_Study.hxx>
|
||||||
#include <SALOMEDSClient_AttributeIOR.hxx>
|
#include <SALOMEDSClient_AttributeIOR.hxx>
|
||||||
#include <SALOMEDSClient_AttributeName.hxx>
|
#include <SALOMEDSClient_AttributeName.hxx>
|
||||||
@ -109,18 +110,29 @@ bool SMESHGUI_MeshOp::onApply()
|
|||||||
|
|
||||||
bool aResult = false;
|
bool aResult = false;
|
||||||
aMess = "";
|
aMess = "";
|
||||||
if ( myToCreate && myIsMesh )
|
try
|
||||||
aResult = createMesh( aMess );
|
{
|
||||||
if ( myToCreate && !myIsMesh )
|
if ( myToCreate && myIsMesh )
|
||||||
aResult = createSubMesh( aMess );
|
aResult = createMesh( aMess );
|
||||||
else if ( !myToCreate )
|
if ( myToCreate && !myIsMesh )
|
||||||
aResult = editMeshOrSubMesh( aMess );
|
aResult = createSubMesh( aMess );
|
||||||
|
else if ( !myToCreate )
|
||||||
|
aResult = editMeshOrSubMesh( aMess );
|
||||||
|
if ( aResult )
|
||||||
|
update( UF_ObjBrowser | UF_Model );
|
||||||
|
}
|
||||||
|
catch ( const SALOME::SALOME_Exception& S_ex )
|
||||||
|
{
|
||||||
|
SalomeApp_Tools::QtCatchCorbaException( S_ex );
|
||||||
|
aResult = false;
|
||||||
|
}
|
||||||
|
catch ( ... )
|
||||||
|
{
|
||||||
|
aResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( aResult )
|
if ( aResult )
|
||||||
{
|
{
|
||||||
update( UF_ObjBrowser | UF_Model );
|
|
||||||
|
|
||||||
// set default name if necessary
|
|
||||||
if ( myToCreate )
|
if ( myToCreate )
|
||||||
setDefaultName();
|
setDefaultName();
|
||||||
}
|
}
|
||||||
@ -229,20 +241,30 @@ void SMESHGUI_MeshOp::selectionDone()
|
|||||||
|
|
||||||
if ( !myToCreate )
|
if ( !myToCreate )
|
||||||
{
|
{
|
||||||
QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
|
try
|
||||||
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry );
|
{
|
||||||
if ( pObj != 0 )
|
QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
|
||||||
|
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry );
|
||||||
|
if ( pObj != 0 )
|
||||||
|
{
|
||||||
|
SMESH::SMESH_subMesh_var aVar =
|
||||||
|
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
|
||||||
|
myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !aVar->_is_nil() );
|
||||||
|
myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide();
|
||||||
|
myDlg->updateGeometry();
|
||||||
|
myDlg->adjustSize();
|
||||||
|
readMesh();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myDlg->reset();
|
||||||
|
}
|
||||||
|
catch ( const SALOME::SALOME_Exception& S_ex )
|
||||||
|
{
|
||||||
|
SalomeApp_Tools::QtCatchCorbaException( S_ex );
|
||||||
|
}
|
||||||
|
catch ( ... )
|
||||||
{
|
{
|
||||||
SMESH::SMESH_subMesh_var aVar =
|
|
||||||
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
|
|
||||||
myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !aVar->_is_nil() );
|
|
||||||
myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide();
|
|
||||||
myDlg->updateGeometry();
|
|
||||||
myDlg->adjustSize();
|
|
||||||
readMesh();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
myDlg->reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -783,18 +805,21 @@ void SMESHGUI_MeshOp::readMesh()
|
|||||||
{
|
{
|
||||||
// get algorithm
|
// get algorithm
|
||||||
QStringList anExisting;
|
QStringList anExisting;
|
||||||
existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
|
|
||||||
SMESH::SMESH_Hypothesis_var aVar = myObjHyps[ dim ][ Algo ].first();
|
|
||||||
QString aHypTypeName = aVar->GetName();
|
|
||||||
|
|
||||||
int aHypIndex = -1;
|
int aHypIndex = -1;
|
||||||
QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( true , dim, false );
|
existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
|
||||||
for ( int i = 0, n = aHypTypeNameList.count(); i < n; i++ )
|
if ( myObjHyps[ dim ][ Algo ].count() > 0 )
|
||||||
if ( aHypTypeName == aHypTypeNameList[ i ] )
|
{
|
||||||
{
|
SMESH::SMESH_Hypothesis_var aVar = myObjHyps[ dim ][ Algo ].first();
|
||||||
aHypIndex = i;
|
QString aHypTypeName = aVar->GetName();
|
||||||
break;
|
|
||||||
}
|
QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( true , dim, false );
|
||||||
|
for ( int i = 0, n = aHypTypeNameList.count(); i < n; i++ )
|
||||||
|
if ( aHypTypeName == aHypTypeNameList[ i ] )
|
||||||
|
{
|
||||||
|
aHypIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
setCurrentHyp( dim, Algo, aHypIndex );
|
setCurrentHyp( dim, Algo, aHypIndex );
|
||||||
|
|
||||||
// get hypotheses
|
// get hypotheses
|
||||||
|
Loading…
Reference in New Issue
Block a user