From 5dcf8c6597ea04d22084a3cc655a9a82e41bdcfa Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 22 May 2013 15:36:05 +0000 Subject: [PATCH] 0022106: EDF 2464 SMESH : Split quadrangles in 4 triangles --- src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx | 85 ++++++++------------------ src/SMESHGUI/SMESH_msg_en.ts | 4 ++ 2 files changed, 30 insertions(+), 59 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index 06d98f6c2..ee4e206b2 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -439,65 +439,6 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds(SMESH::SMESH_IDSource_var& o { myIds.Clear(); obj = SMESH::SMESH_IDSource::_narrow( myMesh ); -// SMESH_Actor * anActor = SMESH::FindActorByObject(myMesh); -// if (!anActor) -// anActor = myActor; -// if (anActor != 0) -// { -// // skl 07.02.2006 -// SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh(); -// if( myFilterType == SMESH::TriaFilter || -// myFilterType == SMESH::QuadFilter || -// myFilterType == SMESH::FaceFilter ) { -// SMDS_FaceIteratorPtr it = aMesh->facesIterator(); -// while(it->more()) { -// const SMDS_MeshFace* f = it->next(); -// if(myFilterType == SMESH::FaceFilter) { -// myIds.Add(f->GetID()); -// } -// else if( myFilterType==SMESH::TriaFilter && -// ( f->NbNodes()==3 || f->NbNodes()==6 ) ) { -// myIds.Add(f->GetID()); -// } -// else if( myFilterType==SMESH::QuadFilter && -// ( f->NbNodes()==4 || f->NbNodes()==8 ) ) { -// myIds.Add(f->GetID()); -// } -// } -// } -// else if(myFilterType == SMESH::VolumeFilter) { -// SMDS_VolumeIteratorPtr it = aMesh->volumesIterator(); -// while(it->more()) { -// const SMDS_MeshVolume* f = it->next(); -// myIds.Add(f->GetID()); -// } -// } - /* commented by skl 07.02.2006 - to work with quadratic elements - TVisualObjPtr aVisualObj = anActor->GetObject(); - vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid(); - if (aGrid != 0) { - for (int i = 0, n = aGrid->GetNumberOfCells(); i < n; i++) { - vtkCell* aCell = aGrid->GetCell(i); - if (aCell != 0) { - vtkTriangle* aTri = vtkTriangle::SafeDownCast(aCell); - vtkQuad* aQua = vtkQuad::SafeDownCast(aCell); - vtkPolygon* aPG = vtkPolygon::SafeDownCast(aCell); - - vtkCell3D* a3d = vtkCell3D::SafeDownCast(aCell); - vtkConvexPointSet* aPH = vtkConvexPointSet::SafeDownCast(aCell); - - if (aTri && myFilterType == SMESHGUI_TriaFilter || - aQua && myFilterType == SMESHGUI_QuadFilter || - (aTri || aQua || aPG) && myFilterType == SMESHGUI_FaceFilter || - (a3d || aPH) && myFilterType == SMESHGUI_VolumeFilter) { - int anObjId = aVisualObj->GetElemObjId(i); - myIds.Add(anObjId); - } - } - } - } - */ - //} } anIds->length(myIds.Extent()); @@ -1225,6 +1166,14 @@ SMESHGUI_CuttingOfQuadsDlg QGridLayout* aLay = (QGridLayout*)(mySelGrp->layout()); aLay->addWidget(myPreviewChk, aLay->rowCount(), 0, 1, aLay->columnCount()); + // "split to 4 tria" option + + QRadioButton* to4TriaRB = new QRadioButton(tr("TO_4_TRIA"), myChoiceWidget); + ((QVBoxLayout*)(myCriterionGrp->layout()))->insertWidget(0, to4TriaRB); + myGroupChoice->addButton(to4TriaRB, 3); + to4TriaRB->setChecked(true); + onCriterionRB(); + myCriterionGrp->show(); myChoiceWidget->show(); myComboBoxFunctor->insertItem(0, tr("MIN_DIAG_ELEMENTS")); @@ -1259,6 +1208,14 @@ bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor, return hasObj ? theEditor->SplitQuadObject(obj, true) : theEditor->SplitQuad(theIds, true); case 1: // use diagonal 2-4 return hasObj ? theEditor->SplitQuadObject(obj, false) : theEditor->SplitQuad(theIds, false); + case 3: // split to 4 tria + { + if ( hasObj ) + return theEditor->QuadTo4Tri( obj ), true; + SMESH::SMESH_IDSource_var elems = theEditor->MakeIDSource( theIds, SMESH::FACE ); + theEditor->QuadTo4Tri( elems ); + return true; + } default: // use numeric functor break; } @@ -1274,6 +1231,16 @@ void SMESHGUI_CuttingOfQuadsDlg::onCriterionRB() else myComboBoxFunctor->setEnabled(false); + if (myGroupChoice->checkedId() == 3) // To 4 tria + { + if ( myPreviewChk->isChecked() ) + myPreviewChk->setChecked( false ); + myPreviewChk->setEnabled( false ); + } + else + { + myPreviewChk->setEnabled( true ); + } onPreviewChk(); } diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 0b92291c7..7fe4e8f7c 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -4795,6 +4795,10 @@ Please verify validity of entered information CAPTION Cutting of quadrangles + + TO_4_TRIA + Cut into 4 triangles + SMESHGUI_DeleteGroupDlg