Salome HOME
IPAL52528: TC7.5.0: Dump study - transparency is lost
authorvsr <vsr@opencascade.com>
Thu, 23 Oct 2014 12:24:55 +0000 (16:24 +0400)
committervsr <vsr@opencascade.com>
Thu, 23 Oct 2014 12:24:55 +0000 (16:24 +0400)
Properly process visibility state on Show/Hide operations

20 files changed:
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Displayer.cxx
src/LightApp/LightApp_Displayer.h
src/LightApp/LightApp_Study.cxx
src/LightApp/LightApp_Study.h
src/Plot2d/Plot2d_Prs.h
src/Prs/SALOME_Prs.cxx
src/Prs/SALOME_Prs.h
src/SOCC/SOCC_Prs.cxx
src/SOCC/SOCC_Prs.h
src/SOCC/SOCC_ViewModel.cxx
src/SOCC/SOCC_ViewModel.h
src/SPlot2d/SPlot2d_Prs.cxx
src/SPlot2d/SPlot2d_Prs.h
src/SPlot2d/SPlot2d_ViewModel.cxx
src/SPlot2d/SPlot2d_ViewModel.h
src/SVTK/SVTK_Prs.cxx
src/SVTK/SVTK_Prs.h
src/SVTK/SVTK_ViewModel.cxx
src/SVTK/SVTK_ViewModel.h

index 62bc2441e8aad221528e194d1eb86fa047639966..dac8913c910133c4f5746d004dfdc0f92d16a339 100644 (file)
@@ -3677,7 +3677,7 @@ void LightApp_Application::removeViewManager( SUIT_ViewManager* vm )
            this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
   LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
   if (aStudy )
-    aStudy->removeViewMgr(vm->getGlobalId());
+    aStudy->removeObjectProperties( vm->getGlobalId() );
 
   CAM_Application::removeViewManager( vm );
 
index cde6ceadf9a2e25c4f0ccc312e17d371905211d1..4943c0904271ca5d71987c839f920714aa6297fc 100644 (file)
@@ -88,7 +88,7 @@ void LightApp_Displayer::Display( const QStringList& list, const bool updateView
       {
        myLastEntry = *it;
         vf->BeforeDisplay( this, prs );
-        vf->Display( prs );
+        vf->Display( this, prs );
         vf->AfterDisplay( this, prs );
 
         if ( updateViewer )
@@ -97,7 +97,6 @@ void LightApp_Displayer::Display( const QStringList& list, const bool updateView
       delete prs;  // delete presentation because displayer is its owner
       setVisibilityState(*it, Qtx::ShownState);
     }
-
   }
 }
 
@@ -174,7 +173,7 @@ void LightApp_Displayer::Erase( const QStringList& list, const bool forced,
     if ( prs ) {
       myLastEntry = *it;
       vf->BeforeErase( this, prs );
-      vf->Erase( prs, forced );
+      vf->Erase( this, prs, forced );
       vf->AfterErase( this, prs );
       if ( updateViewer )
         vf->Repaint();
@@ -190,12 +189,12 @@ void LightApp_Displayer::Erase( const QStringList& list, const bool forced,
   \param updateViewer - is it necessary to update viewer
   \param theViewFrame - view
 */
-void LightApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame ) const
+void LightApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame )
 {
   SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
 
   if ( vf ) {
-    vf->EraseAll( forced );
+    vf->EraseAll( this, forced );
     if ( updateViewer )
       vf->Repaint();
   }
index 414db57a2794bed0985a64cb0f9c200b3954cf9f..704b77556c32604c7f0ab2036b1df807f1999e0b 100644 (file)
@@ -51,7 +51,7 @@ public:
   virtual void Erase( const QStringList&, const bool forced = false,
                       const bool updateViewer = true, SALOME_View* = 0);
   void Erase( const QString&, const bool forced = false, const bool updateViewer = true, SALOME_View* = 0 );
-  virtual void EraseAll( const bool forced = false, const bool updateViewer = true, SALOME_View* = 0 ) const;
+  virtual void EraseAll( const bool forced = false, const bool updateViewer = true, SALOME_View* = 0 );
 
   virtual bool IsDisplayed( const QString&, SALOME_View* = 0 ) const;
   void UpdateViewer() const;
index 2b4f0f4df17cce978b797cf4cc27a6008d301344..524498a0e3365d0a8409e70387bf7f902f7a691a 100644 (file)
@@ -532,49 +532,19 @@ QString LightApp_Study::getVisualComponentName() const
   return "Interface Applicative";
 }
 
-
-
-
-
 /*!
   Set a visual property of the object
-  \param theViewId - Id of the viewer namager
+  \param theViewMgrId - Id of the viewer namager
   \param theEntry - Entry of the object
   \param thePropName - the name of the visual property
   \param theValue - the value of the visual property
 */
-void LightApp_Study::setObjectProperty(int theViewId, QString theEntry, QString thePropName, QVariant theValue) {
-  
-  //Try to find viewer manager in the map
-  ViewMgrMap::Iterator v_it = myViewMgrMap.find(theViewId);
-  if(v_it == myViewMgrMap.end()) {
-
-    //1) Create property map
-    PropMap aPropMap;
-    aPropMap.insert(thePropName, theValue);
-    
-    //2) Create object map
-    ObjMap anObjMap;
-    anObjMap.insert(theEntry,aPropMap);
-
-    //3) Insert in the view manager map
-    myViewMgrMap.insert(theViewId, anObjMap);
-    
-  } else {
-    ObjMap& anObjMap = v_it.value();
-    ObjMap::Iterator o_it = anObjMap.find(theEntry);
-    if(o_it == anObjMap.end()) {
-      //1) Create property map
-      PropMap aPropMap;
-      aPropMap.insert(thePropName, theValue);
-      
-      //2) Insert in the object map
-      anObjMap.insert(theEntry, aPropMap);
-    } else {
-      PropMap& aPropMap = o_it.value();
-      aPropMap.insert(thePropName, theValue);
-    }
-  }
+void LightApp_Study::setObjectProperty( int theViewMgrId,
+                                       const QString& theEntry,
+                                       const QString& thePropName,
+                                       const QVariant& theValue )
+{
+  myViewMgrMap[theViewMgrId][theEntry][thePropName] = theValue;
 }
 
 /*!
@@ -585,16 +555,20 @@ void LightApp_Study::setObjectProperty(int theViewId, QString theEntry, QString
   \param theDefValue - the default value of the visual property.
   \return value of the visual propetry. If value is't found then return theDefValue.
 */
-QVariant LightApp_Study::getObjectProperty(int theViewMgrId, QString theEntry, QString thePropName, QVariant theDefValue) const {
-  QVariant& aResult = theDefValue;
-  ViewMgrMap::ConstIterator v_it = myViewMgrMap.find(theViewMgrId);
-  if(v_it != myViewMgrMap.end()){
+QVariant LightApp_Study::getObjectProperty( int theViewMgrId,
+                                           const QString& theEntry,
+                                           const QString& thePropName,
+                                           const QVariant& theDefValue ) const
+{
+  QVariant aResult = theDefValue;
+  ViewMgrMap::ConstIterator v_it = myViewMgrMap.find( theViewMgrId );
+  if ( v_it != myViewMgrMap.end() ) {
     const ObjMap& anObjectMap = v_it.value();
-    ObjMap::ConstIterator o_it = anObjectMap.find(theEntry);
-    if(o_it != anObjectMap.end()) {
+    ObjMap::ConstIterator o_it = anObjectMap.find( theEntry );
+    if ( o_it != anObjectMap.end() ) {
       const PropMap& aPropMap = o_it.value();
-      PropMap::ConstIterator p_it = aPropMap.find(thePropName);
-      if(p_it != aPropMap.end()) {
+      PropMap::ConstIterator p_it = aPropMap.find( thePropName );
+      if ( p_it != aPropMap.end() ) {
        aResult = p_it.value();
       }
     }
@@ -603,13 +577,38 @@ QVariant LightApp_Study::getObjectProperty(int theViewMgrId, QString theEntry, Q
 }
 
 /*!
-  Remove view manager with all objects.
-  \param theViewMgrId - Id of the viewer manager.
+  Set a visual property of the object for all registered viewers
+  \param theEntry - Entry of the object
+  \param thePropName - the name of the visual property
+  \param theValue - the value of the visual property
 */
-void LightApp_Study::removeViewMgr( int theViewMgrId ) { 
-  myViewMgrMap.remove(theViewMgrId);
+void LightApp_Study::setObjectProperty( const QString& theEntry,
+                                       const QString& thePropName,
+                                       const QVariant& theValue )
+{
+  const ViewMgrMap& vm = getObjectProperties();
+  ViewMgrMap::ConstIterator v_it;
+  for ( v_it = vm.begin(); v_it != vm.end(); ++v_it ) {
+    setObjectProperty( v_it.key(), theEntry, thePropName, theValue );
+  }
 }
 
+/*!
+  Set a visual property for all registered objects for given viewer
+  \param theViewMgrId - Id of the viewer manager.
+  \param thePropName - the name of the visual property
+  \param theValue - the value of the visual property
+*/
+void LightApp_Study::setObjectProperty( int theViewMgrId,
+                                       const QString& thePropName,
+                                       const QVariant& theValue )
+{
+  const ObjMap& om = getObjectProperties( theViewMgrId );
+  ObjMap::ConstIterator o_it;
+  for ( o_it = om.begin(); o_it != om.end(); ++o_it ) {
+    setObjectProperty( theViewMgrId, o_it.key(), thePropName, theValue );
+  }
+}
 
 /*!
   Get a map of the properties of the object identified by theViewMgrId and theEntry.
@@ -617,27 +616,18 @@ void LightApp_Study::removeViewMgr( int theViewMgrId ) {
   \param theEntry - Entry of the object.
   \return a map of the properties of the object.
 */
-const PropMap& LightApp_Study::getObjectPropMap(int theViewMgrId, QString theEntry) {
-  ViewMgrMap::Iterator v_it = myViewMgrMap.find(theViewMgrId);
-  if (v_it != myViewMgrMap.end()) {
-    ObjMap& anObjectMap = v_it.value();
-    ObjMap::Iterator o_it = anObjectMap.find(theEntry);
-    if(o_it != anObjectMap.end()) {
-      return o_it.value();
-    } else {
-      PropMap aPropMap;
-      anObjectMap.insert(theEntry, aPropMap);
-      return anObjectMap.find(theEntry).value();
-    }
-  } else {
-    PropMap aPropMap;
-    ObjMap anObjMap;
-    anObjMap.insert(theEntry,aPropMap);
-    myViewMgrMap.insert(theViewMgrId, anObjMap);
-
-    ObjMap& anObjectMap = myViewMgrMap.find(theViewMgrId).value();
-    return anObjectMap.find(theEntry).value();
-  }
+const PropMap& LightApp_Study::getObjectProperties( int theViewMgrId, const QString& theEntry )
+{
+  ViewMgrMap::Iterator v_it = myViewMgrMap.find( theViewMgrId );
+  if ( v_it == myViewMgrMap.end() )
+    v_it = myViewMgrMap.insert( theViewMgrId, ObjMap() );
+  
+  ObjMap& anObjectMap = v_it.value();
+  ObjMap::Iterator o_it = anObjectMap.find( theEntry );
+  if ( o_it == anObjectMap.end() )
+    o_it = anObjectMap.insert( theEntry, PropMap() );
+  
+  return o_it.value();
 }
 
 /*!
@@ -645,84 +635,83 @@ const PropMap& LightApp_Study::getObjectPropMap(int theViewMgrId, QString theEnt
   \param theViewMgrId - Id of the viewer manager.
   \param theEntry - Entry of the object.
 */
-void LightApp_Study::setObjectPropMap(int theViewMgrId, QString theEntry, PropMap thePropMap) {
-  //Try to find viewer manager in the map
-  ViewMgrMap::Iterator v_it = myViewMgrMap.find(theViewMgrId);
-  if(v_it == myViewMgrMap.end()) {
-    
-    //1) Create object map
-    ObjMap anObjMap;
-    anObjMap.insert(theEntry,thePropMap);
-
-    //3) Insert in the view manager map
-    myViewMgrMap.insert(theViewMgrId, anObjMap);
-  } else {
-    ObjMap& anObjMap = v_it.value();
-    anObjMap.insert(theEntry,thePropMap);
-  }
+void LightApp_Study::setObjectProperties( int theViewMgrId,
+                                         const QString& theEntry,
+                                         const PropMap& thePropMap )
+{
+  myViewMgrMap[theViewMgrId][theEntry] = thePropMap;
+}
+
+/*!
+  Remove view manager with all objects.
+  \param theViewMgrId - Id of the viewer manager.
+*/
+void LightApp_Study::removeObjectProperties( int theViewMgrId )
+{ 
+  myViewMgrMap.remove( theViewMgrId );
 }
 
+
 /*!
    Remove object's properties from all view managers.
   \param theEntry - Entry of the object.
 */
-void LightApp_Study::removeObjectFromAll( QString theEntry ) {
-  ViewMgrMap::Iterator v_it = myViewMgrMap.begin();
-  for( ;v_it != myViewMgrMap.end(); v_it++ ) {
-    v_it.value().remove(theEntry);
-  }
+void LightApp_Study::removeObjectProperties( const QString& theEntry )
+{
+  ViewMgrMap::Iterator v_it;
+  for ( v_it = myViewMgrMap.begin(); v_it != myViewMgrMap.end(); v_it++ )
+    v_it.value().remove( theEntry );
 }
 
 /*!
   Get all objects and it's properties from view manager identified by theViewMgrId.
   \param theEntry - Entry of the object.
 */
-const ObjMap& LightApp_Study::getObjectMap ( int theViewMgrId ) {
-  ViewMgrMap::Iterator v_it = myViewMgrMap.find(theViewMgrId);
-  if( v_it == myViewMgrMap.end() ) {
-    ObjMap anObjMap;
-    myViewMgrMap.insert(theViewMgrId , anObjMap);
-    return myViewMgrMap.find(theViewMgrId).value();
-  }
+const ObjMap& LightApp_Study::getObjectProperties( int theViewMgrId )
+{
+  ViewMgrMap::Iterator v_it = myViewMgrMap.find( theViewMgrId );
+  if ( v_it == myViewMgrMap.end() )
+    v_it = myViewMgrMap.insert( theViewMgrId, ObjMap() );
   return v_it.value();
 }
 
+/*!
+  Get global properties map
+*/
+const ViewMgrMap& LightApp_Study::getObjectProperties() const
+{
+  return myViewMgrMap;
+}
+
 /*!
   Set 'visibility state' property of the object.
   \param theEntry - Entry of the object.
   \param theState - visibility status
 */
-void LightApp_Study::setVisibilityState(const QString& theEntry, Qtx::VisibilityState theState) {
+void LightApp_Study::setVisibilityState( const QString& theEntry, Qtx::VisibilityState theState )
+ {
   LightApp_Application* app = (LightApp_Application*)application();
-  if(!app)
-    return;
+  if ( !app ) return;
   SUIT_DataBrowser* db = app->objectBrowser();
-  if(!db)
-    return;
-
-  SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>(db->model());
-  
-  if(treeModel)
-    treeModel->setVisibilityState(theEntry,theState);
+  if ( !db ) return;
+  SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( db->model() );
+  if ( treeModel )
+    treeModel->setVisibilityState( theEntry, theState );
 }
 
 /*!
   Set 'visibility state' property for all object.
   \param theEntry - Entry of the object.
 */
-void LightApp_Study::setVisibilityStateForAll(Qtx::VisibilityState theState) {
-  
+void LightApp_Study::setVisibilityStateForAll( Qtx::VisibilityState theState )
+{
   LightApp_Application* app = (LightApp_Application*)application();
-  if(!app)
-    return;
+  if ( !app ) return;
   SUIT_DataBrowser* db = app->objectBrowser();
-  if(!db)
-    return;
-
-  SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>(db->model());
-  
-  if(treeModel)
-    treeModel->setVisibilityStateForAll(theState);
+  if ( !db ) return;
+  SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( db->model() );
+  if ( treeModel )
+    treeModel->setVisibilityStateForAll( theState );
 }
 
 /*!
@@ -730,18 +719,19 @@ void LightApp_Study::setVisibilityStateForAll(Qtx::VisibilityState theState) {
   \param theEntry - Entry of the object.
   \return 'visibility state' property of the object.
 */
-Qtx::VisibilityState LightApp_Study::visibilityState(const QString& theEntry) const {
+Qtx::VisibilityState LightApp_Study::visibilityState( const QString& theEntry ) const
+{
+  Qtx::VisibilityState state = Qtx::UnpresentableState;
   LightApp_Application* app = (LightApp_Application*)application();
-  if(app) {
-    
+  if ( app ) {
     SUIT_DataBrowser* db = app->objectBrowser();
-    if(db) {
-      SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>(db->model());
-      if(treeModel)
-       return treeModel->visibilityState(theEntry);
+    if ( db ) {
+      SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( db->model() );
+      if ( treeModel )
+       state = treeModel->visibilityState( theEntry );
     }
   }
-  return Qtx::UnpresentableState;
+  return state;
 }
 
 /*!
index 6b8334d8144fd25a57c7b690b6841759c86d3caf..fea8a04f4eb8089fdc904e970b8a742a08a4e1d6 100644 (file)
@@ -96,14 +96,16 @@ public:
 
   virtual QString     getVisualComponentName() const;
 
-  virtual void              setObjectProperty  ( int theViewMgrId, QString theEntry, QString thePropName, QVariant theValue );
-  virtual QVariant          getObjectProperty  ( int theViewMgrId, QString theEntry, QString thePropName, QVariant theDefValue ) const;
-  virtual void              removeViewMgr      ( int theViewMgrId );
-  virtual void              setObjectPropMap   ( int theViewMgrId, QString theEntry, PropMap thePropMap );
-  virtual const PropMap&    getObjectPropMap   ( int theViewMgrId, QString theEntry ) ;
-  virtual void              removeObjectFromAll( QString theEntry );
-  virtual const ObjMap&     getObjectMap       ( int theViewMgrId );
-  virtual const ViewMgrMap& getViewMgrMap      ( int theViewMgrId ) { return myViewMgrMap; };
+  virtual void              setObjectProperty( int, const QString&, const QString&, const QVariant& );
+  virtual void              setObjectProperty( const QString&, const QString&, const QVariant& );
+  virtual void              setObjectProperty( int, const QString&, const QVariant& );
+  virtual void              setObjectProperties( int, const QString&, const PropMap& );
+  virtual QVariant          getObjectProperty( int, const QString&, const QString&, const QVariant& ) const;
+  virtual const PropMap&    getObjectProperties( int, const QString& );
+  virtual const ObjMap&     getObjectProperties( int );
+  virtual const ViewMgrMap& getObjectProperties() const;
+  virtual void              removeObjectProperties( int );
+  virtual void              removeObjectProperties( const QString& );
 
   virtual void                  setVisibilityState(const QString& theEntry, Qtx::VisibilityState theState);
   virtual Qtx::VisibilityState  visibilityState(const QString& theEntry) const;
index d6b3310ed115383d2721e02a4fa30927b5b5a41c..6629e73254b2c20b3b257ab69a04531ea6609e42 100755 (executable)
@@ -31,7 +31,7 @@ class PLOT2D_EXPORT Plot2d_Prs
 public:
   Plot2d_Prs( bool theDelete = false );
   Plot2d_Prs( Plot2d_Object* obj, bool theDelete = false );
-  ~Plot2d_Prs();
+  virtual ~Plot2d_Prs();
 
   objectList getObjects() const;
   void       AddObject( Plot2d_Object* obj );
index 871a4ca84f012dea4c8f81efcf336bd7ec7ffa15..8f952cda876b8b5181f2d87f5646f1300db8c1e9 100755 (executable)
 
 #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 display operation to proper Display() method of SALOME_View
 */
@@ -220,17 +236,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 );
 }
 
 /*!
@@ -292,9 +310,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 );
 }
 
 /*!
@@ -385,3 +404,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 )
+{
+}
index ebef97acdca832d3de29971f48cb83b26091bd65..bb7b5243aca36cc936e837cf56265f22bb52654a 100755 (executable)
@@ -38,6 +38,8 @@ class SALOME_Displayer;
 class SALOME_ListIO;
 class Handle_SALOME_InteractiveObject;
 
+#include <string>
+
 /*!
  \class SALOME_Prs
  Base class for SALOME graphic object wrappers - presentations.
@@ -48,11 +50,14 @@ class PRS_EXPORT SALOME_Prs
 {
 public:
   //! Constructor
-  SALOME_Prs() : myIsClippable (true) {};
-
+  explicit SALOME_Prs( const char* );
   //! Destructor
   virtual ~SALOME_Prs() {}
 
+  //! Get entry
+  const char* GetEntry() const;
+
   //! Key method for double dispatch of display operation
   virtual void DisplayIn( SALOME_View* ) const = 0;
 
@@ -93,7 +98,7 @@ public:
   }
 
 protected:
-
+  std::string myEntry;
   bool myIsClippable;
 };
 
@@ -106,6 +111,9 @@ protected:
 class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
 {
 public:
+  //! Constructor
+  explicit SALOME_OCCPrs(const char* e) : SALOME_Prs(e) {}
+
   //! It uses double dispatch in order to
   //! invoke Display() method corresponding to the actual type of presentation.
   virtual void DisplayIn( SALOME_View* ) const;
@@ -146,6 +154,9 @@ public:
 class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
 {
 public:
+  //! Constructor
+  explicit SALOME_VTKPrs(const char* e) : SALOME_Prs(e) {}
+
   //! It uses double dispatch in order to
   //! invoke Display() method corresponding to the actual type of presentation.
   virtual void DisplayIn( SALOME_View* ) const;
@@ -185,6 +196,9 @@ public:
 class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
 {
 public:
+  //! Constructor
+  explicit SALOME_Prs2d(const char* e) : SALOME_Prs(e) {}
+
   //! It uses double dispatch in order to
   //! invoke Display() method corresponding to the actual type of presentation.
   virtual void DisplayIn( SALOME_View* ) const;
@@ -233,12 +247,16 @@ public:
   //! This Display() method should be called to display given presentation
   //! created anywhere by anybody. It simply passes control to SALOME_Prs object
   //! so that it could perform double dispatch.
-  void Display( const SALOME_Prs* );
+  void Display( SALOME_Displayer*, const SALOME_Prs* );
 
   //! This Erase() method should be called to erase given presentation
   //! created anywhere by anybody. It simply passes control to SALOME_Prs object
   //! so that it could perform double dispatch.
-  void Erase( const SALOME_Prs*, const bool = false );
+  void Erase( SALOME_Displayer*, const SALOME_Prs*, const bool = false );
+
+  //! This EraseAll() method should be called to erase all presentations
+  //! created anywhere by anybody.
+  virtual void EraseAll( SALOME_Displayer*, const bool = false );
 
   //! This LocalSelection() method should be called to activate sub-shapes selection
   //! created anywhere by anybody. It simply passes control to SALOME_Prs object
@@ -257,7 +275,6 @@ public:
   virtual void Erase( const SALOME_OCCPrs*, const bool = false );//!< Erase SALOME_OCCPrs
   virtual void Erase( const SALOME_VTKPrs*, const bool = false );//!< Erase SALOME_VTKPrs
   virtual void Erase( const SALOME_Prs2d*,  const bool = false );//!< Erase SALOME_Prs2d
-  virtual void EraseAll( const bool = false );
   // Add new Erase() methods here...
 
   // LocalSelection() methods for ALL kinds of presentation should appear here
@@ -325,6 +342,8 @@ public:
   virtual void BeforeErase( SALOME_View*, const SALOME_Prs2d*  ) {} //! Null body here
   virtual void AfterErase ( SALOME_View*, const SALOME_Prs2d*  ) {} //! Null body here
 
+  // Axiluary method called to update visibility state of presentation
+  virtual void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool );
 };
 
 #endif
index 1b99d89e7871e80ad7c0699e1fb99b001031a9e5..689fecf357c6ae20d7de0d99218a7b684a8dd947 100644 (file)
@@ -31,7 +31,8 @@
 /*!
   Default constructor
 */
-SOCC_Prs::SOCC_Prs() 
+SOCC_Prs::SOCC_Prs( const char* entry )
+  : SALOME_OCCPrs( entry )
 {
   myToActivate = true;
 }
@@ -39,7 +40,8 @@ SOCC_Prs::SOCC_Prs()
 /*!
   Standard constructor
 */
-SOCC_Prs::SOCC_Prs( const Handle(AIS_InteractiveObject)& obj ) 
+SOCC_Prs::SOCC_Prs( const char* entry, const Handle(AIS_InteractiveObject)& obj ) 
+  : SALOME_OCCPrs( entry )
 {  
   AddObject( obj ); 
 }
index 244d715c4a3f4c8886e49ad49d495b4daccbf454..6bb17f1a88808149abc5491044544045eaf80fe6 100644 (file)
@@ -38,9 +38,9 @@ class Handle(AIS_InteractiveObject);
 class SOCC_EXPORT SOCC_Prs : public SALOME_OCCPrs
 {
 public:
-  SOCC_Prs();
+  explicit SOCC_Prs( const char* entry );
   // Default constructor
-  SOCC_Prs( const Handle(AIS_InteractiveObject)& obj );
+  SOCC_Prs( const char* entry, const Handle(AIS_InteractiveObject)& obj );
   // Standard constructor
   ~SOCC_Prs();
   // Destructor
index 985d1fed7a87d3bc415d62321e8619974926ba18..3def58d2ccb1650f0d76874836487b5eed22fa94 100755 (executable)
@@ -471,7 +471,7 @@ void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
   Erase all presentations
   \param forced - removes all objects from context
 */
-void SOCC_Viewer::EraseAll( const bool forced )
+void SOCC_Viewer::EraseAll( SALOME_Displayer* d, const bool forced )
 {
   // get SALOMEDS Study
   // Temporarily commented to avoid awful dependecy on SALOMEDS
@@ -513,6 +513,8 @@ void SOCC_Viewer::EraseAll( const bool forced )
     //}
   }
 
+  SALOME_View::EraseAll( d, forced );
+
   Repaint();
   updateTrihedron();
 }
@@ -523,7 +525,7 @@ void SOCC_Viewer::EraseAll( const bool forced )
 */
 SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
 {
-  SOCC_Prs* prs = new SOCC_Prs();
+  SOCC_Prs* prs = new SOCC_Prs(entry);
   if ( entry )
   {
     if(entry2aisobjects.count(entry)>0)
index e46e0bfe15f758d7abdbf5ab1baf990870c520e8..9206e7109f53f447e93ed1c406a58f5f8efa0748 100755 (executable)
@@ -58,7 +58,7 @@ public:
   /* Reimplemented from SALOME_View */
   virtual void                Display( const SALOME_OCCPrs* );
   virtual void                Erase( const SALOME_OCCPrs*, const bool = false );
-  virtual void                EraseAll( const bool = false );
+  virtual void                EraseAll( SALOME_Displayer*, const bool = false );
   virtual SALOME_Prs*         CreatePrs( const char* entry = 0 );
 
   virtual void                LocalSelection( const SALOME_OCCPrs*, const int );
index d9ae35dc28ad1cdbe51520a49defedde09b4bd11..7b64b5cce3d0f646e8af4c618adbead77cb65d68 100644 (file)
 /*!
  Default constructor
 */
-SPlot2d_Prs::SPlot2d_Prs()
-:Plot2d_Prs()  
+SPlot2d_Prs::SPlot2d_Prs( const char* entry )
+  : SALOME_Prs2d( entry ), Plot2d_Prs()  
 {
 }
 
 /*!
  Standard constructor
 */
-SPlot2d_Prs::SPlot2d_Prs( const Plot2d_Object* obj )
-:Plot2d_Prs(obj)
+SPlot2d_Prs::SPlot2d_Prs( const char* entry, const Plot2d_Object* obj )
+  : SALOME_Prs2d( entry ), Plot2d_Prs( obj )
 { 
 }
 
@@ -44,9 +44,13 @@ SPlot2d_Prs::SPlot2d_Prs( const Plot2d_Object* obj )
  Standard constructor
 */
 SPlot2d_Prs::SPlot2d_Prs( const Plot2d_Prs* prs )
+  : SALOME_Prs2d( 0 )
 {
   mySecondY = prs->isSecondY();
   myObjects = prs->getObjects();
+  const SPlot2d_Prs* sp = dynamic_cast<const SPlot2d_Prs*>( prs );
+  if ( sp )
+    myEntry = sp->myEntry;
   myIsAutoDel = false;          // VSR: error? should auto-delete flag be removed
 }
 
index fe74b444b0f6844e4358385e8fa270cf2b46ec4c..37cce143a8e4db36edecb48631433d4ccfed08e3 100644 (file)
@@ -35,11 +35,12 @@ class SPLOT2D_EXPORT SPlot2d_Prs : public SALOME_Prs2d, public Plot2d_Prs
 {
 public:
   // Default constructor 
-  SPlot2d_Prs();
+  explicit SPlot2d_Prs( const char* entry );
 
   // Standard constructor    
-  SPlot2d_Prs( const Plot2d_Object* obj );
+  SPlot2d_Prs( const char* entry , const Plot2d_Object* obj );
 
+  // Copy constructor
   SPlot2d_Prs( const Plot2d_Prs* prs );
 
   // Destructor
index 401a613c36a1b1df1a195b44c8fb0f9a22a8e4ef..a9b214e590a8c97512937076265831cb2415df78 100644 (file)
@@ -230,10 +230,11 @@ void SPlot2d_Viewer::Erase( const Handle(SALOME_InteractiveObject)& IObject, boo
 /*!
    Removes all curves from the view
 */
-void SPlot2d_Viewer::EraseAll(const bool /*forced*/
+void SPlot2d_Viewer::EraseAll(SALOME_Displayer* d, const bool forced
 {
   Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
   if(aViewFrame) aViewFrame->EraseAll();
+  SALOME_View::EraseAll(d, forced);
 }
 
 /*!
@@ -271,7 +272,7 @@ void SPlot2d_Viewer::Erase( const SALOME_Prs2d* prs, const bool )
 SALOME_Prs* SPlot2d_Viewer::CreatePrs( const char* entry )
 {
   Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
-  SPlot2d_Prs *prs = new SPlot2d_Prs();
+  SPlot2d_Prs *prs = new SPlot2d_Prs( entry );
   if(aViewFrame)
   {
     CurveDict aCurves = aViewFrame->getCurves();
index 141a4e7d0f993deb4b3cd430f8fbabea0cbd6af1..64d5cdc7af1f25b7621cd913368b7d0d6d59d8d0 100644 (file)
@@ -68,7 +68,7 @@ public:
   /* Reimplemented from SALOME_View */
   void                 Display( const SALOME_Prs2d* );
   void                 Erase( const SALOME_Prs2d*, const bool = false );
-  virtual void         EraseAll(const bool = false);
+  virtual void         EraseAll(SALOME_Displayer*, const bool = false);
   virtual void         Repaint();
   virtual SALOME_Prs*  CreatePrs( const char* entry = 0 );
 
index 364857a14005678608455e15e706cde959c15300..b710eb58179fc6dce23b9d3ff36dda6ae51893a1 100644 (file)
 /*!
   Default constructor
 */
-SVTK_Prs::SVTK_Prs() : myObjects( 0 )
+SVTK_Prs::SVTK_Prs( const char* entry ) : SALOME_VTKPrs(entry), myObjects( 0 )
 {
 }
  
 /*!
   Standard constructor
 */
-SVTK_Prs::SVTK_Prs( const vtkActor* obj ) 
+SVTK_Prs::SVTK_Prs( const char* entry, const vtkActor* obj ) : SALOME_VTKPrs(entry)
 { 
   AddObject( obj ); 
 }
index 0e540618ea8358e358b3fab45e2f97891e41fd6a..e6f8d380c4f09e8c677365025bb547093dbdd22c 100644 (file)
@@ -36,9 +36,9 @@ class vtkActor;
 class SVTK_EXPORT SVTK_Prs : public SALOME_VTKPrs
 {
 public:
-  SVTK_Prs();
+  explicit SVTK_Prs( const char* entry );
   // Default constructor
-  SVTK_Prs( const vtkActor* obj );
+  SVTK_Prs( const char* entry, const vtkActor* obj );
   // Standard constructor
   ~SVTK_Prs();
   // Destructor
index 2f2477e9965f81284ada715bf90b25ec6fb64d07..f18f9a97e4ed0e926affd04dc48d84d341f0e1b0 100644 (file)
@@ -670,7 +670,7 @@ void SVTK_Viewer::Erase( const SALOME_VTKPrs* prs, const bool forced )
   Erase all presentations
   \param forced - removes all objects from view
 */
-void SVTK_Viewer::EraseAll( const bool forced )
+void SVTK_Viewer::EraseAll( SALOME_Displayer* d, const bool forced )
 {
   // Temporarily commented to avoid awful dependecy on SALOMEDS
   // TODO: better mechanism of storing display/erse status in a study
@@ -711,6 +711,9 @@ void SVTK_Viewer::EraseAll( const bool forced )
         }
       }
   }
+
+  SALOME_View::EraseAll( d, forced );
+
   Repaint();
 }
 
@@ -720,7 +723,7 @@ void SVTK_Viewer::EraseAll( const bool forced )
 */
 SALOME_Prs* SVTK_Viewer::CreatePrs( const char* entry )
 {
-  SVTK_Prs* prs = new SVTK_Prs();
+  SVTK_Prs* prs = new SVTK_Prs( entry );
   if ( entry ) {
     if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(getViewManager()->getActiveView()))
       if(SVTK_View* aView = aViewWindow->getView()){
index e8709d5acf55ebf58b655a3d3cb77f064bc5c230..ca2742d0d163d6811357b0407d3883b16824a082 100644 (file)
@@ -164,8 +164,8 @@ public:
   //! See #SALOME_View::Erase( const SALOME_VTKPrs*, const bool = false )
   void Erase( const SALOME_VTKPrs*, const bool = false );
 
-  //! See #SALOME_View::EraseAll( const bool = false )
-  void EraseAll( const bool = false );
+  //! See #SALOME_View::EraseAll( SALOME_Displayer*, const bool = false )
+  void EraseAll( SALOME_Displayer*, const bool = false );
 
   //! See #SALOME_View::getVisible( SALOME_ListIO& )
   virtual void GetVisible( SALOME_ListIO& );