Salome HOME
Porting SMESH module to Qt 4
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MakeNodeAtPointDlg.cxx
1 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
8 //
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 // File   : SMESHGUI_MakeNodeAtPointDlg.cxx
21 // Author : Edward AGAPOV, Open CASCADE S.A.S.
22 //
23
24 // SMESH includes
25 #include "SMESHGUI_MakeNodeAtPointDlg.h"
26
27 #include "SMESHGUI.h"
28 #include "SMESHGUI_IdValidator.h"
29 #include "SMESHGUI_MeshUtils.h"
30 #include "SMESHGUI_VTKUtils.h"
31 #include "SMESHGUI_SpinBox.h"
32 #include "SMESHGUI_MeshEditPreview.h"
33
34 #include <SMDS_Mesh.hxx>
35 #include <SMESH_Actor.h>
36 #include <SMESH_ActorUtils.h>
37 #include <SMESH_NumberFilter.hxx>
38 #include <SMESH_LogicalFilter.hxx>
39
40 // SALOME GEOM includes
41 #include <GEOMBase.h>
42
43 // SALOME GUI includes
44 #include <LightApp_SelectionMgr.h>
45 #include <SALOME_ListIO.hxx>
46 #include <SUIT_Desktop.h>
47 #include <SVTK_ViewModel.h>
48 #include <SalomeApp_Tools.h>
49 #include <SalomeApp_TypeFilter.h>
50 #include <SUIT_ResourceMgr.h>
51 #include <SUIT_OverrideCursor.h>
52 #include <SUIT_MessageBox.h>
53
54 // OCCT includes
55 #include <TColStd_MapOfInteger.hxx>
56 #include <TopoDS_Vertex.hxx>
57 #include <BRep_Tool.hxx>
58 #include <gp_Pnt.hxx>
59
60 // Qt includes
61 #include <QGroupBox>
62 #include <QGridLayout>
63 #include <QHBoxLayout>
64 #include <QVBoxLayout>
65 #include <QLineEdit>
66 #include <QPushButton>
67 #include <QLabel>
68 #include <QRadioButton>
69 #include <QCheckBox>
70
71 // VTK includes
72 #include <vtkProperty.h>
73
74 // IDL includes
75 #include <SALOMEconfig.h>
76 #include CORBA_SERVER_HEADER(SMESH_Mesh)
77 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
78
79 #define SPACING 6
80 #define MARGIN  11
81
82 /*!
83  * \brief Dialog to publish a sub-shape of the mesh main shape
84  *        by selecting mesh elements
85  */
86 SMESHGUI_MakeNodeAtPointDlg::SMESHGUI_MakeNodeAtPointDlg()
87   : SMESHGUI_Dialog( 0, false, true )
88 {
89   setWindowTitle(tr("CAPTION"));
90
91   QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame());
92   aDlgLay->setMargin(MARGIN);;
93   aDlgLay->setSpacing(SPACING);
94
95   QWidget* aMainFrame = createMainFrame  (mainFrame());
96
97   aDlgLay->addWidget(aMainFrame);
98
99   aDlgLay->setStretchFactor(aMainFrame, 1);
100 }
101
102 //=======================================================================
103 // function : createMainFrame()
104 // purpose  : Create frame containing dialog's input fields
105 //=======================================================================
106 QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
107 {
108   QWidget* aFrame = new QWidget(theParent);
109
110   SUIT_ResourceMgr* rm = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
111   QPixmap iconMoveNode (rm->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
112   QPixmap iconSelect   (rm->loadPixmap("SMESH", tr("ICON_SELECT")));
113
114   // constructor
115
116   QGroupBox* aPixGrp = new QGroupBox(tr("MESH_PASS_THROUGH_POINT"), aFrame);
117   QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp);
118   aPixGrpLayout->setMargin(MARGIN);
119   aPixGrpLayout->setSpacing(SPACING);
120
121   QRadioButton* aRBut = new QRadioButton(aPixGrp);
122   aRBut->setIcon(iconMoveNode);
123   aRBut->setChecked(true);
124   aPixGrpLayout->addWidget(aRBut);
125
126   // coordinates
127
128   QGroupBox* aCoordGrp = new QGroupBox(tr("SMESH_COORDINATES"), aFrame);
129   QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp);
130   aCoordGrpLayout->setMargin(MARGIN);
131   aCoordGrpLayout->setSpacing(SPACING);
132
133   myCoordBtn = new QPushButton(aCoordGrp);
134   myCoordBtn->setIcon(iconSelect);
135   myCoordBtn->setCheckable(true);
136
137   QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp);
138   myX = new SMESHGUI_SpinBox(aCoordGrp);
139
140   QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp);
141   myY = new SMESHGUI_SpinBox(aCoordGrp);
142
143   QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp);
144   myZ = new SMESHGUI_SpinBox(aCoordGrp);
145
146   myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY);
147   myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY);
148   myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY);
149
150   aCoordGrpLayout->addWidget(myCoordBtn);
151   aCoordGrpLayout->addWidget(aXLabel);
152   aCoordGrpLayout->addWidget(myX);
153   aCoordGrpLayout->addWidget(aYLabel);
154   aCoordGrpLayout->addWidget(myY);
155   aCoordGrpLayout->addWidget(aZLabel);
156   aCoordGrpLayout->addWidget(myZ);
157
158   // Method selection
159
160   QGroupBox* aMethodGrp = new QGroupBox(tr("METHOD"), aFrame);
161   QHBoxLayout* aMethodGrpLayout = new QHBoxLayout(aMethodGrp);
162   aMethodGrpLayout->setMargin(MARGIN);
163   aMethodGrpLayout->setSpacing(SPACING);
164
165   myMoveRBtn = new QRadioButton(tr("MOVE_EXISTING_METHOD"), aMethodGrp);
166   myCreateRBtn = new QRadioButton(tr("CREATE_NEW_METHOD"), aMethodGrp);
167
168   aMethodGrpLayout->addWidget(myMoveRBtn);
169   aMethodGrpLayout->addWidget(myCreateRBtn);
170
171   // node ID
172
173   myNodeToMoveGrp = new QGroupBox(tr("NODE_2MOVE"), aFrame);
174
175   QLabel* idLabel = new QLabel(tr("NODE_2MOVE_ID"), myNodeToMoveGrp);
176   myIdBtn = new QPushButton(myNodeToMoveGrp);
177   myIdBtn->setIcon(iconSelect);
178   myIdBtn->setCheckable(true);
179   myId = new QLineEdit(myNodeToMoveGrp);
180   myId->setValidator(new SMESHGUI_IdValidator(this, 1));
181   myAutoSearchChkBox = new QCheckBox( tr("AUTO_SEARCH"), myNodeToMoveGrp);
182   myPreviewChkBox = new QCheckBox( tr("PREVIEW"), myNodeToMoveGrp);
183
184   QGridLayout* myNodeToMoveGrpLayout = new QGridLayout(myNodeToMoveGrp);
185   myNodeToMoveGrpLayout->setSpacing(SPACING);
186   myNodeToMoveGrpLayout->setMargin(MARGIN);
187
188   myNodeToMoveGrpLayout->addWidget( idLabel, 0, 0 );
189   myNodeToMoveGrpLayout->addWidget( myIdBtn, 0, 1 );
190   myNodeToMoveGrpLayout->addWidget( myId,    0, 2 );
191   myNodeToMoveGrpLayout->addWidget( myAutoSearchChkBox, 1, 0, 1, 3 );
192   myNodeToMoveGrpLayout->addWidget( myPreviewChkBox,    2, 0, 1, 3 );
193
194   QVBoxLayout* aLay = new QVBoxLayout(aFrame);
195   aLay->addWidget(aPixGrp);
196   aLay->addWidget(aCoordGrp);
197   aLay->addWidget(aMethodGrp);
198   aLay->addWidget(myNodeToMoveGrp);
199
200   connect(myCoordBtn,         SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
201   connect(myMoveRBtn,         SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
202   connect(myCreateRBtn,       SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
203   connect(myIdBtn,            SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
204   connect(myAutoSearchChkBox, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
205
206   myMoveRBtn->setChecked(true);
207   myIdBtn->setDown(true);
208   myAutoSearchChkBox->setChecked(true);
209
210   return aFrame;
211 }
212
213 //================================================================================
214 /*!
215  * \brief SLOT called when any button is toggled
216   * \param bool - on or off
217  */
218 //================================================================================
219
220 void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on)
221 {
222   const QObject* aSender = sender();
223   if ( on ) {
224     if ( aSender == myCoordBtn ) // button to set coord by node selection
225     {
226       if ( myIdBtn->isEnabled() )
227         myIdBtn->setDown( !on );
228     }
229     else if ( aSender == myIdBtn ) // button to select a node to move
230     {
231       myCoordBtn->setDown( !on );
232     }
233     else if ( aSender == myMoveRBtn ) // move node method
234     {
235       myNodeToMoveGrp->setEnabled( true );
236     }
237     else if ( aSender == myCreateRBtn ) // create node method
238     {
239       myNodeToMoveGrp->setEnabled( false );
240       myCoordBtn->setDown( true ); 
241     }
242   }      
243   if ( aSender == myAutoSearchChkBox ) // automatic node search
244   {
245     if ( on ) {
246       myId->setText("");
247       myId->setReadOnly ( true );
248       myIdBtn->setDown( false );
249       myIdBtn->setEnabled( false );
250       myCoordBtn->setDown( true );
251     }
252     else {
253       myId->setReadOnly ( false );
254       myIdBtn->setEnabled( true );
255     }
256   }
257 }
258
259 //================================================================================
260 /*!
261  * \brief Constructor
262 */
263 //================================================================================
264
265 SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp()
266 {
267   mySimulation = 0;
268   myDlg = new SMESHGUI_MakeNodeAtPointDlg;
269   myFilter = 0;
270   myHelpFileName = "mesh_through_point_page.html";
271
272   // connect signals and slots
273   connect(myDlg->myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
274   connect(myDlg->myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
275   connect(myDlg->myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
276   connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview()));
277   connect(myDlg->myPreviewChkBox,   SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
278   connect(myDlg->myAutoSearchChkBox,SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
279   connect(myDlg->myMoveRBtn,        SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
280   connect(myDlg->myCreateRBtn,      SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
281 }
282
283 //=======================================================================
284 // function : startOperation()
285 // purpose  : Init dialog fields, connect signals and slots, show dialog
286 //=======================================================================
287 void SMESHGUI_MakeNodeAtPointOp::startOperation()
288 {
289   myNoPreview = false;
290   myMeshActor = 0;
291
292   // init simulation with a current View
293   if ( mySimulation ) delete mySimulation;
294   mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( getSMESHGUI() ));
295   vtkProperty* aProp = vtkProperty::New();
296   aProp->SetRepresentationToWireframe();
297   aProp->SetColor(250, 0, 250);
298   aProp->SetPointSize(5);
299   aProp->SetLineWidth( SMESH::GetFloat("SMESH:element_width",1) + 1);
300   mySimulation->GetActor()->SetProperty(aProp);
301   aProp->Delete();
302
303   SMESHGUI_SelectionOp::startOperation();
304
305   // SalomeApp_TypeFilter depends on a current study
306   if ( myFilter ) delete myFilter;
307   QList<SUIT_SelectionFilter*> filters;
308   filters.append( new SalomeApp_TypeFilter((SalomeApp_Study*)study(), "SMESH" ));
309   TColStd_MapOfInteger vertexType;
310   vertexType.Add( TopAbs_VERTEX );
311   filters.append( new SMESH_NumberFilter("GEOM", TopAbs_VERTEX, 1, vertexType ));
312   myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR );
313   
314   activateSelection(); // set filters
315
316   myDlg->myX->SetValue(0);
317   myDlg->myY->SetValue(0);
318   myDlg->myZ->SetValue(0);
319   myDlg->myId->setText("");
320   myDlg->show();
321
322   onSelectionDone(); // init myMeshActor
323
324   if ( myMeshActor ) {
325 //     myMeshOldDisplayMode = myMeshActor->GetRepresentation();
326 //     myMeshActor->SetRepresentation( VTK_WIREFRAME );
327     myMeshActor->SetPointRepresentation(true);
328     SMESH::RepaintCurrentView();
329     redisplayPreview();
330   }
331 }
332
333 //================================================================================
334 /*!
335  * \brief Stops operation
336  */
337 //================================================================================
338
339 void SMESHGUI_MakeNodeAtPointOp::stopOperation()
340 {
341   myNoPreview = true;
342   mySimulation->SetVisibility(false);
343   if ( myMeshActor ) {
344 //     myMeshActor->SetRepresentation( myMeshOldDisplayMode );
345     myMeshActor->SetPointRepresentation(false);
346     SMESH::RepaintCurrentView();
347     myMeshActor = 0;
348   }
349   selectionMgr()->removeFilter( myFilter );
350   SMESHGUI_SelectionOp::stopOperation();
351 }
352
353 //================================================================================
354 /*!
355  * \brief perform it's intention action: move or create a node
356  */
357 //================================================================================
358
359 bool SMESHGUI_MakeNodeAtPointOp::onApply()
360 {
361   if( isStudyLocked() )
362     return false;
363
364   if ( !myMeshActor ) {
365     SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
366                               tr("INVALID_MESH") );
367     dlg()->show();
368     return false;
369   }
370
371   if ( !isValid() ) { // node id is invalid
372     SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
373                               tr("INVALID_ID") );
374     dlg()->show();
375     return false;
376   }
377
378
379   try {
380     SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
381     if (aMesh->_is_nil()) {
382       SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
383                                    tr("SMESHG_NO_MESH") );
384       return true;
385     }
386     SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
387     if (aMeshEditor->_is_nil())
388       return true;
389
390     int aResult = 0;
391     if ( myDlg->myCreateRBtn->isDown() )
392     {
393       aResult = aMeshEditor->AddNode(myDlg->myX->GetValue(),
394                                      myDlg->myY->GetValue(),
395                                      myDlg->myZ->GetValue());
396     }
397     else
398     {
399       int anId = myDlg->myId->text().toInt();
400       aResult = aMeshEditor->MoveClosestNodeToPoint(myDlg->myX->GetValue(),
401                                                     myDlg->myY->GetValue(),
402                                                     myDlg->myZ->GetValue(),
403                                                     anId);
404     }
405     if (aResult)
406     {
407       myDlg->myId->setText("");
408
409       SALOME_ListIO aList;
410       selectionMgr()->setSelectedObjects(aList,false);
411       aList.Append(myMeshActor->getIO());
412       selectionMgr()->setSelectedObjects(aList,false);
413       SMESH::UpdateView();
414     }
415   }
416   catch (const SALOME::SALOME_Exception& S_ex) {
417     SalomeApp_Tools::QtCatchCorbaException(S_ex);
418   }
419   catch (...) {
420   }
421
422   return true;
423 }
424
425 //================================================================================
426 /*!
427  * \brief Check selected node id validity
428  */
429 //================================================================================
430
431 bool SMESHGUI_MakeNodeAtPointOp::isValid()
432 {
433   bool ok = true;
434
435   if ( myMeshActor &&
436        myDlg->myMoveRBtn->isDown() &&
437        !myDlg->myAutoSearchChkBox->isChecked() )
438   {
439     ok = false;
440     int id = myDlg->myId->text().toInt();
441     if ( id > 0 )
442       if (SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh())
443         ok = aMesh->FindNode( id );
444   }
445   return ok;
446 }
447
448 //================================================================================
449 /*!
450  * \brief SLOT called when selection changed
451  */
452 //================================================================================
453
454 void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
455 {
456   if ( !myDlg->isVisible() || !myDlg->isEnabled() )
457     return;
458   try {
459     SALOME_ListIO aList;
460     selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type());
461     if (aList.Extent() != 1)
462       return;
463     Handle(SALOME_InteractiveObject) anIO = aList.First();
464     SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
465
466     if (!aMeshActor) { // coord by geom
467       if ( myDlg->myCoordBtn->isDown() ) {
468         GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
469         if ( !geom->_is_nil() ) {
470           TopoDS_Vertex aShape;
471           if ( GEOMBase::GetShape(geom, aShape) &&
472                aShape.ShapeType() == TopAbs_VERTEX ) {
473             gp_Pnt P = BRep_Tool::Pnt(aShape);
474             myNoPreview = true;
475             myDlg->myX->SetValue(P.X());
476             myDlg->myY->SetValue(P.Y());
477             myDlg->myZ->SetValue(P.Z());
478             myNoPreview = false;
479             redisplayPreview();
480           }
481         }
482         return;
483       }
484     }
485
486     if ( !myMeshActor )
487       myMeshActor = aMeshActor;
488
489     QString aString;
490     int nbElems = SMESH::GetNameOfSelectedElements(selector(),anIO, aString);
491     if (nbElems == 1) {
492       if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) {
493         if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) {
494           myNoPreview = true;
495           if ( myDlg->myCoordBtn->isDown() ) { // set coord
496             myDlg->myX->SetValue(aNode->X());
497             myDlg->myY->SetValue(aNode->Y());
498             myDlg->myZ->SetValue(aNode->Z());
499             myNoPreview = false;
500             redisplayPreview();
501           }
502           else if ( myDlg->myIdBtn->isDown() &&
503                     myDlg->myIdBtn->isEnabled() ) { // set node to move
504             myDlg->myId->setText(aString);
505             myNoPreview = false;
506             redisplayPreview();
507           }
508         }
509       }
510     }
511   } catch (...) {
512   }
513 }
514
515 //================================================================================
516 /*!
517  * \brief update preview
518  */
519 //================================================================================
520
521 void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
522 {
523   if ( myNoPreview )
524     return;
525   myNoPreview = true;
526
527   SMESH::MeshPreviewStruct_var aMeshPreviewStruct;
528
529   bool moveShown = false;
530   if ( myDlg->myMoveRBtn->isDown() && // Move method
531        myMeshActor)
532   {
533     const bool autoSearch = myDlg->myAutoSearchChkBox->isChecked();
534     const bool preview    = myDlg->myPreviewChkBox->isChecked();
535     if ( autoSearch )
536       myDlg->myId->setText("");
537     if ( preview && ( autoSearch || isValid() ))
538     {
539       try {
540         SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
541         if (!aMesh->_is_nil()) {
542           SMESH::SMESH_MeshEditor_var aPreviewer = aMesh->GetMeshEditPreviewer();
543           if (!aPreviewer->_is_nil())
544           {
545             SUIT_OverrideCursor aWaitCursor;
546
547             // find id and/or just compute preview
548             int anId = aPreviewer->MoveClosestNodeToPoint(myDlg->myX->GetValue(),
549                                                           myDlg->myY->GetValue(),
550                                                           myDlg->myZ->GetValue(),
551                                                           myDlg->myId->text().toInt());
552             if ( autoSearch ) { // set found id
553               QString idTxt("%1");
554               if ( anId > 0 )
555                 idTxt = idTxt.arg( anId );
556               else
557                 idTxt = "";
558               myDlg->myId->setText( idTxt );
559             }
560             if ( preview ) { // fill preview data
561               aMeshPreviewStruct = aPreviewer->GetPreviewData();
562               moveShown = ( anId > 0 );
563             }
564           }
565         }
566       }catch (...) {
567       }
568     }
569   }
570
571   if ( !moveShown )
572   {
573     aMeshPreviewStruct = new SMESH::MeshPreviewStruct();
574
575     aMeshPreviewStruct->nodesXYZ.length(1);
576     aMeshPreviewStruct->nodesXYZ[0].x = myDlg->myX->GetValue();
577     aMeshPreviewStruct->nodesXYZ[0].y = myDlg->myY->GetValue();
578     aMeshPreviewStruct->nodesXYZ[0].z = myDlg->myZ->GetValue();
579
580     aMeshPreviewStruct->elementTypes.length(1);
581     aMeshPreviewStruct->elementTypes[0].SMDS_ElementType = SMESH::NODE;
582     aMeshPreviewStruct->elementTypes[0].isPoly = false;
583     aMeshPreviewStruct->elementTypes[0].nbNodesInElement = 1;
584
585     aMeshPreviewStruct->elementConnectivities.length(1);
586     aMeshPreviewStruct->elementConnectivities[0] = 0;
587   }
588
589   // display data
590   if ( aMeshPreviewStruct.operator->() )
591   {
592     mySimulation->SetData(aMeshPreviewStruct._retn());
593   }
594   else
595 {
596     mySimulation->SetVisibility(false);
597   }
598
599   myNoPreview = false;
600 }
601
602 //================================================================================
603 /*!
604  * \brief Activate Node selection
605  */
606 //================================================================================
607
608 void SMESHGUI_MakeNodeAtPointOp::activateSelection()
609 {
610   selectionMgr()->clearFilters();
611   SMESH::SetPointRepresentation(false);
612   selectionMgr()->installFilter( myFilter );
613   setSelectionMode( NodeSelection );
614 }
615
616 //================================================================================
617 /*!
618  * \brief Destructor
619 */
620 //================================================================================
621
622 SMESHGUI_MakeNodeAtPointOp::~SMESHGUI_MakeNodeAtPointOp()
623 {
624   if ( myDlg )        delete myDlg;
625   if ( mySimulation ) delete mySimulation;
626   if ( myFilter )     delete myFilter;
627 }
628
629 //================================================================================
630 /*!
631  * \brief Gets dialog of this operation
632  * \retval LightApp_Dialog* - pointer to dialog of this operation
633  */
634 //================================================================================
635
636 LightApp_Dialog* SMESHGUI_MakeNodeAtPointOp::dlg() const
637 {
638   return myDlg;
639 }
640