2 // File : GeometryGUI_SubShapeDlg.cxx
4 // Author : Lucien PIGNOLONI
6 // Module : GeometryGUI
7 // Copyright : OPEN CASCADE
10 #include "GeometryGUI_SubShapeDlg.h"
12 #include "GeometryGUI.h"
13 #include "QAD_Application.h"
14 #include "QAD_Desktop.h"
15 #include "QAD_RightFrame.h"
16 #include "OCCViewer_Viewer3d.h"
17 #include "utilities.h"
19 #include <TopExp_Explorer.hxx>
21 #include <qbuttongroup.h>
22 #include <qcheckbox.h>
23 #include <qcombobox.h>
24 #include <qgroupbox.h>
26 #include <qlineedit.h>
27 #include <qpushbutton.h>
28 #include <qradiobutton.h>
32 #include <qwhatsthis.h>
37 #include <qmessagebox.h>
39 //=================================================================================
40 // class : GeometryGUI_SubShapeDlg()
41 // purpose : Constructs a GeometryGUI_SubShapeDlg which is a child of 'parent', with the
42 // name 'name' and widget flags set to 'f'.
43 // The dialog will by default be modeless, unless you set 'modal' to
44 // TRUE to construct a modal dialog.
45 //=================================================================================
46 GeometryGUI_SubShapeDlg::GeometryGUI_SubShapeDlg( QWidget* parent,
48 SALOME_Selection* Sel,
49 Handle (AIS_InteractiveContext) ic,
53 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
55 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_SUBSHAPE")));
56 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_SELECT")));
59 setName( "GeometryGUI_SUBSHAPE" );
61 setCaption( tr( "GEOM_SUBSHAPE_TITLE" ) );
62 setSizeGripEnabled( TRUE );
63 GeometryGUI_SubShapeDlgLayout = new QGridLayout( this );
64 GeometryGUI_SubShapeDlgLayout->setSpacing( 6 );
65 GeometryGUI_SubShapeDlgLayout->setMargin( 11 );
67 /***************************************************************/
68 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
69 GroupConstructors->setTitle( tr( "GEOM_SUB_SHAPE" ) );
70 GroupConstructors->setExclusive( TRUE );
71 GroupConstructors->setColumnLayout(0, Qt::Vertical );
72 GroupConstructors->layout()->setSpacing( 0 );
73 GroupConstructors->layout()->setMargin( 0 );
74 GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
75 GroupConstructorsLayout->setAlignment( Qt::AlignTop );
76 GroupConstructorsLayout->setSpacing( 6 );
77 GroupConstructorsLayout->setMargin( 11 );
78 Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
79 Constructor1->setText( tr( "" ) );
80 Constructor1->setPixmap( image0 );
81 Constructor1->setChecked( TRUE );
82 Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
83 Constructor1->setMinimumSize( QSize( 50, 0 ) );
84 GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
85 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
86 GroupConstructorsLayout->addItem( spacer, 0, 1 );
87 GeometryGUI_SubShapeDlgLayout->addWidget( GroupConstructors, 0, 0 );
89 /***************************************************************/
90 GroupButtons = new QGroupBox( this, "GroupButtons" );
91 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
92 GroupButtons->setTitle( tr( "" ) );
93 GroupButtons->setColumnLayout(0, Qt::Vertical );
94 GroupButtons->layout()->setSpacing( 0 );
95 GroupButtons->layout()->setMargin( 0 );
96 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
97 GroupButtonsLayout->setAlignment( Qt::AlignTop );
98 GroupButtonsLayout->setSpacing( 6 );
99 GroupButtonsLayout->setMargin( 11 );
100 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
101 buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
102 buttonCancel->setAutoDefault( TRUE );
103 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
104 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
105 buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
106 buttonApply->setAutoDefault( TRUE );
107 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
108 QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
109 GroupButtonsLayout->addItem( spacer_9, 0, 2 );
110 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
111 buttonOk->setText( tr( "GEOM_BUT_OK" ) );
112 buttonOk->setAutoDefault( TRUE );
113 buttonOk->setDefault( TRUE );
114 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
115 GeometryGUI_SubShapeDlgLayout->addWidget( GroupButtons, 2, 0 );
117 /***************************************************************/
118 GroupC1 = new QGroupBox( this, "GroupC1" );
119 GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
120 GroupC1->setMinimumSize( QSize( 0, 0 ) );
121 GroupC1->setFrameShape( QGroupBox::Box );
122 GroupC1->setFrameShadow( QGroupBox::Sunken );
123 GroupC1->setColumnLayout(0, Qt::Vertical );
124 GroupC1->layout()->setSpacing( 0 );
125 GroupC1->layout()->setMargin( 0 );
126 GroupC1Layout = new QGridLayout( GroupC1->layout() );
127 GroupC1Layout->setAlignment( Qt::AlignTop );
128 GroupC1Layout->setSpacing( 6 );
129 GroupC1Layout->setMargin( 11 );
130 TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
131 TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
132 TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
133 TextLabelC1A1->setFrameShape( QLabel::NoFrame );
134 TextLabelC1A1->setFrameShadow( QLabel::Plain );
135 GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
136 TextLabelComboBox1 = new QLabel( GroupC1, "TextLabelComboBox1" );
137 TextLabelComboBox1->setText( tr( "GEOM_SUBSHAPE_TYPE" ) );
138 GroupC1Layout->addMultiCellWidget( TextLabelComboBox1, 1, 1, 0, 1 );
139 ComboBox1 = new QComboBox( FALSE, GroupC1, "ComboBox1" );
140 ComboBox1->setMaxCount( 100 );
141 GroupC1Layout->addMultiCellWidget( ComboBox1, 1, 1, 2, 3 );
142 CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" );
143 CheckBox1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) );
144 CheckBox1->setChecked( FALSE );
145 GroupC1Layout->addMultiCellWidget( CheckBox1, 2, 2, 0, 1 );
146 LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
147 GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 );
148 SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
149 SelectButtonC1A1->setText( tr( "" ) );
150 SelectButtonC1A1->setPixmap( image1 );
151 SelectButtonC1A1->setToggleButton( FALSE );
152 SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) );
153 GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
154 GeometryGUI_SubShapeDlgLayout->addWidget( GroupC1, 1, 0 );
155 /***************************************************************/
157 /* Initialisations */
162 //=================================================================================
163 // function : ~GeometryGUI_SubShapeDlg()
164 // purpose : Destroys the object and frees any allocated resources
165 //=================================================================================
166 GeometryGUI_SubShapeDlg::~GeometryGUI_SubShapeDlg()
168 // no need to delete child widgets, Qt does it all for us
172 //=================================================================================
175 //=================================================================================
176 void GeometryGUI_SubShapeDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic )
180 myConstructorId = 0 ;
181 Constructor1->setChecked( TRUE );
182 myEditCurrentArgument = LineEditC1A1 ;
187 myUseLocalContext = false ;
188 myLocalContextId = -1;
191 myGeomGUI = GeometryGUI::GetGeometryGUI() ;
193 /* type for sub shape selection */
194 ComboBox1->insertItem("Compound");
195 ComboBox1->insertItem("Compsolid");
196 ComboBox1->insertItem("Solid");
197 ComboBox1->insertItem("Shell");
198 ComboBox1->insertItem("Face");
199 ComboBox1->insertItem("Wire");
200 ComboBox1->insertItem("Edge");
201 ComboBox1->insertItem("Vertex");
202 ComboBox1->insertItem("Shape");
205 myShapeType = ComboBox1->currentItem();
207 /* Select sub shapes mode not checked */
208 CheckBox1->setChecked( FALSE );
209 myOkSelectSubMode = CheckBox1->isChecked();
211 // TODO : previous selection into argument ?
213 /* Filter definitions */
214 Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "Geometry");
215 myGeom = GEOM::GEOM_Gen::_narrow(comp);
217 /* signals and slots connections */
218 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
219 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
220 connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
221 connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) );
223 connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
224 connect( CheckBox1, SIGNAL (stateChanged(int) ), this, SLOT( AllOrNotAll() ) ) ;
226 connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
228 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
229 connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
230 connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
232 connect( ComboBox1, SIGNAL( activated(int) ), this, SLOT( ComboTextChanged() ) );
234 /* Move widget on the botton right corner of main widget */
236 myGeomGUI->DefineDlgPosition( this, x, y ) ;
238 this->show() ; /* display Dialog */
243 //=================================================================================
244 // function : ConstructorsClicked()
245 // purpose : Radio button management
246 //=================================================================================
247 void GeometryGUI_SubShapeDlg::ConstructorsClicked(int constructorId)
252 //=================================================================================
253 // function : ClickOnOk()
255 //=================================================================================
256 void GeometryGUI_SubShapeDlg::ClickOnOk()
258 this->ClickOnApply() ;
260 /* User has aborted or not operation of explode all with many sub shapes */
261 if( this->myAbort == false )
262 this->ClickOnCancel() ;
264 this->myAbort = false ;
270 //=================================================================================
271 // function : ClickOnApply()
273 //=================================================================================
274 void GeometryGUI_SubShapeDlg::ClickOnApply()
276 myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
277 bool testResult = false ;
279 this->myAbort = false ; /* Not aborted by default */
281 switch(myConstructorId)
285 /* Explode all sub shapes */
286 if( myOkShape && !myOkSelectSubMode ) {
288 /* More than 30 subshapes : ask confirmation */
289 unsigned int nb = NumberOfSubShapes( myShape, myShapeType ) ;
291 const QString caption = tr("GEOM_CONFIRM") ;
292 const QString text = tr("GEOM_CONFIRM_INFO").arg(nb) ;
293 const QString button0 = tr("GEOM_BUT_EXPLODE") ;
294 const QString button1 = tr("GEOM_BUT_CANCEL") ;
296 if( QMessageBox::warning( this, caption, text, button0, button1 ) == 0 )
297 testResult = myGeomGUI->OnSubShapeGetAll( myShape, myShapeIOR, myShapeType ) ;
299 this->myAbort = true ; /* aborted */
302 testResult = myGeomGUI->OnSubShapeGetAll( myShape, myShapeIOR, myShapeType ) ;
305 /* explode only selected sub shapes */
306 else if( myOkShape && myOkSelectSubMode ) {
307 testResult = myGeomGUI->OnSubShapeGetSelected( myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext ) ;
310 myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ;
311 this->myAbort = true;
314 myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ;
316 /* Reset all arguments and local context to allow user a new selection ...*/
317 this->ResetStateOfDialog() ;
325 //=================================================================================
326 // function : ClickOnCancel()
328 //=================================================================================
329 void GeometryGUI_SubShapeDlg::ClickOnCancel()
331 disconnect( mySelection, 0, this, 0 );
332 myGeomGUI->ResetState() ;
334 if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
335 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
336 myIC = v3d->getAISContext();
337 if(myUseLocalContext) {
338 myIC->CloseLocalContext(myLocalContextId) ;
339 myGeomGUI->OnDisplayAll(true) ;
340 this->myUseLocalContext = false ;
348 //=================================================================================
349 // function : SelectionIntoArgument()
350 // purpose : Called when selection as changed or other case
351 // : used only by SelectButtonC1A1 (LineEditC1A1)
352 //=================================================================================
353 void GeometryGUI_SubShapeDlg::SelectionIntoArgument()
356 /* Reset all arguments and local context when selection as changed */
357 this->ResetStateOfDialog() ;
359 QString aString = ""; /* future name of selection */
361 int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
364 LineEditC1A1->setText("") ;
371 Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
373 if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
376 if( !IO->hasEntry() ) {
377 myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ;
381 if ( !S.IsNull() && S.ShapeType() != TopAbs_VERTEX )
383 if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) )
385 Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO );
386 myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */
387 LineEditC1A1->setText(aString) ;
393 SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
394 SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
395 SALOMEDS::GenericAttribute_var anAttr;
396 SALOMEDS::AttributeIOR_var anIOR;
397 if ( !obj->_is_nil() )
399 if (obj->FindAttribute(anAttr, "AttributeIOR"))
401 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
402 myShapeIOR = anIOR->Value();
405 LineEditC1A1->setText(aString) ;
410 int SelectedShapeType = ComboBox1->currentItem();
411 int count = ComboBox1->count();
412 if ( myWithShape ) count = count - 1;
415 while ( i <= myShape.ShapeType() ) {
416 ComboBox1->removeItem(0);
420 if (myShape.ShapeType()==TopAbs_COMPOUND)
422 if (myWithShape == false) {
423 ComboBox1->insertItem("Shape");
429 if (myWithShape == true) {
430 ComboBox1->removeItem( ComboBox1->count() -1 );
435 int count1 = ComboBox1->count();
436 if ( myWithShape ) count1 = count1 - 1;
438 if ( SelectedShapeType > myShape.ShapeType() ) {
439 if ( SelectedShapeType == 8 ) {
440 if ( myShape.ShapeType() != TopAbs_COMPOUND ) {
441 ComboBox1->setCurrentItem(0);
442 myShapeType = 8 - count1;
445 ComboBox1->setCurrentItem( count1 - count + SelectedShapeType );
446 myShapeType = 8 - count1 + ComboBox1->currentItem();
449 ComboBox1->setCurrentItem(0);
450 myShapeType = 8 - count1;
456 //=================================================================================
457 // function : SetEditCurrentArgument()
459 //=================================================================================
460 void GeometryGUI_SubShapeDlg::SetEditCurrentArgument()
462 QPushButton* send = (QPushButton*)sender();
463 switch (myConstructorId)
465 case 0: /* default constructor */
467 if(send == SelectButtonC1A1) {
468 LineEditC1A1->setFocus() ;
469 myEditCurrentArgument = LineEditC1A1;
470 SelectionIntoArgument() ;
480 //=================================================================================
481 // function : LineEditReturnPressed()
483 //=================================================================================
484 void GeometryGUI_SubShapeDlg::LineEditReturnPressed()
486 QLineEdit* send = (QLineEdit*)sender();
487 if( send == LineEditC1A1 )
488 myEditCurrentArgument = LineEditC1A1 ;
492 /* User name of object input management */
493 /* If successfull the selection is changed and signal emitted... */
494 /* so SelectionIntoArgument() is automatically called. */
495 const QString objectUserName = myEditCurrentArgument->text() ;
496 QWidget* thisWidget = (QWidget*)this ;
497 if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
498 myEditCurrentArgument->setText( objectUserName ) ;
504 //=================================================================================
505 // function : DeactivateActiveDialog()
507 //=================================================================================
508 void GeometryGUI_SubShapeDlg::DeactivateActiveDialog()
510 /* Check if active */
511 if ( GroupConstructors->isEnabled() ) {
513 this->ResetStateOfDialog() ;
515 disconnect( mySelection, 0, this, 0 );
516 GroupConstructors->setEnabled(false) ;
517 GroupC1->setEnabled(false) ;
518 GroupButtons->setEnabled(false) ;
519 myGeomGUI->ResetState() ;
520 myGeomGUI->SetActiveDialogBox(0) ;
521 myGeomGUI->OnDisplayAll(true) ;
527 //=================================================================================
528 // function : ActivateThisDialog()
530 //=================================================================================
531 void GeometryGUI_SubShapeDlg::ActivateThisDialog()
533 /* Emit a signal to deactivate other active dialog */
534 myGeomGUI->EmitSignalDeactivateDialog() ;
535 GroupConstructors->setEnabled(true) ;
536 GroupC1->setEnabled(true) ;
537 GroupButtons->setEnabled(true) ;
538 connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
539 myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
544 //=================================================================================
545 // function : enterEvent()
547 //=================================================================================
548 void GeometryGUI_SubShapeDlg::enterEvent(QEvent* e)
550 if ( GroupConstructors->isEnabled() )
552 ActivateThisDialog() ;
557 //=================================================================================
558 // function : closeEvent()
560 //=================================================================================
561 void GeometryGUI_SubShapeDlg::closeEvent( QCloseEvent* e )
563 /* same than click on cancel button */
564 this->ClickOnCancel() ;
569 //=================================================================================
570 // function : AllOrNotAll()
571 // purpose : Allow user selection of all or only selected sub shapes
572 // : Called when 'CheckBox1' state change
573 //=================================================================================
574 void GeometryGUI_SubShapeDlg::AllOrNotAll()
577 /* No sub shape selection if main shape not selected */
578 if( !this->myOkShape ) {
579 ResetStateOfDialog() ;
580 myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ;
584 if (myShapeType ==TopAbs_SHAPE && myShape.ShapeType()==TopAbs_COMPOUND)
586 /* Select sub shapes mode not checked */
587 myOkSelectSubMode = false ;
588 CheckBox1->setChecked( FALSE );
589 //no meaning to allow user selection for type = shape
590 //TODO - add another message
591 //myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ;
595 myOkSelectSubMode = CheckBox1->isChecked() ;
597 if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
598 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
599 myIC = v3d->getAISContext();
600 if( this->myUseLocalContext ) {
601 myIC->CloseLocalContext(myLocalContextId) ;
602 this->myUseLocalContext = false ;
603 myGeomGUI->OnDisplayAll(true) ;
606 myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ;
610 if( myOkShape && myOkSelectSubMode ) {
611 /* local context is defined into the method */
612 myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ;
613 myUseLocalContext = true ;
614 myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ;
620 //=================================================================================
621 // function : ResetStateOfDialog()
622 // purpose : Completely reset the state of method including local context
623 //=================================================================================
624 void GeometryGUI_SubShapeDlg::ResetStateOfDialog()
626 /* To leave current selection if explode all as been aborted by user */
627 if( this->myAbort == true ) {
628 this->myOkShape = false ;
629 this->myEditCurrentArgument->setText("") ;
632 ; /* nothing to do : keep selection argument */
635 int SelectedShapeType = ComboBox1->currentItem();
636 int count = ComboBox1->count();
637 if ( myWithShape ) count = count - 1;
638 /* type for sub shape selection */
640 ComboBox1->insertItem("Compound");
641 ComboBox1->insertItem("Compsolid");
642 ComboBox1->insertItem("Solid");
643 ComboBox1->insertItem("Shell");
644 ComboBox1->insertItem("Face");
645 ComboBox1->insertItem("Wire");
646 ComboBox1->insertItem("Edge");
647 ComboBox1->insertItem("Vertex");
648 ComboBox1->insertItem("Shape");
649 this->myWithShape=true;
650 ComboBox1->setCurrentItem( 8 - count + SelectedShapeType );
653 /* unpress buttons : due to abort box*/
654 this->buttonApply->setDown(FALSE) ;
655 this->buttonOk->setDown(FALSE) ;
657 /* Select sub shapes mode not checked */
658 this->myOkSelectSubMode = false ;
659 this->CheckBox1->setChecked( FALSE );
661 /* Close its local contact if opened */
662 if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
663 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
664 myIC = v3d->getAISContext();
665 if( this->myUseLocalContext ) {
666 myIC->CloseLocalContext(this->myLocalContextId) ;
667 this->myUseLocalContext = false ;
668 myGeomGUI->OnDisplayAll(true) ;
676 //=================================================================================
677 // function : ComboTextChanged()
679 //=================================================================================
680 void GeometryGUI_SubShapeDlg::ComboTextChanged()
683 this->myShapeType = ComboBox1->currentItem() + myShape.ShapeType() + 1;
685 this->myShapeType = ComboBox1->currentItem();
687 /* Select sub shapes mode not checked */
688 CheckBox1->setChecked( FALSE );
689 myOkSelectSubMode = FALSE ;
691 if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
692 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
693 myIC = v3d->getAISContext();
694 if( this->myUseLocalContext ) {
695 myIC->CloseLocalContext(myLocalContextId) ;
696 this->myUseLocalContext = false ;
697 myGeomGUI->OnDisplayAll(true) ;
704 //=================================================================================
705 // function : NumberOfSubShapes()
707 //=================================================================================
708 unsigned int GeometryGUI_SubShapeDlg::NumberOfSubShapes( const TopoDS_Shape& S, const int shapeType )
713 unsigned int index = 0 ;
714 TopExp_Explorer Exp( S, TopAbs_ShapeEnum(shapeType) );
715 TopTools_MapOfShape M;
716 while ( Exp.More() ) {
717 if ( M.Add(Exp.Current()) )