+
+//=================================================================================
+// function : onDisplaySimulation
+// purpose : Show/Hide preview
+//=================================================================================
+void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview ) {
+ if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
+
+ if (isValid() && myNbOkElements) {
+ 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::DirStruct aVector;
+ if (GetConstructorId() == 0) {
+ aVector.PS.x = SpinBox2_1->GetValue() - SpinBox1_1->GetValue();
+ aVector.PS.y = SpinBox2_2->GetValue() - SpinBox1_2->GetValue();
+ aVector.PS.z = SpinBox2_3->GetValue() - SpinBox1_3->GetValue();
+ } else if (GetConstructorId() == 1) {
+ aVector.PS.x = SpinBox1_1->GetValue();
+ aVector.PS.y = SpinBox1_2->GetValue();
+ aVector.PS.z = SpinBox1_3->GetValue();
+ }
+
+ try {
+ bool copy = ( ActionGroup->checkedId() == COPY_ELEMS_BUTTON ||
+ ActionGroup->checkedId() == MAKE_MESH_BUTTON );
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+ if(CheckBoxMesh->isChecked())
+ aMeshEditor->TranslateObject(mySelectedObject, aVector, copy);
+ else
+ aMeshEditor->Translate(anElementsId, aVector, copy);
+
+ SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
+ mySimulation->SetData(aMeshPreviewStruct._retn());
+ } catch (...) {
+
+ }
+ }
+ else {
+ hidePreview();
+ }
+ } else {
+ hidePreview();
+ }
+}