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();
161 /* signals and slots connections */
162 connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
163 connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
165 connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
167 connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
168 connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
170 connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
171 connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
172 connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) );
173 connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
175 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
176 this, SLOT( SelectionIntoArgument() ) );
178 connect( myDetectBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
180 initName( tr( "GLUE_NEW_OBJ_NAME" ) );
182 ConstructorsClicked( 0 );
189 //=================================================================================
190 // function : ConstructorsClicked()
191 // purpose : Radio button management
192 //=================================================================================
193 void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
195 if ( myCurrConstrId == constructorId )
198 disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
200 switch ( constructorId ) {
202 GroupPoints2->hide();
204 GroupPoints->LineEdit1->setText( "" );
205 myEditCurrentArgument = GroupPoints->LineEdit1;
207 if ( myCurrConstrId >= 0 ) {
208 // i.e. it is not initialisation
209 // copy tolerance from previous tolerance field
210 myTolEdt->setValue( myTolEdt2->value() );
215 GroupPoints2->show();
216 GroupPoints->LineEdit1->setText( "" );
217 myEditCurrentArgument = GroupPoints2->LineEdit1;
219 if ( myCurrConstrId >= 0 ) {
220 // i.e. it is not initialisation
221 // copy tolerance from previous tolerance field
222 myTolEdt2->setValue( myTolEdt->value() );
223 mySubShapesChk->setChecked( false );
229 myCurrConstrId = constructorId;
231 myEditCurrentArgument->setFocus();
233 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
234 this, SLOT( SelectionIntoArgument() ) );
236 qApp->processEvents();
238 resize( minimumSizeHint() );
243 SelectionIntoArgument();
247 //=================================================================================
248 // function : ClickOnOk()
249 // purpose : Same than click on apply but close this dialog.
250 //=================================================================================
251 void RepairGUI_GlueDlg::ClickOnOk()
253 if ( ClickOnApply() )
258 //=================================================================================
259 // function : ClickOnApply()
261 //=================================================================================
262 bool RepairGUI_GlueDlg::ClickOnApply()
264 if ( !onAcceptLocal() )
269 //GroupPoints->LineEdit1->setText("");
270 //myObject = GEOM::GEOM_Object::_nil();
272 //globalSelection( GEOM_COMPOUND );
274 ConstructorsClicked( getConstructorId() );
280 //=================================================================================
281 // function : SelectionIntoArgument()
282 // purpose : Called when selection
283 //=================================================================================
284 void RepairGUI_GlueDlg::SelectionIntoArgument()
286 if ( mySubShapesChk->isChecked() && getConstructorId() == 1 ) {
292 myEditCurrentArgument->setText( "" );
293 myObject = GEOM::GEOM_Object::_nil();
295 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
296 SALOME_ListIO aSelList;
297 aSelMgr->selectedObjects(aSelList);
299 if ( aSelList.Extent() == 1 ) {
300 Handle(SALOME_InteractiveObject) anIO = aSelList.First();
301 Standard_Boolean aRes;
302 myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
304 myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
309 //=================================================================================
310 // function : SetEditCurrentArgument()
312 //=================================================================================
313 void RepairGUI_GlueDlg::SetEditCurrentArgument()
315 const QObject* send = sender();
316 if ( send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1 ) {
317 myEditCurrentArgument->setFocus();
318 SelectionIntoArgument();
323 //=================================================================================
324 // function : LineEditReturnPressed()
326 //=================================================================================
327 void RepairGUI_GlueDlg::LineEditReturnPressed()
329 const QObject* send = sender();
330 if ( send == GroupPoints->LineEdit1 ) {
331 myEditCurrentArgument = GroupPoints->LineEdit1;
332 GEOMBase_Skeleton::LineEditReturnPressed();
334 else if ( send == GroupPoints2->LineEdit1 ) {
335 myEditCurrentArgument = GroupPoints2->LineEdit1;
336 GEOMBase_Skeleton::LineEditReturnPressed();
341 //=================================================================================
342 // function : ActivateThisDialog()
344 //=================================================================================
345 void RepairGUI_GlueDlg::ActivateThisDialog()
347 GEOMBase_Skeleton::ActivateThisDialog();
348 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
349 this, SLOT( SelectionIntoArgument() ) );
351 //GroupPoints->LineEdit1->setText("");
352 //GroupPoints2->LineEdit1->setText("");
353 //myObject = GEOM::GEOM_Object::_nil();
355 //myGeomGUI->SetState( 0 );
356 //globalSelection( GEOM_COMPOUND );
361 //=================================================================================
362 // function : enterEvent()
363 // purpose : Mouse enter onto the dialog to activate it
364 //=================================================================================
365 void RepairGUI_GlueDlg::enterEvent( QEvent* )
367 if ( !mainFrame()->GroupConstructors->isEnabled() )
368 ActivateThisDialog();
372 //=================================================================================
373 // function : createOperation
375 //=================================================================================
376 GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
378 return getGeomEngine()->GetIShapesOperations( getStudyId() );
381 //=================================================================================
382 // function : isValid
384 //=================================================================================
385 bool RepairGUI_GlueDlg::isValid( QString& msg )
389 switch ( getConstructorId() )
392 v = myTolEdt->value();
393 ok = myTolEdt->isValid( msg, !IsPreview() );
396 v = myTolEdt2->value();
397 ok = myTolEdt2->isValid( msg, !IsPreview() );
400 return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok;
403 //=================================================================================
404 // function : execute
406 //=================================================================================
407 bool RepairGUI_GlueDlg::execute( ObjectList& objects )
409 bool aResult = false;
412 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
413 switch ( getConstructorId() ) {
416 GEOM::GEOM_Object_var anObj = anOper->MakeGlueFaces( myObject, myTolEdt->value(), true );
417 aResult = !anObj->_is_nil();
418 if ( aResult && !IsPreview() )
420 QStringList aParameters;
421 aParameters << myTolEdt->text();
422 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
424 objects.push_back( anObj._retn() );
431 // if this method is used for displaying preview then we must detect glue faces only
432 ObjectList::iterator anIter;
433 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
434 objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
435 return myTmpObjs.size() ? true : false;
438 // Make glue face by list.
439 // Iterate through myTmpObjs and verifies where each object is currently selected or not.
440 QMap<QString, char> selected;
442 // Get names of selected objects
443 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
444 SALOME_ListIO aSelList;
445 aSelMgr->selectedObjects(aSelList);
447 SALOME_ListIteratorOfListIO it (aSelList);
448 for (; it.More(); it.Next())
449 selected.insert(it.Value()->getName(), 0);
451 // Iterate through result and select objects with names from selection
452 // ObjectList toRemoveFromEnggine;
454 ObjectList::iterator anIter;
455 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) {
456 if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
457 toGlue.push_back( *anIter );
461 GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
462 aListForGlue->length( toGlue.size() );
463 ObjectList::iterator anIter3 = toGlue.begin();
464 for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
465 aListForGlue[ i ] = *anIter3;
466 GEOM::GEOM_Object_var anObj = anOper->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true );
468 aResult = !anObj->_is_nil();
474 QStringList aParameters;
475 aParameters << myTolEdt2->text();
476 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
478 objects.push_back( anObj._retn() );
481 // Remove from engine useless objects
493 //=================================================================================
494 // function : restoreSubShapes
496 //=================================================================================
497 void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
498 SALOMEDS::SObject_ptr theSObject )
500 if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
501 GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
502 if ( getConstructorId() == 0 ) // MakeGlueFaces
503 aFindMethod = GEOM::FSM_GetInPlaceByHistory;
505 // empty list of arguments means that all arguments should be restored
506 getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
507 aFindMethod, /*theInheritFirstArg=*/true,
508 mainFrame()->CheckBoxAddPrefix->isChecked() );
512 //================================================================
513 // Function : clearShapeBufferLocal
515 //================================================================
516 void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
518 if ( CORBA::is_nil( theObj ) )
521 CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj );
522 TCollection_AsciiString asciiIOR( (char *)( IOR.in() ) );
523 myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
525 if ( !getStudy() || !( getStudy()->studyDS() ) )
528 _PTR(Study) aStudy = getStudy()->studyDS();
529 _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR.in() ) ) );
533 _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
534 for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
535 _PTR(GenericAttribute) anAttr;
536 if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
537 _PTR(AttributeIOR) anIOR ( anAttr );
538 TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
539 myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
544 //================================================================
545 // Function : onAccept
546 // Purpose : This method should be called from dialog's slots onOk() and onApply()
547 // It perfroms user input validation, then it
548 // performs a proper operation and manages transactions, etc.
549 //================================================================
550 bool RepairGUI_GlueDlg::onAcceptLocal()
552 if ( !getStudy() || !( getStudy()->studyDS() ) )
555 _PTR(Study) aStudy = getStudy()->studyDS();
557 bool aLocked = aStudy->GetProperties()->IsLocked();
559 MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
560 SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "WRN_STUDY_LOCKED" ), tr( "BUT_OK" ) );
565 if ( !isValid( msg ) ) {
570 erasePreview( false );
573 if ( openCommand() ) {
574 SUIT_OverrideCursor wc;
576 myGeomGUI->getApp()->putInfo( "" );
579 if ( !execute( objects ) ) {
585 const int nbObjs = objects.size();
586 for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
587 QString aName = getNewObjectName();
589 if ( aName.isEmpty() )
590 aName = getPrefix( *it );
591 aName = GEOMBase::GetDefaultName( aName );
594 // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
595 if ( aName.isEmpty() )
596 aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
598 addInStudy( *it, aName.toLatin1().data() );
599 display( *it, false );
605 myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") );
611 // JFA 28.12.2004 BEGIN // To enable warnings
612 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
613 if ( !CORBA::is_nil(anOper) && !anOper->IsDone() ) {
615 QString msgw = QObject::tr( anOper->GetErrorCode() );
616 SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
618 // JFA 28.12.2004 END
622 catch( const SALOME::SALOME_Exception& e ) {
623 SalomeApp_Tools::QtCatchCorbaException( e );
635 //=================================================================================
636 // function : onDetect
638 //=================================================================================
639 void RepairGUI_GlueDlg::onDetect()
643 if ( !isValid( msg ) ) {
648 buttonOk()->setEnabled( false );
649 buttonApply()->setEnabled( false );
650 globalSelection( GEOM_ALLSHAPES );
652 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
653 GEOM::ListOfGO_var aList = anOper->GetGlueFaces( myObject, myTolEdt2->value() );
655 for ( int i = 0, n = aList->length(); i < n; i++ )
656 myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
658 if ( myTmpObjs.size() > 0 ) {
659 msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
660 mySubShapesChk->setChecked( true );
663 msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
666 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
667 this, SLOT( SelectionIntoArgument() ) ) ;
668 SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, tr( "Close" ) );
673 //=================================================================================
674 // function : activateSelection
675 // purpose : Redisplay preview and Activate selection
676 //=================================================================================
677 void RepairGUI_GlueDlg::activateSelection()
679 erasePreview( false );
681 int anId = getConstructorId();
683 // Case of whole gluing
684 disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
685 this, SLOT( SelectionIntoArgument() ) );
687 globalSelection( GEOM_ALLSHAPES );
688 if ( myObject->_is_nil())
689 SelectionIntoArgument();
691 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
692 this, SLOT( SelectionIntoArgument() ) );
695 // Second case of gluing
696 if ( !mySubShapesChk->isChecked() )
697 globalSelection( GEOM_ALLSHAPES );
699 displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
700 disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
701 this, SLOT( SelectionIntoArgument() ) ) ;
702 globalSelection( GEOM_PREVIEW );
703 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
704 this, SLOT( SelectionIntoArgument() ) ) ;
710 //=================================================================================
711 // function : updateButtonState
712 // purpose : Update button state
713 //=================================================================================
714 void RepairGUI_GlueDlg::updateButtonState()
716 int anId = getConstructorId();
717 bool hasMainObj = !myObject->_is_nil();
719 buttonOk()->setEnabled( hasMainObj );
720 buttonApply()->setEnabled( hasMainObj );
724 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
725 SALOME_ListIO aSelList;
726 aSelMgr->selectedObjects(aSelList);
728 bool wasSelected = false;
729 SALOME_ListIteratorOfListIO it (aSelList);
732 bool wasDetected = myTmpObjs.size() ? true : false;
733 buttonOk()->setEnabled( hasMainObj && wasDetected && wasSelected );
734 buttonApply()->setEnabled( hasMainObj && wasDetected && wasSelected );
735 mySubShapesChk->setEnabled( hasMainObj && wasDetected );
736 myDetectBtn->setEnabled( hasMainObj );
737 if ( !hasMainObj || !wasDetected )
738 mySubShapesChk->setChecked( false );
742 //=================================================================================
743 // function : clearTemporary
744 // purpose : Remove temporary objects from engine
745 //=================================================================================
746 void RepairGUI_GlueDlg::clearTemporary()
748 ObjectList::iterator anIter;
749 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
750 getGeomEngine()->RemoveObject(*anIter);
755 //=================================================================================
756 // function : onTolerChanged
757 // purpose : Remove temporary objects from engine
758 //=================================================================================
759 void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ )
766 //=================================================================================
767 // function : onSubShapesChk
768 // purpose : Update selection mode
769 //=================================================================================
770 void RepairGUI_GlueDlg::onSubShapesChk()
772 if ( !mySubShapesChk->isChecked() )
778 //=================================================================================
779 // function : ClickOnCancel
780 // purpose : Remove temporary objects from engine and call method of base class
781 //=================================================================================
782 void RepairGUI_GlueDlg::ClickOnCancel()
785 GEOMBase_Skeleton::ClickOnCancel();