1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // GEOM RepairGUI : GUI for Geometry component
24 // File : RepairGUI_GlueDlg.cxx
25 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
27 #include "RepairGUI_GlueDlg.h"
30 #include <GeometryGUI.h>
32 #include <SalomeApp_DoubleSpinBox.h>
34 #include <SalomeApp_Application.h>
35 #include <LightApp_SelectionMgr.h>
36 #include <SalomeApp_Study.h>
37 #include <SalomeApp_Tools.h>
38 #include <SUIT_Session.h>
39 #include <SUIT_Desktop.h>
40 #include <SUIT_MessageBox.h>
41 #include <SUIT_OverrideCursor.h>
42 #include <SUIT_ResourceMgr.h>
43 #include <SUIT_ViewWindow.h>
44 #include <SUIT_ViewManager.h>
45 #include <OCCViewer_ViewModel.h>
46 #include <SALOME_ListIteratorOfListIO.hxx>
48 #include <GEOMImpl_Types.hxx>
50 #include <TCollection_AsciiString.hxx>
52 #define DEFAULT_TOLERANCE_VALUE 1e-07
54 //=================================================================================
55 // class : RepairGUI_GlueDlg()
56 // purpose : Constructs a RepairGUI_GlueDlg which is a child of 'parent', with the
57 // name 'name' and widget flags set to 'f'.
58 // The dialog will by default be modeless, unless you set 'modal' to
59 // TRUE to construct a modal dialog.
60 //=================================================================================
61 RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
63 : GEOMBase_Skeleton( theGeometryGUI, parent, modal ),
66 QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES" ) ) );
67 QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES2" ) ));
68 QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
70 setWindowTitle( tr( "GEOM_GLUE_TITLE" ) );
72 /***************************************************************/
73 mainFrame()->GroupConstructors->setTitle( tr( "GEOM_GLUE_TITLE" ) );
74 mainFrame()->RadioButton1->setIcon( image0 );
75 mainFrame()->RadioButton2->setIcon( image2 );
76 mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
77 mainFrame()->RadioButton3->close();
79 GroupPoints = new DlgRef_1SelExt( centralWidget() );
80 GroupPoints->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
81 GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
82 GroupPoints->PushButton1->setIcon( image1 );
83 GroupPoints->LineEdit1->setReadOnly( true );
85 QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
86 myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
87 initSpinBox( myTolEdt, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
88 myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
90 QGridLayout* boxLayout = new QGridLayout( GroupPoints->Box );
91 boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
92 boxLayout->addWidget( aTolLab, 0, 0 );
93 boxLayout->addWidget( myTolEdt, 0, 2 );
94 /***************************************************************/
96 GroupPoints2 = new DlgRef_1SelExt( centralWidget() );
97 GroupPoints2->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
98 GroupPoints2->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
99 GroupPoints2->PushButton1->setIcon( image1 );
100 GroupPoints2->LineEdit1->setReadOnly( true );
102 QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box );
103 myTolEdt2 = new SalomeApp_DoubleSpinBox( GroupPoints2->Box );
104 initSpinBox( myTolEdt2, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
105 myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE );
107 myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GLUE_FACES" ) ),
109 mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), GroupPoints2->Box );
111 boxLayout = new QGridLayout( GroupPoints2->Box );
112 boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
113 boxLayout->addWidget( aTolLab2, 0, 0 );
114 boxLayout->addWidget( myTolEdt2, 0, 2 );
115 boxLayout->addWidget( myDetectBtn, 1, 0, 1, 3 );
116 boxLayout->addWidget( mySubShapesChk, 2, 0, 1, 3 );
118 QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
119 layout->setMargin( 0 ); layout->setSpacing( 6 );
120 layout->addWidget( GroupPoints );
121 layout->addWidget( GroupPoints2 );
123 /***************************************************************/
125 setHelpFileName( "glue_faces_operation_page.html" );
127 // Disable second way of gluing if OCC viewer is not active one
128 if ( myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
129 != OCCViewer_Viewer::Type() )
130 mainFrame()->RadioButton2->setEnabled( false );
136 //=================================================================================
137 // function : ~RepairGUI_GlueDlg()
138 // purpose : Destroys the object and frees any allocated resources
139 //=================================================================================
140 RepairGUI_GlueDlg::~RepairGUI_GlueDlg()
145 //=================================================================================
148 //=================================================================================
149 void RepairGUI_GlueDlg::Init()
152 myEditCurrentArgument = GroupPoints->LineEdit1;
154 myObject = GEOM::GEOM_Object::_nil();
156 //myGeomGUI->SetState( 0 );
157 //globalSelection( GEOM_COMPOUND );
159 mainFrame()->GroupBoxPublish->show();
160 //Hide preview checkbox
161 mainFrame()->CheckBoxPreview->hide();
163 /* signals and slots connections */
164 connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
165 connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
167 connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
169 connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
170 connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
172 connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
173 connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
174 connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) );
175 connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
177 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
178 this, SLOT( SelectionIntoArgument() ) );
180 connect( myDetectBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
182 initName( tr( "GLUE_NEW_OBJ_NAME" ) );
184 ConstructorsClicked( 0 );
191 //=================================================================================
192 // function : ConstructorsClicked()
193 // purpose : Radio button management
194 //=================================================================================
195 void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
197 if ( myCurrConstrId == constructorId )
200 disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
202 switch ( constructorId ) {
204 GroupPoints2->hide();
206 GroupPoints->LineEdit1->setText( "" );
207 myEditCurrentArgument = GroupPoints->LineEdit1;
209 if ( myCurrConstrId >= 0 ) {
210 // i.e. it is not initialisation
211 // copy tolerance from previous tolerance field
212 myTolEdt->setValue( myTolEdt2->value() );
217 GroupPoints2->show();
218 GroupPoints->LineEdit1->setText( "" );
219 myEditCurrentArgument = GroupPoints2->LineEdit1;
221 if ( myCurrConstrId >= 0 ) {
222 // i.e. it is not initialisation
223 // copy tolerance from previous tolerance field
224 myTolEdt2->setValue( myTolEdt->value() );
225 mySubShapesChk->setChecked( false );
231 myCurrConstrId = constructorId;
233 myEditCurrentArgument->setFocus();
235 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
236 this, SLOT( SelectionIntoArgument() ) );
238 qApp->processEvents();
240 resize( minimumSizeHint() );
245 SelectionIntoArgument();
249 //=================================================================================
250 // function : ClickOnOk()
251 // purpose : Same than click on apply but close this dialog.
252 //=================================================================================
253 void RepairGUI_GlueDlg::ClickOnOk()
255 setIsApplyAndClose( true );
256 if ( ClickOnApply() )
261 //=================================================================================
262 // function : ClickOnApply()
264 //=================================================================================
265 bool RepairGUI_GlueDlg::ClickOnApply()
267 if ( !onAcceptLocal() )
272 //GroupPoints->LineEdit1->setText("");
273 //myObject = GEOM::GEOM_Object::_nil();
275 //globalSelection( GEOM_COMPOUND );
277 ConstructorsClicked( getConstructorId() );
283 //=================================================================================
284 // function : SelectionIntoArgument()
285 // purpose : Called when selection
286 //=================================================================================
287 void RepairGUI_GlueDlg::SelectionIntoArgument()
289 if ( mySubShapesChk->isChecked() && getConstructorId() == 1 ) {
295 myEditCurrentArgument->setText( "" );
296 myObject = GEOM::GEOM_Object::_nil();
298 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
299 SALOME_ListIO aSelList;
300 aSelMgr->selectedObjects(aSelList);
302 if ( aSelList.Extent() == 1 ) {
303 Handle(SALOME_InteractiveObject) anIO = aSelList.First();
304 myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
305 if ( !CORBA::is_nil( myObject ) )
306 myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
311 //=================================================================================
312 // function : SetEditCurrentArgument()
314 //=================================================================================
315 void RepairGUI_GlueDlg::SetEditCurrentArgument()
317 const QObject* send = sender();
318 if ( send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1 ) {
319 myEditCurrentArgument->setFocus();
320 SelectionIntoArgument();
325 //=================================================================================
326 // function : LineEditReturnPressed()
328 //=================================================================================
329 void RepairGUI_GlueDlg::LineEditReturnPressed()
331 const QObject* send = sender();
332 if ( send == GroupPoints->LineEdit1 ) {
333 myEditCurrentArgument = GroupPoints->LineEdit1;
334 GEOMBase_Skeleton::LineEditReturnPressed();
336 else if ( send == GroupPoints2->LineEdit1 ) {
337 myEditCurrentArgument = GroupPoints2->LineEdit1;
338 GEOMBase_Skeleton::LineEditReturnPressed();
343 //=================================================================================
344 // function : ActivateThisDialog()
346 //=================================================================================
347 void RepairGUI_GlueDlg::ActivateThisDialog()
349 GEOMBase_Skeleton::ActivateThisDialog();
350 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
351 this, SLOT( SelectionIntoArgument() ) );
353 //GroupPoints->LineEdit1->setText("");
354 //GroupPoints2->LineEdit1->setText("");
355 //myObject = GEOM::GEOM_Object::_nil();
357 //myGeomGUI->SetState( 0 );
358 //globalSelection( GEOM_COMPOUND );
363 //=================================================================================
364 // function : enterEvent()
365 // purpose : Mouse enter onto the dialog to activate it
366 //=================================================================================
367 void RepairGUI_GlueDlg::enterEvent( QEvent* )
369 if ( !mainFrame()->GroupConstructors->isEnabled() )
370 ActivateThisDialog();
374 //=================================================================================
375 // function : createOperation
377 //=================================================================================
378 GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
380 return getGeomEngine()->GetIShapesOperations( getStudyId() );
383 //=================================================================================
384 // function : isValid
386 //=================================================================================
387 bool RepairGUI_GlueDlg::isValid( QString& msg )
391 switch ( getConstructorId() )
394 v = myTolEdt->value();
395 ok = myTolEdt->isValid( msg, !IsPreview() );
398 v = myTolEdt2->value();
399 ok = myTolEdt2->isValid( msg, !IsPreview() );
402 return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok;
405 //=================================================================================
406 // function : execute
408 //=================================================================================
409 bool RepairGUI_GlueDlg::execute( ObjectList& objects )
411 bool aResult = false;
414 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
415 switch ( getConstructorId() ) {
418 GEOM::GEOM_Object_var anObj = anOper->MakeGlueFaces( myObject, myTolEdt->value(), true );
419 aResult = !anObj->_is_nil();
420 if ( aResult && !IsPreview() )
422 QStringList aParameters;
423 aParameters << myTolEdt->text();
424 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
426 objects.push_back( anObj._retn() );
433 // if this method is used for displaying preview then we must detect glue faces only
434 ObjectList::iterator anIter;
435 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
436 objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
437 return myTmpObjs.size() ? true : false;
440 // Make glue face by list.
441 // Iterate through myTmpObjs and verifies where each object is currently selected or not.
442 QMap<QString, char> selected;
444 // Get names of selected objects
445 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
446 SALOME_ListIO aSelList;
447 aSelMgr->selectedObjects(aSelList);
449 SALOME_ListIteratorOfListIO it (aSelList);
450 for (; it.More(); it.Next())
451 selected.insert(it.Value()->getName(), 0);
453 // Iterate through result and select objects with names from selection
454 // ObjectList toRemoveFromEnggine;
456 ObjectList::iterator anIter;
457 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) {
458 if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
459 toGlue.push_back( *anIter );
463 GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
464 aListForGlue->length( toGlue.size() );
465 ObjectList::iterator anIter3 = toGlue.begin();
466 for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
467 aListForGlue[ i ] = *anIter3;
468 GEOM::GEOM_Object_var anObj = anOper->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true );
470 aResult = !anObj->_is_nil();
476 QStringList aParameters;
477 aParameters << myTolEdt2->text();
478 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
480 objects.push_back( anObj._retn() );
483 // Remove from engine useless objects
495 //=================================================================================
496 // function : restoreSubShapes
498 //=================================================================================
499 void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
500 SALOMEDS::SObject_ptr theSObject )
502 if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
503 GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
504 if ( getConstructorId() == 0 ) // MakeGlueFaces
505 aFindMethod = GEOM::FSM_GetInPlaceByHistory;
507 // empty list of arguments means that all arguments should be restored
508 getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
509 aFindMethod, /*theInheritFirstArg=*/true,
510 mainFrame()->CheckBoxAddPrefix->isChecked() );
514 //================================================================
515 // Function : clearShapeBufferLocal
517 //================================================================
518 void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
520 if ( CORBA::is_nil( theObj ) )
523 CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj );
524 TCollection_AsciiString asciiIOR( (char *)( IOR.in() ) );
525 myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
527 if ( !getStudy() || !( getStudy()->studyDS() ) )
530 _PTR(Study) aStudy = getStudy()->studyDS();
531 _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR.in() ) ) );
535 _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
536 for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
537 _PTR(GenericAttribute) anAttr;
538 if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
539 _PTR(AttributeIOR) anIOR ( anAttr );
540 TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
541 myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
546 //================================================================
547 // Function : onAccept
548 // Purpose : This method should be called from dialog's slots onOk() and onApply()
549 // It perfroms user input validation, then it
550 // performs a proper operation and manages transactions, etc.
551 //================================================================
552 bool RepairGUI_GlueDlg::onAcceptLocal()
554 if ( !getStudy() || !( getStudy()->studyDS() ) )
557 _PTR(Study) aStudy = getStudy()->studyDS();
559 bool aLocked = aStudy->GetProperties()->IsLocked();
561 MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
562 SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "WRN_STUDY_LOCKED" ), tr( "BUT_OK" ) );
567 if ( !isValid( msg ) ) {
572 erasePreview( false );
575 if ( openCommand() ) {
576 SUIT_OverrideCursor wc;
578 myGeomGUI->getApp()->putInfo( "" );
581 if ( !execute( objects ) ) {
587 const int nbObjs = objects.size();
588 for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
589 QString aName = getNewObjectName();
591 if ( aName.isEmpty() )
592 aName = getPrefix( *it );
593 aName = GEOMBase::GetDefaultName( aName );
596 // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
597 if ( aName.isEmpty() )
598 aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
600 addInStudy( *it, aName.toLatin1().data() );
601 display( *it, false );
607 myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") );
613 // JFA 28.12.2004 BEGIN // To enable warnings
614 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
615 if ( !CORBA::is_nil(anOper) && !anOper->IsDone() ) {
617 QString msgw = QObject::tr( anOper->GetErrorCode() );
618 SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
620 // JFA 28.12.2004 END
624 catch( const SALOME::SALOME_Exception& e ) {
625 SalomeApp_Tools::QtCatchCorbaException( e );
637 //=================================================================================
638 // function : onDetect
640 //=================================================================================
641 void RepairGUI_GlueDlg::onDetect()
645 if ( !isValid( msg ) ) {
650 buttonOk()->setEnabled( false );
651 buttonApply()->setEnabled( false );
652 globalSelection( GEOM_ALLSHAPES );
654 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
655 GEOM::ListOfGO_var aList = anOper->GetGlueFaces( myObject, myTolEdt2->value() );
657 for ( int i = 0, n = aList->length(); i < n; i++ )
658 myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
660 if ( myTmpObjs.size() > 0 ) {
661 msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
662 mySubShapesChk->setChecked( true );
665 msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
668 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
669 this, SLOT( SelectionIntoArgument() ) ) ;
670 SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, tr( "Close" ) );
675 //=================================================================================
676 // function : activateSelection
677 // purpose : Redisplay preview and Activate selection
678 //=================================================================================
679 void RepairGUI_GlueDlg::activateSelection()
681 erasePreview( false );
683 int anId = getConstructorId();
685 // Case of whole gluing
686 disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
687 this, SLOT( SelectionIntoArgument() ) );
689 globalSelection( GEOM_ALLSHAPES );
690 if ( myObject->_is_nil())
691 SelectionIntoArgument();
693 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
694 this, SLOT( SelectionIntoArgument() ) );
697 // Second case of gluing
698 if ( !mySubShapesChk->isChecked() )
699 globalSelection( GEOM_ALLSHAPES );
701 displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
702 disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
703 this, SLOT( SelectionIntoArgument() ) ) ;
704 globalSelection( GEOM_PREVIEW );
705 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
706 this, SLOT( SelectionIntoArgument() ) ) ;
712 //=================================================================================
713 // function : updateButtonState
714 // purpose : Update button state
715 //=================================================================================
716 void RepairGUI_GlueDlg::updateButtonState()
718 int anId = getConstructorId();
719 bool hasMainObj = !myObject->_is_nil();
721 buttonOk()->setEnabled( hasMainObj );
722 buttonApply()->setEnabled( hasMainObj );
726 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
727 SALOME_ListIO aSelList;
728 aSelMgr->selectedObjects(aSelList);
730 bool wasSelected = false;
731 SALOME_ListIteratorOfListIO it (aSelList);
734 bool wasDetected = myTmpObjs.size() ? true : false;
735 buttonOk()->setEnabled( hasMainObj && wasDetected && wasSelected );
736 buttonApply()->setEnabled( hasMainObj && wasDetected && wasSelected );
737 mySubShapesChk->setEnabled( hasMainObj && wasDetected );
738 myDetectBtn->setEnabled( hasMainObj );
739 if ( !hasMainObj || !wasDetected )
740 mySubShapesChk->setChecked( false );
744 //=================================================================================
745 // function : clearTemporary
746 // purpose : Remove temporary objects from engine
747 //=================================================================================
748 void RepairGUI_GlueDlg::clearTemporary()
750 ObjectList::iterator anIter;
751 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
752 getGeomEngine()->RemoveObject(*anIter);
757 //=================================================================================
758 // function : onTolerChanged
759 // purpose : Remove temporary objects from engine
760 //=================================================================================
761 void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ )
768 //=================================================================================
769 // function : onSubShapesChk
770 // purpose : Update selection mode
771 //=================================================================================
772 void RepairGUI_GlueDlg::onSubShapesChk()
774 if ( !mySubShapesChk->isChecked() )
780 //=================================================================================
781 // function : ClickOnCancel
782 // purpose : Remove temporary objects from engine and call method of base class
783 //=================================================================================
784 void RepairGUI_GlueDlg::ClickOnCancel()
787 GEOMBase_Skeleton::ClickOnCancel();