case VISU::TCURVE:
case VISU::TCONTAINER:
case VISU::TTABLE:
+ getViewManager(SPlot2d_Viewer::Type(), true);
displayer()->Display(anIO->getEntry());
break;
default: {
if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
if(aContainer && aContainer->GetNbCurves() > 0){
aContainer->Clear();
+ VISU::updateContainerVisibility(aContainer);
UpdateObjBrowser(this);
}
}
if (aDlg->exec()) {
aDlg->storeToPrsObject(aContainer);
UpdateObjBrowser(this, true);
+ delete aDlg;
+ VISU::updateContainerVisibility(aContainer);
}
- delete aDlg;
}
//----------------------------------------------------------------------------
QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
- QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
+ QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
" or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
- QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
+ QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
" or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
- QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
+ QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
" or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
" (type='VISU::TCURVE')))) ) or" + aComponent;
#include "VISU_ViewManager_i.hh"
#include "VISU_Actor.h"
+#include <VISU_Table_i.hh>
+
//#include "VVTK_ViewModel.h"
#include <SVTK_ViewModel.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Desktop.h>
+
+
+void changeVisibility(int theDisplaying, QString entry, SalomeApp_Study* study) {
+
+ _PTR(SObject) obj = study->studyDS()->FindObjectID( (const char*)entry.toLatin1() );
+ CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj );
+ if( CORBA::is_nil( anObj ) )
+ return;
+
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in()) ) {
+ VISU::CurveVisibilityChanged(aCurve,theDisplaying, false, true, true);
+ }
+
+ if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( anObj ).in()) ) {
+ int nbCurves = aContainer->GetNbCurves();
+ for( int k=1; k<=nbCurves; k++ ) {
+ VISU::Curve_i* aCurve = aContainer->GetCurve( k );
+ if(aCurve)
+ VISU::CurveVisibilityChanged(aCurve,theDisplaying, true, true, true);
+ }
+ }
+
+ if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>( VISU::GetServant( anObj ).in()) ) {
+ _PTR(SObject) TableSO = study->studyDS()->FindObjectID( aTable->GetEntry() );
+ if ( TableSO ) {
+ _PTR(ChildIterator) Iter = study->studyDS()->NewChildIterator( TableSO );
+
+ for ( ; Iter->More(); Iter->Next() ) {
+ CORBA::Object_var childObject = VISU::ClientSObjectToObject( Iter->Value() );
+ if( !CORBA::is_nil( childObject ) ) {
+ CORBA::Object_ptr aCurve_ptr = VISU::Curve::_narrow( childObject );
+ if( !CORBA::is_nil( aCurve_ptr ) ) {
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve_ptr).in());
+ if(aCurve)
+ VISU::CurveVisibilityChanged(aCurve,theDisplaying, true, false, true);
+ }
+ }
+ }
+ }
+ }
+}
+
+
VisuGUI_Displayer::VisuGUI_Displayer( SalomeApp_Application* app )
: LightApp_Displayer(),
myApp( app )
{
}
+
+bool VisuGUI_Displayer::IsDisplayed( const QString& id, SALOME_View* vf ) const {
+
+ bool displayed = false;
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
+ if(!aStudy)
+ return displayed;
+
+ _PTR(SObject) aSObject = aStudy->studyDS()->FindObjectID( (const char*)id.toLatin1() );
+ CORBA::Object_var anObj = VISU::ClientSObjectToObject( aSObject );
+ if( CORBA::is_nil( anObj ) )
+ return LightApp_Displayer::IsDisplayed(id, vf);
+
+ if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( anObj ).in())) {
+ int nbCurves = aContainer->GetNbCurves();
+ for( int k=1; k<=nbCurves; k++ ) {
+ VISU::Curve_i* aCurve = aContainer->GetCurve( k );
+ if(aCurve && LightApp_Displayer::IsDisplayed(aCurve->GetEntry().c_str(), vf)) {
+ displayed = true;
+ break;
+ }
+ }
+ return displayed;
+ } else if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>( VISU::GetServant( anObj ).in())) {
+
+ _PTR(SObject) TableSO = aStudy->studyDS()->FindObjectID( (const char*)id.toLatin1() );
+ if( TableSO ) {
+ _PTR(ChildIterator) Iter = aStudy->studyDS()->NewChildIterator( TableSO );
+ for( ; Iter->More(); Iter->Next() ) {
+ CORBA::Object_var childObject = VISU::ClientSObjectToObject( Iter->Value() );
+ if( !CORBA::is_nil( childObject ) ) {
+ CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
+ if( !CORBA::is_nil( aCurve ) ) {
+ VISU::Curve_i* aCurve_i = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
+ if(aCurve && LightApp_Displayer::IsDisplayed(aCurve_i->GetEntry().c_str(), vf)) {
+ displayed = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ return displayed;
+ } else {
+ return LightApp_Displayer::IsDisplayed(id, vf);
+ }
+}
+
SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& theEntry, SALOME_View* theView )
{
SALOME_Prs* aPrs = 0;
aViewWindow->Repaint();
}
}
+ VISU::SetVisibilityState(qPrintable(theEntry),Qtx::ShownState);
}
else
aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aBaseServant);
if( study->isComponent( entry ) )
return true;
- if( dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in() )
- ||
- dynamic_cast<VISU::Container_i*>( VISU::GetServant( anObj ).in() ) )
+ if( (dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in() )
+ ||
+ dynamic_cast<VISU::Container_i*>( VISU::GetServant( anObj ).in() ))
+ && viewer_type==SPlot2d_Viewer::Type())
return true;
if( viewer_type==SVTK_Viewer::Type() /*|| viewer_type==VVTK_Viewer::Type()*/)
else
return false;
}
+
+void VisuGUI_Displayer::AfterDisplay( SALOME_View* vf, const SALOME_Plot2dViewType& ) {
+ changeVisibility(VISU::eDisplay, myLastEntry,dynamic_cast<SalomeApp_Study*>( myApp->activeStudy()));
+}
+
+void VisuGUI_Displayer::AfterErase( SALOME_View* vf, const SALOME_Plot2dViewType& ) {
+ changeVisibility(VISU::eErase, myLastEntry,dynamic_cast<SalomeApp_Study*>( myApp->activeStudy()));
+}
virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const;
+ virtual bool IsDisplayed( const QString&, SALOME_View* = 0 ) const;
+
+ virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& );
+ virtual void AfterErase ( SALOME_View*, const SALOME_Plot2dViewType& );
+
protected:
bool addCurve ( SPlot2d_Prs*, Plot2d_ViewWindow*, VISU::Curve_i* ) const;
#include "VISUConfig.hh"
#include "VisuGUI_Tools.h"
+#include "VISU_Tools.h"
#include "VisuGUI_ViewTools.h"
#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_PipeLine.hxx"
SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
if(aResourceMgr->booleanValue("VISU","display_only",false)){
- theModule->OnEraseAll();
- }
+ theModule->OnEraseAll();
+ SetVisibilityState(aPrs3d->GetEntry(),Qtx::ShownState);
+ }
if (!aValue) {
if (TDlg* aDlg = new TDlg(theModule)) { // dialog box in creation mode
VISU::Prs3d_i* thePrs,
SVTK_ViewWindow* theViewWindow)
{
- VISU_Actor* aActor = NULL;
+ VISU_Actor* anActor = NULL;
if (!thePrs || !theViewWindow)
- return aActor;
+ return anActor;
+
+ SalomeApp_Application *anApp = dynamic_cast<SalomeApp_Application*>(theModule->application());
+ if(!anApp)
+ return anActor;
+
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy());
+
+ if(!aStudy)
+ return anActor;
+
QApplication::setOverrideCursor( Qt::WaitCursor );
try {
- if ((aActor = thePrs->CreateActor()))
- theViewWindow->AddActor(aActor);
+ if ((anActor = thePrs->CreateActor())) {
+ theViewWindow->AddActor(anActor);
+
+ if(anActor->hasIO() && anActor->getIO()->hasEntry())
+ aStudy->setVisibilityState(anActor->getIO()->getEntry(), Qtx::ShownState);
+ }
} catch(std::exception& exc) {
SUIT_MessageBox::warning
(GetDesktop(theModule), QObject::tr("WRN_VISU"),
}
QApplication::restoreOverrideCursor();
- return aActor;
+ return anActor;
}
//------------------------------------------------------------
#include "SVTK_ViewModel.h"
#include "SVTK_ViewWindow.h"
+#include <VISU_Tools.h>
+
#include <SUIT_Desktop.h>
+#include <SalomeApp_Study.h>
+
namespace VISU
{
//----------------------------------------------------------------------------
theViewWindow->getRenderer()->ResetCameraClippingRange();
theViewWindow->Repaint();
QApplication::restoreOverrideCursor();
+
+ if(!thePrs->GetEntry().empty())
+ VISU::SetVisibilityState(thePrs->GetEntry(), Qtx::ShownState);
+ else {
+ VISU::ColoredPrs3d_i* prs = dynamic_cast<VISU::ColoredPrs3d_i*>(thePrs);
+ if(prs && !prs->GetHolderEntry().empty()) {
+ VISU::SetVisibilityState(prs->GetHolderEntry(), Qtx::ShownState);
+ }
+ }
return anActor;
}
} catch(std::exception& exc) {
ErasePrs(VisuGUI* theModule,
Base_i* theBase,
bool theDoRepaint)
- {
+ {
if(!theBase)
return;
+ bool updateState = true;
+
switch (theBase->GetType()) {
case VISU::TCURVE: {
- if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(theBase))
+ if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(theBase)) {
PlotCurve(theModule, aCurve, VISU::eErase );
+ updateState = false;
+ }
break;
}
case VISU::TCONTAINER: {
- if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(theBase))
+ if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(theBase)) {
PlotContainer(theModule, aContainer, VISU::eErase );
+ updateState = false;
+ }
break;
}
case VISU::TTABLE: {
- if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(theBase))
+ if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(theBase)) {
PlotTable(theModule, aTable, VISU::eErase );
+ updateState = false;
+ }
break;
}
case VISU::TPOINTMAP3D: {
aViewWindow->Repaint();
}
} else {
- if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(theBase))
+ if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(theBase)) {
PlotTable(theModule, aTable, VISU::eErase );
+ updateState = false;
+ }
}
}
break;
}
}
}} // switch (aType)
+
+ /* Update visibility state */
+ if(updateState) {
+ if( RemovableObject_i* obj = dynamic_cast<RemovableObject_i*>(theBase)) {
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(theModule->application());
+ if(anApp) {
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy());
+ std::string entry = obj->GetEntry();
+ if(aStudy && !entry.empty())
+ aStudy->setVisibilityState(QString(entry.c_str()), Qtx::HiddenState);
+ }
+ }
+ }
}
-
}
//
#include "VISU_Mesh_i.hh"
#include "VISU_Prs3dUtils.hh"
+#include "VISU_Tools.h"
#include "VISU_Result_i.hh"
#include "VISU_Convertor.hxx"
#include "SALOME_Event.h"
+#include <SUIT_ResourceMgr.h>
-#include "SUIT_ResourceMgr.h"
#ifdef _DEBUG_
static int MYDEBUG = 0;
SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
aStudyBuilder->RemoveAttribute(GetSObject(), "AttributePixMap");
+ //Set visibility state to Qtx::UnpresentableState
+ VISU::SetVisibilityState(GetEntry(), Qtx::UnpresentableState);
+
+
+
+
+
ProcessVoidEvent(new TRemoveFromStudy(this));
}
//
#include "VISU_Table_i.hh"
+#include "VISU_Tools.h"
#include "VISU_CutLinesBase_i.hh"
#include "VISU_CutSegment_i.hh"
#include "VISU_Result_i.hh"
crv->setIO(new SALOME_InteractiveObject(aString.in(), "VISU", GetName().c_str()));
if ( myTable )
crv->setTableIO(new SALOME_InteractiveObject(myTable->GetObjectEntry().c_str(), "VISU", myTable->GetName().c_str()));
+
+ if(!myContainers.isEmpty())
+ crv->addOwners(myContainers);
return crv;
}
/*!
return mySObj;
}
+
+/*!
+ Add container.
+ id - owner of the curve
+*/
+void VISU::Curve_i::addContainer(const QString& id) {
+ myContainers.insert(id);
+}
+
+/*!
+ Remove Container
+ id - entry of the container
+*/
+void VISU::Curve_i::removeContainer(const QString& id) {
+ myContainers.insert(id);
+}
+
+/*!
+ Get all owners of the curve.
+ \return owners of the curve.
+*/
+VISU::ContainerSet VISU::Curve_i::getContainers() const {
+ return myContainers;
+}
+
+
//----------------------------------------------------------------
// Container Object
//----------------------------------------------------------------
SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
SALOMEDS::SObject_var newSO = Builder->NewObject( mySO );
Builder->Addreference( newSO, SO );
+ pCurve->addContainer(GetEntry().c_str());
}
}
}
Builder->RemoveObject( childSO );
}
}
+ pCurve->removeContainer(GetEntry().c_str());
}
}
}
#include "VISU_PrsObject_i.hh"
#include <QStringList>
+#include <QSet>
class SPlot2d_Curve;
bool theFirstStrAsTitle = false);
bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
//==============================================================================
+
+ typedef QSet<QString> ContainerSet;
+
class VISU_I_EXPORT Curve_i : public virtual POA_VISU::Curve,
public virtual PrsObject_i
{
virtual VISU::Curve::LineType GetLine();
virtual CORBA::Long GetLineWidth();
+ virtual void addContainer(const QString& id);
+ virtual void removeContainer(const QString& id);
+ virtual ContainerSet getContainers() const;
+
virtual void RemoveFromStudy();
virtual SALOMEDS::SObject_var GetSObject();
std::string myTitle;
bool myAuto;
SALOMEDS::SObject_var mySObj;
+ ContainerSet myContainers;
public:
virtual Storable* Create();
+
+ Table_i* getTable() const {return myTable;}
int GetHRow() const { return myHRow; }
void SetHRow( const int theHRow ) { myHRow = theHRow; }
#include "VISU_Table_i.hh"
#include "VISU_ViewManager_i.hh"
+#include <VISU_ActorBase.h>
+
+#include <LightApp_Displayer.h>
+
#include <SalomeApp_Study.h>
#include <SalomeApp_Application.h>
+#include <SalomeApp_Module.h>
#include <SPlot2d_ViewModel.h>
#include <Plot2d_ViewFrame.h>
#include <Plot2d_ViewManager.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
//=============================================================================
namespace VISU
}
UpdateCurve( theCurve, thePlot, plotCurve, theDisplaying );
+ CurveVisibilityChanged(theCurve, theDisplaying, true, false, true);
if ( theDisplaying == VISU::eErase && plotCurve ) {
clist.removeAll(plotCurve );
}
}
thePlot->Repaint();
+ SetVisibilityState(table->GetEntry(),GetStateByDisplaying(theDisplaying));
}
+
}
//------------------------------------------------------------
}
thePlot->Repaint();
+
+ SetVisibilityState(theCurve->GetEntry(),GetStateByDisplaying(theDisplaying));
+ CurveVisibilityChanged(theCurve,theDisplaying,false, true, true);
}
//------------------------------------------------------------
if ( plotCurve && theDisplaying == VISU::eErase ) {
clist.removeAll( plotCurve );
}
+ CurveVisibilityChanged(theCurve, theDisplaying, true, true, true);
}
}
}
+
thePlot->Repaint();
if(GetResourceMgr()->booleanValue("VISU","automatic_fit_all",false)){
thePlot->fitAll();
}
+
qApp->processEvents();
}
}
}
}
+
+ //------------------------------------------------------------
+ void SetVisibilityState(std::string entry, Qtx::VisibilityState state) {
+ if(entry.empty())
+ return;
+
+ if( SUIT_Session* aSession = SUIT_Session::session() )
+ if( SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aSession->activeApplication()) )
+ if( SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy()) )
+ aStudy->setVisibilityState(entry.c_str(), state);
+
+ }
+
+ //------------------------------------------------------------
+ void SetVisibilityState(VISU_ActorBase *theActor, Qtx::VisibilityState state) {
+ if(!theActor || theActor->hasIO() || !theActor->getIO()->hasEntry())
+ return;
+ SetVisibilityState(theActor->getIO()->getEntry(), state);
+ }
+
+ void CurveVisibilityChanged(VISU::Curve_i* theCurve,
+ int theDisplaying,
+ bool updateCurve,
+ bool updateTable,
+ bool updateContainers) {
+
+ SUIT_Session* aSession = SUIT_Session::session();
+ if(!aSession)
+ return;
+
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aSession->activeApplication());
+ if( !anApp )
+ return;
+
+ SUIT_ViewManager* aManager = anApp->activeViewManager();
+
+ if( !aManager)
+ return;
+
+ bool is2dViewActive = aManager->getType() == SPlot2d_Viewer::Type();
+
+ Qtx::VisibilityState state = is2dViewActive ? GetStateByDisplaying(theDisplaying) : Qtx::UnpresentableState;
+
+ if(updateCurve)
+ SetVisibilityState(theCurve->GetEntry(), state);
+
+ if(updateTable) {
+ Table_i* aTable = theCurve->getTable();
+ if(aTable) {
+ if( SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy()) ) {
+ _PTR(SObject) TableSO = aStudy->studyDS()->FindObjectID( aTable->GetEntry() );
+ if ( TableSO ) {
+ _PTR(ChildIterator) Iter = aStudy->studyDS()->NewChildIterator( TableSO );
+ bool isTableVisible = false;
+ LightApp_Displayer* aDisplayer = (dynamic_cast<SalomeApp_Module*>(anApp->activeModule()))->displayer();
+ if(aDisplayer && state != Qtx::UnpresentableState ) {
+ for ( ; Iter->More(); Iter->Next() ) {
+ CORBA::Object_var childObject = VISU::ClientSObjectToObject( Iter->Value() );
+ if( !CORBA::is_nil( childObject ) ) {
+ CORBA::Object_ptr aCurve_ptr = VISU::Curve::_narrow( childObject );
+ if( !CORBA::is_nil( aCurve_ptr ) ) {
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve_ptr).in());
+ if(aDisplayer->IsDisplayed(aCurve->GetEntry().c_str())) {
+ isTableVisible = true;
+ break;
+ }
+ } //!CORBA::is_nil( aCurve )
+ } // !CORBA::is_nil( childObject )
+ } //for
+ if(state != Qtx::UnpresentableState)
+ SetVisibilityState(aTable->GetEntry(), (isTableVisible ? Qtx::ShownState : Qtx::HiddenState));
+ else
+ SetVisibilityState(aTable->GetEntry(), state);
+ } //aDisplayer
+ } //TableSO
+ } //aStudy
+ } //aTable
+ } //updateTable
+
+ if(updateContainers) {
+ if( SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy()) ) {
+ if(LightApp_Displayer* aDisplayer = (dynamic_cast<SalomeApp_Module*>(anApp->activeModule()))->displayer()) {
+ ContainerSet aContainers = theCurve->getContainers();
+ ContainerSet::ConstIterator it = aContainers.begin();
+ for(;it != aContainers.end();it++ ) {
+ if(state != Qtx::UnpresentableState) {
+ bool isContainerDisplayed = false;
+ _PTR(SObject) aSObject = aStudy->studyDS()->FindObjectID( (*it).toLatin1().data());
+ CORBA::Object_var anObj = VISU::ClientSObjectToObject( aSObject );
+ if( !CORBA::is_nil( anObj ) ) {
+ if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( anObj ).in())) {
+ int nbCurves = aContainer->GetNbCurves();
+ for( int k=1; k<=nbCurves; k++ ) {
+ VISU::Curve_i* aCurve = aContainer->GetCurve( k );
+ if(aCurve && aDisplayer->IsDisplayed(aCurve->GetEntry().c_str())) {
+ isContainerDisplayed = true;
+ break;
+ } // aCurve && aDisplater->IsDisplayed
+ } //for k=1 ...
+ SetVisibilityState(aContainer->GetEntry(), (isContainerDisplayed ? Qtx::ShownState : Qtx::HiddenState));
+ } //aContainer
+ } //!CORBA::is_nil( anObj )
+ } //state != Qtx::UnpresentableState
+ else {
+ SetVisibilityState((*it).toLatin1().data(), state);
+ }
+ } // for Containers
+ } //aDisplayer
+ } //aStudy
+ } //updateContainers
+ }
+
+ Qtx::VisibilityState GetStateByDisplaying(int theDisplaying) {
+
+ Qtx::VisibilityState state = Qtx::UnpresentableState;
+ if(theDisplaying == eDisplayAll ||
+ theDisplaying == eDisplay ||
+ theDisplaying == eDisplayOnly ) {
+ state = Qtx::ShownState;
+
+ } else if (theDisplaying == eErase || theDisplaying == eEraseAll) {
+ state = Qtx::HiddenState;
+ }
+ return state;
+ }
+
+ void updateContainerVisibility(VISU::Container_i* theContainer) {
+ if(!theContainer)
+ return;
+
+ if( SUIT_Session* aSession = SUIT_Session::session() ) {
+ if( SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aSession->activeApplication()) ) {
+ if( SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy()) ) {
+ Qtx::VisibilityState state = Qtx::UnpresentableState;
+ int nbCurves = theContainer->GetNbCurves();
+ if( nbCurves > 0 ) {
+ if(LightApp_Displayer* aDisplayer = (dynamic_cast<SalomeApp_Module*>(anApp->activeModule()))->displayer()) {
+ for( int k=1; k<=nbCurves; k++ ) {
+ VISU::Curve_i* aCurve = theContainer->GetCurve( k );
+ if(aCurve && aDisplayer->IsDisplayed(aCurve->GetEntry().c_str())) {
+ state = Qtx::ShownState;
+ break;
+ }
+ }
+ if ( state == Qtx::UnpresentableState) {
+ if( SUIT_ViewManager * vm = anApp->activeViewManager()){
+ if(vm->getType() == SPlot2d_Viewer::Type()) {
+ state = Qtx::HiddenState;
+ }
+ }
+ }
+ }
+ } else if(SUIT_ViewManager * vm = anApp->activeViewManager()){
+ if(vm->getType() == SPlot2d_Viewer::Type()) {
+ state = Qtx::HiddenState;
+ }
+ }
+ aStudy->setVisibilityState(theContainer->GetEntry().c_str(),state);
+ }
+ }
+ }
+ }
}
#include "VISUConfig.hh"
#include "VISU_I.hxx"
+#include <Qtx.h>
+
#include <SALOMEDSClient_Study.hxx>
class SPlot2d_Curve;
class Plot2d_ViewFrame;
class SalomeApp_Study;
class SalomeApp_Application;
+class VISU_ActorBase;
namespace VISU
{
VISU_I_EXPORT void CreatePlot( VISU_Gen_i*,
Plot2d_ViewFrame*,
_PTR(SObject) theTableSO );
+
+ VISU_I_EXPORT void SetVisibilityState(std::string entry, Qtx::VisibilityState state);
+ VISU_I_EXPORT void SetVisibilityState(VISU_ActorBase *theActor, Qtx::VisibilityState state);
+
+ VISU_I_EXPORT void CurveVisibilityChanged(VISU::Curve_i* theCurve,
+ int theDisplaying,
+ bool updateCurve,
+ bool updateTable,
+ bool updateContainers);
+
+ VISU_I_EXPORT Qtx::VisibilityState GetStateByDisplaying(int theDisplaying);
+ VISU_I_EXPORT void updateContainerVisibility(VISU::Container_i* theContainer);
}
#endif
#include "VISU_View_i.hh"
#include "VISU_Prs3d_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_Tools.h"
#include "VISU_Actor.h"
#include "VISU_ActorFactory.h"
anVISUActor = VISU_Actor::SafeDownCast(anActor);
if (thePrs == anVISUActor->GetPrs3d()) {
aResActor = anVISUActor;
- if(theDisplaing < eErase)
+ if(theDisplaing < eErase) {
aResActor->VisibilityOn();
- else
+ VISU::SetVisibilityState(aResActor, Qtx::ShownState);
+ }
+ else {
aResActor->VisibilityOff();
+ VISU::SetVisibilityState(aResActor, Qtx::HiddenState);
+ }
} else {
- if(theDisplaing == eEraseAll || theDisplaing == eDisplayOnly)
+ if(theDisplaing == eEraseAll || theDisplaing == eDisplayOnly) {
anVISUActor->VisibilityOff();
- else if ( theDisplaing == eDisplayAll )
+ VISU::SetVisibilityState(aResActor, Qtx::HiddenState);
+ }
+ else if ( theDisplaing == eDisplayAll ) {
anVISUActor->VisibilityOn();
+ VISU::SetVisibilityState(aResActor, Qtx::HiddenState);
+ }
}
}
}
// Module : VISU
//
#include "VISU_View_i.hh"
+#include "VISU_Tools.h"
#include "VISU_Gen_i.hh"
#include "VISU_Prs3d_i.hh"
virtual void Execute()
{
+ Qtx::VisibilityState state = (myDisplaing == eDisplay ||myDisplaing == eDisplayOnly) ?
+ Qtx::ShownState : Qtx::HiddenState;
// is it Curve ?
if (Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(myPrsObj).in())) {
UpdatePlot2d(aCurve,myDisplaing,myView);
+ VISU::SetVisibilityState(aCurve->GetEntry(),state);
+ VISU::CurveVisibilityChanged(aCurve, myDisplaing , false, true, true);
}
// is it Container ?
if (Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(myPrsObj).in())) {
+ VISU::SetVisibilityState(aContainer->GetEntry(),state);
int nbCurves = aContainer->GetNbCurves();
for ( int i = 1; i <= nbCurves; i++ ) {
VISU::Curve_i* aCurve = aContainer->GetCurve( i );
if ( aCurve && aCurve->IsValid() ) {
UpdatePlot2d(aCurve,myDisplaing,myView);
+ VISU::CurveVisibilityChanged(aCurve, myDisplaing , true, true, true);
}
}
myView->Repaint();
CORBA::Object_var childObject = VISU::ClientSObjectToObject(Iter->Value());
if (!CORBA::is_nil(childObject)) {
CORBA::Object_ptr aCurve = VISU::Curve::_narrow(childObject);
- if (!CORBA::is_nil(aCurve))
- UpdatePlot2d(dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in()),
- myDisplaing, myView);
+ if (!CORBA::is_nil(aCurve)) {
+ Curve_i* crv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
+ UpdatePlot2d(crv, myDisplaing, myView);
+ VISU::CurveVisibilityChanged(crv, myDisplaing , true, false, true);
+ }
}
}
myView->Repaint();
+ VISU::SetVisibilityState(aTable->GetEntry(),state);
}
}
}