1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // GEOM GEOMGUI : GUI for Geometry component
23 // File : GroupGUI_GroupDlg.cxx
24 // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
26 #include "GroupGUI_GroupDlg.h"
30 #include <GeometryGUI.h>
31 #include <GEOM_Displayer.h>
33 #include <SalomeApp_Application.h>
34 #include <SalomeApp_Study.h>
35 #include <SalomeApp_Tools.h>
37 #include <LightApp_SelectionMgr.h>
39 #include <OCCViewer_ViewModel.h>
40 #include <OCCViewer_ViewManager.h>
41 #include <SVTK_ViewModel.h>
42 #include <SALOME_Prs.h>
43 #include <SALOME_ListIteratorOfListIO.hxx>
45 #include <SUIT_Desktop.h>
46 #include <SUIT_MessageBox.h>
47 #include <SUIT_OverrideCursor.h>
48 #include <SUIT_ResourceMgr.h>
49 #include <SUIT_Session.h>
50 #include <SUIT_ViewWindow.h>
51 #include <SUIT_ViewManager.h>
54 #include <QListWidget>
58 #include <AIS_ListOfInteractive.hxx>
59 #include <AIS_ListIteratorOfListOfInteractive.hxx>
62 #include <TopExp_Explorer.hxx>
63 #include <TopTools_IndexedMapOfShape.hxx>
64 #include <TColStd_IndexedMapOfInteger.hxx>
65 #include <TColStd_MapOfInteger.hxx>
66 #include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
68 #include <GEOMImpl_Types.hxx>
70 #define GROUP_IDLST_COLOR Qt::blue // Specific color for the IDs of subShapes in the dialog box
71 #define GROUP_NEWIDLST_COLOR Qt::red // Specific color for the new IDs of subShapes in the dialog box
73 enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 };
75 GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent)
76 : GEOMBase_Skeleton(theGeometryGUI, parent, false),
82 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
84 QPixmap image0 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
85 QPixmap image1 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_EDGE")));
86 QPixmap image2 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_FACE")));
87 QPixmap image3 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_SOLID")));
88 QPixmap iconSelect (resMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
90 setWindowTitle(myMode == CreateGroup ? tr("CREATE_GROUP_TITLE") : tr("EDIT_GROUP_TITLE"));
92 // Shape type button group
93 mainFrame()->GroupConstructors->setEnabled(myMode == CreateGroup);
94 mainFrame()->GroupConstructors->setTitle(tr("SHAPE_TYPE"));
95 mainFrame()->RadioButton1->setIcon(image0);
96 mainFrame()->RadioButton2->setIcon(image1);
97 mainFrame()->RadioButton3->setIcon(image2);
98 mainFrame()->RadioButton4->setIcon(image3);
99 mainFrame()->RadioButton4->show();
102 mainFrame()->GroupBoxName->setTitle(tr("GROUP_NAME"));
104 // Main shape and sub-shapes
105 QGroupBox* GroupMedium = new QGroupBox(tr("MAIN_SUB_SHAPES"), centralWidget());
106 QGridLayout* aMedLayout = new QGridLayout(GroupMedium);
107 aMedLayout->setMargin(9);
108 aMedLayout->setSpacing(6);
110 QLabel* aMainLabel = new QLabel(tr("MAIN_SHAPE"), GroupMedium);
112 mySelBtn = new QPushButton(GroupMedium);
113 mySelBtn->setIcon(iconSelect);
114 mySelBtn->setEnabled(myMode == CreateGroup);
116 myMainName = new QLineEdit(GroupMedium);
117 myMainName->setReadOnly(true);
118 myMainName->setEnabled(myMode == CreateGroup);
120 myRestrictGroupBox = new QGroupBox(tr("SHAPE_SEL_RESTR"), GroupMedium);
121 myRestrictGroup = new QButtonGroup(myRestrictGroupBox);
122 QRadioButton* allSubs = new QRadioButton(tr("NO_RESTR") , myRestrictGroupBox);
123 QRadioButton* inPlaceSubs = new QRadioButton(tr("GEOM_PARTS_OF_SHAPE2"), myRestrictGroupBox);
124 QRadioButton* shape2Subs = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2") , myRestrictGroupBox);
125 QGridLayout* aRestrictLayout = new QGridLayout(myRestrictGroupBox);
127 QLabel* aSecondLabel = new QLabel(tr("SECOND_SHAPE"), myRestrictGroupBox);
128 mySelBtn2 = new QPushButton(myRestrictGroupBox);
129 mySelBtn2->setIcon(iconSelect);
130 mySelBtn2->setEnabled(false);
131 myShape2Name = new QLineEdit(myRestrictGroupBox);
132 myShape2Name->setReadOnly(true);
133 myShape2Name->setEnabled(false);
135 aRestrictLayout->setMargin(9);
136 aRestrictLayout->setSpacing(6);
137 aRestrictLayout->addWidget(allSubs, 0, 0, 1, 3);
138 aRestrictLayout->addWidget(inPlaceSubs, 1, 0, 1, 3);
139 aRestrictLayout->addWidget(shape2Subs, 2, 0, 1, 3);
140 aRestrictLayout->addWidget(aSecondLabel, 3, 0);
141 aRestrictLayout->addWidget(mySelBtn2, 3, 1);
142 aRestrictLayout->addWidget(myShape2Name, 3, 2);
143 myRestrictGroup->addButton(allSubs, ALL_SUBSHAPES);
144 myRestrictGroup->addButton(inPlaceSubs, GET_IN_PLACE);
145 myRestrictGroup->addButton(shape2Subs, SUBSHAPES_OF_SHAPE2);
146 myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj));
147 allSubs->setChecked(true);
149 myShowOnlyBtn = new QPushButton(tr("SHOW_ONLY_SELECTED"), GroupMedium);
150 myHideSelBtn = new QPushButton(tr("HIDE_SELECTED"), GroupMedium);
151 myShowAllBtn = new QPushButton(tr("SHOW_ALL_SUB_SHAPES"), GroupMedium);
153 mySelAllBtn = new QPushButton(tr("SELECT_ALL"), GroupMedium);
154 myAddBtn = new QPushButton(tr("ADD"), GroupMedium);
155 myRemBtn = new QPushButton(tr("REMOVE"), GroupMedium);
157 myIdList = new QListWidget(GroupMedium);
159 myIdList->setSelectionMode(QAbstractItemView::ExtendedSelection);
160 myIdList->setFlow(QListView::TopToBottom);
161 myIdList->setWrapping(true);
163 aMedLayout->addWidget(aMainLabel, 0, 0);
164 aMedLayout->addWidget(mySelBtn, 0, 1);
165 aMedLayout->addWidget(myMainName, 0, 2, 1, 2);
166 aMedLayout->addWidget(myRestrictGroupBox, 1, 0, 4, 3);
168 aMedLayout->addWidget(myShowOnlyBtn, 1, 3);
169 aMedLayout->addWidget(myHideSelBtn, 2, 3);
170 aMedLayout->addWidget(myShowAllBtn, 3, 3);
172 aMedLayout->addWidget(myIdList, 5, 0, 4, 3);
173 aMedLayout->addWidget(mySelAllBtn, 5, 3);
174 aMedLayout->addWidget(myAddBtn, 6, 3);
175 aMedLayout->addWidget(myRemBtn, 7, 3);
177 aMedLayout->setColumnStretch(2, 5);
178 aMedLayout->setRowStretch(5, 5);
179 aMedLayout->setRowStretch(8, 5);
181 QVBoxLayout* layout = new QVBoxLayout(centralWidget());
182 layout->setMargin(0); layout->setSpacing(6);
183 layout->addWidget(GroupMedium);
185 setHelpFileName("work_with_groups_page.html");
191 GroupGUI_GroupDlg::~GroupGUI_GroupDlg()
193 GEOM_Displayer* aDisplayer = getDisplayer();
194 if (myIsHiddenMain) {
195 aDisplayer->Display(myMainObj);
196 myIsHiddenMain = false;
198 aDisplayer->Display(myGroup);
202 //=================================================================================
205 //=================================================================================
206 void GroupGUI_GroupDlg::Init()
209 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
211 //unset shape type to avoid preparation of selection before exact user shape type selection
212 unsetConstructorId();
213 myIsShapeType = false;
215 if (myMode == CreateGroup) {
216 initName(tr("GROUP_PREFIX"));
218 // Get ready for main shape selection
219 myEditCurrentArgument = myMainName;
221 connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
222 connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
223 connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
225 else if (myMode == EditGroup) {
226 SALOME_ListIO aSelList;
227 aSelMgr->selectedObjects(aSelList);
229 if (aSelList.Extent()) {
230 GEOM::GEOM_Object_var anObj =
231 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
233 if (!CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) {
236 mainFrame()->ResultName->setText(GEOMBase::GetName(myGroup));
238 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
239 myMainObj = anOper->GetMainShape(myGroup);
240 if (!CORBA::is_nil(myMainObj))
241 myMainName->setText(GEOMBase::GetName(myMainObj));
243 setShapeType((TopAbs_ShapeEnum)anOper->GetType(myGroup));
245 GEOM::ListOfLong_var aCurrList = anOper->GetObjects(myGroup);
246 for (int i = 0, n = aCurrList->length(); i < n; i++) {
247 QListWidgetItem* itm = new QListWidgetItem( QString( "%1" ).arg( aCurrList[ i ] ) );
248 myGroupIdList.append( aCurrList[ i ] );
249 itm->setTextColor( QColor( GROUP_IDLST_COLOR ) );
250 myIdList->addItem( itm );
252 myEditCurrentArgument = 0;
254 connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
258 connect(aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
260 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
261 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
263 connect(myRestrictGroup, SIGNAL(buttonClicked(int)), this, SLOT(SetEditCurrentArgument()));
264 connect(mySelAllBtn, SIGNAL(clicked()), this, SLOT(selectAllSubShapes()));
265 connect(myAddBtn, SIGNAL(clicked()), this, SLOT(add()));
266 connect(myRemBtn, SIGNAL(clicked()), this, SLOT(remove()));
267 connect(myShowOnlyBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
268 connect(myHideSelBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
269 connect(myShowAllBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
270 connect(myIdList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
272 setInPlaceObj(GEOM::GEOM_Object::_nil());
274 myBusy = true; // just activate but do not select in the list
279 //=================================================================================
280 // function : enterEvent()
282 //=================================================================================
283 void GroupGUI_GroupDlg::enterEvent(QEvent* e)
285 if (!buttonCancel()->isEnabled())
286 ActivateThisDialog();
289 //=================================================================================
290 //function : closeEvent
291 //purpose : remove temporary geom object
292 //=================================================================================
293 void GroupGUI_GroupDlg::closeEvent(QCloseEvent* e)
295 setInPlaceObj(GEOM::GEOM_Object::_nil());
298 GEOMBase_Skeleton::closeEvent(e);
301 //=================================================================================
302 // function : ClickOnOk()
304 //=================================================================================
305 void GroupGUI_GroupDlg::ClickOnOk()
307 setIsApplyAndClose(true);
310 setIsApplyAndClose(false);
313 //=================================================================================
314 // function : ClickOnApply()
316 //=================================================================================
317 bool GroupGUI_GroupDlg::ClickOnApply()
319 if(!isApplyAndClose()) {
320 setIsDisableBrowsing( true );
321 setIsDisplayResult( false );
324 if (!onAccept(myMode == CreateGroup, true, isApplyAndClose()))
327 if(!isApplyAndClose()) {
328 setIsDisableBrowsing( false );
329 setIsDisplayResult( true );
332 if (myMode == CreateGroup)
336 ConstructorsClicked(getConstructorId());
340 int n = myIdList->count();
341 myGroupIdList.clear();
344 for (int i = 0; i < n; i++) {
345 QListWidgetItem* anItem = myIdList->item( i );
346 myGroupIdList.append( anItem->text().toInt() );
347 anItem->setTextColor( GROUP_IDLST_COLOR );
355 //=================================================================================
356 // function : ActivateThisDialog()
358 //=================================================================================
359 void GroupGUI_GroupDlg::ActivateThisDialog()
361 GEOMBase_Skeleton::ActivateThisDialog();
363 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
364 this, SLOT(SelectionIntoArgument()));
369 //=================================================================================
370 // function : SetEditCurrentArgument()
372 //=================================================================================
373 void GroupGUI_GroupDlg::SetEditCurrentArgument()
375 QPushButton* send = (QPushButton*)sender();
377 if (send == mySelBtn) {
378 myEditCurrentArgument = myMainName;
379 myShape2Name->setText("");
381 else if (send == mySelBtn2 || sender() == myRestrictGroup) {
382 setInPlaceObj(GEOM::GEOM_Object::_nil());
383 myShape2Name->setText("");
384 if (subSelectionWay() != ALL_SUBSHAPES) {
385 myEditCurrentArgument = myShape2Name;
388 myEditCurrentArgument = 0;
397 //=================================================================================
398 // function : onGetInPlace()
400 //=================================================================================
401 void GroupGUI_GroupDlg::onGetInPlace()
403 setInPlaceObj(GEOM::GEOM_Object::_nil());
404 myEditCurrentArgument->setText("");
406 bool isBlocked = myIdList->signalsBlocked();
407 myIdList->blockSignals(true);
408 myIdList->clearSelection();
409 myIdList->blockSignals(isBlocked);
411 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
412 SALOME_ListIO aSelList;
413 aSelMgr->selectedObjects(aSelList);
415 if (aSelList.Extent() != 1)
418 GEOM::GEOM_Object_var anObj =
419 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
420 if (GEOMBase::IsShape(anObj)) {
421 if (!anObj->_is_equivalent(myMainObj) && !anObj->_is_equivalent(myGroup)) {
422 SUIT_OverrideCursor wc;
423 myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
424 GEOM::GEOM_IShapesOperations_var aShapesOp =
425 getGeomEngine()->GetIShapesOperations(getStudyId());
426 if (subSelectionWay() == GET_IN_PLACE) {
427 GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj);
428 setInPlaceObj(aGetInPlaceObj);
431 bool isVisible = true;
432 if (SALOME_View* view = GEOM_Displayer::GetActiveView())
433 isVisible = view->isVisible(aSelList.First());
434 setInPlaceObj(anObj, isVisible);
436 myEditCurrentArgument = 0;
437 //myBusy = true; // just activate but do not select in the list
444 //=================================================================================
445 //function : setInPlaceObj
446 //purpose : temporarily add an object to study and remove old InPlaceObj
447 //=================================================================================
448 void GroupGUI_GroupDlg::setInPlaceObj(GEOM::GEOM_Object_var theObj, const bool isVisible)
450 if (!myInPlaceObj->_is_equivalent(theObj))
452 myInPlaceObj = theObj;
455 // build map of indices
456 myMain2InPlaceIndices.Clear();
457 if (!myInPlaceObj->_is_nil()) {
458 GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
459 GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId());
461 GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode(myInPlaceObj, getShapeType(), false);
462 for ( int i = 0; i < aSubObjects->length(); i++ )
464 GEOM::ListOfLong_var aCurrList = aShapesOp->GetSameIDs( myMainObj, aSubObjects[i] );
465 if( aCurrList->length() > 1 ) {
466 //rnv : To Fix the 21561: EDF 2184 GEOM: Group with second shape restriction.
467 // In case if GetSameIDs(...) method return more then one ID use
468 // GetSharedShapes(...) method to get sub-shapes of the second shape.
469 GEOM::ListOfGO_var aSubObjects2 = aShapesOp->GetSharedShapes( myMainObj, aSubObjects[i], getShapeType() );
470 for( int j = 0; j < aSubObjects2->length(); j++ ) {
471 CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects2[j] );
472 CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i]);
473 if ( aMainIndex >= 0 && aPlaceIndex > 0 ) {
474 myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex );
477 } else if(aCurrList->length() > 0 ) {
478 CORBA::Long aMainIndex = aCurrList[0];
479 CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i] );
480 if ( aMainIndex >= 0 && aPlaceIndex > 0) {
481 myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex );
486 myInPlaceObjSelectState = subSelectionWay();
487 if (myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible)
488 myInPlaceObjSelectState = SUBSHAPES_OF_INVISIBLE_SHAPE2;
491 //=================================================================================
492 // function : SelectionIntoArgument()
493 // purpose : Called when selection has changed
494 //=================================================================================
495 void GroupGUI_GroupDlg::SelectionIntoArgument()
497 if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name) {
502 if (myEditCurrentArgument == myMainName) { // Selection of a main shape is active
503 myEditCurrentArgument->setText("");
506 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
507 SALOME_ListIO aSelList;
508 aSelMgr->selectedObjects(aSelList);
509 int nbSel = aSelList.Extent();
512 GEOM::GEOM_Object_var anObj =
513 GEOMBase::ConvertIOinGEOMObject(aSelList.First());
515 if (GEOMBase::IsShape(anObj)) {
516 if (myIsHiddenMain) {
517 GEOM_Displayer* aDisplayer = getDisplayer();
518 aDisplayer->Display(myMainObj);
519 myIsHiddenMain = false;
522 myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
523 // activate sub-shapes selection by default
524 myEditCurrentArgument = 0;
530 if (myIsHiddenMain) {
531 GEOM_Displayer* aDisplayer = getDisplayer();
532 aDisplayer->Display(myMainObj);
533 myIsHiddenMain = false;
535 myMainObj = GEOM::GEOM_Object::_nil();
538 else { // an attempt to synchronize list box selection with 3d viewer
539 if (myBusy || myMainObj->_is_nil()) {
543 bool isBlocked = myIdList->signalsBlocked();
544 myIdList->blockSignals(true);
545 myIdList->clearSelection();
547 TColStd_IndexedMapOfInteger aMapIndex;
548 int nbSel = getSelectedSubshapes(aMapIndex);
552 for (int i = 0, n = myIdList->count(); i < n; i++)
553 aMap.insert(myIdList->item(i)->text().toInt(), i);
555 bool highlight = false;
556 for (int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++) {
557 if (aMap.contains(aMapIndex(ii))) {
558 myIdList->item(aMap[aMapIndex(ii)])->setSelected(true);
563 highlightSubShapes();
565 myIdList->blockSignals(isBlocked);
571 //=================================================================================
572 // function : ConstructorsClicked()
573 // purpose : Radio button management
574 //=================================================================================
575 void GroupGUI_GroupDlg::ConstructorsClicked(int constructorId)
577 if (getConstructorId() != constructorId)
578 setConstructorId(constructorId);
580 myIsShapeType = true;
582 myEditCurrentArgument = 0;
584 setInPlaceObj(myInPlaceObj); // to rebuild myMain2InPlaceIndices
589 //=================================================================================
590 // function : selectAllSubShapes
592 //=================================================================================
593 void GroupGUI_GroupDlg::selectAllSubShapes()
595 if (CORBA::is_nil(myMainObj) || !myIsShapeType)
598 GEOM::ListOfLong_var aSubShapes;
599 GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations(getStudyId());
600 aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false);
601 if (aSubShapes->length() > 0) {
602 if (subSelectionWay() == ALL_SUBSHAPES)
604 // myIdList->clear(); // for sorted final list?
606 if (!aShOp->IsDone())
611 aSubShapes = new GEOM::ListOfLong();
612 aSubShapes->length(myMain2InPlaceIndices.Extent());
613 TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip (myMain2InPlaceIndices);
614 for (int i = 0; m2ip.More(); i++, m2ip.Next())
615 aSubShapes[i] = m2ip.Key();
618 bool isBlocked = myIdList->signalsBlocked();
619 myIdList->blockSignals(true);
621 for (int i = 0, n = aSubShapes->length(); i < n; i++) {
622 CORBA::Long anIndex = aSubShapes[i];
626 QListWidgetItem* anItem = 0;
627 QString text = QString("%1").arg(anIndex);
628 // if (!myInPlaceObj->_is_nil()) {
629 QList<QListWidgetItem*> found = myIdList->findItems(text, Qt::MatchExactly);
630 if (found.count()) anItem = found[0];
633 anItem = new QListWidgetItem(text);
634 anItem->setTextColor( myGroupIdList.contains(anIndex) ? QColor( GROUP_IDLST_COLOR ) : QColor( GROUP_NEWIDLST_COLOR ) );
635 myIdList->addItem(anItem);
637 anItem->setSelected(true);
640 myIdList->blockSignals(isBlocked);
641 highlightSubShapes();
645 //=================================================================================
646 // function : showOnlySelected
648 //=================================================================================
649 void GroupGUI_GroupDlg::showOnlySelected()
651 if (CORBA::is_nil(myMainObj) || !myIsShapeType)
654 QPushButton* send = (QPushButton*)sender();
655 if (send == myShowAllBtn) {
660 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
661 SALOME_ListIO aSelList;
662 aSelMgr->selectedObjects(aSelList);
664 GEOM_Displayer* aDisplayer = getDisplayer();
666 if (send == myHideSelBtn) {
667 aDisplayer->Erase(aSelList, /*forced=*/false, /*updateViewer=*/true);
670 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
671 SALOME_View* view = GEOM_Displayer::GetActiveView();
673 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
674 Handle(SALOME_InteractiveObject) io =
675 new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
676 if (view->isVisible(io)) myIsHiddenMain = true;
678 //keep the selected entry and IO in the map for checking
679 std::map<QString, Handle(SALOME_InteractiveObject)> aSelEntriesMap;
680 SALOME_ListIteratorOfListIO aSelIt(aSelList);
681 for ( ; aSelIt.More(); aSelIt.Next() ) {
682 Handle(SALOME_InteractiveObject) anSelIO = aSelIt.Value();
683 aSelEntriesMap[anSelIO->getEntry()] = anSelIO;
685 //get the displayed sub-shapes
686 SALOME_ListIO displayed;
687 view->GetVisible(displayed);
688 // Erase all, except the selected sub-shapes
689 std::map<QString, Handle(SALOME_InteractiveObject)>::iterator
690 aSelDispIter = aSelEntriesMap.end();
691 SALOME_ListIteratorOfListIO aDispIt( displayed );
692 for ( ; aDispIt.More(); aDispIt.Next() ) {
693 Handle(SALOME_InteractiveObject) anIO = aDispIt.Value();
694 aSelDispIter = aSelEntriesMap.find( anIO->getEntry() );
695 if ( aSelDispIter != aSelEntriesMap.end() ) {
696 //sub-shape is selected, so erase it's record from map to keep in it not displayed, but selected sub-shapes only
697 aSelEntriesMap.erase(aSelDispIter);
699 //sub-shape is not in the map of selected, then erase it from view
700 aDisplayer->Erase( anIO, /*forced = */false, /*updateViewer = */false );
704 if ( !aSelEntriesMap.empty() ) {
705 // Build a presentation of the selected, but not displayed sub-shapes
706 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
707 TopTools_IndexedMapOfShape aSubShapesMap;
708 TopExp::MapShapes(aMainShape, aSubShapesMap);
709 QString anEntryBase = aMainEntry.in();
711 TopExp_Explorer anExp (aMainShape, getShapeType());
712 for (; anExp.More(); anExp.Next()) {
713 TopoDS_Shape aSubShape = anExp.Current();
714 int index = aSubShapesMap.FindIndex(aSubShape);
715 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
716 if ( aSelEntriesMap.find( anEntry ) == aSelEntriesMap.end() ) {
717 //skip not selected sub-shapes
720 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, view);
722 displayPreview(aPrs, true, false); // append, do not update
726 aDisplayer->UpdateViewer();
729 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
730 if (getShapeType() == TopAbs_VERTEX && myIsHiddenMain) {
731 aDisplayer->Display(myMainObj);
734 // for the case when selected ids were not displayed in the viewer: Mantis issue 0021367
735 highlightSubShapes();
739 //=================================================================================
740 // function : getSelectedSubshapes
742 //=================================================================================
743 int GroupGUI_GroupDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex)
747 SalomeApp_Application* app = myGeomGUI->getApp();
748 if (!app || myMainObj->_is_nil())
751 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
752 SALOME_ListIO aSelList;
753 aSelMgr->selectedObjects(aSelList);
755 // try to find out and process the global selection
756 // (of not published objects and of published sub-shapes)
758 SALOME_ListIteratorOfListIO anIter (aSelList);
759 for (int i = 0; anIter.More(); anIter.Next(), i++)
761 Handle(SALOME_InteractiveObject) anIObj = anIter.Value();
762 QString anEntry = anIObj->getEntry();
764 int index = anEntry.lastIndexOf(str);
765 if (index > 0) // selection among special preview
767 anEntry.remove(0, index+1);
768 int anIndex = anEntry.toInt();
770 theMapIndex.Add(anIndex);
772 else // selection among published shapes
774 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
775 if (!appStudy) return 0;
776 _PTR(Study) aStudy = appStudy->studyDS();
778 _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
779 GEOM::GEOM_Object_var aGeomObj =
780 GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
782 if (GEOMBase::GetShape(aGeomObj, aShape)) {
783 if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) {
784 TopTools_IndexedMapOfShape aMainMap;
785 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
786 TopExp::MapShapes(aMainShape, aMainMap);
788 TopExp_Explorer anExp (aShape, getShapeType());
789 for (; anExp.More(); anExp.Next()) {
790 TopoDS_Shape aSubShape = anExp.Current();
791 int anIndex = aMainMap.FindIndex(aSubShape);
793 SUIT_MessageBox::warning(app->desktop(), QObject::tr("WRN_WARNING"),
794 tr("WRN_NOT_SUBSHAPE"));
797 if (subSelectionWay() != ALL_SUBSHAPES &&
798 !myMain2InPlaceIndices.IsBound(anIndex))
800 theMapIndex.Add(anIndex);
809 return theMapIndex.Extent();
812 //=================================================================================
815 //=================================================================================
816 void GroupGUI_GroupDlg::add()
818 TColStd_IndexedMapOfInteger aMapIndex;
819 int nbSel = getSelectedSubshapes(aMapIndex);
821 TColStd_MapOfInteger aMap;
822 for (int i = 0, n = myIdList->count(); i < n; i++)
823 aMap.Add(myIdList->item(i)->text().toInt());
826 bool isBlocked = myIdList->signalsBlocked();
827 myIdList->blockSignals(true);
829 for (int i = 1, n = aMapIndex.Extent(); i <= n; i++) {
830 if (aMap.Contains(aMapIndex(i)))
833 QListWidgetItem* anItem = new QListWidgetItem(QString("%1").arg(aMapIndex(i)));
834 anItem->setTextColor( myGroupIdList.contains( aMapIndex( i ) ) ? QColor( GROUP_IDLST_COLOR ) : QColor( GROUP_NEWIDLST_COLOR ) );
835 myIdList->addItem(anItem);
836 anItem->setSelected(true);
839 myIdList->blockSignals(isBlocked);
845 //=================================================================================
848 //=================================================================================
849 void GroupGUI_GroupDlg::remove()
851 bool isBlocked = myIdList->signalsBlocked();
852 myIdList->blockSignals(true);
854 QListIterator<QListWidgetItem*> it (myIdList->selectedItems());
858 myIdList->blockSignals(isBlocked);
860 highlightSubShapes();
863 //=================================================================================
864 //function : subSelectionWay
866 //=================================================================================
867 int GroupGUI_GroupDlg::subSelectionWay() const
869 return myRestrictGroup->checkedId();
872 //=================================================================================
873 // function : getShapeType()
875 //=================================================================================
876 TopAbs_ShapeEnum GroupGUI_GroupDlg::getShapeType() const
878 switch (getConstructorId()) {
879 case 0: return TopAbs_VERTEX;
880 case 1: return TopAbs_EDGE;
881 case 2: return TopAbs_FACE;
882 case 3: return TopAbs_SOLID;
883 default: return TopAbs_SHAPE;
887 //=================================================================================
888 // function : setShapeType()
890 //=================================================================================
891 void GroupGUI_GroupDlg::setShapeType(const TopAbs_ShapeEnum theType)
895 case TopAbs_VERTEX: anId = 0; break;
896 case TopAbs_EDGE: anId = 1; break;
897 case TopAbs_FACE: anId = 2; break;
898 case TopAbs_SOLID: anId = 3; break;
900 setConstructorId(anId);
903 myIsShapeType = true;
904 // workaround to avoid set checked button 0
905 setConstructorId(anId);
909 //=================================================================================
910 // function : activateSelection
911 // purpose : Activate selection in accordance with myEditCurrentArgument
912 //=================================================================================
913 void GroupGUI_GroupDlg::activateSelection()
915 bool isApply = ((QPushButton*)sender() == buttonApply());
916 if(!isApplyAndClose())
920 if (!myMainObj->_is_nil() &&
921 !myEditCurrentArgument &&
922 myIsShapeType) // check if shape type is already choosen by user
924 GEOM_Displayer* aDisplayer = getDisplayer();
926 //display mode for main shape
927 if ( myDmMode == -1 ) {
928 SALOME_View* view = GEOM_Displayer::GetActiveView();
930 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
931 Handle(SALOME_InteractiveObject) io =
932 new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
933 if ( view->isVisible( io ) ) {
934 Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIOinGEOMAISShape( io, true );
936 myDmMode = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
940 myDmMode = SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "display_mode" );
943 aDisplayer->SetDisplayMode(myDmMode);
945 // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
946 if(getShapeType() != TopAbs_VERTEX) {
947 aDisplayer->Erase(myMainObj, false, false);
948 myIsHiddenMain = true;
951 aDisplayer->Display(myMainObj);
953 aDisplayer->Erase(myGroup, false, false);
955 QColor aColor = SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", "editgroup_color" );
956 Quantity_NameOfColor aCol = SalomeApp_Tools::color( aColor ).Name();
958 if(!isApplyAndClose()) {
959 SUIT_ViewWindow* aViewWindow = 0;
960 SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
962 aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
963 if (aViewWindow == 0) return;
965 SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
966 if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
967 aViewManager->getType() != SVTK_Viewer::Type())
970 SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
971 SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
972 if (aView == 0) return;
974 TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
975 TopoDS_Shape aRestrictionShape;
977 if (subSelectionWay() == ALL_SUBSHAPES) {
978 aRestrictionShape = aMainShape;
980 TopTools_IndexedMapOfShape aSubShapesMap;
981 TopExp::MapShapes(aMainShape, aSubShapesMap);
982 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
983 QString anEntryBase = aMainEntry.in();
985 TopExp_Explorer anExp (aRestrictionShape, getShapeType());
986 for (; anExp.More(); anExp.Next()) {
987 TopoDS_Shape aSubShape = anExp.Current();
988 int index = aSubShapesMap.FindIndex(aSubShape);
989 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
990 Handle(SALOME_InteractiveObject) io =
991 new SALOME_InteractiveObject(anEntry.toAscii(), "GEOM", "TEMP_IO");
992 if ( myGroupIdList.contains( index ) ) {
993 aDisplayer->SetColor( aCol );
996 aDisplayer->UnsetColor();
998 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
1000 displayPreview(aPrs, true, false); // append, do not update
1001 // TODO: map or delete Prs
1005 else if (!myInPlaceObj->_is_nil()) {
1006 TopTools_IndexedMapOfShape aSubShapesMap;
1007 TopExp::MapShapes(aMainShape, aSubShapesMap);
1008 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
1009 QString anEntryBase = aMainEntry.in();
1011 TColStd_DataMapIteratorOfDataMapOfIntegerInteger aM2IPit (myMain2InPlaceIndices);
1012 for (; aM2IPit.More(); aM2IPit.Next()) {
1013 int index = aM2IPit.Key();
1014 TopoDS_Shape aSubShape = aSubShapesMap.FindKey(index);
1015 QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
1017 if ( myGroupIdList.contains( index ) ) {
1018 aDisplayer->SetColor( aCol );
1021 aDisplayer->UnsetColor();
1024 SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
1026 displayPreview(aPrs, true, false); // append, do not update
1031 aDisplayer->UnsetDisplayMode();
1032 aDisplayer->UnsetColor();
1033 aDisplayer->UpdateViewer();
1037 globalSelection(GEOM_ALLSHAPES);
1039 SelectionIntoArgument();
1042 //=================================================================================
1043 // function : updateState
1045 //=================================================================================
1046 void GroupGUI_GroupDlg::updateState (bool isAdd)
1048 myAddBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd);
1049 //myShowOnlyBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd);
1051 bool hasSel = myIdList->selectedItems().count() > 0;
1053 myRemBtn->setEnabled(hasSel);
1054 myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj));
1055 mySelAllBtn->setEnabled(!CORBA::is_nil(myMainObj));
1057 mySelBtn2->setEnabled(subSelectionWay() != ALL_SUBSHAPES);
1058 myShape2Name->setEnabled(subSelectionWay() != ALL_SUBSHAPES);
1059 if (subSelectionWay() == ALL_SUBSHAPES)
1060 setInPlaceObj(GEOM::GEOM_Object::_nil());
1063 //=================================================================================
1064 // function : selectionChanged
1066 //=================================================================================
1067 void GroupGUI_GroupDlg::selectionChanged()
1069 highlightSubShapes();
1072 //=================================================================================
1073 // function : highlightSubShapes
1075 //=================================================================================
1076 void GroupGUI_GroupDlg::highlightSubShapes()
1078 if (CORBA::is_nil(myMainObj))
1081 TColStd_MapOfInteger anIds;
1085 int ii = 0, nn = myIdList->count();
1086 for (; ii < nn; ii++)
1088 if (myIdList->item(ii)->isSelected()) {
1089 int id = myIdList->item(ii)->text().toInt();
1090 if (subSelectionWay() != ALL_SUBSHAPES &&
1091 !myMain2InPlaceIndices.IsBound(id)) {
1092 //myIdList->item(ii)->setSelected(false);
1099 SalomeApp_Application* app = myGeomGUI->getApp();
1100 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
1101 aSelMgr->clearSelected();
1103 SUIT_ViewWindow* aViewWindow = 0;
1104 SUIT_Study* activeStudy = app->activeStudy();
1106 aViewWindow = app->desktop()->activeWindow();
1107 if (aViewWindow == 0) return;
1109 SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
1110 if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
1111 aViewManager->getType() != SVTK_Viewer::Type())
1114 SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
1115 SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
1116 if (aView == 0) return;
1118 // TODO??: use here GEOMBase_Helper::myPreview instead of ic->DisplayedObjects()
1120 OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)aViewManager)->getOCCViewer();
1121 Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
1122 AIS_ListOfInteractive List;
1123 //ic->DisplayedObjects(List);
1124 ic->ObjectsInside(List); // Mantis issue 0021367
1126 SALOME_ListIO aSelList;
1128 // To highlight the selected sub-shape in Object Browser, if it's already published under the main shape
1129 GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId());
1130 QMap<int, QString> childsMap;
1131 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
1133 _PTR(Study) aStudy = appStudy->studyDS();
1134 CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
1135 QString anEntry = aMainEntry.in();
1136 _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
1137 _PTR(ChildIterator) anIt (aStudy->NewChildIterator(aSObj));
1138 for (anIt->InitEx(true); anIt->More(); anIt->Next()) {
1139 GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value()));
1140 if (!CORBA::is_nil(aChild)) {
1141 int index = aLocOp->GetSubShapeIndex(myMainObj, aChild);
1142 CORBA::String_var aChildEntry = aChild->GetStudyEntry();
1143 QString anEntry = aChildEntry.in();
1144 childsMap.insert(index, anEntry);
1149 AIS_ListIteratorOfListOfInteractive ite (List);
1150 for (; ite.More(); ite.Next()) {
1151 if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
1152 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
1154 Handle(SALOME_InteractiveObject) anIO = aSh->getIO();
1155 QString anEntry = anIO->getEntry();
1156 int index = anEntry.lastIndexOf("_");
1157 anEntry.remove(0, index+1);
1158 int anIndex = anEntry.toInt();
1159 if (anIds.Contains(anIndex)) {
1160 aSelList.Append(anIO);
1161 if (childsMap.contains (anIndex)) {
1162 Handle(SALOME_InteractiveObject) tmpIO = new SALOME_InteractiveObject(childsMap.value(anIndex).toLatin1().constData(), "GEOM", "TEMP_IO");
1163 aSelList.Append(tmpIO);
1169 aSelMgr->setSelectedObjects(aSelList);
1174 updateState(aSelList.Extent() > 0);
1176 myAddBtn->setEnabled(true);
1177 myAddBtn->setEnabled(true);
1178 myRemBtn->setEnabled(true);
1182 //=================================================================================
1183 // function : createOperation
1185 //=================================================================================
1186 GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation()
1188 return getGeomEngine()->GetIGroupOperations(getStudyId());
1191 #define RETURN_WITH_MSG(a, b) \
1193 theMessage += (b); \
1197 //=================================================================================
1198 // function : isValid()
1199 // purpose : Verify validity of input data
1200 //=================================================================================
1201 bool GroupGUI_GroupDlg::isValid(QString& theMessage)
1203 SalomeApp_Study* study = getStudy();
1205 RETURN_WITH_MSG (!study->studyDS()->GetProperties()->IsLocked(), tr("GEOM_STUDY_LOCKED"))
1207 if (myMode == CreateGroup) {
1208 RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_MAIN_OBJ"))
1211 RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_GROUP"))
1214 QString aName (getNewObjectName());
1215 RETURN_WITH_MSG (!aName.trimmed().isEmpty(), tr("EMPTY_NAME"))
1217 RETURN_WITH_MSG (myIdList->count(), tr("EMPTY_LIST"))
1221 //=================================================================================
1222 // function : execute
1224 //=================================================================================
1225 bool GroupGUI_GroupDlg::execute(ObjectList& objects)
1227 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
1229 GEOM::GEOM_Object_var aGroup;
1230 if (myMode == CreateGroup)
1231 aGroup = anOper->CreateGroup(myMainObj, getShapeType());
1232 else if (myMode == EditGroup)
1235 if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOper->IsDone()))
1238 GEOM::ListOfLong_var aCurrList = anOper->GetObjects(aGroup);
1239 if (!anOper->IsDone())
1242 if (aCurrList->length() > 0)
1244 anOper->DifferenceIDs(aGroup, aCurrList);
1245 if (!anOper->IsDone())
1249 int ii, nn = myIdList->count();
1252 GEOM::ListOfLong_var aNewList = new GEOM::ListOfLong;
1253 aNewList->length(nn);
1254 for (ii = 0; ii < nn; ii++) {
1255 aNewList[ii] = myIdList->item(ii)->text().toInt();
1257 anOper->UnionIDs(aGroup, aNewList);
1258 if (!anOper->IsDone())
1262 SalomeApp_Study* study = getStudy();
1264 QString objIOR = GEOMBase::GetIORFromObject(aGroup);
1266 _PTR(SObject) SO (study->studyDS()->FindObjectIOR(objIOR.toLatin1().constData()));
1268 _PTR(StudyBuilder) aBuilder (study->studyDS()->NewBuilder());
1269 aBuilder->SetName(SO, getNewObjectName().toLatin1().constData());
1274 objects.push_back(aGroup._retn());
1279 //================================================================
1280 // Function : getFather
1281 // Purpose : Get father object for object to be added in study
1282 // (called with addInStudy method)
1283 //================================================================
1284 GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather(GEOM::GEOM_Object_ptr theObj)
1286 GEOM::GEOM_Object_var aFatherObj;
1287 if (theObj->GetType() == GEOM_GROUP) {
1288 GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
1289 aFatherObj = anOper->GetMainShape(theObj);
1291 return aFatherObj._retn();