+
+
+//=================================================================================
+// function : onDisplaySimulation
+// purpose : Show/Hide preview
+//=================================================================================
+void SMESHGUI_RotationDlg::onDisplaySimulation( bool toDisplayPreview ) {
+ if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
+ if(myNbOkElements && isValid() && 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.;
+
+ try {
+ SUIT_OverrideCursor aWaitCursor;
+ bool copy = ( ActionGroup->checkedId() == COPY_ELEMS_BUTTON ||
+ ActionGroup->checkedId() == MAKE_MESH_BUTTON );
+ QList<SMESH::MeshPreviewStruct_var> aMeshPreviewStruct;
+ if(CheckBoxMesh->isChecked())
+ for ( int i = 0; i < myObjects.count(); i++ ) {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditPreviewer();
+ aMeshEditor->RotateObject(myObjects[i], anAxis, anAngle, copy);
+ aMeshPreviewStruct << aMeshEditor->GetPreviewData();
+ }
+ else {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
+ aMeshEditor->Rotate(anElementsId, anAxis, anAngle, copy);
+ aMeshPreviewStruct << aMeshEditor->GetPreviewData();
+ }
+ setSimulationPreview( aMeshPreviewStruct );
+ } catch (...) {
+ hidePreview();
+ }
+ }
+ else {
+ hidePreview();
+ }
+ } else {
+ hidePreview();
+ }
+}