From: mzn Date: Fri, 17 Jun 2005 07:37:11 +0000 (+0000) Subject: Fix for Bug IPAL8957(3.0.0: GEOM local selections don't work in OCC viewer). X-Git-Tag: T3_0_0_a4~96 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=86f5c4e3e04f5e0d4f012497e70f83796fbc856f;p=modules%2Fgui.git Fix for Bug IPAL8957(3.0.0: GEOM local selections don't work in OCC viewer). --- diff --git a/src/SUIT/SUIT_DataOwner.cxx b/src/SUIT/SUIT_DataOwner.cxx index fbfc19448..2726fefb9 100755 --- a/src/SUIT/SUIT_DataOwner.cxx +++ b/src/SUIT/SUIT_DataOwner.cxx @@ -1,5 +1,13 @@ #include "SUIT_DataOwner.h" +#ifndef WNT +#include +#define _typeinfo std::type_info +#else +#include +#define _typeinfo type_info +#endif + //******************************************************************** // SUIT_DataOwner class //******************************************************************** @@ -30,7 +38,7 @@ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) //******************************************************************** // SUIT_DataOwnerPtrList class: implements value list with unique -// items (uniqueness is provided by operator==() and compareItems() +// items (uniqueness is provided by operator==()) //******************************************************************** //==================================================================== @@ -66,15 +74,12 @@ SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOw { SUIT_DataOwnerPtrList::iterator it = find( x ); if ( it != end() ) - return it; - return QValueList::append( x ); -} + { + const _typeinfo& ti1 = typeid( *((*it).operator->()) ); + const _typeinfo& ti2 = typeid( *(x.operator->()) ); -//==================================================================== -// Compares two items -//==================================================================== -int SUIT_DataOwnerPtrList::compareItems( const SUIT_DataOwnerPtr& item1, const SUIT_DataOwnerPtr& item2 ) -{ - return item1 == item2; + if (ti1 == ti2) + return it; + } + return QValueList::append( x ); } - diff --git a/src/SUIT/SUIT_DataOwner.h b/src/SUIT/SUIT_DataOwner.h index f70b63d9c..d951a37cc 100755 --- a/src/SUIT/SUIT_DataOwner.h +++ b/src/SUIT/SUIT_DataOwner.h @@ -33,9 +33,6 @@ public: iterator append ( const SUIT_DataOwnerPtr& x ); -protected: - virtual int compareItems( const SUIT_DataOwnerPtr& item1, const SUIT_DataOwnerPtr& item2 ); - private: // hide this methods: only append() should be used to add items to the list iterator prepend( const SUIT_DataOwnerPtr& x ); diff --git a/src/SalomeApp/SalomeApp_SelectionMgr.cxx b/src/SalomeApp/SalomeApp_SelectionMgr.cxx index 683d5327b..8c432279c 100644 --- a/src/SalomeApp/SalomeApp_SelectionMgr.cxx +++ b/src/SalomeApp/SalomeApp_SelectionMgr.cxx @@ -43,11 +43,16 @@ void SalomeApp_SelectionMgr::selectedObjects( SALOME_ListIO& theList, const QStr SUIT_DataOwnerPtrList aList; selected( aList, theType ); + QMap entryMap; + for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) { const SalomeApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if( owner ) + if( !owner ) continue; + + if ( !entryMap.contains(owner->entry()) ) theList.Append( owner->IO() ); + entryMap.insert(owner->entry(), 1); } }