1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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 GEOMGUI : GUI for Geometry component
24 // File : GroupGUI_GroupDlg.cxx
25 // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
27 #include "GroupGUI_GroupDlg.h"
31 #include <GeometryGUI.h>
32 #include <GEOM_Displayer.h>
34 #include <SalomeApp_Application.h>
35 #include <SalomeApp_Study.h>
36 #include <SalomeApp_Tools.h>
38 #include <LightApp_SelectionMgr.h>
39 #include "utilities.h"
41 #include <OCCViewer_ViewModel.h>
42 #include <OCCViewer_ViewManager.h>
43 #include <SVTK_ViewModel.h>
44 #include <SALOME_Prs.h>
45 #include <SALOME_ListIO.hxx>
47 #include <SUIT_Desktop.h>
48 #include <SUIT_MessageBox.h>
49 #include <SUIT_OverrideCursor.h>
50 #include <SUIT_ResourceMgr.h>
51 #include <SUIT_Session.h>
52 #include <SUIT_ViewWindow.h>
53 #include <SUIT_ViewManager.h>
56 #include <QListWidget>
60 #include <AIS_ListOfInteractive.hxx>
61 #include <AIS_ListIteratorOfListOfInteractive.hxx>
64 #include <TopExp_Explorer.hxx>
65 #include <TopTools_IndexedMapOfShape.hxx>
66 #include <TColStd_IndexedMapOfInteger.hxx>
67 #include <TColStd_MapOfInteger.hxx>
68 #include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
70 #include <GEOMImpl_Types.hxx>
72 #define GROUP_IDLST_COLOR Qt::blue // Specific color for the IDs of subShapes in the dialog box
73 #define GROUP_NEWIDLST_COLOR Qt::red // Specific color for the new IDs of subShapes in the dialog box
75 enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 };
77 GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent)
78 : GEOMBase_Skeleton(theGeometryGUI, parent, false),
82 myIsHiddenMain(false),
85 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
87 QPixmap image0 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
88 QPixmap image1 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_EDGE")));
89 QPixmap image2 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_FACE")));
90 QPixmap image3 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_SOLID")));
91 QPixmap iconSelect (resMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
93 setWindowTitle(myMode == CreateGroup ? tr("CREATE_GROUP_TITLE") : tr("EDIT_GROUP_TITLE"));
95 // Shape type button group
96 mainFrame()->GroupConstructors->setEnabled(myMode == CreateGroup);
97 mainFrame()->GroupConstructors->setTitle(tr("SHAPE_TYPE"));
98 mainFrame()->RadioButton1->setIcon(image0);
99 mainFrame()->RadioButton2->setIcon(image1);
100 mainFrame()->RadioButton3->setIcon(image2);
101 mainFrame()->RadioButton4->setIcon(image3);
102 mainFrame()->RadioButton4->show();
105 mainFrame()->GroupBoxName->setTitle(tr("GROUP_NAME"));
107 // Main shape and sub-shapes
108 QGroupBox* GroupMedium = new QGroupBox(tr("MAIN_SUB_SHAPES"), centralWidget());
109 QGridLayout* aMedLayout = new QGridLayout(GroupMedium);
110 aMedLayout->setMargin(9);
111 aMedLayout->setSpacing(6);
113 QLabel* aMainLabel = new QLabel(tr("MAIN_SHAPE"), GroupMedium);
115 mySelBtn = new QPushButton(GroupMedium);
116 mySelBtn->setIcon(iconSelect);
117 mySelBtn->setEnabled(myMode == CreateGroup);
119 myMainName = new QLineEdit(GroupMedium);
120 myMainName->setReadOnly(true);
121 myMainName->setEnabled(myMode == CreateGroup);
123 myRestrictGroupBox = new QGroupBox(tr("SHAPE_SEL_RESTR"), GroupMedium);
124 myRestrictGroup = new QButtonGroup(myRestrictGroupBox);
125 QRadioButton* allSubs = new QRadioButton(tr("NO_RESTR") , myRestrictGroupBox);
126 QRadioButton* inPlaceSubs = new QRadioButton(tr("GEOM_PARTS_OF_SHAPE2"), myRestrictGroupBox);
127 QRadioButton* shape2Subs = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2") , myRestrictGroupBox);
128 QGridLayout* aRestrictLayout = new QGridLayout(myRestrictGroupBox);
130 QLabel* aSecondLabel = new QLabel(tr("SECOND_SHAPE"), myRestrictGroupBox);
131 mySelBtn2 = new QPushButton(myRestrictGroupBox);
132 mySelBtn2->setIcon(iconSelect);
133 mySelBtn2->setEnabled(false);
134 myShape2Name = new QLineEdit(myRestrictGroupBox);
135 myShape2Name->setReadOnly(true);
136 myShape2Name->setEnabled(false);
138 aRestrictLayout->setMargin(9);
139 aRestrictLayout->setSpacing(6);
140 aRestrictLayout->addWidget(allSubs, 0, 0, 1, 3);
141 aRestrictLayout->addWidget(inPlaceSubs, 1, 0, 1, 3);
142 aRestrictLayout->addWidget(shape2Subs, 2, 0, 1, 3);
143 aRestrictLayout->addWidget(aSecondLabel, 3, 0);
144 aRestrictLayout->addWidget(mySelBtn2, 3, 1);
145 aRestrictLayout->addWidget(myShape2Name, 3, 2);
146 myRestrictGroup->addButton(allSubs, ALL_SUBSHAPES);
147 myRestrictGroup->addButton(inPlaceSubs, GET_IN_PLACE);
148 myRestrictGroup->addButton(shape2Subs, SUBSHAPES_OF_SHAPE2);
149 myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj));
150 allSubs->setChecked(true);
152 myShowOnlyBtn = new QPushButton(tr("SHOW_ONLY_SELECTED"), GroupMedium);
153 myHideSelBtn = new QPushButton(tr("HIDE_SELECTED"), GroupMedium);
154 myShowAllBtn = new QPushButton(tr("SHOW_ALL_SUB_SHAPES"), GroupMedium);
156 mySelAllBtn = new QPushButton(tr("SELECT_ALL"), GroupMedium);
157 myAddBtn = new QPushButton(tr("ADD"), GroupMedium);
158 myRemBtn = new QPushButton(tr("REMOVE"), GroupMedium);
160 myIdList = new QListWidget(GroupMedium);
162 myIdList->setSelectionMode(QAbstractItemView::ExtendedSelection);
163 myIdList->setFlow(QListView::TopToBottom);
164 myIdList->setWrapping(true);
166 aMedLayout->addWidget(aMainLabel, 0, 0);
167 aMedLayout->addWidget(mySelBtn, 0, 1);
168 aMedLayout->addWidget(myMainName, 0, 2, 1, 2);
169 aMedLayout->addWidget(myRestrictGroupBox, 1, 0, 4, 3);
171 aMedLayout->addWidget(myShowOnlyBtn, 1, 3);
172 aMedLayout->addWidget(myHideSelBtn, 2, 3);
173 aMedLayout->addWidget(myShowAllBtn, 3, 3);
175 aMedLayout->addWidget(myIdList, 5, 0, 4, 3);
176 aMedLayout->addWidget(mySelAllBtn, 5, 3);
177 aMedLayout->addWidget(myAddBtn, 6, 3);
178 aMedLayout->addWidget(myRemBtn, 7, 3);
180 aMedLayout->setColumnStretch(2, 5);
181 aMedLayout->setRowStretch(5, 5);
182 aMedLayout->setRowStretch(8, 5);
184 QVBoxLayout* layout = new QVBoxLayout(centralWidget());
185 layout->setMargin(0); layout->setSpacing(6);
186 layout->addWidget(GroupMedium);
188 setHelpFileName("work_with_groups_page.html");
194 GroupGUI_GroupDlg::~GroupGUI_GroupDlg()
196 GEOM_Displayer* aDisplayer = getDisplayer();
197 if (myWasHiddenMain) {
198 aDisplayer->Erase(myMainObj);
199 myIsHiddenMain = true;
201 aDisplayer->Display(myMainObj);
202 myIsHiddenMain = false;
204 aDisplayer->Display(myGroup);
208 //=================================================================================
211 //=================================================================================
212 void GroupGUI_GroupDlg::Init()
215 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
217 //unset shape type to avoid preparation of selection before exact user shape type selection
218 unsetConstructorId();
219 myIsShapeType = false;
221 if (myMode == CreateGroup) {
222 initName(tr("GROUP_PREFIX"));
224 // Get ready for main shape selection
225 myEditCurrentArgument = myMainName;
227 connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
228 connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
229 connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
231 else if (myMode == EditGroup) {
232 SALOME_ListIO aSelList;
233 aSelMgr->selectedObjects(aSelList);
235 if (aSelList.Extent()) {
236 GEOM::GEOM_Object_var anObj =
237 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
239 if (!CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) {
242 mainFrame()->ResultName->setText(GEOMBase::GetName(myGroup));
244 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
245 myMainObj = anOper->GetMainShape(myGroup);
246 if (!CORBA::is_nil(myMainObj)) {
247 myMainName->setText(GEOMBase::GetName(myMainObj));
248 SALOME_View* view = GEOM_Displayer::GetActiveView();
250 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
251 Handle(SALOME_InteractiveObject) io =
252 new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
253 if (view->isVisible(io)) myWasHiddenMain = false;
257 setShapeType((TopAbs_ShapeEnum)anOper->GetType(myGroup));
259 GEOM::ListOfLong_var aCurrList = anOper->GetObjects(myGroup);
260 for (int i = 0, n = aCurrList->length(); i < n; i++) {
261 QListWidgetItem* itm = new QListWidgetItem( QString( "%1" ).arg( aCurrList[ i ] ) );
262 myGroupIdList.append( aCurrList[ i ] );
263 itm->setTextColor( QColor( GROUP_IDLST_COLOR ) );
264 myIdList->addItem( itm );
266 myEditCurrentArgument = 0;
268 connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
272 connect(aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
274 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
275 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
277 connect(myRestrictGroup, SIGNAL(buttonClicked(int)), this, SLOT(SetEditCurrentArgument()));
278 connect(mySelAllBtn, SIGNAL(clicked()), this, SLOT(selectAllSubShapes()));
279 connect(myAddBtn, SIGNAL(clicked()), this, SLOT(add()));
280 connect(myRemBtn, SIGNAL(clicked()), this, SLOT(remove()));
281 connect(myShowOnlyBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
282 connect(myHideSelBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
283 connect(myShowAllBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
284 connect(myIdList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
286 setInPlaceObj(GEOM::GEOM_Object::_nil());
288 myBusy = true; // just activate but do not select in the list
293 //=================================================================================
294 // function : enterEvent()
296 //=================================================================================
297 void GroupGUI_GroupDlg::enterEvent(QEvent* e)
299 if (!buttonCancel()->isEnabled())
300 ActivateThisDialog();
303 //=================================================================================
304 //function : closeEvent
305 //purpose : remove temporary geom object
306 //=================================================================================
307 void GroupGUI_GroupDlg::closeEvent(QCloseEvent* e)
309 setInPlaceObj(GEOM::GEOM_Object::_nil());
312 GEOMBase_Skeleton::closeEvent(e);
315 //=================================================================================
316 // function : ClickOnOk()
318 //=================================================================================
319 void GroupGUI_GroupDlg::ClickOnOk()
321 setIsApplyAndClose(true);
324 setIsApplyAndClose(false);
325 getDisplayer()->UnsetDisplayMode();
328 //=================================================================================
329 // function : ClickOnApply()
331 //=================================================================================
332 bool GroupGUI_GroupDlg::ClickOnApply()
334 if(!isApplyAndClose()) {
335 setIsDisableBrowsing( true );
336 setIsDisplayResult( false );
339 if (!onAccept(myMode == CreateGroup, true, isApplyAndClose()))
342 if(!isApplyAndClose()) {
343 setIsDisableBrowsing( false );
344 setIsDisplayResult( true );
347 if (myMode == CreateGroup)
351 ConstructorsClicked(getConstructorId());
355 int n = myIdList->count();
356 myGroupIdList.clear();
359 for (int i = 0; i < n; i++) {
360 QListWidgetItem* anItem = myIdList->item( i );
361 myGroupIdList.append( anItem->text().toInt() );
362 anItem->setTextColor( GROUP_IDLST_COLOR );
370 //=================================================================================
371 // function : ActivateThisDialog()
373 //=================================================================================
374 void GroupGUI_GroupDlg::ActivateThisDialog()
376 GEOMBase_Skeleton::ActivateThisDialog();
378 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
379 this, SLOT(SelectionIntoArgument()));
384 //=================================================================================
385 // function : SetEditCurrentArgument()
387 //=================================================================================
388 void GroupGUI_GroupDlg::SetEditCurrentArgument()
390 QPushButton* send = (QPushButton*)sender();
392 if (send == mySelBtn) {
393 myEditCurrentArgument = myMainName;
394 myShape2Name->setText("");
396 else if (send == mySelBtn2 || sender() == myRestrictGroup) {
397 setInPlaceObj(GEOM::GEOM_Object::_nil());
398 myShape2Name->setText("");
399 if (subSelectionWay() != ALL_SUBSHAPES) {
400 myEditCurrentArgument = myShape2Name;
403 myEditCurrentArgument = 0;
412 //=================================================================================
413 // function : onGetInPlace()
415 //=================================================================================
416 void GroupGUI_GroupDlg::onGetInPlace()
418 setInPlaceObj(GEOM::GEOM_Object::_nil());
419 myEditCurrentArgument->setText("");
421 bool isBlocked = myIdList->signalsBlocked();
422 myIdList->blockSignals(true);
423 myIdList->clearSelection();
424 myIdList->blockSignals(isBlocked);
426 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
427 SALOME_ListIO aSelList;
428 aSelMgr->selectedObjects(aSelList);
430 if (aSelList.Extent() != 1)
433 GEOM::GEOM_Object_var anObj =
434 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
435 if (GEOMBase::IsShape(anObj)) {
436 if (!anObj->_is_equivalent(myMainObj) && !anObj->_is_equivalent(myGroup)) {
437 SUIT_OverrideCursor wc;
438 myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
439 GEOM::GEOM_IShapesOperations_var aShapesOp =
440 getGeomEngine()->GetIShapesOperations(getStudyId());
441 if (subSelectionWay() == GET_IN_PLACE) {
442 GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj);
443 setInPlaceObj(aGetInPlaceObj);
446 bool isVisible = true;
447 if (SALOME_View* view = GEOM_Displayer::GetActiveView())
448 isVisible = view->isVisible(aSelList.First());
449 setInPlaceObj(anObj, isVisible);
451 myEditCurrentArgument = 0;
452 //myBusy = true; // just activate but do not select in the list
459 //=================================================================================
460 //function : setInPlaceObj
461 //purpose : temporarily add an object to study and remove old InPlaceObj
462 //=================================================================================
463 void GroupGUI_GroupDlg::setInPlaceObj(GEOM::GEOM_Object_var theObj, const bool isVisible)
465 if (!myInPlaceObj->_is_equivalent(theObj))
467 myInPlaceObj = theObj;
470 // build map of indices
471 myMain2InPlaceIndices.Clear();
472 if (!myInPlaceObj->_is_nil()) {
473 GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
474 GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId());
476 GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode(myInPlaceObj, getShapeType(), false);
477 for ( int i = 0; i < aSubObjects->length(); i++ )
479 GEOM::ListOfLong_var aCurrList = aShapesOp->GetSameIDs( myMainObj, aSubObjects[i] );
480 if( aCurrList->length() > 1 ) {
481 //rnv : To Fix the 21561: EDF 2184 GEOM: Group with second shape restriction.
482 // In case if GetSameIDs(...) method return more then one ID use
483 // GetSharedShapes(...) method to get sub-shapes of the second shape.
484 GEOM::ListOfGO_var aSubObjects2 = aShapesOp->GetSharedShapes( myMainObj, aSubObjects[i], getShapeType() );
485 for( int j = 0; j < aSubObjects2->length(); j++ ) {
486 CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects2[j] );
487 CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i]);
488 if ( aMainIndex >= 0 && aPlaceIndex > 0 ) {
489 myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex );
492 } else if(aCurrList->length() > 0 ) {
493 CORBA::Long aMainIndex = aCurrList[0];
494 CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i] );
495 if ( aMainIndex >= 0 && aPlaceIndex > 0) {
496 myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex );
501 myInPlaceObjSelectState = subSelectionWay();
502 if (myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible)
503 myInPlaceObjSelectState = SUBSHAPES_OF_INVISIBLE_SHAPE2;
506 //=================================================================================
507 // function : SelectionIntoArgument()
508 // purpose : Called when selection has changed
509 //=================================================================================
510 void GroupGUI_GroupDlg::SelectionIntoArgument()
512 if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name) {
517 if (myEditCurrentArgument == myMainName) { // Selection of a main shape is active
518 myEditCurrentArgument->setText("");
521 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
522 SALOME_ListIO aSelList;
523 aSelMgr->selectedObjects(aSelList);
524 int nbSel = aSelList.Extent();
527 GEOM::GEOM_Object_var anObj =
528 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
530 if (GEOMBase::IsShape(anObj)) {
531 if (myIsHiddenMain) {
532 GEOM_Displayer* aDisplayer = getDisplayer();
533 aDisplayer->Display(myMainObj);
534 myIsHiddenMain = false;
537 if (!CORBA::is_nil(myMainObj)) {
538 SALOME_View* view = GEOM_Displayer::GetActiveView();
540 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
541 Handle(SALOME_InteractiveObject) io =
542 new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
543 if (view->isVisible(io)) myWasHiddenMain = false;
546 myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
547 // activate sub-shapes selection by default
548 myEditCurrentArgument = 0;
554 if (myIsHiddenMain) {
555 GEOM_Displayer* aDisplayer = getDisplayer();
556 aDisplayer->Display(myMainObj);
557 myIsHiddenMain = false;
559 myMainObj = GEOM::GEOM_Object::_nil();
562 else { // an attempt to synchronize list box selection with 3d viewer
563 if (myBusy || myMainObj->_is_nil()) {
567 bool isBlocked = myIdList->signalsBlocked();
568 myIdList->blockSignals(true);
569 myIdList->clearSelection();
571 TColStd_IndexedMapOfInteger aMapIndex;
572 int nbSel = getSelectedSubshapes(aMapIndex);
576 for (int i = 0, n = myIdList->count(); i < n; i++)
577 aMap.insert(myIdList->item(i)->text().toInt(), i);
579 bool highlight = false;
580 for (int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++) {
581 if (aMap.contains(aMapIndex(ii))) {
582 myIdList->item(aMap[aMapIndex(ii)])->setSelected(true);
587 highlightSubShapes();
589 myIdList->blockSignals(isBlocked);
595 //=================================================================================
596 // function : ConstructorsClicked()
597 // purpose : Radio button management
598 //=================================================================================
599 void GroupGUI_GroupDlg::ConstructorsClicked(int constructorId)
601 if (getConstructorId() != constructorId)
602 setConstructorId(constructorId);
604 myIsShapeType = true;
606 myEditCurrentArgument = 0;
608 setInPlaceObj(myInPlaceObj); // to rebuild myMain2InPlaceIndices
613 //=================================================================================
614 // function : selectAllSubShapes
616 //=================================================================================
617 void GroupGUI_GroupDlg::selectAllSubShapes()
619 if (CORBA::is_nil(myMainObj) || !myIsShapeType)
622 GEOM::ListOfLong_var aSubShapes;
623 GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations(getStudyId());
624 aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false);
625 if (aSubShapes->length() > 0) {
626 if (subSelectionWay() == ALL_SUBSHAPES)
628 // myIdList->clear(); // for sorted final list?
630 if (!aShOp->IsDone())
635 aSubShapes = new GEOM::ListOfLong();
636 aSubShapes->length(myMain2InPlaceIndices.Extent());
637 TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip (myMain2InPlaceIndices);
638 for (int i = 0; m2ip.More(); i++, m2ip.Next())
639 aSubShapes[i] = m2ip.Key();
642 bool isBlocked = myIdList->signalsBlocked();
643 myIdList->blockSignals(true);
645 for (int i = 0, n = aSubShapes->length(); i < n; i++) {
646 CORBA::Long anIndex = aSubShapes[i];
650 QListWidgetItem* anItem = 0;
651 QString text = QString("%1").arg(anIndex);
652 // if (!myInPlaceObj->_is_nil()) {
653 QList<QListWidgetItem*> found = myIdList->findItems(text, Qt::MatchExactly);
654 if (found.count()) anItem = found[0];
657 anItem = new QListWidgetItem(text);
658 anItem->setTextColor( myGroupIdList.contains(anIndex) ? QColor( GROUP_IDLST_COLOR ) : QColor( GROUP_NEWIDLST_COLOR ) );
659 myIdList->addItem(anItem);
661 anItem->setSelected(true);
664 myIdList->blockSignals(isBlocked);
665 highlightSubShapes();
669 //=================================================================================
670 // function : showOnlySelected
672 //=================================================================================
673 void GroupGUI_GroupDlg::showOnlySelected()
675 if (CORBA::is_nil(myMainObj) || !myIsShapeType)
678 QPushButton* send = (QPushButton*)sender();
679 if (send == myShowAllBtn) {
684 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
685 SALOME_ListIO aSelList;
686 aSelMgr->selectedObjects(aSelList);
688 GEOM_Displayer* aDisplayer = getDisplayer();
690 if (send == myHideSelBtn) {
691 aDisplayer->Erase(aSelList, /*forced=*/false, /*updateViewer=*/true);
694 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
695 SALOME_View* view = GEOM_Displayer::GetActiveView();
697 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
698 Handle(SALOME_InteractiveObject) io =
699 new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
700 if (view->isVisible(io)) myIsHiddenMain = true;
702 //keep the selected entry and IO in the map for checking
703 std::map<QString, Handle(SALOME_InteractiveObject)> aSelEntriesMap;
704 SALOME_ListIteratorOfListIO aSelIt(aSelList);
705 for ( ; aSelIt.More(); aSelIt.Next() ) {
706 Handle(SALOME_InteractiveObject) anSelIO = aSelIt.Value();
707 aSelEntriesMap[anSelIO->getEntry()] = anSelIO;
709 //get the displayed sub-shapes
710 SALOME_ListIO displayed;
711 view->GetVisible(displayed);
712 // Erase all, except the selected sub-shapes
713 std::map<QString, Handle(SALOME_InteractiveObject)>::iterator
714 aSelDispIter = aSelEntriesMap.end();
715 SALOME_ListIteratorOfListIO aDispIt( displayed );
716 for ( ; aDispIt.More(); aDispIt.Next() ) {
717 Handle(SALOME_InteractiveObject) anIO = aDispIt.Value();
718 aSelDispIter = aSelEntriesMap.find( anIO->getEntry() );
719 if ( aSelDispIter != aSelEntriesMap.end() ) {
720 //sub-shape is selected, so erase it's record from map to keep in it not displayed, but selected sub-shapes only
721 aSelEntriesMap.erase(aSelDispIter);
723 //sub-shape is not in the map of selected, then erase it from view
724 aDisplayer->Erase( anIO, /*forced = */false, /*updateViewer = */false );
728 if ( !aSelEntriesMap.empty() ) {
729 // Build a presentation of the selected, but not displayed sub-shapes
730 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
731 TopTools_IndexedMapOfShape aSubShapesMap;
732 TopExp::MapShapes(aMainShape, aSubShapesMap);
733 QString anEntryBase = aMainEntry.in();
735 TopExp_Explorer anExp (aMainShape, getShapeType());
736 for (; anExp.More(); anExp.Next()) {
737 TopoDS_Shape aSubShape = anExp.Current();
738 int index = aSubShapesMap.FindIndex(aSubShape);
739 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
740 if ( aSelEntriesMap.find( anEntry ) == aSelEntriesMap.end() ) {
741 //skip not selected sub-shapes
744 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, view);
746 displayPreview(aPrs, true, false); // append, do not update
750 aDisplayer->UpdateViewer();
753 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
754 if (getShapeType() == TopAbs_VERTEX && myIsHiddenMain) {
755 aDisplayer->Display(myMainObj);
758 // for the case when selected ids were not displayed in the viewer: Mantis issue 0021367
759 highlightSubShapes();
763 //=================================================================================
764 // function : getSelectedSubshapes
766 //=================================================================================
767 int GroupGUI_GroupDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex)
771 SalomeApp_Application* app = myGeomGUI->getApp();
772 if (!app || myMainObj->_is_nil())
775 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
776 SALOME_ListIO aSelList;
777 aSelMgr->selectedObjects(aSelList);
779 // try to find out and process the global selection
780 // (of not published objects and of published sub-shapes)
782 SALOME_ListIteratorOfListIO anIter (aSelList);
783 for (int i = 0; anIter.More(); anIter.Next(), i++)
785 Handle(SALOME_InteractiveObject) anIObj = anIter.Value();
786 QString anEntry = anIObj->getEntry();
788 int index = anEntry.lastIndexOf(str);
789 if (index > 0) // selection among special preview
791 anEntry.remove(0, index+1);
792 int anIndex = anEntry.toInt();
794 theMapIndex.Add(anIndex);
796 else // selection among published shapes
798 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
799 if (!appStudy) return 0;
800 _PTR(Study) aStudy = appStudy->studyDS();
802 _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
803 GEOM::GEOM_Object_var aGeomObj =
804 GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
806 if (GEOMBase::GetShape(aGeomObj, aShape)) {
807 if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) {
808 TopTools_IndexedMapOfShape aMainMap;
809 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
810 TopExp::MapShapes(aMainShape, aMainMap);
812 TopExp_Explorer anExp (aShape, getShapeType());
813 bool isShowWarning = true;
814 for (; anExp.More(); anExp.Next()) {
815 TopoDS_Shape aSubShape = anExp.Current();
816 int anIndex = aMainMap.FindIndex(aSubShape);
819 SUIT_MessageBox::warning(app->desktop(), QObject::tr("WRN_WARNING"),
820 tr("WRN_NOT_SUBSHAPE"));
821 isShowWarning = false;
825 if (subSelectionWay() != ALL_SUBSHAPES &&
826 !myMain2InPlaceIndices.IsBound(anIndex))
828 theMapIndex.Add(anIndex);
837 return theMapIndex.Extent();
840 //=================================================================================
843 //=================================================================================
844 void GroupGUI_GroupDlg::add()
846 TColStd_IndexedMapOfInteger aMapIndex;
847 int nbSel = getSelectedSubshapes(aMapIndex);
849 TColStd_MapOfInteger aMap;
850 for (int i = 0, n = myIdList->count(); i < n; i++)
851 aMap.Add(myIdList->item(i)->text().toInt());
854 bool isBlocked = myIdList->signalsBlocked();
855 myIdList->blockSignals(true);
857 for (int i = 1, n = aMapIndex.Extent(); i <= n; i++) {
858 if (aMap.Contains(aMapIndex(i)))
861 QListWidgetItem* anItem = new QListWidgetItem(QString("%1").arg(aMapIndex(i)));
862 anItem->setTextColor( myGroupIdList.contains( aMapIndex( i ) ) ? QColor( GROUP_IDLST_COLOR ) : QColor( GROUP_NEWIDLST_COLOR ) );
863 myIdList->addItem(anItem);
864 anItem->setSelected(true);
867 myIdList->blockSignals(isBlocked);
873 //=================================================================================
876 //=================================================================================
877 void GroupGUI_GroupDlg::remove()
879 bool isBlocked = myIdList->signalsBlocked();
880 myIdList->blockSignals(true);
882 QListIterator<QListWidgetItem*> it (myIdList->selectedItems());
886 myIdList->blockSignals(isBlocked);
888 highlightSubShapes();
891 //=================================================================================
892 //function : subSelectionWay
894 //=================================================================================
895 int GroupGUI_GroupDlg::subSelectionWay() const
897 return myRestrictGroup->checkedId();
900 //=================================================================================
901 // function : getShapeType()
903 //=================================================================================
904 TopAbs_ShapeEnum GroupGUI_GroupDlg::getShapeType() const
906 switch (getConstructorId()) {
907 case 0: return TopAbs_VERTEX;
908 case 1: return TopAbs_EDGE;
909 case 2: return TopAbs_FACE;
910 case 3: return TopAbs_SOLID;
911 default: return TopAbs_SHAPE;
915 //=================================================================================
916 // function : setShapeType()
918 //=================================================================================
919 void GroupGUI_GroupDlg::setShapeType(const TopAbs_ShapeEnum theType)
923 case TopAbs_VERTEX: anId = 0; break;
924 case TopAbs_EDGE: anId = 1; break;
925 case TopAbs_FACE: anId = 2; break;
926 case TopAbs_SOLID: anId = 3; break;
928 setConstructorId(anId);
931 myIsShapeType = true;
932 // workaround to avoid set checked button 0
933 setConstructorId(anId);
937 //=================================================================================
938 // function : activateSelection
939 // purpose : Activate selection in accordance with myEditCurrentArgument
940 //=================================================================================
941 void GroupGUI_GroupDlg::activateSelection()
943 bool isApply = ((QPushButton*)sender() == buttonApply());
944 if(!isApplyAndClose())
948 if (!myMainObj->_is_nil() &&
949 !myEditCurrentArgument &&
950 myIsShapeType) // check if shape type is already choosen by user
952 GEOM_Displayer* aDisplayer = getDisplayer();
954 //display mode for main shape
955 if ( myDmMode == -1 ) {
956 SALOME_View* view = GEOM_Displayer::GetActiveView();
958 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
959 Handle(SALOME_InteractiveObject) io =
960 new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
961 if ( view->isVisible( io ) ) {
962 Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIOinGEOMAISShape( io, true );
964 myDmMode = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
968 myDmMode = SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "display_mode" );
971 aDisplayer->SetDisplayMode(myDmMode);
973 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
974 if(getShapeType() != TopAbs_VERTEX) {
975 aDisplayer->Erase(myMainObj, false, false);
976 myIsHiddenMain = true;
979 aDisplayer->Display(myMainObj);
981 aDisplayer->Erase(myGroup, false, false);
983 QColor aColor = SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", "editgroup_color" );
984 Quantity_NameOfColor aCol = SalomeApp_Tools::color( aColor ).Name();
986 if(!isApplyAndClose()) {
987 SUIT_ViewWindow* aViewWindow = 0;
988 SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
990 aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
991 if (aViewWindow == 0) return;
993 SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
994 if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
995 aViewManager->getType() != SVTK_Viewer::Type())
998 SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
999 SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
1000 if (aView == 0) return;
1002 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
1003 TopoDS_Shape aRestrictionShape;
1005 if (subSelectionWay() == ALL_SUBSHAPES) {
1006 aRestrictionShape = aMainShape;
1008 TopTools_IndexedMapOfShape aSubShapesMap;
1009 TopExp::MapShapes(aMainShape, aSubShapesMap);
1010 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
1011 QString anEntryBase = aMainEntry.in();
1013 TopExp_Explorer anExp (aRestrictionShape, getShapeType());
1014 for (; anExp.More(); anExp.Next()) {
1015 TopoDS_Shape aSubShape = anExp.Current();
1016 int index = aSubShapesMap.FindIndex(aSubShape);
1017 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
1018 Handle(SALOME_InteractiveObject) io =
1019 new SALOME_InteractiveObject(anEntry.toAscii(), "GEOM", "TEMP_IO");
1020 if ( myGroupIdList.contains( index ) ) {
1021 aDisplayer->SetColor( aCol );
1024 aDisplayer->UnsetColor();
1026 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
1028 displayPreview(aPrs, true, false); // append, do not update
1029 // TODO: map or delete Prs
1033 else if (!myInPlaceObj->_is_nil()) {
1034 TopTools_IndexedMapOfShape aSubShapesMap;
1035 TopExp::MapShapes(aMainShape, aSubShapesMap);
1036 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
1037 QString anEntryBase = aMainEntry.in();
1039 TColStd_DataMapIteratorOfDataMapOfIntegerInteger aM2IPit (myMain2InPlaceIndices);
1040 for (; aM2IPit.More(); aM2IPit.Next()) {
1041 int index = aM2IPit.Key();
1042 TopoDS_Shape aSubShape = aSubShapesMap.FindKey(index);
1043 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
1045 if ( myGroupIdList.contains( index ) ) {
1046 aDisplayer->SetColor( aCol );
1049 aDisplayer->UnsetColor();
1052 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
1054 displayPreview(aPrs, true, false); // append, do not update
1059 aDisplayer->UnsetDisplayMode();
1060 aDisplayer->UnsetColor();
1061 aDisplayer->UpdateViewer();
1065 globalSelection(GEOM_ALLSHAPES);
1067 SelectionIntoArgument();
1070 //=================================================================================
1071 // function : updateState
1073 //=================================================================================
1074 void GroupGUI_GroupDlg::updateState (bool isAdd)
1076 myAddBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd);
1077 //myShowOnlyBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd);
1079 bool hasSel = myIdList->selectedItems().count() > 0;
1081 myRemBtn->setEnabled(hasSel);
1082 myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj));
1083 mySelAllBtn->setEnabled(!CORBA::is_nil(myMainObj));
1085 mySelBtn2->setEnabled(subSelectionWay() != ALL_SUBSHAPES);
1086 myShape2Name->setEnabled(subSelectionWay() != ALL_SUBSHAPES);
1087 if (subSelectionWay() == ALL_SUBSHAPES)
1088 setInPlaceObj(GEOM::GEOM_Object::_nil());
1091 //=================================================================================
1092 // function : selectionChanged
1094 //=================================================================================
1095 void GroupGUI_GroupDlg::selectionChanged()
1097 highlightSubShapes();
1100 //=================================================================================
1101 // function : highlightSubShapes
1103 //=================================================================================
1104 void GroupGUI_GroupDlg::highlightSubShapes()
1106 if (CORBA::is_nil(myMainObj))
1109 TColStd_MapOfInteger anIds;
1113 int ii = 0, nn = myIdList->count();
1114 for (; ii < nn; ii++)
1116 if (myIdList->item(ii)->isSelected()) {
1117 int id = myIdList->item(ii)->text().toInt();
1118 if (subSelectionWay() != ALL_SUBSHAPES &&
1119 !myMain2InPlaceIndices.IsBound(id)) {
1120 //myIdList->item(ii)->setSelected(false);
1127 SalomeApp_Application* app = myGeomGUI->getApp();
1128 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
1129 aSelMgr->clearSelected();
1131 SUIT_ViewWindow* aViewWindow = 0;
1132 SUIT_Study* activeStudy = app->activeStudy();
1134 aViewWindow = app->desktop()->activeWindow();
1135 if (aViewWindow == 0) return;
1137 SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
1138 if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
1139 aViewManager->getType() != SVTK_Viewer::Type())
1142 SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
1143 SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
1144 if (aView == 0) return;
1146 // TODO??: use here GEOMBase_Helper::myPreview instead of ic->DisplayedObjects()
1148 OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)aViewManager)->getOCCViewer();
1149 Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
1150 AIS_ListOfInteractive List;
1151 //ic->DisplayedObjects(List);
1152 ic->ObjectsInside(List); // Mantis issue 0021367
1154 SALOME_ListIO aSelList;
1156 // To highlight the selected sub-shape in Object Browser, if it's already published under the main shape
1157 GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId());
1158 QMap<int, QString> childsMap;
1159 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
1161 _PTR(Study) aStudy = appStudy->studyDS();
1162 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
1163 QString anEntry = aMainEntry.in();
1164 _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
1165 _PTR(ChildIterator) anIt (aStudy->NewChildIterator(aSObj));
1166 for (anIt->InitEx(true); anIt->More(); anIt->Next()) {
1167 GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value()));
1168 if (!CORBA::is_nil(aChild)) {
1169 int index = aLocOp->GetSubShapeIndex(myMainObj, aChild);
1170 CORBA::String_var aChildEntry = aChild->GetStudyEntry();
1171 QString anEntry = aChildEntry.in();
1172 childsMap.insert(index, anEntry);
1177 AIS_ListIteratorOfListOfInteractive ite (List);
1178 for (; ite.More(); ite.Next()) {
1179 if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
1180 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
1182 Handle(SALOME_InteractiveObject) anIO = aSh->getIO();
1183 QString anEntry = anIO->getEntry();
1184 int index = anEntry.lastIndexOf("_");
1185 anEntry.remove(0, index+1);
1186 int anIndex = anEntry.toInt();
1187 if (anIds.Contains(anIndex)) {
1188 aSelList.Append(anIO);
1189 if (childsMap.contains (anIndex)) {
1190 Handle(SALOME_InteractiveObject) tmpIO = new SALOME_InteractiveObject(childsMap.value(anIndex).toLatin1().constData(), "GEOM", "TEMP_IO");
1191 aSelList.Append(tmpIO);
1197 aSelMgr->setSelectedObjects(aSelList);
1202 updateState(aSelList.Extent() > 0);
1204 myAddBtn->setEnabled(true);
1205 myAddBtn->setEnabled(true);
1206 myRemBtn->setEnabled(true);
1210 //=================================================================================
1211 // function : createOperation
1213 //=================================================================================
1214 GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation()
1216 return getGeomEngine()->GetIGroupOperations(getStudyId());
1219 #define RETURN_WITH_MSG(a, b) \
1221 theMessage += (b); \
1225 //=================================================================================
1226 // function : isValid()
1227 // purpose : Verify validity of input data
1228 //=================================================================================
1229 bool GroupGUI_GroupDlg::isValid(QString& theMessage)
1231 SalomeApp_Study* study = getStudy();
1233 RETURN_WITH_MSG (!study->studyDS()->GetProperties()->IsLocked(), tr("GEOM_STUDY_LOCKED"))
1235 if (myMode == CreateGroup) {
1236 RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_MAIN_OBJ"))
1239 RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_GROUP"))
1242 QString aName (getNewObjectName());
1243 RETURN_WITH_MSG (!aName.trimmed().isEmpty(), tr("EMPTY_NAME"))
1245 RETURN_WITH_MSG (myIdList->count(), tr("EMPTY_LIST"))
1249 //=================================================================================
1250 // function : execute
1252 //=================================================================================
1253 bool GroupGUI_GroupDlg::execute(ObjectList& objects)
1255 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
1257 GEOM::GEOM_Object_var aGroup;
1258 if (myMode == CreateGroup)
1259 aGroup = anOper->CreateGroup(myMainObj, getShapeType());
1260 else if (myMode == EditGroup)
1263 if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOper->IsDone()))
1266 GEOM::ListOfLong_var aCurrList = anOper->GetObjects(aGroup);
1267 if (!anOper->IsDone())
1270 if (aCurrList->length() > 0)
1272 anOper->DifferenceIDs(aGroup, aCurrList);
1273 if (!anOper->IsDone())
1277 int ii, nn = myIdList->count();
1280 GEOM::ListOfLong_var aNewList = new GEOM::ListOfLong;
1281 aNewList->length(nn);
1282 for (ii = 0; ii < nn; ii++) {
1283 aNewList[ii] = myIdList->item(ii)->text().toInt();
1285 anOper->UnionIDs(aGroup, aNewList);
1286 if (!anOper->IsDone())
1290 SalomeApp_Study* study = getStudy();
1292 QString objIOR = GEOMBase::GetIORFromObject(aGroup);
1294 _PTR(SObject) SO (study->studyDS()->FindObjectIOR(objIOR.toLatin1().constData()));
1296 _PTR(StudyBuilder) aBuilder (study->studyDS()->NewBuilder());
1297 aBuilder->SetName(SO, getNewObjectName().toLatin1().constData());
1302 objects.push_back(aGroup._retn());
1307 //================================================================
1308 // Function : getFather
1309 // Purpose : Get father object for object to be added in study
1310 // (called with addInStudy method)
1311 //================================================================
1312 GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather(GEOM::GEOM_Object_ptr theObj)
1314 GEOM::GEOM_Object_var aFatherObj;
1315 if (theObj->GetType() == GEOM_GROUP) {
1316 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
1317 aFatherObj = anOper->GetMainShape(theObj);
1319 return aFatherObj._retn();