From 9c468915b24d63453df565e19ca6421386af54e4 Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 27 Sep 2005 06:31:14 +0000 Subject: [PATCH] PAL9391 --- src/CAM/CAM_Module.h | 28 ++--- src/Qtx/QtxStdOperations.cxx | 32 ++++-- src/SPlot2d/SPlot2d_ViewModel.cxx | 7 +- src/SVTK/SVTK_ViewModel.cxx | 4 + src/SalomeApp/Makefile.in | 11 +- src/SalomeApp/SalomeApp_Displayer.cxx | 145 +++++++++++++++++++++++++ src/SalomeApp/SalomeApp_Displayer.h | 28 +++++ src/SalomeApp/SalomeApp_Module.cxx | 62 ++++++++++- src/SalomeApp/SalomeApp_Module.h | 4 + src/SalomeApp/SalomeApp_Selection.cxx | 33 +++++- src/SalomeApp/SalomeApp_ShowHideOp.cxx | 74 +++++++++++++ src/SalomeApp/SalomeApp_ShowHideOp.h | 26 +++++ 12 files changed, 421 insertions(+), 33 deletions(-) create mode 100644 src/SalomeApp/SalomeApp_Displayer.cxx create mode 100644 src/SalomeApp/SalomeApp_Displayer.h create mode 100644 src/SalomeApp/SalomeApp_ShowHideOp.cxx create mode 100644 src/SalomeApp/SalomeApp_ShowHideOp.h diff --git a/src/CAM/CAM_Module.h b/src/CAM/CAM_Module.h index feff5c1f4..b0fcfc7cd 100755 --- a/src/CAM/CAM_Module.h +++ b/src/CAM/CAM_Module.h @@ -41,6 +41,20 @@ public: virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& title ) {}; virtual void updateCommandsStatus() {}; + /** @name Set Menu Shown*/ + //@{ + void setMenuShown( const bool ); + void setMenuShown( QAction*, const bool ); + void setMenuShown( const int, const bool ); + //@} + + /** @name Set Tool Shown*/ + //@{ + void setToolShown( const bool ); + void setToolShown( QAction*, const bool ); + void setToolShown( const int, const bool ); + //@} + public slots: virtual bool activateModule( SUIT_Study* ); virtual bool deactivateModule( SUIT_Study* ); @@ -76,20 +90,6 @@ protected: int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 ); //@} - /** @name Set Menu Shown*/ - //@{ - void setMenuShown( const bool ); - void setMenuShown( QAction*, const bool ); - void setMenuShown( const int, const bool ); - //@} - - /** @name Set Tool Shown*/ - //@{ - void setToolShown( const bool ); - void setToolShown( QAction*, const bool ); - void setToolShown( const int, const bool ); - //@} - static QAction* separator(); /**Action ids methods.*/ diff --git a/src/Qtx/QtxStdOperations.cxx b/src/Qtx/QtxStdOperations.cxx index 5301bfef8..69a7453c9 100644 --- a/src/Qtx/QtxStdOperations.cxx +++ b/src/Qtx/QtxStdOperations.cxx @@ -289,6 +289,8 @@ QtxLogic::QtxLogic() ListOfTypes aTypes; aTypes.append( QVariant::Bool ); + aTypes.append( QVariant::Int ); + aTypes.append( QVariant::UInt ); addTypes( aTypes ); } @@ -308,9 +310,9 @@ bool QtxLogic::createValue( const QString& str, QtxValue& v ) const { bool ok = true; if( str.lower()=="true" ) - v = true; + v = QtxValue( true, 0 ); else if( str.lower()=="false" ) - v = false; + v = QtxValue( false, 0 ); else ok = QtxStdOperations::createValue( str, v ); @@ -338,6 +340,18 @@ int QtxLogic::prior( const QString& op, bool isBin ) const return 0; } +bool boolean_value( const QtxValue& v ) +{ + if( v.type()==QVariant::Bool ) + return v.toBool(); + else if( v.type()==QVariant::Int ) + return v.toInt()!=0; + else if( v.type()==QVariant::UInt ) + return v.toUInt()!=0; + else + return false; +} + //================================================================ // Function : // Purpose : @@ -346,22 +360,24 @@ QtxParser::Error QtxLogic::calculate( const QString& op, QtxValue& v1, QtxValue& v2 ) const { QtxParser::Error err = QtxParser::OK; + bool val1 = boolean_value( v1 ), + val2 = boolean_value( v2 ); if( v1.isValid() && v2.isValid() ) { if( op=="and" || op=="&&" ) - set( v1, v1.toBool() && v2.toBool() ); + set( v1, val1 && val2 ); else if( op=="or" || op=="||" ) - set( v1, v1.toBool() || v2.toBool() ); + set( v1, val1 || val2 ); else if( op=="xor" ) - set( v1, ( !v1.toBool() && v2.toBool() ) || ( v1.toBool() && !v2.toBool() ) ); + set( v1, ( !val1 && val2 ) || ( val1 && !val2 ) ); else if( op=="imp" ) - set( v1, !v1.toBool() || v2.toBool() ); + set( v1, !val1 || val2 ); else if( op=="=" ) - set( v1, v1.toBool()==v2.toBool() ); + set( v1, val1==val2 ); } else if( op=="not" || op=="!" ) - set( v2, !v2.toBool() ); + set( v2, !val2 ); return err; } diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index b90fe2b5c..9bd393771 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -223,8 +223,11 @@ void SPlot2d_Viewer::Erase( const SALOME_Prs2d* prs, const bool ) SALOME_Prs* SPlot2d_Viewer::CreatePrs( const char* entry ) { Plot2d_ViewFrame* aViewFrame = getActiveViewFrame(); - if(aViewFrame) { - return new SPlot2d_Prs(aViewFrame->CreatePrs(entry)); + if(aViewFrame) + { + Plot2d_Prs* prs = aViewFrame->CreatePrs(entry); + if( prs ) + return new SPlot2d_Prs( prs ); } return NULL; diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 17f0ac85c..b87a14746 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -422,7 +422,11 @@ SVTK_Viewer if(SUIT_ViewWindow* aViewWindow = aViews.at(i)) if(SVTK_ViewWindow* aView = dynamic_cast(aViewWindow)) if(SVTK_RenderWindow* aRW = aView->getRenderWindow()) + { + aView->getRenderer()->Render(); + aView->getRWInteractor()->unHighlightAll(); aRW->update(); + } } void diff --git a/src/SalomeApp/Makefile.in b/src/SalomeApp/Makefile.in index fb914ced0..b80a6844a 100755 --- a/src/SalomeApp/Makefile.in +++ b/src/SalomeApp/Makefile.in @@ -44,7 +44,7 @@ EXPORT_HEADERS= SalomeApp.h \ SalomeApp_Operation.h \ SalomeApp_Dialog.h \ SalomeApp_UpdateFlags.h \ - SalomeApp_SwitchOp.cxx + SalomeApp_Displayer.h # .po files to transform in .qm PO_FILES = SalomeApp_images.po \ @@ -85,7 +85,9 @@ LIB_SRC= SalomeApp_Module.cxx \ SalomeApp_CheckFileDlg.cxx \ SalomeApp_Operation.cxx \ SalomeApp_Dialog.cxx \ - SalomeApp_SwitchOp.cxx + SalomeApp_SwitchOp.cxx \ + SalomeApp_Displayer.cxx \ + SalomeApp_ShowHideOp.cxx LIB_MOC = SalomeApp_AboutDlg.h \ SalomeApp_Application.h \ @@ -107,7 +109,8 @@ LIB_MOC = SalomeApp_AboutDlg.h \ SalomeApp_CheckFileDlg.h \ SalomeApp_Operation.h \ SalomeApp_Dialog.h \ - SalomeApp_SwitchOp.h + SalomeApp_SwitchOp.h \ + SalomeApp_ShowHideOp.h LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_Exception.idl \ @@ -125,7 +128,7 @@ RESOURCES_FILES = icon_about.png \ CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS) -LIBS+= -lsuit -lstd -lCAM -lObjBrowser -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lSalomeContainer -lToolsGUI +LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lSalomePrs -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lSalomeContainer -lToolsGUI @CONCLUDE@ diff --git a/src/SalomeApp/SalomeApp_Displayer.cxx b/src/SalomeApp/SalomeApp_Displayer.cxx new file mode 100644 index 000000000..ad8bbaabc --- /dev/null +++ b/src/SalomeApp/SalomeApp_Displayer.cxx @@ -0,0 +1,145 @@ + +#include "SalomeApp_Displayer.h" +#include "SalomeApp_Application.h" + +#include + +#include +#include +#include +#include +#include + +#include + +SalomeApp_Displayer::SalomeApp_Displayer() +{ +} + +SalomeApp_Displayer::~SalomeApp_Displayer() +{ +} + +void SalomeApp_Displayer::Display( const QString& entry, const bool updateViewer, SALOME_View* theViewFrame ) +{ + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); + if ( vf ) + { + SALOME_Prs* prs = buildPresentation( entry, vf ); + + if ( prs ) + { + vf->BeforeDisplay( this ); + vf->Display( prs ); + vf->AfterDisplay( this ); + + if ( updateViewer ) + vf->Repaint(); + + delete prs; // delete presentation because displayer is its owner + } + } +} + +void SalomeApp_Displayer::Redisplay( const QString& entry, const bool updateViewer ) +{ + // Remove the object permanently ( == true) + SUIT_Session* ses = SUIT_Session::session(); + SUIT_Application* app = ses->activeApplication(); + if ( app ) + { + SUIT_Desktop* desk = app->desktop(); + QPtrList wnds = desk->windows(); + SUIT_ViewWindow* wnd; + for ( wnd = wnds.first(); wnd; wnd = wnds.next() ) + { + SUIT_ViewManager* vman = wnd->getViewManager(); + if( !vman ) + continue; + + SUIT_ViewModel* vmodel = vman->getViewModel(); + if( !vmodel ) + continue; + + SALOME_View* view = dynamic_cast(vmodel); + if( view && ( IsDisplayed( entry, view ) || view == GetActiveView() ) ) + { + Erase( entry, true, false, view ); + Display( entry, updateViewer, view ); + } + } + } +} + +void SalomeApp_Displayer::Erase( const QString& entry, const bool forced, + const bool updateViewer, SALOME_View* theViewFrame ) +{ + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); + + if ( vf ) { + SALOME_Prs* prs = vf->CreatePrs( entry.latin1() ); + if ( prs ) { + vf->Erase( prs, forced ); + if ( updateViewer ) + vf->Repaint(); + delete prs; // delete presentation because displayer is its owner + } + } +} + +void SalomeApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame ) const +{ + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); + + if ( vf ) { + vf->EraseAll( forced ); + if ( updateViewer ) + vf->Repaint(); + } +} + +bool SalomeApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theViewFrame ) const +{ + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); + if( vf ) + { + Handle( SALOME_InteractiveObject ) temp = new SALOME_InteractiveObject(); + temp->setEntry( entry.latin1() ); + return vf->isVisible( temp ); + } + else + return false; +} + +void SalomeApp_Displayer::UpdateViewer() const +{ + SALOME_View* vf = GetActiveView(); + if ( vf ) + vf->Repaint(); +} + +SALOME_Prs* SalomeApp_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame ) +{ + SALOME_Prs* prs = 0; + + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); + + if ( vf ) + prs = vf->CreatePrs( entry.latin1() ); + + return prs; +} + +SALOME_View* SalomeApp_Displayer::GetActiveView() +{ + SUIT_Session* session = SUIT_Session::session(); + if ( SUIT_Application* app = session->activeApplication() ) { + if ( SalomeApp_Application* sApp = dynamic_cast( app ) ) { + if( SUIT_ViewManager* vman = sApp->activeViewManager() ) { + if ( SUIT_ViewModel* vmod = vman->getViewModel() ) + return dynamic_cast( vmod ); + } + } + } + return 0; +} diff --git a/src/SalomeApp/SalomeApp_Displayer.h b/src/SalomeApp/SalomeApp_Displayer.h new file mode 100644 index 000000000..a28effdb7 --- /dev/null +++ b/src/SalomeApp/SalomeApp_Displayer.h @@ -0,0 +1,28 @@ + +#ifndef SALOMEAPP_DISPLAYER_HEADER +#define SALOMEAPP_DISPLAYER_HEADER + +#include + +class QString; + +class SalomeApp_Displayer : public SALOME_Displayer +{ +public: + SalomeApp_Displayer(); + virtual ~SalomeApp_Displayer(); + + void Display( const QString&, const bool = true, SALOME_View* = 0 ); + void Redisplay( const QString&, const bool = true ); + 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; + void UpdateViewer() const; + + static SALOME_View* GetActiveView(); + +protected: + virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); +}; + +#endif diff --git a/src/SalomeApp/SalomeApp_Module.cxx b/src/SalomeApp/SalomeApp_Module.cxx index f62a3eca4..21da6e509 100644 --- a/src/SalomeApp/SalomeApp_Module.cxx +++ b/src/SalomeApp/SalomeApp_Module.cxx @@ -12,6 +12,7 @@ #include "SalomeApp_UpdateFlags.h" #include "SalomeApp_Operation.h" #include "SalomeApp_SwitchOp.h" +#include "SalomeApp_ShowHideOp.h" #include @@ -33,7 +34,10 @@ SalomeApp_Module::SalomeApp_Module( const QString& name ) : CAM_Module( name ), myPopupMgr( 0 ), -mySwitchOp( 0 ) +mySwitchOp( 0 ), +myDisplay( -1 ), +myErase( -1 ), +myDisplayOnly( -1 ) { } @@ -132,7 +136,33 @@ void SalomeApp_Module::onModelClosed() QtxPopupMgr* SalomeApp_Module::popupMgr() { if ( !myPopupMgr ) + { myPopupMgr = new QtxPopupMgr( 0, this ); + + QPixmap p; + SUIT_Desktop* d = application()->desktop(); + + QAction + *disp = createAction( -1, tr( "TOP_DISPLAY" ), p, tr( "MEN_DISPLAY" ), tr( "STB_DISPLAY" ), + 0, d, false, this, SLOT( onShowHide() ) ), + *erase = createAction( -1, tr( "TOP_ERASE" ), p, tr( "MEN_ERASE" ), tr( "STB_ERASE" ), + 0, d, false, this, SLOT( onShowHide() ) ), + *dispOnly = createAction( -1, tr( "TOP_DISPLAY_ONLY" ), p, tr( "MEN_DISPLAY_ONLY" ), tr( "STB_DISPLAY_ONLY" ), + 0, d, false, this, SLOT( onShowHide() ) ); + myDisplay = actionId( disp ); + myErase = actionId( erase ); + myDisplayOnly = actionId( dispOnly ); + + myPopupMgr->insert( disp, -1, 0 ); + myPopupMgr->insert( erase, -1, 0 ); + myPopupMgr->insert( dispOnly, -1, 0 ); + myPopupMgr->insert( separator(), -1, 0 ); + + QString uniform = "( count( $component ) = 1 ) and ( component != activeModule )"; + myPopupMgr->setRule( disp, QString( "( not isVisible ) and " ) + uniform, true ); + myPopupMgr->setRule( erase, QString( "( isVisible ) and " ) + uniform, true ); + myPopupMgr->setRule( dispOnly, uniform, true ); + } return myPopupMgr; } @@ -305,9 +335,19 @@ void SalomeApp_Module::startOperation( const int id ) * automatically from startOperation. You may redefine this method in concrete module to * create operations. */ -SalomeApp_Operation* SalomeApp_Module::createOperation( const int /*id*/ ) const +SalomeApp_Operation* SalomeApp_Module::createOperation( const int id ) const { - return 0; + if( id==-1 ) + return 0; + + if( id==myDisplay ) + return new SalomeApp_ShowHideOp( SalomeApp_ShowHideOp::DISPLAY ); + else if( id==myErase ) + return new SalomeApp_ShowHideOp( SalomeApp_ShowHideOp::ERASE ); + else if( id==myDisplayOnly ) + return new SalomeApp_ShowHideOp( SalomeApp_ShowHideOp::DISPLAY_ONLY ); + else + return 0; } /*! @@ -345,3 +385,19 @@ void SalomeApp_Module::onOperationDestroyed() } } } + +SalomeApp_Displayer* SalomeApp_Module::displayer() +{ + return 0; +} + +void SalomeApp_Module::onShowHide() +{ + if( !sender()->inherits( "QAction" ) || !popupMgr() ) + return; + + QAction* act = ( QAction* )sender(); + int id = actionId( act ); + if( id!=-1 ) + startOperation( id ); +} diff --git a/src/SalomeApp/SalomeApp_Module.h b/src/SalomeApp/SalomeApp_Module.h index 644608c5d..1ab7f75cd 100644 --- a/src/SalomeApp/SalomeApp_Module.h +++ b/src/SalomeApp/SalomeApp_Module.h @@ -30,6 +30,7 @@ class SalomeApp_Preferences; class SalomeApp_SelectionManager; class SalomeApp_Operation; class SalomeApp_SwitchOp; +class SalomeApp_Displayer; /*! * \brief Base class for all salome modules @@ -45,6 +46,7 @@ public: virtual void initialize( CAM_Application* ); virtual void windows( QMap& ) const; virtual void viewManagers( QStringList& ) const; + virtual SalomeApp_Displayer* displayer(); /*! engineIOR() should be a pure virtual method, to avoid logical errors!\n * Implementation in derived classes can return the following values:\n @@ -88,6 +90,7 @@ protected slots: virtual void onModelClosed(); virtual void onOperationStopped( SUIT_Operation* ); virtual void onOperationDestroyed(); + virtual void onShowHide(); protected: QtxPopupMgr* popupMgr(); @@ -122,6 +125,7 @@ private: QtxPopupMgr* myPopupMgr; MapOfOperation myOperations; SalomeApp_SwitchOp* mySwitchOp; + int myDisplay, myErase, myDisplayOnly; }; #endif diff --git a/src/SalomeApp/SalomeApp_Selection.cxx b/src/SalomeApp/SalomeApp_Selection.cxx index 8115b435c..14bcc8ad5 100644 --- a/src/SalomeApp/SalomeApp_Selection.cxx +++ b/src/SalomeApp/SalomeApp_Selection.cxx @@ -1,10 +1,10 @@ #include "SalomeApp_Selection.h" - #include "SalomeApp_SelectionMgr.h" #include "SalomeApp_DataOwner.h" #include "SalomeApp_Study.h" #include "SalomeApp_Application.h" +#include "SalomeApp_Displayer.h" #include "SUIT_Session.h" #include "SUIT_ViewWindow.h" @@ -62,8 +62,27 @@ int SalomeApp_Selection::count() const /*! Gets QtxValue(); */ -QtxValue SalomeApp_Selection::param( const int, const QString& p ) const +QtxValue SalomeApp_Selection::param( const int ind, const QString& p ) const { + if( !( ind>=0 && indstudyDS()->FindObjectID( myEntries[ ind ] ) ); + _PTR(SComponent) comp = obj->GetFatherComponent(); + QString mod_name = comp->ComponentDataType().c_str(); + //cout << "component : " << ind << " >> " << mod_name.latin1() << endl; + if( !mod_name.isEmpty() ) + return mod_name; + } + return QtxValue(); } @@ -73,6 +92,16 @@ QtxValue SalomeApp_Selection::param( const int, const QString& p ) const QtxValue SalomeApp_Selection::globalParam( const QString& p ) const { if ( p == "client" ) return QtxValue( myPopupClient ); + else if ( p == "activeModule" ) + { + SalomeApp_Application* app = dynamic_cast( myStudy->application() ); + QString mod_name = app ? QString( app->activeModule()->name() ) : QString::null; + //cout << "activeModule : " << mod_name.latin1() << endl; + if( !mod_name.isEmpty() ) + return mod_name; + else + return QtxValue(); + } else if ( p == "isActiveView" ) return QtxValue( (bool)activeVW() ); else if ( p == "activeView" ) return QtxValue( activeViewType() ); #ifndef WNT diff --git a/src/SalomeApp/SalomeApp_ShowHideOp.cxx b/src/SalomeApp/SalomeApp_ShowHideOp.cxx new file mode 100644 index 000000000..d36939326 --- /dev/null +++ b/src/SalomeApp/SalomeApp_ShowHideOp.cxx @@ -0,0 +1,74 @@ + +#include "SalomeApp_ShowHideOp.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SalomeApp_DataOwner.h" +#include "SalomeApp_Selection.h" +#include "SalomeApp_Module.h" +#include "SalomeApp_Displayer.h" + +SalomeApp_ShowHideOp::SalomeApp_ShowHideOp( ActionType type ) +: SalomeApp_Operation(), + myActionType( type ) +{ +} + +SalomeApp_ShowHideOp::~SalomeApp_ShowHideOp() +{ +} + +void SalomeApp_ShowHideOp::startOperation() +{ + SalomeApp_Application* app = dynamic_cast( application() ); + if( !app ) + { + abort(); + return; + } + + SalomeApp_SelectionMgr* mgr = app->selectionMgr(); + SalomeApp_Selection sel; sel.init( "", mgr ); + if( sel.count()==0 ) + { + abort(); + return; + } + + QString mod_name = app->moduleTitle( sel.param( 0, "component" ).toString() ); + SalomeApp_Module* m = dynamic_cast( app ? app->module( mod_name ) : 0 ); + if( !m ) + { + m = dynamic_cast( app->loadModule( mod_name ) ); + app->addModule( m ); + m->setMenuShown( false ); + m->setToolShown( false ); + } + + SalomeApp_Displayer* d = m ? m->displayer(): 0; + if( !d ) + { + abort(); + return; + } + + if( myActionType==DISPLAY_ONLY ) + d->EraseAll( false, false, 0 ); + + SUIT_DataOwnerPtrList selected; + mgr->selected( selected ); + SUIT_DataOwnerPtrList::const_iterator anIt = selected.begin(), aLast = selected.end(); + for( ; anIt!=aLast; anIt++ ) + { + SalomeApp_DataOwner* owner = dynamic_cast( (*anIt).operator->() ); + if( !owner ) + continue; + + if( myActionType==DISPLAY || myActionType==DISPLAY_ONLY ) + d->Display( owner->entry(), false, 0 ); + else if( myActionType==ERASE ) + d->Erase( owner->entry(), false, false, 0 ); + } + d->UpdateViewer(); + commit(); +} + diff --git a/src/SalomeApp/SalomeApp_ShowHideOp.h b/src/SalomeApp/SalomeApp_ShowHideOp.h new file mode 100644 index 000000000..a3280a96d --- /dev/null +++ b/src/SalomeApp/SalomeApp_ShowHideOp.h @@ -0,0 +1,26 @@ + +#ifndef SALOMEAPP_SHOW_HIDE_OPERATION_HEADER +#define SALOMEAPP_SHOW_HIDE_OPERATION_HEADER + +#include "SalomeApp_Operation.h" + +class SalomeApp_ShowHideOp : public SalomeApp_Operation +{ + Q_OBJECT + +public: + typedef enum { DISPLAY, ERASE, DISPLAY_ONLY } ActionType; + +public: + SalomeApp_ShowHideOp( ActionType ); + ~SalomeApp_ShowHideOp(); + +protected: + virtual void startOperation(); + +private: + ActionType myActionType; +}; + +#endif + -- 2.39.2