Salome HOME
0022765: [EDF] Improvement of local selection mechanism
[modules/gui.git] / src / Prs / SALOME_Prs.cxx
index 8f952cda876b8b5181f2d87f5646f1300db8c1e9..45960968bb6467973a94b9f536392d23c1762645 100755 (executable)
@@ -41,6 +41,14 @@ const char* SALOME_Prs::GetEntry() const
   return myEntry.c_str();
 }
 
+/*!
+  Dispatches operation of activation of sub-shapes selection
+*/
+void SALOME_Prs::LocalSelectionIn( SALOME_View*, const std::list<int> ) const
+{
+  // base implementation does nothing
+}
+
 /*!
   Dispatches display operation to proper Display() method of SALOME_View
 */
@@ -94,7 +102,17 @@ void SALOME_OCCPrs::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
 */
 void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
 {
-  if ( v ) v->LocalSelection( this, mode );
+  std::list<int> modes;
+  modes.push_back( mode );
+  LocalSelectionIn( v, modes );
+}
+
+/*!
+  Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const std::list<int> modes ) const
+{
+  if ( v && !modes.empty() ) v->LocalSelection( this, modes );
 }
 
 /*!
@@ -256,7 +274,17 @@ void SALOME_View::Erase( SALOME_Displayer* d, const SALOME_Prs* prs, const bool
 */
 void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
 {
-  prs->LocalSelectionIn( this, mode );
+  std::list<int> modes;
+  modes.push_back( mode );
+  LocalSelection( prs, modes );
+}
+
+/*!
+  Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
+void SALOME_View::LocalSelection( const SALOME_Prs* prs, const std::list<int> modes )
+{
+  prs->LocalSelectionIn( this, modes );
 }
 
 /*!
@@ -325,6 +353,15 @@ void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const int )
 //   Probably, selection is being activated in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const std::list<int> )
+{
+//  MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
+//   Probably, selection is being activated in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */