Salome HOME
updated copyright message
[modules/gui.git] / src / Prs / SALOME_Prs.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 871a4ca..deb496b
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 
 #include "SALOME_Prs.h"
 
+/*!
+  Constructor
+*/
+SALOME_Prs::SALOME_Prs(const char* e) : myIsClippable(true)
+{
+  myEntry = std::string( e ? e : "" );
+}
+
+/*!
+  Get entry
+*/
+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
 */
@@ -78,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 );
 }
 
 /*!
@@ -153,6 +187,80 @@ void SALOME_VTKPrs::Update( SALOME_Displayer* d )
   if ( d ) d->Update( this );
 }
 
+/*!
+  Dispatches display operation to proper Display() method of SALOME_View
+*/
+void SALOME_PV3DPrs::DisplayIn( SALOME_View* v ) const
+{
+  if ( v ) v->Display( this );
+}
+
+/*!
+  Dispatches display operation to proper Erase() method of SALOME_View
+*/
+void SALOME_PV3DPrs::EraseIn( SALOME_View* v, const bool forced ) const
+{
+  if ( v ) v->Erase( this, forced );
+}
+
+/*!
+  Dispatches display operation to proper BeforeDisplay() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
+{
+  d->BeforeDisplay( v, this );
+}
+
+/*!
+  Dispatches display operation to proper AfterDisplay() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
+{
+  d->AfterDisplay( v, this );
+}
+
+/*!
+  Dispatches display operation to proper BeforeErase() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
+{
+  d->BeforeErase( v, this );
+}
+
+/*!
+  Dispatches display operation to proper AfterErase() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
+{
+  d->AfterErase( v, this );
+}
+
+/*!
+  Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_PV3DPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
+{
+  std::list<int> modes;
+  modes.push_back( mode );
+  LocalSelectionIn( v, modes );
+}
+
+/*!
+  Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_PV3DPrs::LocalSelectionIn( SALOME_View* v, const std::list<int> modes ) const
+{
+  if ( v && !modes.empty() ) v->LocalSelection( this, modes );
+}
+
+/*!
+   Dispatches update operation to proper Update() method of SALOME_Displayer
+*/
+void SALOME_PV3DPrs::Update( SALOME_Displayer* d )
+{
+  if ( d ) d->Update( this );
+}
+
 /*!
   Dispatches display operation to proper Display() method of SALOME_View
 */
@@ -220,17 +328,19 @@ void SALOME_Prs2d::Update( SALOME_Displayer* d )
 /*!
   Gives control to SALOME_Prs object, so that it could perform double dispatch
 */
-void SALOME_View::Display( const SALOME_Prs* prs )
+void SALOME_View::Display( SALOME_Displayer* d, const SALOME_Prs* prs )
 {
   prs->DisplayIn( this );
+  if ( d ) d->UpdateVisibility( this, prs, true );
 }
 
 /*!
   Gives control to SALOME_Prs object, so that it could perform double dispatch
 */
-void SALOME_View::Erase( const SALOME_Prs* prs, const bool forced )
+void SALOME_View::Erase( SALOME_Displayer* d, const SALOME_Prs* prs, const bool forced )
 {
   prs->EraseIn( this, forced );
+  if ( d ) d->UpdateVisibility( this, prs, false );
 }
 
 /*!
@@ -238,7 +348,17 @@ void SALOME_View::Erase( const SALOME_Prs* prs, const bool forced )
 */
 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 );
 }
 
 /*!
@@ -257,6 +377,14 @@ void SALOME_View::Display( const SALOME_VTKPrs* )
 //  MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Display( const SALOME_PV3DPrs* )
+{
+//  MESSAGE( "SALOME_View::Display( const SALOME_PV3DPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
@@ -281,6 +409,14 @@ void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
 //  MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Erase( const SALOME_PV3DPrs*, const bool )
+{
+//  MESSAGE( "SALOME_View::Erase( const SALOME_PV3DPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
@@ -292,9 +428,10 @@ void SALOME_View::Erase( const SALOME_Prs2d*, const bool )
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
-void SALOME_View::EraseAll( const bool )
+void SALOME_View::EraseAll( SALOME_Displayer* d, const bool )
 {
 //  MESSAGE( "SALOME_View::EraseAll() called!" );
+  if ( d ) d->UpdateVisibility( this, 0, false );
 }
 
 /*!
@@ -306,6 +443,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.
 */
@@ -315,6 +461,15 @@ void SALOME_View::LocalSelection( const SALOME_VTKPrs*, 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_PV3DPrs*, const int )
+{
+//  MESSAGE( "SALOME_View::LocalSelection( const SALOME_PV3DPrs* ) called!
+//   Probably, selection is being activated in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
@@ -377,6 +532,14 @@ void SALOME_Displayer::Update( SALOME_VTKPrs* )
 //  MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_Displayer::Update( SALOME_PV3DPrs* )
+{
+//  MESSAGE( "SALOME_Displayer::Update( SALOME_PV3DPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
+}
+
 /*!
   Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
 */
@@ -385,3 +548,9 @@ void SALOME_Displayer::Update( SALOME_Prs2d* )
 //  MESSAGE( "SALOME_Displayer::Update( SALOME_Prs2d* ) called! Probably, presentation is being updated in uncompatible viewframe." );
 }
 
+/*!
+  Virtual method, should be reimplemented in successors, by default does nothing.
+*/
+void SALOME_Displayer::UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool )
+{
+}