+ onDisplaySimulation(true);
+}
+
+//=================================================================================
+// function : keyPressEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e )
+{
+ QDialog::keyPressEvent( e );
+ if ( e->isAccepted() )
+ return;
+
+ if ( e->key() == Qt::Key_F1 ) {
+ e->accept();
+ ClickOnHelp();
+ }
+}
+
+//=================================================================================
+// function : onDisplaySimulation()
+// purpose : Show/Hide preview
+//=================================================================================
+void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
+{
+ if (myPreviewCheckBox->isChecked() && toDisplayPreview)
+ {
+ //display preview
+ if (myNbOkElements && IsAxisOk())
+ {
+ QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
+
+ SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+ anElementsId->length(aListElementsId.count());
+ for (int i = 0; i < aListElementsId.count(); i++)
+ anElementsId[i] = aListElementsId[i].toInt();
+
+ SMESH::AxisStruct anAxis;
+
+ anAxis.x = SpinBox_X->GetValue();
+ anAxis.y = SpinBox_Y->GetValue();
+ anAxis.z = SpinBox_Z->GetValue();
+ anAxis.vx = SpinBox_DX->GetValue();
+ anAxis.vy = SpinBox_DY->GetValue();
+ anAxis.vz = SpinBox_DZ->GetValue();
+
+ double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
+ long aNbSteps = (long)SpinBox_NbSteps->value();
+ double aTolerance = SpinBox_Tolerance->GetValue();
+
+ if (GroupAngle->checkedId() == 1)
+ anAngle = anAngle/aNbSteps;
+
+ try {
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+ if( CheckBoxMesh->isChecked() ) {
+ if( GetConstructorId() == 0 )
+ aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ else
+ aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis,
+ anAngle, aNbSteps, aTolerance);
+ }
+ else
+ aMeshEditor->RotationSweep(anElementsId.inout(),
+ anAxis,
+ anAngle,
+ aNbSteps,
+ aTolerance);
+ SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
+ mySimulation->SetData(aMeshPreviewStruct._retn());
+ } catch (...) {}
+ }
+ else
+ {
+ mySimulation->SetVisibility(false);
+ }
+ }
+ else
+ {
+ //erase preview
+ mySimulation->SetVisibility(false);
+ }
+}
+
+//=================================================================================
+// function : onSelectVectorButton()
+// purpose : [slot]
+//=================================================================================
+void SMESHGUI_RevolutionDlg::onSelectVectorButton(){
+ if(SelectVectorMenu) {
+ SelectVectorMenu->exec( QCursor::pos() );
+ }
+}
+
+//=================================================================================
+// function : onSelectVectorMenu()
+// purpose : [slot]
+//=================================================================================
+void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
+ if(!action)
+ return;
+
+ disconnect(mySelectionMgr, 0, this, 0);
+
+ switch(myMenuActions[action]) {
+ case POINT_SELECT:
+ SMESH::SetPointRepresentation(true);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(NodeSelection);
+ break;
+
+ case FACE_SELECT:
+ SMESH::SetPointRepresentation(false);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+ break;
+ }
+
+ myVectorDefinition = myMenuActions[action];
+ myEditCurrentArgument = (QWidget*)SpinBox_DX;
+ myEditCurrentArgument->setFocus();
+ connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_RevolutionDlg::setFilters()
+{
+ if(myMesh->_is_nil()) {
+ SUIT_MessageBox::critical(this,
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
+ return;
+ }
+ if ( !myFilterDlg )
+ {
+ QList<int> types;
+ types.append( SMESH::EDGE );
+ types.append( SMESH::FACE );
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
+ }
+ myFilterDlg->Init( GetConstructorId() ? SMESH::FACE : SMESH::EDGE );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditElements );
+
+ myFilterDlg->show();
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool SMESHGUI_RevolutionDlg::isValid()
+{
+ QString msg;
+ bool ok = true;
+ ok = SpinBox_X->isValid( msg, true ) && ok;
+ ok = SpinBox_Y->isValid( msg, true ) && ok;
+ ok = SpinBox_Z->isValid( msg, true ) && ok;
+ ok = SpinBox_DX->isValid( msg, true ) && ok;
+ ok = SpinBox_DY->isValid( msg, true ) && ok;
+ ok = SpinBox_DZ->isValid( msg, true ) && ok;
+ ok = SpinBox_Angle->isValid( msg, true ) && ok;
+ ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
+ ok = SpinBox_Tolerance->isValid( msg, true ) && ok;
+
+ if( !ok ) {
+ QString str( tr( "SMESH_INCORRECT_INPUT" ) );
+ if ( !msg.isEmpty() )
+ str += "\n" + msg;
+ SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
+ return false;
+ }
+ return true;