- erasePreview();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::Init
-// Purpose : Init dialog fields
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::Init()
-{
- myPreviewActor = 0;
- myMeshActor = 0;
- myBusy = false;
-
- mySMESHGUI->SetActiveDialogBox((QDialog*)this);
-
- // selection and SMESHGUI
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
- connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
- connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
-
- reset();
- setEnabled(true);
-
- int x, y;
- mySMESHGUI->DefineDlgPosition(this, x, y);
- this->move(x, y);
- this->show();
-
- // set selection mode
- SMESH::SetPointRepresentation(true);
- myViewWindow->SetSelectionMode(NodeSelection);
-
- onSelectionDone();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::isValid
-// Purpose : Verify validity of entry information
-//=======================================================================
-bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) const
-{
- if (myId->text().isEmpty()) {
- if (theMess)
- QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"),
- tr("NODE_ID_IS_NOT_DEFINED"), QMessageBox::Ok);
- return false;
- }
- return true;
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::reset
-// Purpose : Reset the dialog state
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::reset()
-{
- myId->clear();
- myX->SetValue(0);
- myY->SetValue(0);
- myZ->SetValue(0);
- redisplayPreview();
- updateButtons();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onApply
-// Purpose : SLOT called when "Apply" button pressed.
-//=======================================================================
-bool SMESHGUI_MoveNodesDlg::onApply()
-{
- if (mySMESHGUI->isActiveStudyLocked())
- return false;
-
- if (!isValid(true))
- return false;
-
- SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
- if (aMesh->_is_nil()) {
- QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("SMESHG_NO_MESH"), QMessageBox::Ok);
- return false;
- }
-
- SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
- if (aMeshEditor->_is_nil())
- return false;
-
- int anId = myId->text().toInt();
- bool aResult = false;
- try {
- aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
- } catch (...) {
- }
-
- if (aResult) {
- SALOME_ListIO aList;
- aList.Append(myMeshActor->getIO());
- mySelectionMgr->setSelectedObjects(aList,false);
- SMESH::UpdateView();
- reset();
- }
-
- return aResult;
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed.
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onOk()
-{
- if (onApply())
- onClose();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onClose()
-{
- mySelectionMgr->clearSelected();
- SMESH::SetPointRepresentation(false);
- myViewWindow->SetSelectionMode(ActorSelection);
- disconnect(mySelectionMgr, 0, this, 0);
- disconnect(mySMESHGUI, 0, this, 0);
- mySMESHGUI->ResetState();
- reject();