Salome HOME
NRI : First integration.
[modules/geom.git] / src / GEOMGUI / GeometryGUI_MaxToleranceDlg.cxx
1 using namespace std;
2 //  File      : GeometryGUI_MaxToleranceDlg.cxx
3 //  Created   : Mon Mar 04 14:08:28 2002
4 //  Author    : Nicolas REJNERI
5
6 //  Project   : SALOME
7 //  Module    : GEOM
8 //  Copyright : Open CASCADE 2002
9 //  $Header$
10
11 #include "GeometryGUI_MaxToleranceDlg.h"
12
13 #include "GeometryGUI.h"
14 #include "QAD_Application.h"
15 #include "QAD_Desktop.h"
16 #include "utilities.h"
17
18 // Open CASCADE Includes
19 #include <TopExp_Explorer.hxx>
20 #include <BRep_Tool.hxx>
21
22 // QT Includes
23 #include <qbuttongroup.h>
24 #include <qgroupbox.h>
25 #include <qlabel.h>
26 #include <qlineedit.h>
27 #include <qpushbutton.h>
28 #include <qradiobutton.h>
29 #include <qlayout.h>
30 #include <qvariant.h>
31 #include <qtooltip.h>
32 #include <qwhatsthis.h>
33 #include <qimage.h>
34 #include <qpixmap.h>
35
36
37
38 //=================================================================================
39 // class    : GeometryGUI_MaxToleranceDlg()
40 // purpose  : Constructs a GeometryGUI_MaxToleranceDlg which is a child of 'parent', with the 
41 //            name 'name' and widget flags set to 'f'.
42 //            The dialog will by default be modeless, unless you set 'modal' to
43 //            TRUE to construct a modal dialog.
44 //=================================================================================
45 GeometryGUI_MaxToleranceDlg::GeometryGUI_MaxToleranceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
46     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
47 {
48     QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_TOLERANCE")));
49     QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT")));
50
51     if ( !name )
52         setName( "GeometryGUI_MaxToleranceDlg" );
53     resize( 303, 275 ); 
54     setCaption( tr( "GEOM_TOLERANCE_TITLE"  ) );
55     setSizeGripEnabled( TRUE );
56     GeometryGUI_MaxToleranceDlgLayout = new QGridLayout( this ); 
57     GeometryGUI_MaxToleranceDlgLayout->setSpacing( 6 );
58     GeometryGUI_MaxToleranceDlgLayout->setMargin( 11 );
59     
60     /***************************************************************/
61     GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
62     GroupConstructors->setTitle( tr( "GEOM_TOLERANCE"  ) );
63     GroupConstructors->setExclusive( TRUE );
64     GroupConstructors->setColumnLayout(0, Qt::Vertical );
65     GroupConstructors->layout()->setSpacing( 0 );
66     GroupConstructors->layout()->setMargin( 0 );
67     GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
68     GroupConstructorsLayout->setAlignment( Qt::AlignTop );
69     GroupConstructorsLayout->setSpacing( 6 );
70     GroupConstructorsLayout->setMargin( 11 );
71     Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
72     Constructor1->setText( tr( ""  ) );
73     Constructor1->setPixmap( image0 );
74     Constructor1->setChecked( TRUE );
75     Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 
76                                               Constructor1->sizePolicy().hasHeightForWidth() ) );
77     Constructor1->setMinimumSize( QSize( 60, 0 ) );
78     GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
79     QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
80     GroupConstructorsLayout->addItem( spacer, 0, 1 );
81     GeometryGUI_MaxToleranceDlgLayout->addWidget( GroupConstructors, 0, 0 );
82
83     /***************************************************************/
84     GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
85     GroupConstructor1->setTitle( tr( "GEOM_TOLERANCE_CONSTR"  ) );
86     GroupConstructor1->setColumnLayout(0, Qt::Vertical );
87     GroupConstructor1->layout()->setSpacing( 0 );
88     GroupConstructor1->layout()->setMargin( 0 );
89     GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
90     GroupConstructor1Layout->setAlignment( Qt::AlignTop );
91     GroupConstructor1Layout->setSpacing( 6 );
92     GroupConstructor1Layout->setMargin( 11 );
93
94     LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" );
95     LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
96 //    GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 );
97     SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" );
98     SelectButtonC1A1->setText( tr( ""  ) );
99     SelectButtonC1A1->setPixmap( image1 );
100 //    GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 );
101     TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" );
102     TextLabelC1A1->setText( tr( "GEOM_OBJECT"  ) );
103     TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
104     TextLabelC1A1->setFrameShape( QLabel::NoFrame );
105     TextLabelC1A1->setFrameShadow( QLabel::Plain );
106 //    GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 );
107
108     QHBoxLayout* bl = new QHBoxLayout;
109     bl->setMargin(0); bl->setSpacing(6);
110     bl->addWidget(TextLabelC1A1); bl->addWidget(SelectButtonC1A1); bl->addWidget(LineEditC1A1);
111     GroupConstructor1Layout->addMultiCellLayout(bl, 0, 0, 0, 2);
112
113     TextLabel_Min = new QLabel( GroupConstructor1, "TextLabel_Min" );
114     TextLabel_Min->setText( tr( "GEOM_MIN"  ) );
115     TextLabel_Min->setMinimumSize( QSize( 50, 0 ) );
116     TextLabel_Min->setFrameShape( QLabel::NoFrame );
117     TextLabel_Min->setFrameShadow( QLabel::Plain );
118     GroupConstructor1Layout->addWidget( TextLabel_Min, 1, 1 );
119
120     TextLabel_Max = new QLabel( GroupConstructor1, "TextLabel_Max" );
121     TextLabel_Max->setText( tr( "GEOM_MAX"  ) );
122     TextLabel_Max->setMinimumSize( QSize( 50, 0 ) );
123     TextLabel_Max->setFrameShape( QLabel::NoFrame );
124     TextLabel_Max->setFrameShadow( QLabel::Plain );
125     GroupConstructor1Layout->addWidget( TextLabel_Max, 1, 2 );
126
127     TextLabel_Face = new QLabel( GroupConstructor1, "TextLabel_Face" );
128     TextLabel_Face->setText( tr( "GEOM_TOLERANCE_FACE"  ) );
129     TextLabel_Face->setMinimumSize( QSize( 50, 0 ) );
130     TextLabel_Face->setFrameShape( QLabel::NoFrame );
131     TextLabel_Face->setFrameShadow( QLabel::Plain );
132     GroupConstructor1Layout->addWidget( TextLabel_Face, 2, 0 );
133     LineEdit_MinFace = new QLineEdit( GroupConstructor1, "LineEdit_MinFace" );
134     LineEdit_MinFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
135                                                  LineEdit_MinFace->sizePolicy().hasHeightForWidth() ) );
136     //LineEdit_MinFace->setEnabled( FALSE );
137     LineEdit_MinFace->setReadOnly( TRUE );
138     GroupConstructor1Layout->addWidget( LineEdit_MinFace, 2, 1 );
139     LineEdit_MaxFace = new QLineEdit( GroupConstructor1, "LineEdit_MaxFace" );
140     LineEdit_MaxFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
141                                                  LineEdit_MaxFace->sizePolicy().hasHeightForWidth() ) );
142     //LineEdit_MaxFace->setEnabled( FALSE );
143     LineEdit_MaxFace->setReadOnly( TRUE );
144     GroupConstructor1Layout->addWidget( LineEdit_MaxFace, 2, 2 );
145
146     TextLabel_Edge = new QLabel( GroupConstructor1, "TextLabel_Edge" );
147     TextLabel_Edge->setText( tr( "GEOM_TOLERANCE_EDGE"  ) );
148     TextLabel_Edge->setMinimumSize( QSize( 50, 0 ) );
149     TextLabel_Edge->setFrameShape( QLabel::NoFrame );
150     TextLabel_Edge->setFrameShadow( QLabel::Plain );
151     GroupConstructor1Layout->addWidget( TextLabel_Edge, 3, 0 );
152     LineEdit_MinEdge = new QLineEdit( GroupConstructor1, "LineEdit_MinEdge" );
153     LineEdit_MinEdge->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
154                                                  LineEdit_MinEdge->sizePolicy().hasHeightForWidth() ) );
155     //LineEdit_MinEdge->setEnabled( FALSE );
156     LineEdit_MinEdge->setReadOnly( TRUE );
157     GroupConstructor1Layout->addWidget( LineEdit_MinEdge, 3, 1 );
158     LineEdit_MaxEdge = new QLineEdit( GroupConstructor1, "LineEdit_MaxEdge" );
159     LineEdit_MaxEdge->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
160                                                  LineEdit_MaxEdge->sizePolicy().hasHeightForWidth() ) );
161     //LineEdit_MaxEdge->setEnabled( FALSE );
162     LineEdit_MaxEdge->setReadOnly( TRUE );
163     GroupConstructor1Layout->addWidget( LineEdit_MaxEdge, 3, 2 );
164
165     TextLabel_Vertex = new QLabel( GroupConstructor1, "TextLabel_Vertex" );
166     TextLabel_Vertex->setText( tr( "GEOM_TOLERANCE_VERTEX"  ) );
167     TextLabel_Vertex->setMinimumSize( QSize( 50, 0 ) );
168     TextLabel_Vertex->setFrameShape( QLabel::NoFrame );
169     TextLabel_Vertex->setFrameShadow( QLabel::Plain );
170     GroupConstructor1Layout->addWidget( TextLabel_Vertex, 4, 0 );
171     LineEdit_MinVertex = new QLineEdit( GroupConstructor1, "LineEdit_MinVertex" );
172     LineEdit_MinVertex->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
173                                                  LineEdit_MinVertex->sizePolicy().hasHeightForWidth() ) );
174     //LineEdit_MinVertex->setEnabled( FALSE );
175     LineEdit_MinVertex->setReadOnly( TRUE );
176     GroupConstructor1Layout->addWidget( LineEdit_MinVertex, 4, 1 );
177     LineEdit_MaxVertex = new QLineEdit( GroupConstructor1, "LineEdit_MaxVertex" );
178     LineEdit_MaxVertex->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
179                                                  LineEdit_MaxVertex->sizePolicy().hasHeightForWidth() ) );
180     //LineEdit_MaxVertex->setEnabled( FALSE );
181     LineEdit_MaxVertex->setReadOnly( TRUE );
182     GroupConstructor1Layout->addWidget( LineEdit_MaxVertex, 4, 2 );
183
184     GeometryGUI_MaxToleranceDlgLayout->addWidget( GroupConstructor1, 1, 0 );
185
186     /***************************************************************/
187     GroupButtons = new QGroupBox( this, "GroupButtons" );
188     GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
189     GroupButtons->setTitle( tr( ""  ) );
190     GroupButtons->setColumnLayout(0, Qt::Vertical );
191     GroupButtons->layout()->setSpacing( 0 );
192     GroupButtons->layout()->setMargin( 0 );
193     GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
194     GroupButtonsLayout->setAlignment( Qt::AlignTop );
195     GroupButtonsLayout->setSpacing( 6 );
196     GroupButtonsLayout->setMargin( 11 );
197     buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
198     buttonCancel->setText( tr( "GEOM_BUT_CLOSE"  ) );
199     buttonCancel->setAutoDefault( TRUE );
200     GroupButtonsLayout->addWidget( buttonCancel, 0, 1 );
201     // buttonApply = new QPushButton( GroupButtons, "buttonApply" );
202 //     buttonApply->setText( tr( "GEOM_BUT_APPLY"  ) );
203 //     buttonApply->setAutoDefault( TRUE );
204 //     GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
205     QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
206     GroupButtonsLayout->addItem( spacer_8, 0, 0 );
207     QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
208     GroupButtonsLayout->addItem( spacer_9, 0, 2 );
209 //     buttonOk = new QPushButton( GroupButtons, "buttonOk" );
210 //     buttonOk->setText( tr( "GEOM_BUT_OK"  ) );
211 //     buttonOk->setAutoDefault( TRUE );
212 //     buttonOk->setDefault( TRUE );
213 //     GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
214     GeometryGUI_MaxToleranceDlgLayout->addWidget( GroupButtons, 2, 0 );
215     /***************************************************************/
216
217     Init(Sel) ; /* Initialisations */
218 }
219
220
221 //=================================================================================
222 // function : ~GeometryGUI_MaxToleranceDlg()
223 // purpose  : Destroys the object and frees any allocated resources
224 //=================================================================================
225 GeometryGUI_MaxToleranceDlg::~GeometryGUI_MaxToleranceDlg()
226 {
227     // no need to delete child widgets, Qt does it all for us
228 }
229
230
231 //=================================================================================
232 // function : Init()
233 // purpose  :
234 //=================================================================================
235 void GeometryGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel )
236 {
237   myConstructorId = 0 ;
238   Constructor1->setChecked( TRUE );
239   myEditCurrentArgument = LineEditC1A1 ;        
240   mySelection = Sel;
241   myGeomGUI = GeometryGUI::GetGeometryGUI() ;
242   myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
243   
244   // TODO : previous selection into argument ?
245
246   /* Filter definitions */
247   Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry");
248   myGeom = GEOM::GEOM_Gen::_narrow(comp);
249
250   /* signals and slots connections */
251   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
252   connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
253   connect( SelectButtonC1A1, SIGNAL (clicked() ),   this, SLOT( SetEditCurrentArgument() ) ) ;
254   connect( mySelection, SIGNAL( currentSelectionChanged() ),     this, SLOT( SelectionIntoArgument() ) );
255
256   connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
257
258   connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
259   /* to close dialog if study change */
260   connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
261
262   /* Move widget on the botton right corner of main widget */
263   int x, y ;
264   myGeomGUI->DefineDlgPosition( this, x, y ) ;
265   this->move( x, y ) ;
266   this->show() ; /* displays Dialog */
267   return ;
268 }
269
270
271 //=================================================================================
272 // function : ConstructorsClicked()
273 // purpose  : Radio button management
274 //=================================================================================
275 void GeometryGUI_MaxToleranceDlg::ConstructorsClicked(int constructorId)
276 {
277   return ;
278 }
279
280
281
282 //=================================================================================
283 // function : ClickOnCancel()
284 // purpose  :
285 //=================================================================================
286 void GeometryGUI_MaxToleranceDlg::ClickOnCancel()
287 {
288   disconnect( mySelection, 0, this, 0 );
289   myGeomGUI->ResetState() ;
290   reject() ;
291   return ;
292 }
293
294
295 //=================================================================================
296 // function : SelectionIntoArgument()
297 // purpose  : Called when selection as changed or other case
298 //=================================================================================
299 void GeometryGUI_MaxToleranceDlg::SelectionIntoArgument()
300 {
301   LineEdit_MinFace->setText("") ;
302   LineEdit_MinEdge->setText("") ;
303   LineEdit_MinVertex->setText("") ;
304   LineEdit_MaxFace->setText("") ;
305   LineEdit_MaxEdge->setText("") ;
306   LineEdit_MaxVertex->setText("") ;  
307   myEditCurrentArgument->setText("") ;
308
309   QString aString = ""; /* future the name of selection */
310
311   int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
312   if ( nbSel != 1 ) {
313     return ;
314   }
315
316   /*  nbSel == 1  */ 
317   TopoDS_Shape S;
318   if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
319     return ;
320   
321   if( S.IsNull() ) {
322     myEditCurrentArgument->setText( "" );
323     return ;
324   }
325  
326   LineEditC1A1->setText(aString) ;
327   this->CalculateMaxTolerance(S) ;
328
329   return ;
330 }
331
332
333 //=================================================================================
334 // function : SetEditCurrentArgument()
335 // purpose  :
336 //=================================================================================
337 void GeometryGUI_MaxToleranceDlg::SetEditCurrentArgument()
338 {
339   QPushButton* send = (QPushButton*)sender();
340   switch (myConstructorId)
341     {
342     case 0: /* default constructor */
343       { 
344         if(send == SelectButtonC1A1) {
345           LineEditC1A1->setFocus() ;
346           myEditCurrentArgument = LineEditC1A1;
347         }
348         SelectionIntoArgument() ;
349         break;
350       }
351     }
352   return ;
353 }
354
355
356
357 //=================================================================================
358 // function : LineEditReturnPressed()
359 // purpose  :
360 //=================================================================================
361 void GeometryGUI_MaxToleranceDlg::LineEditReturnPressed()
362 {
363   QLineEdit* send = (QLineEdit*)sender();  
364   if( send == LineEditC1A1 )
365     myEditCurrentArgument = LineEditC1A1 ;
366   else
367     return ;
368   
369   /* User name of object input management                          */
370   /* If successfull the selection is changed and signal emitted... */
371   /* so SelectionIntoArgument() is automatically called.           */
372   const QString objectUserName = myEditCurrentArgument->text() ;
373   QWidget* thisWidget = (QWidget*)this ;
374   if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
375     myEditCurrentArgument->setText( objectUserName ) ;
376   }
377   return ;
378 }
379
380
381
382 //=================================================================================
383 // function : DeactivateActiveDialog()
384 // purpose  :
385 //=================================================================================
386 void GeometryGUI_MaxToleranceDlg::DeactivateActiveDialog()
387 {
388   if ( GroupConstructors->isEnabled() ) {    
389     disconnect( mySelection, 0, this, 0 );
390     GroupConstructors->setEnabled(false) ;
391     GroupConstructor1->setEnabled(false) ;
392     GroupButtons->setEnabled(false) ;
393   }
394   return ;
395 }
396
397
398 //=================================================================================
399 // function : ActivateThisDialog()
400 // purpose  :
401 //=================================================================================
402 void GeometryGUI_MaxToleranceDlg::ActivateThisDialog()
403 {
404   /* Emit a signal to deactivate the active dialog */
405   myGeomGUI->EmitSignalDeactivateDialog() ;   
406   GroupConstructors->setEnabled(true) ;
407   GroupConstructor1->setEnabled(true) ;
408   GroupButtons->setEnabled(true) ;
409   connect( mySelection, SIGNAL( currentSelectionChanged() ),     this, SLOT( SelectionIntoArgument() ) );
410   return ;
411 }
412
413
414 //=================================================================================
415 // function : enterEvent()
416 // purpose  :
417 //=================================================================================
418 void GeometryGUI_MaxToleranceDlg::enterEvent(QEvent* e)
419 {
420   if ( GroupConstructors->isEnabled() )
421     return ;  
422   ActivateThisDialog() ;
423   return ;
424 }
425
426
427 //=================================================================================
428 // function : closeEvent()
429 // purpose  :
430 //=================================================================================
431 void GeometryGUI_MaxToleranceDlg::closeEvent( QCloseEvent* e )
432 {
433   /* same than click on cancel button */
434   this->ClickOnCancel() ;
435   return ;
436 }
437
438
439 //=================================================================================
440 // function : CalculateMaxTolerance()
441 // purpose  :
442 //=================================================================================
443 void GeometryGUI_MaxToleranceDlg::CalculateMaxTolerance(const TopoDS_Shape& S)
444 {
445   LineEdit_MinFace->setText("") ;
446   LineEdit_MinEdge->setText("") ;
447   LineEdit_MinVertex->setText("") ;
448   LineEdit_MaxFace->setText("") ;
449   LineEdit_MaxEdge->setText("") ;
450   LineEdit_MaxVertex->setText("") ;
451   if( S.IsNull() ) 
452     return ;
453
454   Standard_Real T,TMF,TME,TMV,TmF,TmE,TmV;
455   Standard_Integer nbF,nbE,nbV;
456   TMF=TME=TMV=-RealLast();
457   TmF=TmE=TmV=RealLast();
458   nbF=nbE=nbV=0;
459
460   bool m_isFace = false;
461   bool m_isEdge = false;
462   bool m_isVertex = false;
463   try 
464     {
465     for( TopExp_Explorer ExF(S,TopAbs_FACE); ExF.More(); ExF.Next() ) 
466       { 
467         m_isFace = true;
468         TopoDS_Face Face=TopoDS::Face(ExF.Current());
469         T=BRep_Tool::Tolerance(Face);
470         if(T>TMF) TMF=T;
471         if(T<TmF) TmF=T;
472         nbF++;
473       }
474     for( TopExp_Explorer ExE(S,TopAbs_EDGE); ExE.More(); ExE.Next() )
475       { 
476         m_isEdge = true;
477         TopoDS_Edge Edge=TopoDS::Edge(ExE.Current());
478         T=BRep_Tool::Tolerance(Edge);
479         if(T>TME) TME=T;
480         if(T<TmE) TmE=T;
481         nbE++;
482       }
483     for( TopExp_Explorer ExV(S,TopAbs_VERTEX); ExV.More(); ExV.Next() )
484       { 
485         m_isVertex = true;
486         TopoDS_Vertex Vertex=TopoDS::Vertex(ExV.Current());
487         T=BRep_Tool::Tolerance(Vertex);
488         if(T>TMV) TMV=T;
489         if(T<TmV) TmV=T;
490         nbV++;
491       }
492     if (m_isFace)
493       {
494         LineEdit_MinFace->setText( tr("%1").arg( TmF, 5, 'e', 8 ) ) ;
495         LineEdit_MaxFace->setText( tr("%1").arg( TMF, 5, 'e', 8 ) ) ;
496       }
497     else
498       {
499         LineEdit_MinFace->setText( "" ) ;
500         LineEdit_MaxFace->setText( "" ) ;
501       }
502     if (m_isEdge)
503       {
504         LineEdit_MinEdge->setText( tr("%1").arg( TmE, 5, 'e', 8 ) ) ;
505         LineEdit_MaxEdge->setText( tr("%1").arg( TME, 5, 'e', 8 ) ) ;
506       }
507     else
508       {
509         LineEdit_MinEdge->setText( "" ) ;
510         LineEdit_MaxEdge->setText( "" ) ;
511       }
512     if (m_isVertex)
513       {
514         LineEdit_MinVertex->setText( tr("%1").arg( TmV, 5, 'e', 8 ) ) ;
515         LineEdit_MaxVertex->setText( tr("%1").arg( TMV, 5, 'e', 8 ) ) ;
516       }
517     else
518       {
519         LineEdit_MinVertex->setText( "" ) ;
520         LineEdit_MaxVertex->setText( "" ) ;
521       }
522   }
523   catch(Standard_Failure) 
524     {
525       MESSAGE("Catch intercepted in CalculateMaxTolerance()" << endl ) ;
526     }
527   return ;
528 }