IPAL21558 In Group creation dialog, selection of sub-shapes in OB, viewer and dialog is not well syncronized

This commit is contained in:
dmv 2010-02-05 09:40:56 +00:00
parent 7f1598797a
commit 07c4797eb5

View File

@ -488,11 +488,16 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
for (int i = 0, n = myIdList->count(); i < n; i++) for (int i = 0, n = myIdList->count(); i < n; i++)
aMap.insert(myIdList->item(i)->text().toInt(), i); aMap.insert(myIdList->item(i)->text().toInt(), i);
bool highlight = false;
for (int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++) { 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); myIdList->item(aMap[aMapIndex(ii)])->setSelected(true);
highlight = true;
} }
} }
if ( highlight )
highlightSubShapes();
}
myIdList->blockSignals(isBlocked); myIdList->blockSignals(isBlocked);
updateState(nbSel); updateState(nbSel);
@ -914,6 +919,27 @@ void GroupGUI_GroupDlg::highlightSubShapes()
SALOME_ListIO aSelList; 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); AIS_ListIteratorOfListOfInteractive ite (List);
for (; ite.More(); ite.Next()) { for (; ite.More(); ite.Next()) {
if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
@ -924,8 +950,13 @@ void GroupGUI_GroupDlg::highlightSubShapes()
int index = anEntry.lastIndexOf("_"); int index = anEntry.lastIndexOf("_");
anEntry.remove(0, index+1); anEntry.remove(0, index+1);
int anIndex = anEntry.toInt(); int anIndex = anEntry.toInt();
if (anIds.Contains(anIndex)) if ( anIds.Contains(anIndex) ) {
aSelList.Append(anIO); 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);
}
}
} }
} }
} }