From 8e7cd4625dda461348523fc48bcff5f62eff451d Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 16 Sep 2008 14:49:49 +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 | 59 ++++++++++++++++++++++++++++++++ src/SMESHGUI/SMESHGUI_MeshOp.h | 3 +- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 11d298a6d..9257f2b6d 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -340,6 +340,53 @@ 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.latin1() ); + 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].latin1() ); + } + +// GEOM::GEOM_Object_var geom; +// if (_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() )) +// 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].latin1() ); + } +// } + } + } + return 0; +} + //================================================================================ /*! * \brief find an existing submesh by the selected shape @@ -526,8 +573,20 @@ 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::warn1( myDlg, tr( "SMESH_ERROR" ), + tr("SUBMESH_NOT_ALLOWED").arg(algoName), tr( "SMESH_BUT_OK" )); + 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 c658fb74e..0fbd27a47 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.h +++ b/src/SMESHGUI/SMESHGUI_MeshOp.h @@ -100,7 +100,7 @@ private: QStringList& theHyps, THypDataList& theDataList, HypothesisData* theAlgoData = 0 ) const; - void existingHyps( const int theDim, + static void existingHyps( const int theDim, const int theHypType, _PTR(SObject) theFather, QStringList& theHyps, @@ -129,6 +129,7 @@ private: SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType, const QString& aServerLib ) const; bool isSubshapeOk() const; + char* isSubmeshIgnored() const; _PTR(SObject) getSubmeshByGeom() const; void selectObject( _PTR(SObject) ) const; -- 2.39.2