Salome HOME
Crash after pre-viewing mesh translation
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MakeNodeAtPointDlg.cxx
index 89034c8a6782b23aa6d4937d66ce61c8dadbc0be..f1b55af95c457e537a1d81eab8b1f7c91de93ec9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #define SPACING 6
 #define MARGIN  11
 
+namespace
+{
+  enum { MANUAL_MODE = 0, SEARCH_MODE }; // how a node to move is specified
+}
+
 /*!
  * \brief Dialog to publish a sub-shape of the mesh main shape
  *        by selecting mesh elements
@@ -350,7 +355,7 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp()
   mySMESHGUI = 0;
   myDlg = new SMESHGUI_MakeNodeAtPointDlg;
   myFilter = 0;
-  myHelpFileName = "mesh_through_point_page.html";
+  myHelpFileName = "mesh_through_point.html";
 
   myNoPreview = false;
   myUpdateDestination = false;
@@ -437,7 +442,7 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation()
   myDlg->myDestDZ->setReadOnly(true);
   myDlg->myRButNodeToMove->setChecked(true);
 
-  myDlg->ConstructorsClicked(GetConstructorId());
+  myDlg->ConstructorsClicked( GetConstructorId() );
 
   myDlg->show();
 
@@ -469,12 +474,13 @@ void SMESHGUI_MakeNodeAtPointOp::stopOperation()
     mySimulation = 0;
   }
   if ( myMeshActor ) {
-    myMeshActor->SetPointRepresentation(false);
-    SMESH::RepaintCurrentView();
     myMeshActor = 0;
   }
+  SMESH::SetPointRepresentation( false );
+  SMESH::RepaintCurrentView();
+
   disconnect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView()));
-  disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView()));
+  disconnect(mySMESHGUI, SIGNAL (SignalCloseView()),            this, SLOT(onCloseView()));
   selectionMgr()->removeFilter( myFilter );
   SMESHGUI_SelectionOp::stopOperation();
 }
@@ -487,7 +493,7 @@ void SMESHGUI_MakeNodeAtPointOp::stopOperation()
 
 bool SMESHGUI_MakeNodeAtPointOp::onApply()
 {
-  if( isStudyLocked() )
+  if( SMESHGUI::isStudyLocked() )
     return false;
 
   if ( !myMeshActor ) {
@@ -522,7 +528,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
     if (aMeshEditor->_is_nil())
       return true;
 
-    aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+    aMesh->SetParameters( aParameters.join(":").toUtf8().constData() );
 
     bool ok;
     int anId = myDlg->myId->text().toInt( &ok );
@@ -685,6 +691,9 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
     return;
   myNoPreview = true;
 
+  if ( !myMeshActor && GetConstructorId() == SEARCH_MODE )
+    onSelectionDone();
+
   SMESH::MeshPreviewStruct_var aMeshPreviewStruct;
 
   bool moveShown = false;
@@ -776,7 +785,8 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
             }
           }
         }
-      }catch (...) {
+      }
+      catch (...) {
       }
     }
   }
@@ -801,9 +811,9 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
   if (!mySimulation)
     mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
   // display data
-  if ( aMeshPreviewStruct.operator->() )
+  if ( & aMeshPreviewStruct.in() )
   {
-    mySimulation->SetData(aMeshPreviewStruct._retn());
+    mySimulation->SetData( aMeshPreviewStruct.in() );
   }
   else
   {