From: vsr Date: Thu, 23 Oct 2014 12:24:55 +0000 (+0400) Subject: IPAL52528: TC7.5.0: Dump study - transparency is lost X-Git-Tag: V7_5_0b1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5279f7d4f36b5ce0ebf7dbd11a8c00eb4ad4c227;p=modules%2Fgui.git IPAL52528: TC7.5.0: Dump study - transparency is lost Properly process visibility state on Show/Hide operations --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 62bc2441e..dac8913c9 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -3677,7 +3677,7 @@ void LightApp_Application::removeViewManager( SUIT_ViewManager* vm ) this, SLOT( onCloseView( SUIT_ViewManager* ) ) ); LightApp_Study* aStudy = dynamic_cast(activeStudy()); if (aStudy ) - aStudy->removeViewMgr(vm->getGlobalId()); + aStudy->removeObjectProperties( vm->getGlobalId() ); CAM_Application::removeViewManager( vm ); diff --git a/src/LightApp/LightApp_Displayer.cxx b/src/LightApp/LightApp_Displayer.cxx index cde6ceadf..4943c0904 100644 --- a/src/LightApp/LightApp_Displayer.cxx +++ b/src/LightApp/LightApp_Displayer.cxx @@ -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(); } diff --git a/src/LightApp/LightApp_Displayer.h b/src/LightApp/LightApp_Displayer.h index 414db57a2..704b77556 100644 --- a/src/LightApp/LightApp_Displayer.h +++ b/src/LightApp/LightApp_Displayer.h @@ -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; diff --git a/src/LightApp/LightApp_Study.cxx b/src/LightApp/LightApp_Study.cxx index 2b4f0f4df..524498a0e 100644 --- a/src/LightApp/LightApp_Study.cxx +++ b/src/LightApp/LightApp_Study.cxx @@ -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(db->model()); - - if(treeModel) - treeModel->setVisibilityState(theEntry,theState); + if ( !db ) return; + SUIT_AbstractModel* treeModel = dynamic_cast( 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(db->model()); - - if(treeModel) - treeModel->setVisibilityStateForAll(theState); + if ( !db ) return; + SUIT_AbstractModel* treeModel = dynamic_cast( 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(db->model()); - if(treeModel) - return treeModel->visibilityState(theEntry); + if ( db ) { + SUIT_AbstractModel* treeModel = dynamic_cast( db->model() ); + if ( treeModel ) + state = treeModel->visibilityState( theEntry ); } } - return Qtx::UnpresentableState; + return state; } /*! diff --git a/src/LightApp/LightApp_Study.h b/src/LightApp/LightApp_Study.h index 6b8334d81..fea8a04f4 100644 --- a/src/LightApp/LightApp_Study.h +++ b/src/LightApp/LightApp_Study.h @@ -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; diff --git a/src/Plot2d/Plot2d_Prs.h b/src/Plot2d/Plot2d_Prs.h index d6b3310ed..6629e7325 100755 --- a/src/Plot2d/Plot2d_Prs.h +++ b/src/Plot2d/Plot2d_Prs.h @@ -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 ); diff --git a/src/Prs/SALOME_Prs.cxx b/src/Prs/SALOME_Prs.cxx index 871a4ca84..8f952cda8 100755 --- a/src/Prs/SALOME_Prs.cxx +++ b/src/Prs/SALOME_Prs.cxx @@ -25,6 +25,22 @@ #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 ) +{ +} diff --git a/src/Prs/SALOME_Prs.h b/src/Prs/SALOME_Prs.h index ebef97acd..bb7b5243a 100755 --- a/src/Prs/SALOME_Prs.h +++ b/src/Prs/SALOME_Prs.h @@ -38,6 +38,8 @@ class SALOME_Displayer; class SALOME_ListIO; class Handle_SALOME_InteractiveObject; +#include + /*! \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 diff --git a/src/SOCC/SOCC_Prs.cxx b/src/SOCC/SOCC_Prs.cxx index 1b99d89e7..689fecf35 100644 --- a/src/SOCC/SOCC_Prs.cxx +++ b/src/SOCC/SOCC_Prs.cxx @@ -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 ); } diff --git a/src/SOCC/SOCC_Prs.h b/src/SOCC/SOCC_Prs.h index 244d715c4..6bb17f1a8 100644 --- a/src/SOCC/SOCC_Prs.h +++ b/src/SOCC/SOCC_Prs.h @@ -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 diff --git a/src/SOCC/SOCC_ViewModel.cxx b/src/SOCC/SOCC_ViewModel.cxx index 985d1fed7..3def58d2c 100755 --- a/src/SOCC/SOCC_ViewModel.cxx +++ b/src/SOCC/SOCC_ViewModel.cxx @@ -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) diff --git a/src/SOCC/SOCC_ViewModel.h b/src/SOCC/SOCC_ViewModel.h index e46e0bfe1..9206e7109 100755 --- a/src/SOCC/SOCC_ViewModel.h +++ b/src/SOCC/SOCC_ViewModel.h @@ -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 ); diff --git a/src/SPlot2d/SPlot2d_Prs.cxx b/src/SPlot2d/SPlot2d_Prs.cxx index d9ae35dc2..7b64b5cce 100644 --- a/src/SPlot2d/SPlot2d_Prs.cxx +++ b/src/SPlot2d/SPlot2d_Prs.cxx @@ -27,16 +27,16 @@ /*! 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( prs ); + if ( sp ) + myEntry = sp->myEntry; myIsAutoDel = false; // VSR: error? should auto-delete flag be removed } diff --git a/src/SPlot2d/SPlot2d_Prs.h b/src/SPlot2d/SPlot2d_Prs.h index fe74b444b..37cce143a 100644 --- a/src/SPlot2d/SPlot2d_Prs.h +++ b/src/SPlot2d/SPlot2d_Prs.h @@ -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 diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index 401a613c3..a9b214e59 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -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(); diff --git a/src/SPlot2d/SPlot2d_ViewModel.h b/src/SPlot2d/SPlot2d_ViewModel.h index 141a4e7d0..64d5cdc7a 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.h +++ b/src/SPlot2d/SPlot2d_ViewModel.h @@ -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 ); diff --git a/src/SVTK/SVTK_Prs.cxx b/src/SVTK/SVTK_Prs.cxx index 364857a14..b710eb581 100644 --- a/src/SVTK/SVTK_Prs.cxx +++ b/src/SVTK/SVTK_Prs.cxx @@ -31,14 +31,14 @@ /*! 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 ); } diff --git a/src/SVTK/SVTK_Prs.h b/src/SVTK/SVTK_Prs.h index 0e540618e..e6f8d380c 100644 --- a/src/SVTK/SVTK_Prs.h +++ b/src/SVTK/SVTK_Prs.h @@ -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 diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 2f2477e99..f18f9a97e 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -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(getViewManager()->getActiveView())) if(SVTK_View* aView = aViewWindow->getView()){ diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h index e8709d5ac..ca2742d0d 100644 --- a/src/SVTK/SVTK_ViewModel.h +++ b/src/SVTK/SVTK_ViewModel.h @@ -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& );