]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx
Salome HOME
Dump Puthon extension
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MakeNodeAtPointDlg.cxx
index ddc62504c8bfa66cea7b0c7da76f8f4f52a28366..74711ca31f7ef4372dfd2950a8d273c8e7c156b3 100644 (file)
@@ -67,6 +67,7 @@
 #include <QLabel>
 #include <QRadioButton>
 #include <QCheckBox>
+#include <QButtonGroup>
 
 // VTK includes
 #include <vtkProperty.h>
@@ -114,6 +115,7 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
   // constructor
 
   QGroupBox* aPixGrp = new QGroupBox(tr("MESH_PASS_THROUGH_POINT"), aFrame);
+  QButtonGroup* aBtnGrp = new QButtonGroup(this);
   QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp);
   aPixGrpLayout->setMargin(MARGIN);
   aPixGrpLayout->setSpacing(SPACING);
@@ -122,6 +124,7 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
   aRBut->setIcon(iconMoveNode);
   aRBut->setChecked(true);
   aPixGrpLayout->addWidget(aRBut);
+  aBtnGrp->addButton(aRBut, 0);
 
   // coordinates
 
@@ -300,8 +303,6 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation()
   mySimulation->GetActor()->SetProperty(aProp);
   aProp->Delete();
 
-  SMESHGUI_SelectionOp::startOperation();
-
   // SalomeApp_TypeFilter depends on a current study
   if ( myFilter ) delete myFilter;
   QList<SUIT_SelectionFilter*> filters;
@@ -310,8 +311,10 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation()
   vertexType.Add( TopAbs_VERTEX );
   filters.append( new SMESH_NumberFilter("GEOM", TopAbs_VERTEX, 1, vertexType ));
   myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR );
-  
-  activateSelection(); // set filters
+
+  // IPAL19360
+  SMESHGUI_SelectionOp::startOperation(); // this method should be called only after filter creation
+  //activateSelection(); // set filters   // called inside of previous statement
 
   myDlg->myX->SetValue(0);
   myDlg->myY->SetValue(0);
@@ -368,9 +371,11 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
     return false;
   }
 
-  if ( !isValid() ) { // node id is invalid
-    SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
-                             tr("INVALID_ID") );
+  QString msg;
+  if ( !isValid( msg ) ) { // node id is invalid
+    if( !msg.isEmpty() )
+      SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
+                               tr("INVALID_ID") );
     dlg()->show();
     return false;
   }
@@ -404,6 +409,12 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
     }
     if (aResult)
     {
+      QStringList aParameters;
+      aParameters << myDlg->myX->text();
+      aParameters << myDlg->myY->text();
+      aParameters << myDlg->myZ->text();
+      aMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+
       myDlg->myId->setText("");
 
       SALOME_ListIO aList;
@@ -428,10 +439,9 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
  */
 //================================================================================
 
-bool SMESHGUI_MakeNodeAtPointOp::isValid()
+bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg )
 {
   bool ok = true;
-
   if ( myMeshActor &&
        myDlg->myMoveRBtn->isDown() &&
        !myDlg->myAutoSearchChkBox->isChecked() )
@@ -441,7 +451,14 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid()
     if ( id > 0 )
       if (SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh())
         ok = aMesh->FindNode( id );
+    if( !ok )
+      msg += tr("INVALID_ID") + "\n";
   }
+
+  ok = myDlg->myX->isValid( msg, !myNoPreview ) && ok;
+  ok = myDlg->myY->isValid( msg, !myNoPreview ) && ok;
+  ok = myDlg->myZ->isValid( msg, !myNoPreview ) && ok;
+
   return ok;
 }
 
@@ -534,7 +551,8 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
     const bool preview    = myDlg->myPreviewChkBox->isChecked();
     if ( autoSearch )
       myDlg->myId->setText("");
-    if ( preview && ( autoSearch || isValid() ))
+    QString msg;
+    if ( preview && ( autoSearch || isValid( msg ) ))
     {
       try {
         SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());