Salome HOME
NRI : Explode OCC_LIBS.
[modules/geom.git] / src / GEOMGUI / GeometryGUI_DistanceDlg.cxx
1 using namespace std;
2 //  File      : GeometryGUI_DistanceDlg.cxx
3 //  Created   : Mon Mar 04 22:32:20 2002
4 //  Author    : Nicolas REJNERI
5 //  Project   : SALOME
6 //  Module    : GEOM
7 //  Copyright : Open CASCADE 2002
8 //  $Header$
9
10
11 #include "GeometryGUI_DistanceDlg.h"
12
13 #include "GeometryGUI.h"
14 #include "QAD_Application.h"
15 #include "QAD_Desktop.h"
16 #include "QAD_RightFrame.h"
17 #include "utilities.h"
18
19 #include "OCCViewer_Viewer3d.h"
20 #include "OCCViewer_ViewFrame.h"
21
22 // Open CASCADE Includes
23 #include <BRepBuilderAPI_MakeEdge.hxx>
24 #include <BRepBuilderAPI_MakeVertex.hxx>
25 #include <AIS_ListIteratorOfListOfInteractive.hxx>
26
27 // QT Includes
28 #include <qmessagebox.h>
29 #include <qbuttongroup.h>
30 #include <qframe.h>
31 #include <qgroupbox.h>
32 #include <qlabel.h>
33 #include <qlineedit.h>
34 #include <qpushbutton.h>
35 #include <qradiobutton.h>
36 #include <qlayout.h>
37 #include <qvariant.h>
38 #include <qtooltip.h>
39 #include <qwhatsthis.h>
40 #include <qimage.h>
41 #include <qpixmap.h>
42 #include <qevent.h>
43
44
45 //=================================================================================
46 // class    : GeometryGUI_DistanceDlg()
47 // purpose  : Constructs a GeometryGUI_DistanceDlg which is a child of 'parent', with the 
48 //            name 'name' and widget flags set to 'f'.
49 //            The dialog will by default be modeless, unless you set 'modal' to
50 //            TRUE to construct a modal dialog.
51 //=================================================================================
52 GeometryGUI_DistanceDlg::GeometryGUI_DistanceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
53     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
54 {
55     QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MINDIST")));
56     QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
57
58     if ( !name )
59         setName( "GeometryGUI_DistanceDlg" );
60     resize( 322, 220 ); 
61     setCaption( tr( "GEOM_MINDIST_TITLE" ) );
62     setSizeGripEnabled( TRUE );
63
64     GeometryGUI_DistanceDlgLayout = new QGridLayout( this ); 
65     GeometryGUI_DistanceDlgLayout->setSpacing( 6 );
66     GeometryGUI_DistanceDlgLayout->setMargin( 11 );
67
68     /***************************************************************/
69     GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
70     GroupConstructors->setTitle( tr( "GEOM_DISTANCE"  ) );
71     GroupConstructors->setExclusive( TRUE );
72     GroupConstructors->setColumnLayout(0, Qt::Vertical );
73     GroupConstructors->layout()->setSpacing( 0 );
74     GroupConstructors->layout()->setMargin( 0 );
75     GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
76     GroupConstructorsLayout->setAlignment( Qt::AlignTop );
77     GroupConstructorsLayout->setSpacing( 6 );
78     GroupConstructorsLayout->setMargin( 11 );
79     QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
80     GroupConstructorsLayout->addItem( spacer, 0, 1 );
81     Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
82     Constructor1->setText( tr( ""  ) );
83     Constructor1->setPixmap( image0 );
84     Constructor1->setChecked( TRUE );
85     Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
86     GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
87     GeometryGUI_DistanceDlgLayout->addWidget( GroupConstructors, 0, 0 );
88
89     /***************************************************************/
90     GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
91     GroupConstructor1->setTitle( tr( "GEOM_MINDIST_OBJ"  ) );
92     GroupConstructor1->setColumnLayout(0, Qt::Vertical );
93     GroupConstructor1->layout()->setSpacing( 0 );
94     GroupConstructor1->layout()->setMargin( 0 );
95     GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
96     GroupConstructor1Layout->setAlignment( Qt::AlignTop );
97     GroupConstructor1Layout->setSpacing( 6 );
98     GroupConstructor1Layout->setMargin( 11 );
99     LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" );
100     LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) );
101     GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 );
102     LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" );
103     LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) );
104     GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 );
105     SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" );
106     SelectButtonC1A1Shape->setText( tr( ""  ) );
107     SelectButtonC1A1Shape->setPixmap( image1 );
108     GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 );
109     SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" );
110     SelectButtonC1A2Shape->setText( tr( ""  ) );
111     SelectButtonC1A2Shape->setPixmap( image1 );
112     GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 );
113     TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" );
114     TextLabelC1A2Shape->setText( tr( "GEOM_OBJECT_I"  ).arg("2") );
115     TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) );
116     TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame );
117     TextLabelC1A2Shape->setFrameShadow( QLabel::Plain );
118     GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 );
119     TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" );
120     TextLabelC1A1Shape->setText( tr( "GEOM_OBJECT_I"  ).arg("1") );
121     TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) );
122     TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame );
123     TextLabelC1A1Shape->setFrameShadow( QLabel::Plain );
124     GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 );
125     GeometryGUI_DistanceDlgLayout->addWidget( GroupConstructor1, 1, 0 );
126
127     TextLabel_Length = new QLabel( GroupConstructor1, "TextLabel_Length" );
128     TextLabel_Length->setText( tr( "GEOM_LENGTH"  ) );
129     TextLabel_Length->setMinimumSize( QSize( 50, 0 ) );
130     TextLabel_Length->setFrameShape( QLabel::NoFrame );
131     TextLabel_Length->setFrameShadow( QLabel::Plain );
132     GroupConstructor1Layout->addWidget( TextLabel_Length, 2, 0 );
133     LineEdit_Length = new QLineEdit( GroupConstructor1, "LineEdit_Length" );
134     LineEdit_Length->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Length->sizePolicy().hasHeightForWidth() ) );
135     //    LineEdit_Length->setEnabled( FALSE );
136     LineEdit_Length->setReadOnly( TRUE );
137     GroupConstructor1Layout->addWidget( LineEdit_Length, 2, 2 );
138
139     /***************************************************************/
140     GroupButtons = new QGroupBox( this, "GroupButtons" );
141     GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
142     GroupButtons->setTitle( tr( ""  ) );
143     GroupButtons->setColumnLayout(0, Qt::Vertical );
144     GroupButtons->layout()->setSpacing( 0 );
145     GroupButtons->layout()->setMargin( 0 );
146     GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
147     GroupButtonsLayout->setAlignment( Qt::AlignTop );
148     GroupButtonsLayout->setSpacing( 6 );
149     GroupButtonsLayout->setMargin( 11 );
150     buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
151     buttonCancel->setText( tr( "GEOM_BUT_CLOSE"  ) );
152     buttonCancel->setAutoDefault( TRUE );
153     GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
154     buttonApply = new QPushButton( GroupButtons, "buttonApply" );
155     buttonApply->setText( tr( "GEOM_BUT_APPLY"  ) );
156     buttonApply->setAutoDefault( TRUE );
157     GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
158     QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
159     GroupButtonsLayout->addItem( spacer_9, 0, 2 );
160     buttonOk = new QPushButton( GroupButtons, "buttonOk" );
161     buttonOk->setText( tr( "GEOM_BUT_OK"  ) );
162     buttonOk->setAutoDefault( TRUE );
163     buttonOk->setDefault( TRUE );
164     GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
165     GeometryGUI_DistanceDlgLayout->addWidget( GroupButtons, 2, 0 ); 
166
167     /* Initialisation */
168     Init( Sel ) ; 
169 }
170
171
172 //=================================================================================
173 // function : ~GeometryGUI_DistanceDlg()
174 // purpose  : Destroys the object and frees any allocated resources
175 //=================================================================================
176 GeometryGUI_DistanceDlg::~GeometryGUI_DistanceDlg()
177 {  
178   /* no need to delete child widgets, Qt does it all for us */
179   this->destroy(TRUE, TRUE) ;
180 }
181
182
183
184 //=================================================================================
185 // function : Init()
186 // purpose  :
187 //=================================================================================
188 void GeometryGUI_DistanceDlg::Init( SALOME_Selection* Sel )
189 {  
190   mySelection = Sel ;
191   myShape1.Nullify() ;
192   myShape2.Nullify() ;
193   myConstructorId = 0 ;
194   
195   myGeomGUI = GeometryGUI::GetGeometryGUI() ;
196
197   GroupConstructor1->show();
198   myConstructorId = 0 ;
199   myEditCurrentArgument = LineEditC1A1Shape ;   
200   Constructor1->setChecked( TRUE );
201   myOkShape1 = myOkShape2 = false ;
202
203   myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
204
205   Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
206   myGeom = GEOM::GEOM_Gen::_narrow(comp);
207   
208   // TODO previous selection into argument ?
209
210   /* signals and slots connections */
211   connect( buttonOk, SIGNAL( clicked() ),     this, SLOT( ClickOnOk() ) );
212   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
213   connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
214   connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
215   connect( SelectButtonC1A1Shape, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
216   connect( SelectButtonC1A2Shape, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
217
218   connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
219   connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
220
221   connect( mySelection, SIGNAL( currentSelectionChanged() ),     this, SLOT( SelectionIntoArgument() ) );
222   connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
223   /* to close dialog if study change */
224   connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
225
226   /* Move widget on the botton right corner of main widget */
227   int x, y ;
228   myGeomGUI->DefineDlgPosition( this, x, y ) ;
229   this->move( x, y ) ; 
230   this->show() ; /* Displays Dialog */ 
231
232   return ;
233 }
234
235
236
237 //=================================================================================
238 // function : ConstructorsClicked()
239 // purpose  : Radio button management
240 //=================================================================================
241 void GeometryGUI_DistanceDlg::ConstructorsClicked(int constructorId)
242 {
243   EraseDistance();
244   myGeomGUI->EraseSimulationShape() ;
245
246   switch (constructorId)
247     {
248     case 0:
249       {
250         GroupConstructor1->show();
251         myConstructorId = constructorId ;
252         myEditCurrentArgument = LineEditC1A1Shape ;
253         LineEditC1A2Shape->setText(tr("")) ;
254         Constructor1->setChecked( TRUE );
255         myOkShape1 =  myOkShape2 = false ;
256         break;
257       }
258     }
259  return ;
260 }
261
262 //=================================================================================
263 // function : ClickOnOk()
264 // purpose  :
265 //=================================================================================
266 void GeometryGUI_DistanceDlg::ClickOnOk()
267 {
268   this->ClickOnApply() ;
269   this->ClickOnCancel() ;
270
271   return ;
272 }
273
274 //=================================================================================
275 // function : ClickOnApply()
276 // purpose  :
277 //=================================================================================
278 void GeometryGUI_DistanceDlg::ClickOnApply()
279 {
280   EraseDistance() ;
281   myGeomGUI->EraseSimulationShape() ;
282   mySimulationTopoDs.Nullify() ;
283   myGeomGUI->GetDesktop()->putInfo( tr("") ) ; 
284   switch(myConstructorId)
285     { 
286     case 0 :
287       {
288         if(myOkShape1 && myOkShape2) {    
289           this->MakeDistanceSimulationAndDisplay(myShape1 ,myShape2) ;
290         }
291         break ;
292       }
293     }
294
295   // accept();
296   return ;
297 }
298
299
300 //=================================================================================
301 // function : ClickOnCancel()
302 // purpose  :
303 //=================================================================================
304 void GeometryGUI_DistanceDlg::ClickOnCancel()
305 {
306   EraseDistance() ;
307   myGeomGUI->EraseSimulationShape() ;
308   mySimulationTopoDs.Nullify() ;
309   disconnect( mySelection, 0, this, 0 );
310   myGeomGUI->ResetState() ;
311   reject() ;
312   return ;
313 }
314
315
316
317 //=================================================================================
318 // function : SelectionIntoArgument()
319 // purpose  : Called when selection has changed
320 //=================================================================================
321 void GeometryGUI_DistanceDlg::SelectionIntoArgument()
322 {
323   myGeomGUI->EraseSimulationShape() ; 
324   mySimulationTopoDs.Nullify() ;
325
326   LineEdit_Length->setText("") ;
327   myEditCurrentArgument->setText("") ; /* by default */
328   QString aString = ""; /* the name of selection */
329
330   int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
331   if ( nbSel != 1 ) {
332     switch (myConstructorId) 
333       {
334       case 0:
335         {
336           if ( myEditCurrentArgument == LineEditC1A1Shape ) {
337             myOkShape1 = false ;
338           }
339           else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
340             myOkShape2 = false ;
341           }
342           break ;
343         } 
344       }
345     return ;
346   }
347
348   /*  nbSel == 1  */ 
349   TopoDS_Shape S; 
350   Standard_Boolean testResult ;
351   Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
352   
353   if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
354     return ;
355
356   if ( myEditCurrentArgument == LineEditC1A1Shape ) {
357     myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
358     if( !testResult )
359       return ;
360     myShape1 = S ;
361     LineEditC1A1Shape->setText(aString) ;
362     myOkShape1 = true ;
363   }    
364   else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
365     myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
366     if( !testResult )
367       return ;
368     myShape2 = S ;
369     LineEditC1A2Shape->setText(aString) ;
370     myOkShape2 = true ;
371   }
372
373   return ; 
374 }
375
376
377 //=================================================================================
378 // function : SetEditCurrentArgument()
379 // purpose  :
380 //=================================================================================
381 void GeometryGUI_DistanceDlg::SetEditCurrentArgument()
382 {
383   QPushButton* send = (QPushButton*)sender();
384
385   switch (myConstructorId)
386     {
387     case 0: /* default constructor */
388       { 
389         if( send == SelectButtonC1A1Shape ) {
390           LineEditC1A1Shape->setFocus() ;
391           myEditCurrentArgument = LineEditC1A1Shape ;
392         }
393         else if(send == SelectButtonC1A2Shape) {
394           LineEditC1A2Shape->setFocus() ;
395           myEditCurrentArgument = LineEditC1A2Shape;
396         }
397         SelectionIntoArgument() ;
398         break;
399       }
400     }
401   return ;
402 }
403
404
405
406 //=================================================================================
407 // function : LineEditReturnPressed()
408 // purpose  :
409 //=================================================================================
410 void GeometryGUI_DistanceDlg::LineEditReturnPressed()
411 {
412   QLineEdit* send = (QLineEdit*)sender();  
413   if( send == LineEditC1A1Shape )
414     myEditCurrentArgument = LineEditC1A1Shape ;
415   else if ( send == LineEditC1A2Shape )
416     myEditCurrentArgument = LineEditC1A2Shape ; 
417   else
418     return ;
419   
420   /* User name of object input management                          */
421   /* If successfull the selection is changed and signal emitted... */
422   /* so SelectionIntoArgument() is automatically called.           */
423   const QString objectUserName = myEditCurrentArgument->text() ;
424   QWidget* thisWidget = (QWidget*)this ;
425   if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
426     myEditCurrentArgument->setText( objectUserName ) ;
427   }
428   return ;
429 }
430
431
432
433 //=================================================================================
434 // function : DeactivateActiveDialog()
435 // purpose  :
436 //=================================================================================
437 void GeometryGUI_DistanceDlg::DeactivateActiveDialog()
438 {
439   if ( GroupConstructors->isEnabled() ) {
440
441     GroupConstructors->setEnabled(false) ;
442     GroupConstructor1->setEnabled(false) ;
443     GroupButtons->setEnabled(false) ;  
444     disconnect( mySelection, 0, this, 0 );
445   }
446   return ;
447 }
448
449
450
451 //=================================================================================
452 // function : closeEvent()
453 // purpose  :
454 //=================================================================================
455 void GeometryGUI_DistanceDlg::closeEvent( QCloseEvent* e )
456 {
457   this->ClickOnCancel() ; /* same than click on cancel button */
458 }
459
460
461 //=================================================================================
462 // function : enterEvent()
463 // purpose  : when mouse enter onto the QWidget
464 //=================================================================================
465 void GeometryGUI_DistanceDlg::enterEvent( QEvent *  )
466 {
467   if ( GroupConstructors->isEnabled() )
468     return ;
469   ActivateThisDialog() ;
470 }
471
472
473
474 //=================================================================================
475 // function : ActivateThisDialog()
476 // purpose  :
477 //=================================================================================
478 void GeometryGUI_DistanceDlg::ActivateThisDialog()
479 {
480   /* Emit a signal to deactivate any active dialog */
481   myGeomGUI->EmitSignalDeactivateDialog() ;
482   GroupConstructors->setEnabled(true) ;
483   GroupConstructor1->setEnabled(true) ;
484   GroupButtons->setEnabled(true) ;
485   
486   connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
487
488   if( !mySimulationTopoDs.IsNull() )
489     myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
490
491   return ;
492 }
493
494
495
496 //=================================================================================
497 // function : MakeDistanceSimulationAndDisplay()
498 // purpose  :
499 //=================================================================================
500 void GeometryGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape& S1, const TopoDS_Shape& S2) 
501 {
502   LineEdit_Length->setText("") ;
503   EraseDistance() ;
504   myGeomGUI->EraseSimulationShape() ;
505   
506   BRepExtrema_DistShapeShape dst( S1, S2 );
507   if (dst.IsDone()) {
508     int i;
509     for (i=1; i<= dst.NbSolution(); i++) {
510       gp_Pnt P1,P2;
511       P1 = (dst.PointOnShape1(i));
512       P2 = (dst.PointOnShape2(i));
513       
514       Standard_Real Dist = P1.Distance(P2);
515       if (Dist<=1.e-9) {
516         BRepBuilderAPI_MakeVertex MakeVertex(P1);
517         mySimulationTopoDs =  MakeVertex.Vertex();
518         myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
519
520         LineEdit_Length->setText("0.0") ;
521       } else {
522         BRepBuilderAPI_MakeEdge MakeEdge(P1, P2);
523         mySimulationTopoDs = MakeEdge.Edge();
524
525         TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(P1);
526         TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(P2);
527
528         QString S;
529         S.sprintf("%.1f",Dist);
530         Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension (V1,V2, new Geom_Plane (0.,0.,1.,0.), 
531                                                                         Dist, TCollection_ExtendedString(strdup(S)));
532
533         LineEdit_Length->setText(S) ;
534
535         if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
536           return ;
537         
538         OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
539         Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
540         ic->Display( Distance );
541         ic->UpdateCurrentViewer();
542       }
543     }
544   } else
545     myGeomGUI->GetDesktop()->putInfo( tr( "GEOM_PRP_MIN_DIST" ) );
546 }
547
548
549 //=================================================================================
550 // function : EraseDistance()
551 // purpose  :
552 //=================================================================================
553 void GeometryGUI_DistanceDlg::EraseDistance()
554 {
555   int count = myGeomGUI->GetActiveStudy()->getStudyFramesCount();
556   for ( int i = 0; i < count; i++ )
557     if (myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC ) {
558       OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
559       Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
560
561       AIS_ListOfInteractive L;
562       ic->DisplayedObjects(AIS_KOI_Relation,-1,L);
563       AIS_ListIteratorOfListOfInteractive ite(L);
564       while (ite.More()) {
565         ic->Remove( ite.Value() );
566         ic->UpdateCurrentViewer();
567         ite.Next();
568       }
569     }
570 }