-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// GEOM GEOMGUI : GUI for Geometry component
// File : GroupGUI_GroupDlg.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
-
+//
#include "GroupGUI_GroupDlg.h"
#include <DlgRef.h>
myMainName->setReadOnly(true);
myMainName->setEnabled(myMode == CreateGroup);
- QLabel* aSecondLabel = new QLabel(tr("SECOND_SHAPE"), GroupMedium);
+ myRestrictGroupBox = new QGroupBox(tr("SHAPE_SEL_RESTR"), GroupMedium);
+ myRestrictGroup = new QButtonGroup(myRestrictGroupBox);
+ QRadioButton* allSubs = new QRadioButton(tr("NO_RESTR") , myRestrictGroupBox);
+ QRadioButton* inPlaceSubs = new QRadioButton(tr("GEOM_PARTS_OF_SHAPE2"), myRestrictGroupBox);
+ QRadioButton* shape2Subs = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2") , myRestrictGroupBox);
+ QGridLayout* aRestrictLayout = new QGridLayout(myRestrictGroupBox);
- mySelBtn2 = new QPushButton(GroupMedium);
+ QLabel* aSecondLabel = new QLabel(tr("SECOND_SHAPE"), myRestrictGroupBox);
+ mySelBtn2 = new QPushButton(myRestrictGroupBox);
mySelBtn2->setIcon(iconSelect);
mySelBtn2->setEnabled(false);
-
- myShape2Name = new QLineEdit(GroupMedium);
+ myShape2Name = new QLineEdit(myRestrictGroupBox);
myShape2Name->setReadOnly(true);
myShape2Name->setEnabled(false);
- myRestrictGroupBox = new QGroupBox(tr("SHAPE_SEL_RESTR"), GroupMedium);
- myRestrictGroup = new QButtonGroup(myRestrictGroupBox);
- QRadioButton* allSubs = new QRadioButton(tr("NO_RESTR") , myRestrictGroupBox);
- QRadioButton* inPlaceSubs = new QRadioButton(tr("GEOM_PARTS_OF_SHAPE2"), myRestrictGroupBox);
- QRadioButton* shape2Subs = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2") , myRestrictGroupBox);
- QVBoxLayout* aRestrictLayout = new QVBoxLayout(myRestrictGroupBox);
aRestrictLayout->setMargin(9);
aRestrictLayout->setSpacing(6);
- aRestrictLayout->addWidget(allSubs);
- aRestrictLayout->addWidget(inPlaceSubs);
- aRestrictLayout->addWidget(shape2Subs);
- myRestrictGroup->addButton(allSubs, ALL_SUBSHAPES);
- myRestrictGroup->addButton(inPlaceSubs, GET_IN_PLACE);
- myRestrictGroup->addButton(shape2Subs, SUBSHAPES_OF_SHAPE2);
+ aRestrictLayout->addWidget(allSubs, 0, 0, 1, 3);
+ aRestrictLayout->addWidget(inPlaceSubs, 1, 0, 1, 3);
+ aRestrictLayout->addWidget(shape2Subs, 2, 0, 1, 3);
+ aRestrictLayout->addWidget(aSecondLabel, 3, 0);
+ aRestrictLayout->addWidget(mySelBtn2, 3, 1);
+ aRestrictLayout->addWidget(myShape2Name, 3, 2);
+ myRestrictGroup->addButton(allSubs, ALL_SUBSHAPES);
+ myRestrictGroup->addButton(inPlaceSubs, GET_IN_PLACE);
+ myRestrictGroup->addButton(shape2Subs, SUBSHAPES_OF_SHAPE2);
+ myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj));
allSubs->setChecked(true);
myShowOnlyBtn = new QPushButton(tr("Show only selected"), GroupMedium);
aMedLayout->addWidget(aMainLabel, 0, 0);
aMedLayout->addWidget(mySelBtn, 0, 1);
aMedLayout->addWidget(myMainName, 0, 2, 1, 2);
- aMedLayout->addWidget(aSecondLabel, 1, 0);
- aMedLayout->addWidget(mySelBtn2, 1, 1);
- aMedLayout->addWidget(myShape2Name, 1, 2, 1, 2);
- aMedLayout->addWidget(myRestrictGroupBox, 2, 0, 3, 3);
+ aMedLayout->addWidget(myRestrictGroupBox, 1, 0, 4, 3);
- aMedLayout->addWidget(myShowOnlyBtn, 2, 3);
- aMedLayout->addWidget(myHideSelBtn, 3, 3);
- aMedLayout->addWidget(myShowAllBtn, 4, 3);
+ aMedLayout->addWidget(myShowOnlyBtn, 1, 3);
+ aMedLayout->addWidget(myHideSelBtn, 2, 3);
+ aMedLayout->addWidget(myShowAllBtn, 3, 3);
+ aMedLayout->addWidget(myIdList, 5, 0, 4, 3);
aMedLayout->addWidget(mySelAllBtn, 5, 3);
aMedLayout->addWidget(myAddBtn, 6, 3);
aMedLayout->addWidget(myRemBtn, 7, 3);
- aMedLayout->addWidget(myIdList, 5, 0, 3, 3);
- aMedLayout->setRowStretch(5, 1);
+ aMedLayout->setColumnStretch( 2, 5 );
+ aMedLayout->setRowStretch(5, 5);
+ aMedLayout->setRowStretch(8, 5);
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
for (int i = 0, n = myIdList->count(); i < n; i++)
aMap.insert(myIdList->item(i)->text().toInt(), i);
+ bool highlight = false;
for (int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++) {
- if (aMap.contains(aMapIndex(ii)))
+ if (aMap.contains(aMapIndex(ii))) {
myIdList->item(aMap[aMapIndex(ii)])->setSelected(true);
+ highlight = true;
+ }
}
+ if ( highlight )
+ highlightSubShapes();
}
myIdList->blockSignals(isBlocked);
SALOME_ListIO aSelList;
+ // To highlight the selected subshape in Object Browser, if it's already pudlished under the main shape
+ GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId());
+ QMap<int, QString> childsMap;
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+ if (appStudy) {
+ _PTR(Study) aStudy = appStudy->studyDS();
+ CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
+ QString anEntry = aMainEntry.in();
+ _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
+ _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
+ for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
+ GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value()));
+ if ( !CORBA::is_nil( aChild ) ) {
+ int index = aLocOp->GetSubShapeIndex(myMainObj, aChild);
+ CORBA::String_var aChildEntry = aChild->GetStudyEntry();
+ QString anEntry = aChildEntry.in();
+ childsMap.insert(index, anEntry);
+ }
+ }
+ }
+
AIS_ListIteratorOfListOfInteractive ite (List);
for (; ite.More(); ite.Next()) {
if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
int index = anEntry.lastIndexOf("_");
anEntry.remove(0, index+1);
int anIndex = anEntry.toInt();
- if (anIds.Contains(anIndex))
+ if ( anIds.Contains(anIndex) ) {
aSelList.Append(anIO);
+ if ( childsMap.contains ( anIndex )) {
+ Handle(SALOME_InteractiveObject) tmpIO = new SALOME_InteractiveObject( childsMap.value(anIndex).toLatin1().constData(), "GEOM", "TEMP_IO" );
+ aSelList.Append(tmpIO);
+ }
+ }
}
}
}