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 myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
302 if ( !CORBA::is_nil( myObject ) )
303 myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
308 //=================================================================================
309 // function : SetEditCurrentArgument()
311 //=================================================================================
312 void RepairGUI_GlueDlg::SetEditCurrentArgument()
314 const QObject* send = sender();
315 if ( send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1 ) {
316 myEditCurrentArgument->setFocus();
317 SelectionIntoArgument();
322 //=================================================================================
323 // function : LineEditReturnPressed()
325 //=================================================================================
326 void RepairGUI_GlueDlg::LineEditReturnPressed()
328 const QObject* send = sender();
329 if ( send == GroupPoints->LineEdit1 ) {
330 myEditCurrentArgument = GroupPoints->LineEdit1;
331 GEOMBase_Skeleton::LineEditReturnPressed();
333 else if ( send == GroupPoints2->LineEdit1 ) {
334 myEditCurrentArgument = GroupPoints2->LineEdit1;
335 GEOMBase_Skeleton::LineEditReturnPressed();
340 //=================================================================================
341 // function : ActivateThisDialog()
343 //=================================================================================
344 void RepairGUI_GlueDlg::ActivateThisDialog()
346 GEOMBase_Skeleton::ActivateThisDialog();
347 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
348 this, SLOT( SelectionIntoArgument() ) );
350 //GroupPoints->LineEdit1->setText("");
351 //GroupPoints2->LineEdit1->setText("");
352 //myObject = GEOM::GEOM_Object::_nil();
354 //myGeomGUI->SetState( 0 );
355 //globalSelection( GEOM_COMPOUND );
360 //=================================================================================
361 // function : enterEvent()
362 // purpose : Mouse enter onto the dialog to activate it
363 //=================================================================================
364 void RepairGUI_GlueDlg::enterEvent( QEvent* )
366 if ( !mainFrame()->GroupConstructors->isEnabled() )
367 ActivateThisDialog();
371 //=================================================================================
372 // function : createOperation
374 //=================================================================================
375 GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
377 return getGeomEngine()->GetIShapesOperations( getStudyId() );
380 //=================================================================================
381 // function : isValid
383 //=================================================================================
384 bool RepairGUI_GlueDlg::isValid( QString& msg )
388 switch ( getConstructorId() )
391 v = myTolEdt->value();
392 ok = myTolEdt->isValid( msg, !IsPreview() );
395 v = myTolEdt2->value();
396 ok = myTolEdt2->isValid( msg, !IsPreview() );
399 return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok;
402 //=================================================================================
403 // function : execute
405 //=================================================================================
406 bool RepairGUI_GlueDlg::execute( ObjectList& objects )
408 bool aResult = false;
411 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
412 switch ( getConstructorId() ) {
415 GEOM::GEOM_Object_var anObj = anOper->MakeGlueFaces( myObject, myTolEdt->value(), true );
416 aResult = !anObj->_is_nil();
417 if ( aResult && !IsPreview() )
419 QStringList aParameters;
420 aParameters << myTolEdt->text();
421 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
423 objects.push_back( anObj._retn() );
430 // if this method is used for displaying preview then we must detect glue faces only
431 ObjectList::iterator anIter;
432 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
433 objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
434 return myTmpObjs.size() ? true : false;
437 // Make glue face by list.
438 // Iterate through myTmpObjs and verifies where each object is currently selected or not.
439 QMap<QString, char> selected;
441 // Get names of selected objects
442 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
443 SALOME_ListIO aSelList;
444 aSelMgr->selectedObjects(aSelList);
446 SALOME_ListIteratorOfListIO it (aSelList);
447 for (; it.More(); it.Next())
448 selected.insert(it.Value()->getName(), 0);
450 // Iterate through result and select objects with names from selection
451 // ObjectList toRemoveFromEnggine;
453 ObjectList::iterator anIter;
454 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) {
455 if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
456 toGlue.push_back( *anIter );
460 GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
461 aListForGlue->length( toGlue.size() );
462 ObjectList::iterator anIter3 = toGlue.begin();
463 for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
464 aListForGlue[ i ] = *anIter3;
465 GEOM::GEOM_Object_var anObj = anOper->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true );
467 aResult = !anObj->_is_nil();
473 QStringList aParameters;
474 aParameters << myTolEdt2->text();
475 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
477 objects.push_back( anObj._retn() );
480 // Remove from engine useless objects
492 //=================================================================================
493 // function : restoreSubShapes
495 //=================================================================================
496 void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
497 SALOMEDS::SObject_ptr theSObject )
499 if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
500 GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
501 if ( getConstructorId() == 0 ) // MakeGlueFaces
502 aFindMethod = GEOM::FSM_GetInPlaceByHistory;
504 // empty list of arguments means that all arguments should be restored
505 getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
506 aFindMethod, /*theInheritFirstArg=*/true,
507 mainFrame()->CheckBoxAddPrefix->isChecked() );
511 //================================================================
512 // Function : clearShapeBufferLocal
514 //================================================================
515 void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
517 if ( CORBA::is_nil( theObj ) )
520 CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj );
521 TCollection_AsciiString asciiIOR( (char *)( IOR.in() ) );
522 myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
524 if ( !getStudy() || !( getStudy()->studyDS() ) )
527 _PTR(Study) aStudy = getStudy()->studyDS();
528 _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR.in() ) ) );
532 _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
533 for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
534 _PTR(GenericAttribute) anAttr;
535 if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
536 _PTR(AttributeIOR) anIOR ( anAttr );
537 TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
538 myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
543 //================================================================
544 // Function : onAccept
545 // Purpose : This method should be called from dialog's slots onOk() and onApply()
546 // It perfroms user input validation, then it
547 // performs a proper operation and manages transactions, etc.
548 //================================================================
549 bool RepairGUI_GlueDlg::onAcceptLocal()
551 if ( !getStudy() || !( getStudy()->studyDS() ) )
554 _PTR(Study) aStudy = getStudy()->studyDS();
556 bool aLocked = aStudy->GetProperties()->IsLocked();
558 MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
559 SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "WRN_STUDY_LOCKED" ), tr( "BUT_OK" ) );
564 if ( !isValid( msg ) ) {
569 erasePreview( false );
572 if ( openCommand() ) {
573 SUIT_OverrideCursor wc;
575 myGeomGUI->getApp()->putInfo( "" );
578 if ( !execute( objects ) ) {
584 const int nbObjs = objects.size();
585 for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
586 QString aName = getNewObjectName();
588 if ( aName.isEmpty() )
589 aName = getPrefix( *it );
590 aName = GEOMBase::GetDefaultName( aName );
593 // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
594 if ( aName.isEmpty() )
595 aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
597 addInStudy( *it, aName.toLatin1().data() );
598 display( *it, false );
604 myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") );
610 // JFA 28.12.2004 BEGIN // To enable warnings
611 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
612 if ( !CORBA::is_nil(anOper) && !anOper->IsDone() ) {
614 QString msgw = QObject::tr( anOper->GetErrorCode() );
615 SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
617 // JFA 28.12.2004 END
621 catch( const SALOME::SALOME_Exception& e ) {
622 SalomeApp_Tools::QtCatchCorbaException( e );
634 //=================================================================================
635 // function : onDetect
637 //=================================================================================
638 void RepairGUI_GlueDlg::onDetect()
642 if ( !isValid( msg ) ) {
647 buttonOk()->setEnabled( false );
648 buttonApply()->setEnabled( false );
649 globalSelection( GEOM_ALLSHAPES );
651 GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
652 GEOM::ListOfGO_var aList = anOper->GetGlueFaces( myObject, myTolEdt2->value() );
654 for ( int i = 0, n = aList->length(); i < n; i++ )
655 myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
657 if ( myTmpObjs.size() > 0 ) {
658 msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
659 mySubShapesChk->setChecked( true );
662 msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
665 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
666 this, SLOT( SelectionIntoArgument() ) ) ;
667 SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, tr( "Close" ) );
672 //=================================================================================
673 // function : activateSelection
674 // purpose : Redisplay preview and Activate selection
675 //=================================================================================
676 void RepairGUI_GlueDlg::activateSelection()
678 erasePreview( false );
680 int anId = getConstructorId();
682 // Case of whole gluing
683 disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
684 this, SLOT( SelectionIntoArgument() ) );
686 globalSelection( GEOM_ALLSHAPES );
687 if ( myObject->_is_nil())
688 SelectionIntoArgument();
690 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
691 this, SLOT( SelectionIntoArgument() ) );
694 // Second case of gluing
695 if ( !mySubShapesChk->isChecked() )
696 globalSelection( GEOM_ALLSHAPES );
698 displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
699 disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
700 this, SLOT( SelectionIntoArgument() ) ) ;
701 globalSelection( GEOM_PREVIEW );
702 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
703 this, SLOT( SelectionIntoArgument() ) ) ;
709 //=================================================================================
710 // function : updateButtonState
711 // purpose : Update button state
712 //=================================================================================
713 void RepairGUI_GlueDlg::updateButtonState()
715 int anId = getConstructorId();
716 bool hasMainObj = !myObject->_is_nil();
718 buttonOk()->setEnabled( hasMainObj );
719 buttonApply()->setEnabled( hasMainObj );
723 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
724 SALOME_ListIO aSelList;
725 aSelMgr->selectedObjects(aSelList);
727 bool wasSelected = false;
728 SALOME_ListIteratorOfListIO it (aSelList);
731 bool wasDetected = myTmpObjs.size() ? true : false;
732 buttonOk()->setEnabled( hasMainObj && wasDetected && wasSelected );
733 buttonApply()->setEnabled( hasMainObj && wasDetected && wasSelected );
734 mySubShapesChk->setEnabled( hasMainObj && wasDetected );
735 myDetectBtn->setEnabled( hasMainObj );
736 if ( !hasMainObj || !wasDetected )
737 mySubShapesChk->setChecked( false );
741 //=================================================================================
742 // function : clearTemporary
743 // purpose : Remove temporary objects from engine
744 //=================================================================================
745 void RepairGUI_GlueDlg::clearTemporary()
747 ObjectList::iterator anIter;
748 for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
749 getGeomEngine()->RemoveObject(*anIter);
754 //=================================================================================
755 // function : onTolerChanged
756 // purpose : Remove temporary objects from engine
757 //=================================================================================
758 void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ )
765 //=================================================================================
766 // function : onSubShapesChk
767 // purpose : Update selection mode
768 //=================================================================================
769 void RepairGUI_GlueDlg::onSubShapesChk()
771 if ( !mySubShapesChk->isChecked() )
777 //=================================================================================
778 // function : ClickOnCancel
779 // purpose : Remove temporary objects from engine and call method of base class
780 //=================================================================================
781 void RepairGUI_GlueDlg::ClickOnCancel()
784 GEOMBase_Skeleton::ClickOnCancel();