From c9179d6bde30332fcf0c168a93660e4ab4c75a05 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 16 Sep 2008 08:55:16 +0000 Subject: [PATCH] [SALOME platform 0013410]: SubMesh not taken into account with Netgen 1D-2D et 1D-2D-3D //================================================================================ /*! + * \brief Return name of the algorithm that does not support submeshes and makes + * submesh creation useless + * \retval char* - string is to be deleted!!! + */ +//================================================================================ + +char* SMESHGUI_MeshOp::isSubmeshIgnored() const --- src/SMESHGUI/SMESHGUI_MeshOp.cxx | 62 +++++++++++++++++++++++++++++++- src/SMESHGUI/SMESHGUI_MeshOp.h | 3 +- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 4d27d31ae..5f37e5762 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -334,10 +334,57 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const return false; } +//================================================================================ +/*! + * \brief Return name of the algorithm that does not support submeshes and makes + * submesh creation useless + * \retval char* - string is to be deleted!!! + */ +//================================================================================ + +char* SMESHGUI_MeshOp::isSubmeshIgnored() const +{ + if ( myToCreate && !myIsMesh ) { + + QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ); + QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); + _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() ); + if ( pMesh ) { + + QStringList algoNames; + THypList algoList; + existingHyps(3, Algo, pMesh, algoNames, algoList); + if (!algoList.empty()) { + HypothesisData* algo = SMESH::GetHypothesisData( algoList[0].first->GetName() ); + if ( algo && + algo->InputTypes.empty() && // builds all dimensions it-self + !algo->IsSupportSubmeshes ) + return CORBA::string_dup( algoNames[0].toLatin1().data() ); + } + +// GEOM::GEOM_Object_var geom; +// if (_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() )) +// geom = SMESH::SObjectToInterface( pGeom ); + +// if ( !geom->_is_nil() && geom->GetShapeType() >= GEOM::FACE ) { // WIRE, EDGE as well + existingHyps(2, Algo, pMesh, algoNames, algoList); + if (!algoList.empty()) { + HypothesisData* algo = SMESH::GetHypothesisData( algoList[0].first->GetName() ); + if ( algo && + algo->InputTypes.empty() && // builds all dimensions it-self + !algo->IsSupportSubmeshes ) + return CORBA::string_dup( algoNames[0].toLatin1().data() ); + } +// } + } + } + return 0; +} + //================================================================================ /*! * \brief find an existing submesh by the selected shape - * \retval _PTR(SObject) - the found submesh SObject + * \retval _PTR(SObject) - the found submesh SObject */ //================================================================================ @@ -540,8 +587,21 @@ void SMESHGUI_MeshOp::selectionDone() myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" ); selectObject( _PTR(SObject)() ); selectionDone(); + return; } } + // discard selected mesh if submesh creation not allowed because of + // a global algorithm that does not support submeshes + if ( char* algoName = isSubmeshIgnored() ) { + SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ), + tr(QString("SUBMESH_NOT_ALLOWED") + .toLatin1().data() ).arg(algoName)); + CORBA::string_free( algoName ); + myDlg->selectObject( "", SMESHGUI_MeshDlg::Mesh, "" ); + selectObject( _PTR(SObject)() ); + selectionDone(); + return; + } // enable/disable popup for choice of geom selection way bool enable = false; diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.h b/src/SMESHGUI/SMESHGUI_MeshOp.h index e0bc74796..985064fb5 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.h +++ b/src/SMESHGUI/SMESHGUI_MeshOp.h @@ -87,7 +87,7 @@ private: QStringList&, THypDataList&, HypothesisData* = 0 ) const; - void existingHyps( const int, + static void existingHyps( const int, const int, _PTR(SObject), QStringList&, @@ -116,6 +116,7 @@ private: SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString&, const QString& ) const; bool isSubshapeOk() const; + char* isSubmeshIgnored() const; _PTR(SObject) getSubmeshByGeom() const; void selectObject( _PTR(SObject) ) const;