2 #include <HYDROGUI_Operation.h>
3 #include <HYDROGUI_Module.h>
4 #include <HYDROGUI_InputPanel.h>
5 #include <HYDROData_Document.h>
6 #include <HYDROData_Iterator.h>
7 #include <LightApp_Application.h>
8 #include <LightApp_SelectionMgr.h>
9 #include <SUIT_Desktop.h>
10 #include <SUIT_Study.h>
12 HYDROGUI_Operation::HYDROGUI_Operation( HYDROGUI_Module* theModule )
13 : LightApp_Operation(), myModule( theModule ), myPanel( 0 )
17 HYDROGUI_Operation::~HYDROGUI_Operation()
21 SUIT_SelectionMgr* HYDROGUI_Operation::selectionMgr() const
23 return myModule->getApp()->selectionMgr();
26 HYDROGUI_Module* HYDROGUI_Operation::module() const
31 void HYDROGUI_Operation::startOperation()
33 doc()->StartOperation();
37 connect( inputPanel(), SIGNAL( panelApply() ), this, SLOT( OnApply() ) );
38 connect( inputPanel(), SIGNAL( panelCancel() ), this, SLOT( OnCancel() ) );
41 myModule->getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, inputPanel() );
45 HYDROGUI_InputPanel* HYDROGUI_Operation::inputPanel() const
48 ( ( HYDROGUI_Operation* )this )->myPanel = createInputPanel();
52 Handle_HYDROData_Document HYDROGUI_Operation::doc() const
54 int aStudyId = myModule->application()->activeStudy()->id();
55 return HYDROData_Document::Document( aStudyId );
58 void HYDROGUI_Operation::OnApply()
60 doc()->CommitOperation();
64 void HYDROGUI_Operation::OnCancel()
66 doc()->AbortOperation();
70 Handle_HYDROData_Object HYDROGUI_Operation::FindObjectByName( const QString& theName, int theKind ) const
72 HYDROData_Iterator anIt( doc(), theKind );
73 for( ; anIt.More(); anIt.Next() )
75 if( anIt.Current()->GetName() == theName )
76 return anIt.Current();
78 return Handle_HYDROData_Object();