2 #include "LightApp_ShowHideOp.h"
3 #include "LightApp_Application.h"
4 #include "LightApp_DataOwner.h"
5 #include "LightApp_Module.h"
6 #include "LightApp_Displayer.h"
9 #include "LightApp_SelectionMgr.h"
10 #include "LightApp_Selection.h"
12 #include <SALOME_ListIO.hxx>
13 #include <SALOME_ListIteratorOfListIO.hxx>
15 LightApp_ShowHideOp::LightApp_ShowHideOp( ActionType type )
16 : LightApp_Operation(),
21 LightApp_ShowHideOp::~LightApp_ShowHideOp()
25 void LightApp_ShowHideOp::startOperation()
27 LightApp_Application* app = dynamic_cast<LightApp_Application*>( application() );
34 LightApp_SelectionMgr* mgr = app->selectionMgr();
35 LightApp_Selection sel; sel.init( "", mgr );
41 QString aStr = sel.param( 0, "component" ).toString();
42 QString mod_name = app->moduleTitle( aStr );//sel.param( 0, "component" ).toString() );
43 LightApp_Module* m = dynamic_cast<LightApp_Module*>( app ? app->module( mod_name ) : 0 );
46 m = dynamic_cast<LightApp_Module*>( app->loadModule( mod_name ) );
48 m->connectToStudy( dynamic_cast<CAM_Study*>( app->activeStudy() ) );
49 m->setMenuShown( false );
50 m->setToolShown( false );
53 LightApp_Displayer* d = m ? m->displayer(): 0;
60 if( myActionType==DISPLAY_ONLY )
61 d->EraseAll( false, false, 0 );
63 SALOME_ListIO selObjs;
64 mgr->selectedObjects( selObjs );
65 SALOME_ListIteratorOfListIO anIt( selObjs );
66 for( ; anIt.More(); anIt.Next() )
68 if( anIt.Value().IsNull() )
72 if( myActionType==DISPLAY || myActionType==DISPLAY_ONLY )
73 d->Display( anIt.Value()->getEntry(), false, 0 );
74 else if( myActionType==ERASE )
75 d->Erase( anIt.Value()->getEntry(), false, false, 0 );