+bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
+ const SMESH::long_array& theIds,
+ SMESH::SMESH_IDSource_ptr theObj)
+{
+ SMESH::IDSource_wrap obj = theObj;
+ if ( CORBA::is_nil( obj ))
+ obj = theEditor->MakeIDSource( theIds, SMESH::VOLUME );
+ else
+ obj->Register();
+ try {
+ if ( isIntoPrisms() )
+ {
+ QStringList aParameters;
+ aParameters << myPointSpin[0]->text();
+ aParameters << myPointSpin[1]->text();
+ aParameters << myPointSpin[2]->text();
+ aParameters << myDirSpin[0]->text();
+ aParameters << myDirSpin[1]->text();
+ aParameters << myDirSpin[2]->text();
+ myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+
+ SMESH::PointStruct_var point = new SMESH::PointStruct;
+ point->x = myPointSpin[0]->GetValue();
+ point->y = myPointSpin[1]->GetValue();
+ point->z = myPointSpin[2]->GetValue();
+ SMESH::DirStruct_var norm = new SMESH::DirStruct;
+ norm->PS.x = myDirSpin[0]->GetValue();
+ norm->PS.y = myDirSpin[1]->GetValue();
+ norm->PS.z = myDirSpin[2]->GetValue();
+
+ theEditor->SplitHexahedraIntoPrisms( obj, point, norm,
+ myGroupChoice->checkedId()+1,
+ myAllDomainsChk->isChecked() );
+ }
+ else
+ {
+ theEditor->SplitVolumesIntoTetra( obj, myGroupChoice->checkedId()+1 );
+ }
+ }
+ catch ( const SALOME::SALOME_Exception& S_ex ) {
+ SalomeApp_Tools::QtCatchCorbaException( S_ex );
+ return false;
+ }
+ catch(...) {
+ return false;
+ }
+ return true;
+}
+
+int SMESHGUI_SplitVolumesDlg::nbElemsInMesh()
+{
+ return isIntoPrisms() ? myMesh->NbHexas() : myMesh->NbVolumes() - myMesh->NbTetras();
+}
+
+bool SMESHGUI_SplitVolumesDlg::isIntoPrisms()
+{
+ return ( myEntityTypeGrp->checkedId() == 1 );
+}
+
+//================================================================================
+/*!
+ * \brief Slot called when a target element type changes
+ */
+//================================================================================
+
+void SMESHGUI_SplitVolumesDlg::on3d2dChanged(int isPrism)
+{
+ if ( isPrism )
+ {
+ myFacetSelGrp->show();
+ myAllDomainsChk->show();
+ myGroupChoice->button(2)->hide();
+ myGroupChoice->button(0)->setText( tr("SPLIT_HEX_TO_2_PRISMS"));
+ myGroupChoice->button(1)->setText( tr("SPLIT_HEX_TO_4_PRISMS"));
+ }
+ else
+ {
+ myFacetSelGrp->hide();
+ myAllDomainsChk->hide();
+ myGroupChoice->button(2)->show();
+ myGroupChoice->button(0)->setText( tr("SPLIT_HEX_TO_5_TETRA"));
+ myGroupChoice->button(1)->setText( tr("SPLIT_HEX_TO_6_TETRA"));
+ myGroupChoice->button(2)->setText( tr("SPLIT_HEX_TO_24_TETRA"));
+ }
+ SMESHGUI_MultiEditDlg::on3d2dChanged( !myEntityType );
+ myEntityType = 1; // == VOLUME
+ myChoiceWidget->hide();
+ myChoiceWidget->show();
+ resize(minimumSizeHint());
+ onSelectionDone();
+}
+
+//================================================================================
+/*!
+ * \brief Set selection mode
+ */
+//================================================================================
+
+void SMESHGUI_SplitVolumesDlg::setSelectionMode()
+{
+ if ( myBusy || !isEnabled() ) return;
+
+ SMESH::RemoveFilters();
+
+ mySelectionMgr->clearFilters();
+
+ if (mySubmeshChk->isChecked()) {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
+ mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::SUBMESH));
+ myFacetSelBtn->setChecked( false );
+ }
+ else if (myGroupChk->isChecked()) {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
+ mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::GROUP));
+ myFacetSelBtn->setChecked( false );
+ }
+
+ if ( myFacetSelBtn->isChecked() )
+ {
+ // facet selection - select any element
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode( CellSelection );
+ myFilterType = SMESH::AllElementsFilter;
+ }
+ else
+ {
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode( VolumeSelection );
+ if ( isIntoPrisms() )
+ {
+ SMESH::SetFilter(new SMESHGUI_VolumeShapeFilter( SMDSGeom_HEXA ));
+ myFilterType = SMESHGUI_VolumeShapeFilter::GetId( SMDSGeom_HEXA );
+ }
+ else // to tetrahedra
+ {
+ SMESH::SetFilter(new SMESHGUI_VolumesFilter());
+ myFilterType = SMESH::VolumeFilter;
+ }
+ }
+}
+
+//================================================================================
+/*!
+ * \brief SLOT called when selection changed
+ */
+//================================================================================
+
+void SMESHGUI_SplitVolumesDlg::onSelectionDone()
+{
+ if (myBusy || !isEnabled()) return;
+
+ if ( !myFacetSelBtn->isChecked() )
+ {
+ SMESHGUI_MultiEditDlg::onSelectionDone();
+ }
+ else // set point and normal by a selected element
+ {
+ const SALOME_ListIO& aList = mySelector->StoredIObjects();
+ int nbSel = aList.Extent();
+ if (nbSel > 0)
+ {
+ Handle(SALOME_InteractiveObject) anIO = aList.First();