]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
MPV NPAL13114: for OCCViewer we have to store not-displayed selected objects also...
authormpv <mpv@opencascade.com>
Wed, 27 Dec 2006 07:50:33 +0000 (07:50 +0000)
committermpv <mpv@opencascade.com>
Wed, 27 Dec 2006 07:50:33 +0000 (07:50 +0000)
onDeselection slot clears this list: in calls in case on selection in OCC viewer without shift pressed before setSelection method call.

src/LightApp/LightApp_OCCSelector.cxx
src/LightApp/LightApp_OCCSelector.h

index 446ae593bf46bdbea8381408e4d4823d1f35c556..beb379e07a3ab7562a8ec6b4929d8912ba5bdd18 100644 (file)
@@ -33,8 +33,10 @@ LightApp_OCCSelector::LightApp_OCCSelector( OCCViewer_Viewer* viewer, SUIT_Selec
 : SUIT_Selector( mgr, viewer ),
   myViewer( viewer )
 {
-  if ( myViewer )
+  if ( myViewer ) {
     connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
+    connect( myViewer, SIGNAL( deselection() ), this, SLOT( onDeselection() ) );
+  }
 }
 
 /*!
@@ -58,6 +60,12 @@ void LightApp_OCCSelector::onSelectionChanged()
   selectionChanged();
 }
 
+/*!On selection cleared.*/
+void LightApp_OCCSelector::onDeselection()
+{
+  mySelectedExternals.clear();
+}
+
 /*!Gets selection list.*/
 void LightApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
 {
@@ -77,6 +85,11 @@ void LightApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
       aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( entry( anIt.Value() ) ) ) );
 #endif
     }
+  // add externally selected objects
+  SUIT_DataOwnerPtrList::const_iterator anExtIter;
+  for(anExtIter = mySelectedExternals.begin(); anExtIter != mySelectedExternals.end(); anExtIter++) {
+    aList.append(*anExtIter);
+  }
 }
 
 /*!Sets selection list.*/
@@ -99,12 +112,16 @@ void LightApp_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
     if ( !entryStr.isEmpty() )
       aDisplayed.insert( entryStr, it.Value() );
   }
+  
+  mySelectedExternals.clear();
 
   for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
   {
     const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
     if ( owner && aDisplayed.contains( owner->entry() ) )
       aSelList.Append( aDisplayed[owner->entry()] );
+    else
+      mySelectedExternals.append(*itr);
   }
 
   myViewer->unHighlightAll( false );
index c358efe8aa48fd387c1442201afb0a880a17783d..f0da3b25166e4515c17e2f9a4404718520a6fa10 100644 (file)
@@ -22,6 +22,7 @@
 #include "LightApp.h"
 
 #include <SUIT_Selector.h>
+#include <SUIT_DataOwner.h>
 
 #include <OCCViewer_ViewModel.h>
 
@@ -45,6 +46,7 @@ public:
 
 private slots:
   virtual void      onSelectionChanged();
+  virtual void      onDeselection();
 
 protected:
   virtual void      getSelection( SUIT_DataOwnerPtrList& ) const;
@@ -52,6 +54,8 @@ protected:
 
   QString           entry( const Handle_AIS_InteractiveObject& ) const;
 
+  SUIT_DataOwnerPtrList mySelectedExternals;
+
 private:
   OCCViewer_Viewer* myViewer;
 };