1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : RepairGUI_SuppressHoleDlg.cxx
25 // Author : Lucien PIGNOLONI
30 #include "RepairGUI_SuppressHoleDlg.h"
32 #include "DisplayGUI.h"
34 #include "QAD_RightFrame.h"
35 #include "OCCViewer_Viewer3d.h"
37 #include <TopExp_Explorer.hxx>
39 //=================================================================================
40 // class : RepairGUI_SuppressHoleDlg()
41 // purpose : Constructs a RepairGUI_SuppressHoleDlg 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 RepairGUI_SuppressHoleDlg::RepairGUI_SuppressHoleDlg(QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, bool modal, WFlags fl)
47 :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
50 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_HOLE")));
51 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_HOLE_FACE_SHELL")));
52 QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
54 setCaption(tr("GEOM_SUPPRESSHOLE_TITLE"));
56 /***************************************************************/
57 GroupConstructors->setTitle(tr(""));
58 RadioButton1->setPixmap(image0);
59 RadioButton2->setPixmap(image1);
60 RadioButton3->close(TRUE);
62 Group1 = new DlgRef_1Sel3Check_QTD(this, "Group1");
63 Group1->GroupBox1->setTitle(tr(""));
64 Group1->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
65 Group1->CheckButton1->setText(tr("GEOM_SUPPRESSHOLE_SELECTFACE"));
66 Group1->CheckButton2->setText(tr("GEOM_SUPPRESSHOLE_SELECTWIRE"));
67 Group1->CheckButton3->setText(tr("GEOM_SUPPRESSHOLE_SELECTFACE_END"));
68 Group1->PushButton1->setPixmap(image2);
70 Group2 = new DlgRef_1Sel1Check_QTD(this, "Group2");
71 Group2->GroupBox1->setTitle(tr(""));
72 Group2->TextLabel1->setText(tr("GEOM_SUPPRESSHOLE_FACE_SHELL"));
73 Group2->CheckButton1->setText(tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE"));
74 Group2->PushButton1->setPixmap(image2);
76 Layout1->addWidget(Group1, 1, 0);
77 Layout1->addWidget(Group2, 1, 0);
78 /***************************************************************/
81 myRepairGUI = theRepairGUI;
86 //=================================================================================
87 // function : ~RepairGUI_SuppressHoleDlg()
88 // purpose : Destroys the object and frees any allocated resources
89 //=================================================================================
90 RepairGUI_SuppressHoleDlg::~RepairGUI_SuppressHoleDlg()
92 // no need to delete child widgets, Qt does it all for us
96 //=================================================================================
99 //=================================================================================
100 void RepairGUI_SuppressHoleDlg::Init(Handle (AIS_InteractiveContext) ic)
104 myEditCurrentArgument = Group1->LineEdit1;
107 myUseLocalContext = myOkShape = myOkSelectFace = false;
108 myLocalContextId = -1;
110 myListOfIdFace = new GEOM::GEOM_Shape::ListOfSubShapeID;
111 myListOfIdWire = new GEOM::GEOM_Shape::ListOfSubShapeID;
112 myListOfIdEndFace = new GEOM::GEOM_Shape::ListOfSubShapeID;
114 myListOfIdFace->length(0);
115 myListOfIdWire->length(0);
116 myListOfIdEndFace->length(0);
118 /* signals and slots connections */
119 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
120 connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
121 connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
123 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
124 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
125 connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
127 connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
128 connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
129 connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
130 connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
132 connect(Group1->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserFaceSelection()));
133 connect(Group1->CheckButton2, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserWireSelection()));
134 connect(Group1->CheckButton3, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserEndFaceSelection()));
135 connect(Group2->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserWiresOnFaceShellSelection()));
137 connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
139 /* displays Dialog */
148 //=================================================================================
149 // function : ConstructorsClicked()
150 // purpose : Radio button management
151 //=================================================================================
152 void RepairGUI_SuppressHoleDlg::ConstructorsClicked(int constructorId)
154 myConstructorId = constructorId;
155 disconnect(mySelection, 0, this, 0);
158 if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) {
159 myIC->CloseLocalContext(myLocalContextId);
160 DisplayGUI* myDisplayGUI = new DisplayGUI();
161 myDisplayGUI->OnDisplayAll(true);
162 myUseLocalContext = false;
165 switch (constructorId)
173 myEditCurrentArgument = Group1->LineEdit1;
174 Group1->LineEdit1->setText("");
175 connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
177 myOkSelectFace = false;
178 this->ResetPartial();
187 myEditCurrentArgument = Group2->LineEdit1;
188 Group2->LineEdit1->setText("");
190 this->ResetPartial();
191 connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
192 this->ResetPartial();
200 //=================================================================================
201 // function : ClickOnOk()
202 // purpose : Same than click on apply but close this dialog.
203 //=================================================================================
204 void RepairGUI_SuppressHoleDlg::ClickOnOk()
206 this->ClickOnApply();
207 this->ClickOnCancel();
212 //=================================================================================
213 // function : ClickOnApply()
215 //=================================================================================
216 void RepairGUI_SuppressHoleDlg::ClickOnApply()
218 QAD_Application::getDesktop()->putInfo(tr(""));
219 bool testResult = false;
224 switch (myConstructorId)
226 case 0: /* default constructor */
231 if(Group1->CheckButton2->isChecked()) {
232 if(!Group1->CheckButton3->isChecked()) {
233 /* Call method to get sub shape selection of GEOM::WIRE */
234 bool aTest = this->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext);
236 /* Display all objects so that next method using ic can memorize them */
237 DisplayGUI* myDisplayGUI = new DisplayGUI();
238 myDisplayGUI->OnDisplayAll(true);
240 if(!aTest || myListOfIdWire->length() != 1) {
241 Group1->CheckButton2->setChecked(FALSE);
242 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
245 myListOfIdEndFace->length(0); /* no end face */
246 QApplication::setOverrideCursor(Qt::waitCursor);
247 testResult = myRepairGUI->OnSuppressHole(myShapeIOR, myListOfIdFace, myListOfIdWire, myListOfIdEndFace);
248 QApplication::restoreOverrideCursor();
251 else { /* Group1->CheckButton3->isChecked() */
253 /* Call method to get sub shape selection of END GEOM::FACE */
254 bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdEndFace, myLocalContextId, myUseLocalContext);
256 /* Display all objects so that next method using ic can memorize them */
257 DisplayGUI* myDisplayGUI = new DisplayGUI();
258 myDisplayGUI->OnDisplayAll(true);
260 if(!aTest || myListOfIdEndFace->length() != 1) {
261 Group1->CheckButton3->setChecked(FALSE);
262 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
265 QApplication::setOverrideCursor(Qt::waitCursor);
266 testResult = myRepairGUI->OnSuppressHole(myShapeIOR, myListOfIdFace, myListOfIdWire, myListOfIdEndFace);
267 QApplication::restoreOverrideCursor();
273 case 1: /* second constructor */
275 if(Group2->CheckButton1->isChecked()) {
276 /* Call method to get sub shape selection of one or more GEOM::WIRE(s) on a face or a shell */
277 bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext);
279 /* Display all objects so that next method using ic can memorize them */
280 DisplayGUI* myDisplayGUI = new DisplayGUI();
281 myDisplayGUI->OnDisplayAll(true);
283 if(!aTest || myListOfIdWire->length() < 1) {
284 Group2->CheckButton1->setChecked(FALSE);
285 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
288 QApplication::setOverrideCursor(Qt::waitCursor);
289 testResult = myRepairGUI->OnSuppressHolesInFaceOrShell(myShapeIOR, myListOfIdWire);
290 QApplication::restoreOverrideCursor();
299 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
301 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
303 /* Reset arguments to allow a new selection */
304 this->ResetStateOfDialog();
309 //=================================================================================
310 // function : ClickOnCancel()
312 //=================================================================================
313 void RepairGUI_SuppressHoleDlg::ClickOnCancel()
315 this->ResetStateOfDialog();
316 GEOMBase_Skeleton::ClickOnCancel();
321 //=================================================================================
322 // function : SelectionIntoArgument()
323 // purpose : Called when selection as changed or other case
324 // : used only by SelectButtonC1A1 and SelectButtonC2A1
325 //=================================================================================
326 void RepairGUI_SuppressHoleDlg::SelectionIntoArgument()
328 myEditCurrentArgument->setText("");
329 this->ResetStateOfDialog();
330 QString aString = ""; /* name of selection */
332 int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
338 Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
340 if(!myGeomBase->GetTopoFromSelection(mySelection, S))
343 if(S.IsNull() || S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE)
346 /* Test the exact type of topology to suppress faces into. */
347 /* For the second constructor a face or shell selection is needed */
348 if(myConstructorId == 0 || (myConstructorId == 1 && (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL))) {
349 if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) {
350 Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO);
352 /* The Geom IOR string of selection */
353 myShapeIOR = GIObject->getIOR();
354 myEditCurrentArgument->setText(aString);
361 SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
362 SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry());
363 SALOMEDS::GenericAttribute_var anAttr;
364 SALOMEDS::AttributeIOR_var anIOR;
365 if(!obj->_is_nil()) {
366 if(obj->FindAttribute(anAttr, "AttributeIOR")) {
367 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
368 myShapeIOR = anIOR->Value();
371 myEditCurrentArgument->setText(aString);
382 //=================================================================================
383 // function : SetEditCurrentArgument()
385 //=================================================================================
386 void RepairGUI_SuppressHoleDlg::SetEditCurrentArgument()
388 QPushButton* send = (QPushButton*)sender();
390 if(send == Group1->PushButton1) {
391 Group1->LineEdit1->setFocus();
392 myEditCurrentArgument = Group1->LineEdit1;
394 else if(send == Group2->PushButton1) {
395 Group2->LineEdit1->setFocus();
396 myEditCurrentArgument = Group2->LineEdit1;
398 this->SelectionIntoArgument();
403 //=================================================================================
404 // function : LineEditReturnPressed()
406 //=================================================================================
407 void RepairGUI_SuppressHoleDlg::LineEditReturnPressed()
409 QLineEdit* send = (QLineEdit*)sender();
410 if(send == Group1->LineEdit1)
411 myEditCurrentArgument = Group1->LineEdit1;
412 else if (send == Group2->LineEdit1)
413 myEditCurrentArgument = Group2->LineEdit1;
417 GEOMBase_Skeleton::LineEditReturnPressed();
422 //=================================================================================
423 // function : DeactivateActiveDialog()
425 //=================================================================================
426 void RepairGUI_SuppressHoleDlg::DeactivateActiveDialog()
428 this->ResetStateOfDialog();
429 GEOMBase_Skeleton::DeactivateActiveDialog();
434 //=================================================================================
435 // function : ActivateThisDialog()
437 //=================================================================================
438 void RepairGUI_SuppressHoleDlg::ActivateThisDialog()
440 GEOMBase_Skeleton::ActivateThisDialog();
441 connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
446 //=================================================================================
447 // function : enterEvent()
448 // purpose : Mouse enter onto the dialog to activate it
449 //=================================================================================
450 void RepairGUI_SuppressHoleDlg::enterEvent(QEvent* e)
452 if(GroupConstructors->isEnabled())
454 this->ActivateThisDialog();
459 //=================================================================================
460 // function : closeEvent()
462 //=================================================================================
463 void RepairGUI_SuppressHoleDlg::closeEvent(QCloseEvent* e)
465 /* same than click on cancel button */
466 this->ClickOnCancel();
471 //=================================================================================
472 // function : ActivateUserFaceSelection()
473 // purpose : Called when CheckBox1 state has changed. (Face selection is ckecked)
474 // : Be careful user must first select a face then a wire !
475 //=================================================================================
476 void RepairGUI_SuppressHoleDlg::ActivateUserFaceSelection()
478 if(!this->myOkShape) {
479 this->ResetStateOfDialog();
480 QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT"));
484 if(Group1->CheckButton1->isChecked()) {
485 /* local context is opened into the method : Prepare GEOM::FACE sub selection */
486 DisplayGUI* myDisplayGUI = new DisplayGUI();
487 myDisplayGUI->PrepareSubShapeSelection(int(TopAbs_FACE), myLocalContextId);
488 myUseLocalContext = true;
489 QAD_Application::getDesktop()->putInfo(tr("GEOM_SUPPRESSHOLE_SELECTFACE"));
492 this->ResetPartial();
498 //=================================================================================
499 // function : ActivateUserWireSelection()
500 // purpose : Called when CheckBox2 state has changed. (Wire selection is ckecked)
501 // : Be careful user must first select a face then a wire !
502 //=================================================================================
503 void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection()
507 this->ResetStateOfDialog();
508 QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT"));
512 if(Group1->CheckButton1->isChecked()) {
513 /* Get sub shape selection GEOM::FACE : local context is closed */
514 bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdFace, myLocalContextId, myUseLocalContext);
516 /* Display all objects so that next method using ic can memorize them */
517 DisplayGUI* myDisplayGUI = new DisplayGUI();
518 myDisplayGUI->OnDisplayAll(true);
519 if(!aTest || myListOfIdFace->length() != 1) {
520 Group1->CheckButton1->setChecked(FALSE);
521 myOkSelectFace = false;
522 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
525 myOkSelectFace = true;
528 this->ResetPartial();
533 if(Group1->CheckButton2->isChecked()) {
534 /* Get the face selection */
535 myFace = FaceFromList(myShape, myListOfIdFace);
536 /* Local context is opened into the method : Prepare GEOM::WIRE sub selection into a face */
537 DisplayGUI* myDisplayGUI = new DisplayGUI();
538 myDisplayGUI->PrepareSubShapeSelectionArgumentShape(myFace, int(TopAbs_WIRE), myLocalContextId);
539 myUseLocalContext = true;
540 QAD_Application::getDesktop()->putInfo(tr("GEOM_SUPPRESSHOLE_SELECTWIRE"));
543 this->ResetPartial();
549 //=================================================================================
550 // function : ActivateUserlEndFaceSelection()
551 // purpose : Called when CheckBox3 state has changed. ( Optional End Face selection )
552 // : Be careful user must first select a face then a wire then this optional end face !
553 //=================================================================================
554 void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection()
558 this->ResetStateOfDialog();
559 QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT"));
563 if(Group1->CheckButton2->isChecked()) {
564 /* Call method to get sub shape selection for the GEOM::WIRE into myFace : local context is closed */
565 bool aTest = this->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext);
567 /* Display all objects so that next method using ic can memorize them */
568 DisplayGUI* myDisplayGUI = new DisplayGUI();
569 myDisplayGUI->OnDisplayAll(true);
571 if(!aTest || myListOfIdWire->length() != 1) {
572 Group1->CheckButton2->setChecked(FALSE);
573 Group1->CheckButton3->setChecked(FALSE);
574 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
579 this->ResetPartial();
584 if(Group1->CheckButton3->isChecked()) {
585 /* Local context is opened into the method : prepare GEOM::FACE(end) into myShape sub selection */
586 DisplayGUI* myDisplayGUI = new DisplayGUI();
587 myDisplayGUI->PrepareSubShapeSelectionArgumentShape(myShape, int(TopAbs_FACE), myLocalContextId);
588 myUseLocalContext = true;
589 QAD_Application::getDesktop()->putInfo(tr("GEOM_SUPPRESSHOLE_SELECTFACE_END"));
592 this->ResetPartial();
597 //=================================================================================
598 // function : ActivateUserWiresOnFaceShellSelection()
599 // purpose : Called when CheckBoxC2_1 state has changed.
600 // : Only for second constructor !
601 // : Prepare selection for wire(s) on main object that is a face or a shell
602 //=================================================================================
603 void RepairGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection()
607 this->ResetStateOfDialog();
608 QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT"));
612 if(Group2->CheckButton1->isChecked()) {
613 /* Local context is opened to prepare GEOM::WIRE(S) selection into 'myShape' that is a (main) face */
614 DisplayGUI* myDisplayGUI = new DisplayGUI();
615 myDisplayGUI->PrepareSubShapeSelectionArgumentShape(myShape, int(TopAbs_WIRE), myLocalContextId);
616 myUseLocalContext = true;
617 QAD_Application::getDesktop()->putInfo(tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE"));
620 this->ResetPartial();
625 //=================================================================================
626 // function : FaceFromList()
627 // purpose : Return the face (selected by user) that is a sub shape of 'aShape'
628 // : and which unique index is in 'ListOfSub'.
629 // : This allows opening a local context with this face loaded.
630 // : See : myGeomBase->PrepareSubShapeSelectionArgumentShape(...)
631 //=================================================================================
632 TopoDS_Shape RepairGUI_SuppressHoleDlg::FaceFromList(const TopoDS_Shape& aShape,
633 const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub)
637 if(ListOfSub.length() != 1 || aShape.IsNull())
640 int i = ListOfSub[0];
643 for(exp.Init(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
645 return exp.Current();
652 //=================================================================================
653 // function : ResetStateOfDialog()
654 // purpose : Completely reset the state of method including local context
655 //=================================================================================
656 void RepairGUI_SuppressHoleDlg::ResetStateOfDialog()
659 myEditCurrentArgument->setText("");
660 QApplication::restoreOverrideCursor();
662 /* Partial reset and more ...*/
663 this->ResetPartial();
669 //=================================================================================
670 // function : ResetPartial()
671 // purpose : Partially reset to keep only main selection
672 //=================================================================================
673 void RepairGUI_SuppressHoleDlg::ResetPartial()
675 /* Select sub shape modes not checked */
676 myOkSelectFace = false ;
677 Group1->CheckButton1->setChecked(FALSE);
678 Group1->CheckButton2->setChecked(FALSE);
679 Group1->CheckButton3->setChecked(FALSE);
680 Group2->CheckButton1->setChecked(FALSE);
682 myListOfIdFace->length(0);
683 myListOfIdWire->length(0);
684 myListOfIdEndFace->length(0);
686 /* Close its local contact if opened */
687 if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) {
688 myIC->CloseLocalContext(myLocalContextId);
689 myUseLocalContext = false;
690 DisplayGUI* myDisplayGUI = new DisplayGUI();
691 myDisplayGUI->OnDisplayAll(true);
697 //=====================================================================================
698 // function : GetIndexSubShapeSelected()
699 // purpose : Define a ListOfID of sub shapes selected in ShapeTopo with SubShapeType
700 // : Method used by Dialogs
701 //=====================================================================================
702 bool RepairGUI_SuppressHoleDlg::GetIndexSubShapeSelected(const TopoDS_Shape& ShapeTopo, const int SubShapeType, GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID, Standard_Integer& aLocalContextId, bool& myUseLocalContext)
704 //* Test the type of viewer */
705 if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
708 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
709 Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
712 int nbSelected = ic->NbSelected();
713 ListOfID.length(nbSelected);
715 //***************** DEFINE INDEX OF EACH SELECTION *********************//
717 ic->InitSelected(); /* to restart */
718 while(ic->MoreSelected()) {
719 /* Find index of sub shape into main shape */
720 TopExp_Explorer Exp (ShapeTopo, TopAbs_ShapeEnum(SubShapeType));
724 if((Exp.Current()).IsSame(ic->SelectedShape())) {
732 /* Manage local context from DialogBox */
733 ic->CloseLocalContext(aLocalContextId);
734 myUseLocalContext = false;
741 //***************** END *********************//
743 /* Manage local context from DialogBox */
744 ic->CloseLocalContext(aLocalContextId);
745 myUseLocalContext = false;