if ( vf )
{
+ myLastEntry = *it;
vf->BeforeDisplay( this );
vf->Display( prs );
vf->AfterDisplay( this );
{
SALOME_Prs* prs = vf->CreatePrs( (*it).toLatin1().data() );
if ( prs ) {
+ myLastEntry = *it;
+ vf->BeforeErase(this);
vf->Erase( prs, forced );
+ vf->AfterErase(this);
if ( updateViewer )
vf->Repaint();
delete prs; // delete presentation because displayer is its owner
void Erase( const QString&, const bool forced = false, const bool updateViewer = true, SALOME_View* = 0 );
void EraseAll( const bool forced = false, const bool updateViewer = true, SALOME_View* = 0 ) const;
- bool IsDisplayed( const QString&, SALOME_View* = 0 ) const;
+ virtual bool IsDisplayed( const QString&, SALOME_View* = 0 ) const;
void UpdateViewer() const;
static SALOME_View* GetActiveView();
protected:
virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
+protected:
+ QString myLastEntry;
};
#endif
virtual void BeforeDisplay( SALOME_Displayer* ) {} //!< Null body here
virtual void AfterDisplay ( SALOME_Displayer* ) {} //!< Null body here
+ // Axiluary methods called before and after erasing of objects
+ virtual void BeforeErase( SALOME_Displayer* ) {} //!< Null body here
+ virtual void AfterErase ( SALOME_Displayer* ) {} //!< Null body here
+
+
// New methods (asv)
//! \retval Return false.
virtual bool isVisible( const Handle_SALOME_InteractiveObject& ){ return false; }
virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
+
+ // Axiluary methods called before and after erasing of objects
+ virtual void BeforeErase( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
+ virtual void AfterErase ( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
+ virtual void BeforeErase( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
+ virtual void AfterErase ( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
+ virtual void BeforeErase( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
+ virtual void AfterErase ( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
+
};
#endif
d->AfterDisplay( this, SALOME_OCCViewType() );
}
+
+/*!
+ Auxiliary method called before erasing of objects
+*/
+void SOCC_Viewer::BeforeErase( SALOME_Displayer* d )
+{
+ d->BeforeErase( this, SALOME_OCCViewType() );
+}
+
+/*!
+ Auxiliary method called after erase of objects
+*/
+void SOCC_Viewer::AfterErase( SALOME_Displayer* d )
+{
+ d->AfterErase( this, SALOME_OCCViewType() );
+}
+
/*!
Get new and current trihedron size corresponding to the current model size
*/
virtual SALOME_Prs* CreatePrs( const char* entry = 0 );
virtual void BeforeDisplay( SALOME_Displayer* d );
virtual void AfterDisplay ( SALOME_Displayer* d );
+
+ virtual void BeforeErase( SALOME_Displayer* d );
+ virtual void AfterErase ( SALOME_Displayer* d );
+
virtual void LocalSelection( const SALOME_OCCPrs*, const int );
virtual void GlobalSelection( const bool = false ) const;
virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
title = getTableIO()->getName();
return title;
}
+
+/*!
+ Add owner of the curve.
+ \param owner - owner of the curve
+*/
+void SPlot2d_Curve::addOwner(const QString& owner) {
+ myOwners.insert(owner);
+}
+
+/*!
+ Remove owner of the curve.
+ \param owner - owner of the curve
+*/
+void SPlot2d_Curve::removeOwner(const QString& owner) {
+ myOwners.insert(owner);
+}
+
+/*!
+ Get all owners of the curve.
+ \return owners of the curve.
+*/
+OwnerSet SPlot2d_Curve::getOwners() const {
+ return myOwners;
+}
+
+
+/*!
+ Add owners of the curve.
+ \param owners - owners of the curve
+*/
+void SPlot2d_Curve::addOwners(OwnerSet& owners) {
+ myOwners = myOwners|=owners;
+}
+
#include "SPlot2d.h"
#include "Plot2d_Curve.h"
+
+#include <QSet>
+
#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
#include <Handle_SALOME_InteractiveObject.hxx>
#endif
#include "SALOME_InteractiveObject.hxx"
+typedef QSet<QString> OwnerSet;
+
class SPLOT2D_EXPORT SPlot2d_Curve : public Plot2d_Curve
{
public:
virtual Handle(SALOME_InteractiveObject) getTableIO() const;
virtual void setTableIO( const Handle(SALOME_InteractiveObject)& );
+ virtual void addOwner(const QString& owner);
+ virtual void removeOwner(const QString& owner);
+ virtual OwnerSet getOwners() const;
+ virtual void addOwners (OwnerSet& owners);
+
private:
Handle(SALOME_InteractiveObject) myIO;
Handle(SALOME_InteractiveObject) myTableIO;
+ OwnerSet myOwners;
};
#endif // SPlot2d_Curve_h
CurveDict aCurves = aViewFrame->getCurves();
CurveDict::Iterator it = aCurves.begin();
for( ; it != aCurves.end(); ++it ) {
- SPlot2d_Curve* aCurve = dynamic_cast<SPlot2d_Curve*>(it.value());
- if ( aCurve && aCurve->hasIO() && !strcmp( aCurve->getIO()->getEntry(), entry ) ) {
- prs->AddObject(aCurve);
- break;
- }
- }
+ SPlot2d_Curve* aCurve = dynamic_cast<SPlot2d_Curve*>(it.value());
+ OwnerSet owners = aCurve->getOwners();
+ if(aCurve) {
+ if (
+ (aCurve->hasIO() && !strcmp( aCurve->getIO()->getEntry(), entry )) ||
+ (aCurve->hasTableIO() && !strcmp( aCurve->getTableIO()->getEntry(), entry )) ||
+ owners.contains(entry)
+ ) {
+ prs->AddObject(aCurve);
+ }
+ }
+ }
}
return prs;
}
d->AfterDisplay( this, SALOME_Plot2dViewType() );
}
+/*!
+ Axiluary method called before erasing of objects
+*/
+void SPlot2d_Viewer::BeforeErase( SALOME_Displayer* d )
+{
+ d->BeforeErase( this, SALOME_Plot2dViewType() );
+}
+
+/*!
+ Axiluary method called after erasing of objects
+*/
+void SPlot2d_Viewer::AfterErase( SALOME_Displayer* d )
+{
+ d->AfterErase( this, SALOME_Plot2dViewType() );
+}
+
/*!
Returns true if interactive object is presented in the viewer and displayed
*/
virtual SALOME_Prs* CreatePrs( const char* entry = 0 );
virtual void BeforeDisplay( SALOME_Displayer* d );
virtual void AfterDisplay ( SALOME_Displayer* d );
+
+ virtual void BeforeErase( SALOME_Displayer* d );
+ virtual void AfterErase ( SALOME_Displayer* d );
+
virtual bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
virtual void GetVisible( SALOME_ListIO& theList );
\param state - visible state
*/
void SUIT_TreeModel::setVisibilityState(const QString& id, Qtx::VisibilityState state) {
+ if(myVisibilityMap.contains(id) && myVisibilityMap.value(id) == state)
+ return;
+
bool needSignal = false;
if(state != Qtx::UnpresentableState) {
myVisibilityMap.insert(id, state);
d->AfterDisplay( this, SALOME_VTKViewType() );
}
+
+/*!
+ Auxiliary method called before erasing of objects
+*/
+void SVTK_Viewer::BeforeErase( SALOME_Displayer* d )
+{
+ d->BeforeErase( this, SALOME_VTKViewType() );
+}
+
+/*!
+ Auxiliary method called after displaying of objects
+*/
+void SVTK_Viewer::AfterErase( SALOME_Displayer* d )
+{
+ d->AfterErase( this, SALOME_VTKViewType() );
+}
+
+
/*!
\return true if object is displayed in viewer
\param obj - object to be checked
//! See #SALOME_View::AfterDisplay( SALOME_Displayer* d )
virtual void AfterDisplay( SALOME_Displayer* d );
+ //! See #SALOME_View::BeforeDisplay( SALOME_Displayer* d )
+ virtual void BeforeErase( SALOME_Displayer* d );
+
+ //! See #SALOME_View::AfterDisplay( SALOME_Displayer* d )
+ virtual void AfterErase( SALOME_Displayer* d );
+
//! See #SALOME_View::isVisible( const Handle(SALOME_InteractiveObject)& )
virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
Update visibility state of given objects
*/
void SalomeApp_Application::updateVisibilityState( DataObjectList& theList,
- SUIT_ViewModel* theViewModel )
-{
+ SUIT_ViewModel* theViewModel ) {
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
if(!theViewModel)
return;
SALOME_View* aView = dynamic_cast<SALOME_View*>( theViewModel );
-
+
if (theList.isEmpty() || !aView || !aStudy)
return;
-
- // take visibale objects from current view
- QStringList aVisibleList;
- SALOME_ListIO aListOfIO;
- aView->GetVisible( aListOfIO );
- SALOME_ListIteratorOfListIO anIter(aListOfIO);
- for(; anIter.More(); anIter.Next()) {
- Handle_SALOME_InteractiveObject& anObj = anIter.Value();
- if (!anObj.IsNull() && anObj->hasEntry())
- aVisibleList.append(anObj->getEntry());
- }
-
- for ( DataObjectList::iterator itr = theList.begin(); itr != theList.end(); ++itr )
- {
+
+ for ( DataObjectList::iterator itr = theList.begin(); itr != theList.end(); ++itr ) {
LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>(*itr);
- if (!obj ) continue;
-
- //if object is visible in aView => set Qtx::ShownState status
- if ( aVisibleList.contains( obj->entry() ) )
- aStudy->setVisibilityState( obj->entry(), Qtx::ShownState );
- else {
- //check that object can be displayed in the aView
- //and set Qtx::HiddenState
- Qtx::VisibilityState anObjState = Qtx::UnpresentableState;
- LightApp_Module* anObjModule = dynamic_cast<LightApp_Module*>(obj->module());
-
- if(anObjModule) {
- LightApp_Displayer* aDisplayer = anObjModule->displayer();
-
- if(aDisplayer && !aStudy->isComponent(obj->entry())) {
- if(aDisplayer->canBeDisplayed(obj->entry(), theViewModel->getType())) {
+
+ if (aStudy->isComponent(obj->entry()) || !obj)
+ continue;
+
+ LightApp_Module* anObjModule = dynamic_cast<LightApp_Module*>(obj->module());
+ Qtx::VisibilityState anObjState = Qtx::UnpresentableState;
+
+ if(anObjModule) {
+ LightApp_Displayer* aDisplayer = anObjModule->displayer();
+ if(aDisplayer) {
+ if( aDisplayer->canBeDisplayed(obj->entry(), theViewModel->getType()) ) {
+ if(aDisplayer->IsDisplayed(obj->entry(),aView))
+ anObjState = Qtx::ShownState;
+ else
anObjState = Qtx::HiddenState;
- }
}
}
aStudy->setVisibilityState( obj->entry(), anObjState );