From 06656bb3f5cd381adeb91aa7c2787c7aa61f9ef8 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 17 Oct 2007 10:03:04 +0000 Subject: [PATCH] NPAL17269: Performance pb. when creating a group with GUI. --- src/GEOMGUI/GEOMGUI_OCCSelector.cxx | 9 +++++++-- src/GroupGUI/GroupGUI_GroupDlg.cxx | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx index 066a19b42..1732d0624 100644 --- a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx @@ -318,7 +318,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); // for better performance + for (; i <= n; i++) { Handle(SelectMgr_EntityOwner) owner = ownersmap( i ); if ( owner->State() ) @@ -329,8 +332,10 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) else ic->AddOrRemoveSelected( Handle(AIS_InteractiveObject)::DownCast(owner->Selectable()), false ); } + ic->SetAutomaticHilight(isAutoHilight); // restore - vw->update(); + ic->HilightSelected(/*updateviewer*/Standard_True); + //vw->update(); // fill extra selected mySelectedExternals.clear(); diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index 7e0e5355c..d970fc9f6 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -510,11 +510,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(); } @@ -694,6 +700,7 @@ void GroupGUI_GroupDlg::highlightSubShapes() return; TColStd_MapOfInteger anIds; + //TColStd_IndexedMapOfInteger anIds; myBusy = true; @@ -701,10 +708,16 @@ void GroupGUI_GroupDlg::highlightSubShapes() 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 ); + aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false); + //SUIT_DataOwnerPtrList aList; + //Handle(SALOME_InteractiveObject) IObject = aSh->getIO(); + //for (int i = 1; i <= anIds.Extent(); i++) + // aList.append(new LightApp_DataSubOwner(QString(IObject->getEntry()), anIds(i))); + //aSelMgr->setSelected(aList, /*append*/false); + ////aSelMgr->selectObjects(aSh->getIO(), anIds, /*append*/false); myBusy = false; -- 2.39.2