]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for Bug IPAL8957(3.0.0: GEOM local selections don't work in OCC viewer).
authormzn <mzn@opencascade.com>
Fri, 17 Jun 2005 07:37:11 +0000 (07:37 +0000)
committermzn <mzn@opencascade.com>
Fri, 17 Jun 2005 07:37:11 +0000 (07:37 +0000)
src/SUIT/SUIT_DataOwner.cxx
src/SUIT/SUIT_DataOwner.h
src/SalomeApp/SalomeApp_SelectionMgr.cxx

index fbfc19448046748bf60d0fd23ea557a791d42e39..2726fefb99d396d7a1c72bb54577d3692375a167 100755 (executable)
@@ -1,5 +1,13 @@
 #include "SUIT_DataOwner.h"
 
+#ifndef WNT
+#include <typeinfo>
+#define _typeinfo std::type_info
+#else
+#include <typeinfo.h>
+#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<SUIT_DataOwnerPtr>::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<SUIT_DataOwnerPtr>::append( x );
 }
-
index f70b63d9ca803e51a8fc0d75822fc777302c4d9d..d951a37cc4dbf8323569d9e9e9d58fdf0f6cc402 100755 (executable)
@@ -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 );
index 683d5327b971110246ec4c0a2c80e520f5399cf6..8c432279c675703b1c5f8e00ba8194bd94450162 100644 (file)
@@ -43,11 +43,16 @@ void SalomeApp_SelectionMgr::selectedObjects( SALOME_ListIO& theList, const QStr
   SUIT_DataOwnerPtrList aList;
   selected( aList, theType );
 
+  QMap<QString,int> entryMap;
+
   for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
   {
     const SalomeApp_DataOwner* owner = dynamic_cast<const SalomeApp_DataOwner*>( (*itr).operator->() );
-    if( owner )
+    if( !owner ) continue;
+    
+    if ( !entryMap.contains(owner->entry()) )
       theList.Append( owner->IO() );
+    entryMap.insert(owner->entry(), 1);
   }
 }