From: jfa Date: Wed, 24 Oct 2007 08:28:52 +0000 (+0000) Subject: NPAL17269: Merge from 3.2.X. X-Git-Tag: V4_1_0a3~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1284fb70d1fedd8815d9a553cc1cfdcd899b431b;p=modules%2Fgeom.git NPAL17269: Merge from 3.2.X. --- diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx index 26c475ec3..0452e97ba 100644 --- a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx @@ -314,7 +314,10 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) vw->unHighlightAll( false ); // DO the selection - for ( int i = 1, n = ownersmap.Extent(); i <= n; i++ ) + int i = 1, n = ownersmap.Extent(); + bool isAutoHilight = ic->AutomaticHilight(); + ic->SetAutomaticHilight(Standard_False); //Bug 17269: for better performance + for (; i <= n; i++) { Handle(SelectMgr_EntityOwner) owner = ownersmap( i ); if ( owner->State() ) @@ -325,8 +328,11 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) else ic->AddOrRemoveSelected( Handle(AIS_InteractiveObject)::DownCast(owner->Selectable()), false ); } - - vw->update(); + ic->SetAutomaticHilight(isAutoHilight); //Bug 17269: restore mode + if (n < 3000) + ic->HilightSelected(/*updateviewer*/Standard_True); + else + vw->update(); // fill extra selected mySelectedExternals.clear(); diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index 548bfc8ee..8ea7ae829 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -313,14 +313,16 @@ void GroupGUI_GroupDlg::SelectionIntoArgument() TColStd_IndexedMapOfInteger aMapIndex; - if ( IObjectCount() == 1 ) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); - - if ( aResult && !anObj->_is_nil() ) - ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))-> - selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); + SALOME_ListIO aSelIOs; + SalomeApp_Application* app = myGeomGUI->getApp(); + if (app) { + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if (aSelMgr) { + QMap aMap; + aSelMgr->selectedSubOwners(aMap); + if (aMap.size() == 1) + aMapIndex = aMap.begin().data(); + } } // try to find out and process the object browser selection @@ -438,14 +440,16 @@ void GroupGUI_GroupDlg::add() TColStd_IndexedMapOfInteger aMapIndex; - if ( IObjectCount() == 1 ) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); - - if ( aResult && !anObj->_is_nil() ) - ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))-> - selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); + SALOME_ListIO aSelIOs; + SalomeApp_Application* app = myGeomGUI->getApp(); + if (app) { + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if (aSelMgr) { + QMap aMap; + aSelMgr->selectedSubOwners(aMap); + if (aMap.size() == 1) + aMapIndex = aMap.begin().data(); + } } // try to find out and process the object browser selection @@ -510,11 +514,17 @@ void GroupGUI_GroupDlg::add() //================================================================================= void GroupGUI_GroupDlg::remove() { + bool isBlocked = myIdList->signalsBlocked(); + myIdList->blockSignals( true ); + for ( int i = myIdList->count() - 1; i >= 0; i-- ) { if ( myIdList->isSelected( i ) ) myIdList->removeItem( i ); } - updateState(); + + myIdList->blockSignals( isBlocked ); + + highlightSubShapes(); } @@ -589,16 +599,10 @@ void GroupGUI_GroupDlg::updateState() if (app) { LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); if (aSelMgr) { - aSelMgr->selectedObjects(aSelIOs); - - if ( aSelIOs.Extent() == 1 ) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( aSelIOs.First(), aResult ); - - if ( aResult && !anObj->_is_nil() ) - aSelMgr->GetIndexes( aSelIOs.First(), aMapIndex ); - } + QMap aMap; + aSelMgr->selectedSubOwners(aMap); + if (aMap.size() == 1) + aMapIndex = aMap.begin().data(); } } @@ -698,18 +702,27 @@ void GroupGUI_GroupDlg::highlightSubShapes() myBusy = true; - for ( int ii = 0, nn = myIdList->count(); ii < nn; ii++ ) + int ii = 0, nn = myIdList->count(); + for ( ; ii < nn; ii++ ) if ( myIdList->isSelected( ii ) ) anIds.Add( myIdList->item( ii )->text().toInt() ); - LightApp_SelectionMgr* aSelMgr = - ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + SalomeApp_Application* app = myGeomGUI->getApp(); + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); aSelMgr->clearSelected(); - aSelMgr->AddOrRemoveIndex( aSh->getIO(), anIds, false ); + //if (nn < 3000) aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false); + aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false); myBusy = false; - updateState(); + //updateState(); + if (nn < 3000) { + updateState(); + } + else { + myAddBtn->setEnabled( true ); + myRemBtn->setEnabled( true ); + } } //=================================================================================