From 210a76c4baa2e86c11cc005e51dde7cd675409a6 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 24 Oct 2007 08:27:33 +0000 Subject: [PATCH] NPAL17269: Merge from 3.2.X. --- src/LightApp/LightApp_SelectionMgr.cxx | 46 +++++++++++++++++--------- src/LightApp/LightApp_SelectionMgr.h | 3 +- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/LightApp/LightApp_SelectionMgr.cxx b/src/LightApp/LightApp_SelectionMgr.cxx index ca18b5759..1c9e38b86 100644 --- a/src/LightApp/LightApp_SelectionMgr.cxx +++ b/src/LightApp/LightApp_SelectionMgr.cxx @@ -212,23 +212,26 @@ void LightApp_SelectionMgr::GetIndexes( const QString& theEntry, TColStd_Indexed /*! Add or remove interactive objects from selection manager. */ -bool LightApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, - const TColStd_MapOfInteger& theIndexes, - bool modeShift) +//bool LightApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, +void LightApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, + const TColStd_MapOfInteger& theIndexes, + bool modeShift) { SUIT_DataOwnerPtrList remainsOwners; - + SUIT_DataOwnerPtrList aList; selected( aList ); + QString ioEntry (IObject->getEntry()); + if ( !modeShift ) { for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) { const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if ( owner ) + if ( owner ) { - if ( owner->entry() != QString(IObject->getEntry()) ) - { + if ( owner->entry() != ioEntry ) + { const LightApp_DataSubOwner* subOwner = dynamic_cast( owner ); if ( subOwner ) remainsOwners.append( new LightApp_DataSubOwner( subOwner->entry(), subOwner->index() ) ); @@ -244,17 +247,17 @@ bool LightApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObj TColStd_MapIteratorOfMapOfInteger It; It.Initialize(theIndexes); for(;It.More();It.Next()) - remainsOwners.append( new LightApp_DataSubOwner( QString(IObject->getEntry()), It.Key() ) ); - + remainsOwners.append( new LightApp_DataSubOwner( ioEntry, It.Key() ) ); + bool append = false; setSelected( remainsOwners, append ); emit currentSelectionChanged(); - TColStd_IndexedMapOfInteger anIndexes; - GetIndexes( IObject, anIndexes ); - return !anIndexes.IsEmpty(); - + // Bug 17269: To avoid calling of selected(aList) + //TColStd_IndexedMapOfInteger anIndexes; + //GetIndexes( IObject, anIndexes ); + //return !anIndexes.IsEmpty(); } /*! @@ -316,14 +319,25 @@ void LightApp_SelectionMgr::selectedSubOwners( MapEntryOfMapOfInteger& theMap ) for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) { - const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); + const LightApp_DataSubOwner* subOwner = + dynamic_cast( (*itr).operator->() ); if ( subOwner ) { if ( !theMap.contains( subOwner->entry() ) ) { anIndexes.Clear(); - GetIndexes( subOwner->entry(), anIndexes ); - theMap.insert( subOwner->entry(), anIndexes ); + //Bug 17269: GetIndexes( subOwner->entry(), anIndexes ); + //Bug 17269: To avoid multiple calling of selected(aList) + for ( SUIT_DataOwnerPtrList::const_iterator itr2 = itr; itr2 != aList.end(); ++itr2 ) + { + const LightApp_DataSubOwner* subOwner2 = + dynamic_cast( (*itr2).operator->() ); + if ( subOwner2 ) + if ( subOwner2->entry() == subOwner->entry() ) + anIndexes.Add( subOwner2->index() ); + } + // + theMap.insert( subOwner->entry(), anIndexes ); } } } diff --git a/src/LightApp/LightApp_SelectionMgr.h b/src/LightApp/LightApp_SelectionMgr.h index be758e079..d865cac15 100644 --- a/src/LightApp/LightApp_SelectionMgr.h +++ b/src/LightApp/LightApp_SelectionMgr.h @@ -62,7 +62,8 @@ public: void GetIndexes( const QString& theEntry, TColStd_IndexedMapOfInteger& theIndex ); - bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, + //bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, + void AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, const TColStd_MapOfInteger& theIndices, bool modeShift ); -- 2.39.2