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>
40 #include <OCCViewer_ViewModel.h>
41 #include <OCCViewer_ViewManager.h>
42 #include <SVTK_ViewModel.h>
43 #include <SALOME_Prs.h>
44 #include <SALOME_ListIteratorOfListIO.hxx>
46 #include <SUIT_Desktop.h>
47 #include <SUIT_MessageBox.h>
48 #include <SUIT_OverrideCursor.h>
49 #include <SUIT_ResourceMgr.h>
50 #include <SUIT_Session.h>
51 #include <SUIT_ViewWindow.h>
52 #include <SUIT_ViewManager.h>
55 #include <QListWidget>
59 #include <AIS_ListOfInteractive.hxx>
60 #include <AIS_ListIteratorOfListOfInteractive.hxx>
63 #include <TopExp_Explorer.hxx>
64 #include <TopTools_IndexedMapOfShape.hxx>
65 #include <TColStd_IndexedMapOfInteger.hxx>
66 #include <TColStd_MapOfInteger.hxx>
67 #include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
69 #include <GEOMImpl_Types.hxx>
71 #define GROUP_IDLST_COLOR Qt::blue // Specific color for the IDs of subShapes in the dialog box
72 #define GROUP_NEWIDLST_COLOR Qt::red // Specific color for the new IDs of subShapes in the dialog box
74 enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 };
76 GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent)
77 : GEOMBase_Skeleton(theGeometryGUI, parent, false),
83 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
85 QPixmap image0 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
86 QPixmap image1 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_EDGE")));
87 QPixmap image2 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_FACE")));
88 QPixmap image3 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_SOLID")));
89 QPixmap iconSelect (resMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
91 setWindowTitle(myMode == CreateGroup ? tr("CREATE_GROUP_TITLE") : tr("EDIT_GROUP_TITLE"));
93 // Shape type button group
94 mainFrame()->GroupConstructors->setEnabled(myMode == CreateGroup);
95 mainFrame()->GroupConstructors->setTitle(tr("SHAPE_TYPE"));
96 mainFrame()->RadioButton1->setIcon(image0);
97 mainFrame()->RadioButton2->setIcon(image1);
98 mainFrame()->RadioButton3->setIcon(image2);
99 mainFrame()->RadioButton4->setIcon(image3);
100 mainFrame()->RadioButton4->show();
103 mainFrame()->GroupBoxName->setTitle(tr("GROUP_NAME"));
105 // Main shape and sub-shapes
106 QGroupBox* GroupMedium = new QGroupBox(tr("MAIN_SUB_SHAPES"), centralWidget());
107 QGridLayout* aMedLayout = new QGridLayout(GroupMedium);
108 aMedLayout->setMargin(9);
109 aMedLayout->setSpacing(6);
111 QLabel* aMainLabel = new QLabel(tr("MAIN_SHAPE"), GroupMedium);
113 mySelBtn = new QPushButton(GroupMedium);
114 mySelBtn->setIcon(iconSelect);
115 mySelBtn->setEnabled(myMode == CreateGroup);
117 myMainName = new QLineEdit(GroupMedium);
118 myMainName->setReadOnly(true);
119 myMainName->setEnabled(myMode == CreateGroup);
121 myRestrictGroupBox = new QGroupBox(tr("SHAPE_SEL_RESTR"), GroupMedium);
122 myRestrictGroup = new QButtonGroup(myRestrictGroupBox);
123 QRadioButton* allSubs = new QRadioButton(tr("NO_RESTR") , myRestrictGroupBox);
124 QRadioButton* inPlaceSubs = new QRadioButton(tr("GEOM_PARTS_OF_SHAPE2"), myRestrictGroupBox);
125 QRadioButton* shape2Subs = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2") , myRestrictGroupBox);
126 QGridLayout* aRestrictLayout = new QGridLayout(myRestrictGroupBox);
128 QLabel* aSecondLabel = new QLabel(tr("SECOND_SHAPE"), myRestrictGroupBox);
129 mySelBtn2 = new QPushButton(myRestrictGroupBox);
130 mySelBtn2->setIcon(iconSelect);
131 mySelBtn2->setEnabled(false);
132 myShape2Name = new QLineEdit(myRestrictGroupBox);
133 myShape2Name->setReadOnly(true);
134 myShape2Name->setEnabled(false);
136 aRestrictLayout->setMargin(9);
137 aRestrictLayout->setSpacing(6);
138 aRestrictLayout->addWidget(allSubs, 0, 0, 1, 3);
139 aRestrictLayout->addWidget(inPlaceSubs, 1, 0, 1, 3);
140 aRestrictLayout->addWidget(shape2Subs, 2, 0, 1, 3);
141 aRestrictLayout->addWidget(aSecondLabel, 3, 0);
142 aRestrictLayout->addWidget(mySelBtn2, 3, 1);
143 aRestrictLayout->addWidget(myShape2Name, 3, 2);
144 myRestrictGroup->addButton(allSubs, ALL_SUBSHAPES);
145 myRestrictGroup->addButton(inPlaceSubs, GET_IN_PLACE);
146 myRestrictGroup->addButton(shape2Subs, SUBSHAPES_OF_SHAPE2);
147 myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj));
148 allSubs->setChecked(true);
150 myShowOnlyBtn = new QPushButton(tr("SHOW_ONLY_SELECTED"), GroupMedium);
151 myHideSelBtn = new QPushButton(tr("HIDE_SELECTED"), GroupMedium);
152 myShowAllBtn = new QPushButton(tr("SHOW_ALL_SUB_SHAPES"), GroupMedium);
154 mySelAllBtn = new QPushButton(tr("SELECT_ALL"), GroupMedium);
155 myAddBtn = new QPushButton(tr("ADD"), GroupMedium);
156 myRemBtn = new QPushButton(tr("REMOVE"), GroupMedium);
158 myIdList = new QListWidget(GroupMedium);
160 myIdList->setSelectionMode(QAbstractItemView::ExtendedSelection);
161 myIdList->setFlow(QListView::TopToBottom);
162 myIdList->setWrapping(true);
164 aMedLayout->addWidget(aMainLabel, 0, 0);
165 aMedLayout->addWidget(mySelBtn, 0, 1);
166 aMedLayout->addWidget(myMainName, 0, 2, 1, 2);
167 aMedLayout->addWidget(myRestrictGroupBox, 1, 0, 4, 3);
169 aMedLayout->addWidget(myShowOnlyBtn, 1, 3);
170 aMedLayout->addWidget(myHideSelBtn, 2, 3);
171 aMedLayout->addWidget(myShowAllBtn, 3, 3);
173 aMedLayout->addWidget(myIdList, 5, 0, 4, 3);
174 aMedLayout->addWidget(mySelAllBtn, 5, 3);
175 aMedLayout->addWidget(myAddBtn, 6, 3);
176 aMedLayout->addWidget(myRemBtn, 7, 3);
178 aMedLayout->setColumnStretch(2, 5);
179 aMedLayout->setRowStretch(5, 5);
180 aMedLayout->setRowStretch(8, 5);
182 QVBoxLayout* layout = new QVBoxLayout(centralWidget());
183 layout->setMargin(0); layout->setSpacing(6);
184 layout->addWidget(GroupMedium);
186 setHelpFileName("work_with_groups_page.html");
192 GroupGUI_GroupDlg::~GroupGUI_GroupDlg()
194 GEOM_Displayer* aDisplayer = getDisplayer();
195 if (myIsHiddenMain) {
196 aDisplayer->Display(myMainObj);
197 myIsHiddenMain = false;
199 aDisplayer->Display(myGroup);
203 //=================================================================================
206 //=================================================================================
207 void GroupGUI_GroupDlg::Init()
210 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
212 //unset shape type to avoid preparation of selection before exact user shape type selection
213 unsetConstructorId();
214 myIsShapeType = false;
216 if (myMode == CreateGroup) {
217 initName(tr("GROUP_PREFIX"));
219 // Get ready for main shape selection
220 myEditCurrentArgument = myMainName;
222 connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
223 connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
224 connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
226 else if (myMode == EditGroup) {
227 SALOME_ListIO aSelList;
228 aSelMgr->selectedObjects(aSelList);
230 if (aSelList.Extent()) {
231 GEOM::GEOM_Object_var anObj =
232 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
234 if (!CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) {
237 mainFrame()->ResultName->setText(GEOMBase::GetName(myGroup));
239 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
240 myMainObj = anOper->GetMainShape(myGroup);
241 if (!CORBA::is_nil(myMainObj))
242 myMainName->setText(GEOMBase::GetName(myMainObj));
244 setShapeType((TopAbs_ShapeEnum)anOper->GetType(myGroup));
246 GEOM::ListOfLong_var aCurrList = anOper->GetObjects(myGroup);
247 for (int i = 0, n = aCurrList->length(); i < n; i++) {
248 QListWidgetItem* itm = new QListWidgetItem( QString( "%1" ).arg( aCurrList[ i ] ) );
249 myGroupIdList.append( aCurrList[ i ] );
250 itm->setTextColor( QColor( GROUP_IDLST_COLOR ) );
251 myIdList->addItem( itm );
253 myEditCurrentArgument = 0;
255 connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
259 connect(aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
261 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
262 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
264 connect(myRestrictGroup, SIGNAL(buttonClicked(int)), this, SLOT(SetEditCurrentArgument()));
265 connect(mySelAllBtn, SIGNAL(clicked()), this, SLOT(selectAllSubShapes()));
266 connect(myAddBtn, SIGNAL(clicked()), this, SLOT(add()));
267 connect(myRemBtn, SIGNAL(clicked()), this, SLOT(remove()));
268 connect(myShowOnlyBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
269 connect(myHideSelBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
270 connect(myShowAllBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
271 connect(myIdList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
273 setInPlaceObj(GEOM::GEOM_Object::_nil());
275 myBusy = true; // just activate but do not select in the list
280 //=================================================================================
281 // function : enterEvent()
283 //=================================================================================
284 void GroupGUI_GroupDlg::enterEvent(QEvent* e)
286 if (!buttonCancel()->isEnabled())
287 ActivateThisDialog();
290 //=================================================================================
291 //function : closeEvent
292 //purpose : remove temporary geom object
293 //=================================================================================
294 void GroupGUI_GroupDlg::closeEvent(QCloseEvent* e)
296 setInPlaceObj(GEOM::GEOM_Object::_nil());
299 GEOMBase_Skeleton::closeEvent(e);
302 //=================================================================================
303 // function : ClickOnOk()
305 //=================================================================================
306 void GroupGUI_GroupDlg::ClickOnOk()
308 setIsApplyAndClose(true);
311 setIsApplyAndClose(false);
314 //=================================================================================
315 // function : ClickOnApply()
317 //=================================================================================
318 bool GroupGUI_GroupDlg::ClickOnApply()
320 if(!isApplyAndClose()) {
321 setIsDisableBrowsing( true );
322 setIsDisplayResult( false );
325 if (!onAccept(myMode == CreateGroup, true, isApplyAndClose()))
328 if(!isApplyAndClose()) {
329 setIsDisableBrowsing( false );
330 setIsDisplayResult( true );
333 if (myMode == CreateGroup)
337 ConstructorsClicked(getConstructorId());
341 int n = myIdList->count();
342 myGroupIdList.clear();
345 for (int i = 0; i < n; i++) {
346 QListWidgetItem* anItem = myIdList->item( i );
347 myGroupIdList.append( anItem->text().toInt() );
348 anItem->setTextColor( GROUP_IDLST_COLOR );
356 //=================================================================================
357 // function : ActivateThisDialog()
359 //=================================================================================
360 void GroupGUI_GroupDlg::ActivateThisDialog()
362 GEOMBase_Skeleton::ActivateThisDialog();
364 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
365 this, SLOT(SelectionIntoArgument()));
370 //=================================================================================
371 // function : SetEditCurrentArgument()
373 //=================================================================================
374 void GroupGUI_GroupDlg::SetEditCurrentArgument()
376 QPushButton* send = (QPushButton*)sender();
378 if (send == mySelBtn) {
379 myEditCurrentArgument = myMainName;
380 myShape2Name->setText("");
382 else if (send == mySelBtn2 || sender() == myRestrictGroup) {
383 setInPlaceObj(GEOM::GEOM_Object::_nil());
384 myShape2Name->setText("");
385 if (subSelectionWay() != ALL_SUBSHAPES) {
386 myEditCurrentArgument = myShape2Name;
389 myEditCurrentArgument = 0;
398 //=================================================================================
399 // function : onGetInPlace()
401 //=================================================================================
402 void GroupGUI_GroupDlg::onGetInPlace()
404 setInPlaceObj(GEOM::GEOM_Object::_nil());
405 myEditCurrentArgument->setText("");
407 bool isBlocked = myIdList->signalsBlocked();
408 myIdList->blockSignals(true);
409 myIdList->clearSelection();
410 myIdList->blockSignals(isBlocked);
412 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
413 SALOME_ListIO aSelList;
414 aSelMgr->selectedObjects(aSelList);
416 if (aSelList.Extent() != 1)
419 GEOM::GEOM_Object_var anObj =
420 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
421 if (GEOMBase::IsShape(anObj)) {
422 if (!anObj->_is_equivalent(myMainObj) && !anObj->_is_equivalent(myGroup)) {
423 SUIT_OverrideCursor wc;
424 myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
425 GEOM::GEOM_IShapesOperations_var aShapesOp =
426 getGeomEngine()->GetIShapesOperations(getStudyId());
427 if (subSelectionWay() == GET_IN_PLACE) {
428 GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj);
429 setInPlaceObj(aGetInPlaceObj);
432 bool isVisible = true;
433 if (SALOME_View* view = GEOM_Displayer::GetActiveView())
434 isVisible = view->isVisible(aSelList.First());
435 setInPlaceObj(anObj, isVisible);
437 myEditCurrentArgument = 0;
438 //myBusy = true; // just activate but do not select in the list
445 //=================================================================================
446 //function : setInPlaceObj
447 //purpose : temporarily add an object to study and remove old InPlaceObj
448 //=================================================================================
449 void GroupGUI_GroupDlg::setInPlaceObj(GEOM::GEOM_Object_var theObj, const bool isVisible)
451 if (!myInPlaceObj->_is_equivalent(theObj))
453 myInPlaceObj = theObj;
456 // build map of indices
457 myMain2InPlaceIndices.Clear();
458 if (!myInPlaceObj->_is_nil()) {
459 GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
460 GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId());
462 GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode(myInPlaceObj, getShapeType(), false);
463 for ( int i = 0; i < aSubObjects->length(); i++ )
465 GEOM::ListOfLong_var aCurrList = aShapesOp->GetSameIDs( myMainObj, aSubObjects[i] );
466 if( aCurrList->length() > 1 ) {
467 //rnv : To Fix the 21561: EDF 2184 GEOM: Group with second shape restriction.
468 // In case if GetSameIDs(...) method return more then one ID use
469 // GetSharedShapes(...) method to get sub-shapes of the second shape.
470 GEOM::ListOfGO_var aSubObjects2 = aShapesOp->GetSharedShapes( myMainObj, aSubObjects[i], getShapeType() );
471 for( int j = 0; j < aSubObjects2->length(); j++ ) {
472 CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects2[j] );
473 CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i]);
474 if ( aMainIndex >= 0 && aPlaceIndex > 0 ) {
475 myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex );
478 } else if(aCurrList->length() > 0 ) {
479 CORBA::Long aMainIndex = aCurrList[0];
480 CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i] );
481 if ( aMainIndex >= 0 && aPlaceIndex > 0) {
482 myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex );
487 myInPlaceObjSelectState = subSelectionWay();
488 if (myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible)
489 myInPlaceObjSelectState = SUBSHAPES_OF_INVISIBLE_SHAPE2;
492 //=================================================================================
493 // function : SelectionIntoArgument()
494 // purpose : Called when selection has changed
495 //=================================================================================
496 void GroupGUI_GroupDlg::SelectionIntoArgument()
498 if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name) {
503 if (myEditCurrentArgument == myMainName) { // Selection of a main shape is active
504 myEditCurrentArgument->setText("");
507 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
508 SALOME_ListIO aSelList;
509 aSelMgr->selectedObjects(aSelList);
510 int nbSel = aSelList.Extent();
513 GEOM::GEOM_Object_var anObj =
514 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
516 if (GEOMBase::IsShape(anObj)) {
517 if (myIsHiddenMain) {
518 GEOM_Displayer* aDisplayer = getDisplayer();
519 aDisplayer->Display(myMainObj);
520 myIsHiddenMain = false;
523 myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
524 // activate sub-shapes selection by default
525 myEditCurrentArgument = 0;
531 if (myIsHiddenMain) {
532 GEOM_Displayer* aDisplayer = getDisplayer();
533 aDisplayer->Display(myMainObj);
534 myIsHiddenMain = false;
536 myMainObj = GEOM::GEOM_Object::_nil();
539 else { // an attempt to synchronize list box selection with 3d viewer
540 if (myBusy || myMainObj->_is_nil()) {
544 bool isBlocked = myIdList->signalsBlocked();
545 myIdList->blockSignals(true);
546 myIdList->clearSelection();
548 TColStd_IndexedMapOfInteger aMapIndex;
549 int nbSel = getSelectedSubshapes(aMapIndex);
553 for (int i = 0, n = myIdList->count(); i < n; i++)
554 aMap.insert(myIdList->item(i)->text().toInt(), i);
556 bool highlight = false;
557 for (int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++) {
558 if (aMap.contains(aMapIndex(ii))) {
559 myIdList->item(aMap[aMapIndex(ii)])->setSelected(true);
564 highlightSubShapes();
566 myIdList->blockSignals(isBlocked);
572 //=================================================================================
573 // function : ConstructorsClicked()
574 // purpose : Radio button management
575 //=================================================================================
576 void GroupGUI_GroupDlg::ConstructorsClicked(int constructorId)
578 if (getConstructorId() != constructorId)
579 setConstructorId(constructorId);
581 myIsShapeType = true;
583 myEditCurrentArgument = 0;
585 setInPlaceObj(myInPlaceObj); // to rebuild myMain2InPlaceIndices
590 //=================================================================================
591 // function : selectAllSubShapes
593 //=================================================================================
594 void GroupGUI_GroupDlg::selectAllSubShapes()
596 if (CORBA::is_nil(myMainObj) || !myIsShapeType)
599 GEOM::ListOfLong_var aSubShapes;
600 GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations(getStudyId());
601 aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false);
602 if (aSubShapes->length() > 0) {
603 if (subSelectionWay() == ALL_SUBSHAPES)
605 // myIdList->clear(); // for sorted final list?
607 if (!aShOp->IsDone())
612 aSubShapes = new GEOM::ListOfLong();
613 aSubShapes->length(myMain2InPlaceIndices.Extent());
614 TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip (myMain2InPlaceIndices);
615 for (int i = 0; m2ip.More(); i++, m2ip.Next())
616 aSubShapes[i] = m2ip.Key();
619 bool isBlocked = myIdList->signalsBlocked();
620 myIdList->blockSignals(true);
622 for (int i = 0, n = aSubShapes->length(); i < n; i++) {
623 CORBA::Long anIndex = aSubShapes[i];
627 QListWidgetItem* anItem = 0;
628 QString text = QString("%1").arg(anIndex);
629 // if (!myInPlaceObj->_is_nil()) {
630 QList<QListWidgetItem*> found = myIdList->findItems(text, Qt::MatchExactly);
631 if (found.count()) anItem = found[0];
634 anItem = new QListWidgetItem(text);
635 anItem->setTextColor( myGroupIdList.contains(anIndex) ? QColor( GROUP_IDLST_COLOR ) : QColor( GROUP_NEWIDLST_COLOR ) );
636 myIdList->addItem(anItem);
638 anItem->setSelected(true);
641 myIdList->blockSignals(isBlocked);
642 highlightSubShapes();
646 //=================================================================================
647 // function : showOnlySelected
649 //=================================================================================
650 void GroupGUI_GroupDlg::showOnlySelected()
652 if (CORBA::is_nil(myMainObj) || !myIsShapeType)
655 QPushButton* send = (QPushButton*)sender();
656 if (send == myShowAllBtn) {
661 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
662 SALOME_ListIO aSelList;
663 aSelMgr->selectedObjects(aSelList);
665 GEOM_Displayer* aDisplayer = getDisplayer();
667 if (send == myHideSelBtn) {
668 aDisplayer->Erase(aSelList, /*forced=*/false, /*updateViewer=*/true);
671 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
672 SALOME_View* view = GEOM_Displayer::GetActiveView();
674 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
675 Handle(SALOME_InteractiveObject) io =
676 new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
677 if (view->isVisible(io)) myIsHiddenMain = true;
679 //keep the selected entry and IO in the map for checking
680 std::map<QString, Handle(SALOME_InteractiveObject)> aSelEntriesMap;
681 SALOME_ListIteratorOfListIO aSelIt(aSelList);
682 for ( ; aSelIt.More(); aSelIt.Next() ) {
683 Handle(SALOME_InteractiveObject) anSelIO = aSelIt.Value();
684 aSelEntriesMap[anSelIO->getEntry()] = anSelIO;
686 //get the displayed sub-shapes
687 SALOME_ListIO displayed;
688 view->GetVisible(displayed);
689 // Erase all, except the selected sub-shapes
690 std::map<QString, Handle(SALOME_InteractiveObject)>::iterator
691 aSelDispIter = aSelEntriesMap.end();
692 SALOME_ListIteratorOfListIO aDispIt( displayed );
693 for ( ; aDispIt.More(); aDispIt.Next() ) {
694 Handle(SALOME_InteractiveObject) anIO = aDispIt.Value();
695 aSelDispIter = aSelEntriesMap.find( anIO->getEntry() );
696 if ( aSelDispIter != aSelEntriesMap.end() ) {
697 //sub-shape is selected, so erase it's record from map to keep in it not displayed, but selected sub-shapes only
698 aSelEntriesMap.erase(aSelDispIter);
700 //sub-shape is not in the map of selected, then erase it from view
701 aDisplayer->Erase( anIO, /*forced = */false, /*updateViewer = */false );
705 if ( !aSelEntriesMap.empty() ) {
706 // Build a presentation of the selected, but not displayed sub-shapes
707 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
708 TopTools_IndexedMapOfShape aSubShapesMap;
709 TopExp::MapShapes(aMainShape, aSubShapesMap);
710 QString anEntryBase = aMainEntry.in();
712 TopExp_Explorer anExp (aMainShape, getShapeType());
713 for (; anExp.More(); anExp.Next()) {
714 TopoDS_Shape aSubShape = anExp.Current();
715 int index = aSubShapesMap.FindIndex(aSubShape);
716 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
717 if ( aSelEntriesMap.find( anEntry ) == aSelEntriesMap.end() ) {
718 //skip not selected sub-shapes
721 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, view);
723 displayPreview(aPrs, true, false); // append, do not update
727 aDisplayer->UpdateViewer();
730 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
731 if (getShapeType() == TopAbs_VERTEX && myIsHiddenMain) {
732 aDisplayer->Display(myMainObj);
735 // for the case when selected ids were not displayed in the viewer: Mantis issue 0021367
736 highlightSubShapes();
740 //=================================================================================
741 // function : getSelectedSubshapes
743 //=================================================================================
744 int GroupGUI_GroupDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex)
748 SalomeApp_Application* app = myGeomGUI->getApp();
749 if (!app || myMainObj->_is_nil())
752 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
753 SALOME_ListIO aSelList;
754 aSelMgr->selectedObjects(aSelList);
756 // try to find out and process the global selection
757 // (of not published objects and of published sub-shapes)
759 SALOME_ListIteratorOfListIO anIter (aSelList);
760 for (int i = 0; anIter.More(); anIter.Next(), i++)
762 Handle(SALOME_InteractiveObject) anIObj = anIter.Value();
763 QString anEntry = anIObj->getEntry();
765 int index = anEntry.lastIndexOf(str);
766 if (index > 0) // selection among special preview
768 anEntry.remove(0, index+1);
769 int anIndex = anEntry.toInt();
771 theMapIndex.Add(anIndex);
773 else // selection among published shapes
775 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
776 if (!appStudy) return 0;
777 _PTR(Study) aStudy = appStudy->studyDS();
779 _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
780 GEOM::GEOM_Object_var aGeomObj =
781 GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
783 if (GEOMBase::GetShape(aGeomObj, aShape)) {
784 if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) {
785 TopTools_IndexedMapOfShape aMainMap;
786 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
787 TopExp::MapShapes(aMainShape, aMainMap);
789 TopExp_Explorer anExp (aShape, getShapeType());
790 for (; anExp.More(); anExp.Next()) {
791 TopoDS_Shape aSubShape = anExp.Current();
792 int anIndex = aMainMap.FindIndex(aSubShape);
794 SUIT_MessageBox::warning(app->desktop(), QObject::tr("WRN_WARNING"),
795 tr("WRN_NOT_SUBSHAPE"));
798 if (subSelectionWay() != ALL_SUBSHAPES &&
799 !myMain2InPlaceIndices.IsBound(anIndex))
801 theMapIndex.Add(anIndex);
810 return theMapIndex.Extent();
813 //=================================================================================
816 //=================================================================================
817 void GroupGUI_GroupDlg::add()
819 TColStd_IndexedMapOfInteger aMapIndex;
820 int nbSel = getSelectedSubshapes(aMapIndex);
822 TColStd_MapOfInteger aMap;
823 for (int i = 0, n = myIdList->count(); i < n; i++)
824 aMap.Add(myIdList->item(i)->text().toInt());
827 bool isBlocked = myIdList->signalsBlocked();
828 myIdList->blockSignals(true);
830 for (int i = 1, n = aMapIndex.Extent(); i <= n; i++) {
831 if (aMap.Contains(aMapIndex(i)))
834 QListWidgetItem* anItem = new QListWidgetItem(QString("%1").arg(aMapIndex(i)));
835 anItem->setTextColor( myGroupIdList.contains( aMapIndex( i ) ) ? QColor( GROUP_IDLST_COLOR ) : QColor( GROUP_NEWIDLST_COLOR ) );
836 myIdList->addItem(anItem);
837 anItem->setSelected(true);
840 myIdList->blockSignals(isBlocked);
846 //=================================================================================
849 //=================================================================================
850 void GroupGUI_GroupDlg::remove()
852 bool isBlocked = myIdList->signalsBlocked();
853 myIdList->blockSignals(true);
855 QListIterator<QListWidgetItem*> it (myIdList->selectedItems());
859 myIdList->blockSignals(isBlocked);
861 highlightSubShapes();
864 //=================================================================================
865 //function : subSelectionWay
867 //=================================================================================
868 int GroupGUI_GroupDlg::subSelectionWay() const
870 return myRestrictGroup->checkedId();
873 //=================================================================================
874 // function : getShapeType()
876 //=================================================================================
877 TopAbs_ShapeEnum GroupGUI_GroupDlg::getShapeType() const
879 switch (getConstructorId()) {
880 case 0: return TopAbs_VERTEX;
881 case 1: return TopAbs_EDGE;
882 case 2: return TopAbs_FACE;
883 case 3: return TopAbs_SOLID;
884 default: return TopAbs_SHAPE;
888 //=================================================================================
889 // function : setShapeType()
891 //=================================================================================
892 void GroupGUI_GroupDlg::setShapeType(const TopAbs_ShapeEnum theType)
896 case TopAbs_VERTEX: anId = 0; break;
897 case TopAbs_EDGE: anId = 1; break;
898 case TopAbs_FACE: anId = 2; break;
899 case TopAbs_SOLID: anId = 3; break;
901 setConstructorId(anId);
904 myIsShapeType = true;
905 // workaround to avoid set checked button 0
906 setConstructorId(anId);
910 //=================================================================================
911 // function : activateSelection
912 // purpose : Activate selection in accordance with myEditCurrentArgument
913 //=================================================================================
914 void GroupGUI_GroupDlg::activateSelection()
916 bool isApply = ((QPushButton*)sender() == buttonApply());
917 if(!isApplyAndClose())
921 if (!myMainObj->_is_nil() &&
922 !myEditCurrentArgument &&
923 myIsShapeType) // check if shape type is already choosen by user
925 GEOM_Displayer* aDisplayer = getDisplayer();
927 //display mode for main shape
928 if ( myDmMode == -1 ) {
929 SALOME_View* view = GEOM_Displayer::GetActiveView();
931 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
932 Handle(SALOME_InteractiveObject) io =
933 new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
934 if ( view->isVisible( io ) ) {
935 Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIOinGEOMAISShape( io, true );
937 myDmMode = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
941 myDmMode = SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "display_mode" );
944 aDisplayer->SetDisplayMode(myDmMode);
946 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
947 if(getShapeType() != TopAbs_VERTEX) {
948 aDisplayer->Erase(myMainObj, false, false);
949 myIsHiddenMain = true;
952 aDisplayer->Display(myMainObj);
954 aDisplayer->Erase(myGroup, false, false);
956 QColor aColor = SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", "editgroup_color" );
957 Quantity_NameOfColor aCol = SalomeApp_Tools::color( aColor ).Name();
959 if(!isApplyAndClose()) {
960 SUIT_ViewWindow* aViewWindow = 0;
961 SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
963 aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
964 if (aViewWindow == 0) return;
966 SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
967 if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
968 aViewManager->getType() != SVTK_Viewer::Type())
971 SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
972 SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
973 if (aView == 0) return;
975 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
976 TopoDS_Shape aRestrictionShape;
978 if (subSelectionWay() == ALL_SUBSHAPES) {
979 aRestrictionShape = aMainShape;
981 TopTools_IndexedMapOfShape aSubShapesMap;
982 TopExp::MapShapes(aMainShape, aSubShapesMap);
983 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
984 QString anEntryBase = aMainEntry.in();
986 TopExp_Explorer anExp (aRestrictionShape, getShapeType());
987 for (; anExp.More(); anExp.Next()) {
988 TopoDS_Shape aSubShape = anExp.Current();
989 int index = aSubShapesMap.FindIndex(aSubShape);
990 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
991 Handle(SALOME_InteractiveObject) io =
992 new SALOME_InteractiveObject(anEntry.toAscii(), "GEOM", "TEMP_IO");
993 if ( myGroupIdList.contains( index ) ) {
994 aDisplayer->SetColor( aCol );
997 aDisplayer->UnsetColor();
999 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
1001 displayPreview(aPrs, true, false); // append, do not update
1002 // TODO: map or delete Prs
1006 else if (!myInPlaceObj->_is_nil()) {
1007 TopTools_IndexedMapOfShape aSubShapesMap;
1008 TopExp::MapShapes(aMainShape, aSubShapesMap);
1009 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
1010 QString anEntryBase = aMainEntry.in();
1012 TColStd_DataMapIteratorOfDataMapOfIntegerInteger aM2IPit (myMain2InPlaceIndices);
1013 for (; aM2IPit.More(); aM2IPit.Next()) {
1014 int index = aM2IPit.Key();
1015 TopoDS_Shape aSubShape = aSubShapesMap.FindKey(index);
1016 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
1018 if ( myGroupIdList.contains( index ) ) {
1019 aDisplayer->SetColor( aCol );
1022 aDisplayer->UnsetColor();
1025 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
1027 displayPreview(aPrs, true, false); // append, do not update
1032 aDisplayer->UnsetDisplayMode();
1033 aDisplayer->UnsetColor();
1034 aDisplayer->UpdateViewer();
1038 globalSelection(GEOM_ALLSHAPES);
1040 SelectionIntoArgument();
1043 //=================================================================================
1044 // function : updateState
1046 //=================================================================================
1047 void GroupGUI_GroupDlg::updateState (bool isAdd)
1049 myAddBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd);
1050 //myShowOnlyBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd);
1052 bool hasSel = myIdList->selectedItems().count() > 0;
1054 myRemBtn->setEnabled(hasSel);
1055 myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj));
1056 mySelAllBtn->setEnabled(!CORBA::is_nil(myMainObj));
1058 mySelBtn2->setEnabled(subSelectionWay() != ALL_SUBSHAPES);
1059 myShape2Name->setEnabled(subSelectionWay() != ALL_SUBSHAPES);
1060 if (subSelectionWay() == ALL_SUBSHAPES)
1061 setInPlaceObj(GEOM::GEOM_Object::_nil());
1064 //=================================================================================
1065 // function : selectionChanged
1067 //=================================================================================
1068 void GroupGUI_GroupDlg::selectionChanged()
1070 highlightSubShapes();
1073 //=================================================================================
1074 // function : highlightSubShapes
1076 //=================================================================================
1077 void GroupGUI_GroupDlg::highlightSubShapes()
1079 if (CORBA::is_nil(myMainObj))
1082 TColStd_MapOfInteger anIds;
1086 int ii = 0, nn = myIdList->count();
1087 for (; ii < nn; ii++)
1089 if (myIdList->item(ii)->isSelected()) {
1090 int id = myIdList->item(ii)->text().toInt();
1091 if (subSelectionWay() != ALL_SUBSHAPES &&
1092 !myMain2InPlaceIndices.IsBound(id)) {
1093 //myIdList->item(ii)->setSelected(false);
1100 SalomeApp_Application* app = myGeomGUI->getApp();
1101 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
1102 aSelMgr->clearSelected();
1104 SUIT_ViewWindow* aViewWindow = 0;
1105 SUIT_Study* activeStudy = app->activeStudy();
1107 aViewWindow = app->desktop()->activeWindow();
1108 if (aViewWindow == 0) return;
1110 SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
1111 if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
1112 aViewManager->getType() != SVTK_Viewer::Type())
1115 SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
1116 SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
1117 if (aView == 0) return;
1119 // TODO??: use here GEOMBase_Helper::myPreview instead of ic->DisplayedObjects()
1121 OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)aViewManager)->getOCCViewer();
1122 Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
1123 AIS_ListOfInteractive List;
1124 //ic->DisplayedObjects(List);
1125 ic->ObjectsInside(List); // Mantis issue 0021367
1127 SALOME_ListIO aSelList;
1129 // To highlight the selected sub-shape in Object Browser, if it's already published under the main shape
1130 GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId());
1131 QMap<int, QString> childsMap;
1132 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
1134 _PTR(Study) aStudy = appStudy->studyDS();
1135 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
1136 QString anEntry = aMainEntry.in();
1137 _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
1138 _PTR(ChildIterator) anIt (aStudy->NewChildIterator(aSObj));
1139 for (anIt->InitEx(true); anIt->More(); anIt->Next()) {
1140 GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value()));
1141 if (!CORBA::is_nil(aChild)) {
1142 int index = aLocOp->GetSubShapeIndex(myMainObj, aChild);
1143 CORBA::String_var aChildEntry = aChild->GetStudyEntry();
1144 QString anEntry = aChildEntry.in();
1145 childsMap.insert(index, anEntry);
1150 AIS_ListIteratorOfListOfInteractive ite (List);
1151 for (; ite.More(); ite.Next()) {
1152 if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
1153 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
1155 Handle(SALOME_InteractiveObject) anIO = aSh->getIO();
1156 QString anEntry = anIO->getEntry();
1157 int index = anEntry.lastIndexOf("_");
1158 anEntry.remove(0, index+1);
1159 int anIndex = anEntry.toInt();
1160 if (anIds.Contains(anIndex)) {
1161 aSelList.Append(anIO);
1162 if (childsMap.contains (anIndex)) {
1163 Handle(SALOME_InteractiveObject) tmpIO = new SALOME_InteractiveObject(childsMap.value(anIndex).toLatin1().constData(), "GEOM", "TEMP_IO");
1164 aSelList.Append(tmpIO);
1170 aSelMgr->setSelectedObjects(aSelList);
1175 updateState(aSelList.Extent() > 0);
1177 myAddBtn->setEnabled(true);
1178 myAddBtn->setEnabled(true);
1179 myRemBtn->setEnabled(true);
1183 //=================================================================================
1184 // function : createOperation
1186 //=================================================================================
1187 GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation()
1189 return getGeomEngine()->GetIGroupOperations(getStudyId());
1192 #define RETURN_WITH_MSG(a, b) \
1194 theMessage += (b); \
1198 //=================================================================================
1199 // function : isValid()
1200 // purpose : Verify validity of input data
1201 //=================================================================================
1202 bool GroupGUI_GroupDlg::isValid(QString& theMessage)
1204 SalomeApp_Study* study = getStudy();
1206 RETURN_WITH_MSG (!study->studyDS()->GetProperties()->IsLocked(), tr("GEOM_STUDY_LOCKED"))
1208 if (myMode == CreateGroup) {
1209 RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_MAIN_OBJ"))
1212 RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_GROUP"))
1215 QString aName (getNewObjectName());
1216 RETURN_WITH_MSG (!aName.trimmed().isEmpty(), tr("EMPTY_NAME"))
1218 RETURN_WITH_MSG (myIdList->count(), tr("EMPTY_LIST"))
1222 //=================================================================================
1223 // function : execute
1225 //=================================================================================
1226 bool GroupGUI_GroupDlg::execute(ObjectList& objects)
1228 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
1230 GEOM::GEOM_Object_var aGroup;
1231 if (myMode == CreateGroup)
1232 aGroup = anOper->CreateGroup(myMainObj, getShapeType());
1233 else if (myMode == EditGroup)
1236 if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOper->IsDone()))
1239 GEOM::ListOfLong_var aCurrList = anOper->GetObjects(aGroup);
1240 if (!anOper->IsDone())
1243 if (aCurrList->length() > 0)
1245 anOper->DifferenceIDs(aGroup, aCurrList);
1246 if (!anOper->IsDone())
1250 int ii, nn = myIdList->count();
1253 GEOM::ListOfLong_var aNewList = new GEOM::ListOfLong;
1254 aNewList->length(nn);
1255 for (ii = 0; ii < nn; ii++) {
1256 aNewList[ii] = myIdList->item(ii)->text().toInt();
1258 anOper->UnionIDs(aGroup, aNewList);
1259 if (!anOper->IsDone())
1263 SalomeApp_Study* study = getStudy();
1265 QString objIOR = GEOMBase::GetIORFromObject(aGroup);
1267 _PTR(SObject) SO (study->studyDS()->FindObjectIOR(objIOR.toLatin1().constData()));
1269 _PTR(StudyBuilder) aBuilder (study->studyDS()->NewBuilder());
1270 aBuilder->SetName(SO, getNewObjectName().toLatin1().constData());
1275 objects.push_back(aGroup._retn());
1280 //================================================================
1281 // Function : getFather
1282 // Purpose : Get father object for object to be added in study
1283 // (called with addInStudy method)
1284 //================================================================
1285 GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather(GEOM::GEOM_Object_ptr theObj)
1287 GEOM::GEOM_Object_var aFatherObj;
1288 if (theObj->GetType() == GEOM_GROUP) {
1289 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
1290 aFatherObj = anOper->GetMainShape(theObj);
1292 return aFatherObj._retn();