From: eap Date: Tue, 14 Feb 2012 11:35:04 +0000 (+0000) Subject: 0021494: EDF 2118 SMESH: Projection2D hypothesis causes Unknown Exception X-Git-Tag: V6_5_0a1~135 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b0aa026c95111259763674563ddb96b2ee470f50;p=modules%2Fsmesh.git 0021494: EDF 2118 SMESH: Projection2D hypothesis causes Unknown Exception enhance checkParams() to allow 1 pair of vertices only for a face with 1 vertex --- diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 192a46c1f..b807d2d23 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -391,7 +392,8 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const ok = ( w->IsObjectSelected() ); if ( !ok ) w->SetObject( CORBA::Object::_nil() ); int nbAssocVert = ( hypType() == "ProjectionSource1D" ? 1 : 2 ); - for ( int i = 0; ok && i < nbAssocVert; i += 2) + int nbNonEmptyAssoc = 0; + for ( int i = 0; ok && i < nbAssocVert*2; i += 2) { QString srcV, tgtV; StdMeshersGUI_ObjectReferenceParamWdg* w1 = @@ -406,8 +408,26 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const w1->SetObject( CORBA::Object::_nil() ); w2->SetObject( CORBA::Object::_nil() ); } + nbNonEmptyAssoc += !srcV.isEmpty(); + } + if ( ok && nbNonEmptyAssoc == 1 && nbAssocVert == 2 ) + { + // only one pair of VERTEXes is given for a FACE, + // then the FACE must have only one VERTEX + GEOM::GEOM_Object_var face = w->GetObject< GEOM::GEOM_Object >(); + + GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + GEOM::GEOM_IShapesOperations_var shapeOp; + if ( !geomGen->_is_nil() && aStudy ) + shapeOp = geomGen->GetIShapesOperations( aStudy->StudyId() ); + if ( !shapeOp->_is_nil() ) + { + GEOM::ListOfLong_var vertices = + shapeOp->GetAllSubShapesIDs (face, GEOM::VERTEX, /*isSorted=*/false); + ok = ( vertices->length() == 1 ); + } } - // Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg if ( ok ) deactivateObjRefParamWdg( customWidgets() ); @@ -424,14 +444,7 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 ); ok = ( w && w->IsOk() ); } - else if ( hypType() == "QuadrangleParams" ) - { - //StdMeshersGUI_SubShapeSelectorWdg* w = - // widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); - //ok = ( w->GetListSize() > 0 ); - //StdMeshersGUI_QuadrangleParamWdg* w = - // widget< StdMeshersGUI_QuadrangleParamWdg >( 1 ); - } + return ok; }