2 #include <HYDROGUI_Module.h>
3 #include <LightApp_Application.h>
4 #include <LightApp_SelectionMgr.h>
5 #include <GraphicsView_PrsImage.h>
6 #include <GraphicsView_Viewer.h>
7 #include <GraphicsView_ViewFrame.h>
8 #include <GraphicsView_ViewPort.h>
9 #include <LightApp_GVSelector.h>
10 #include <SUIT_ViewManager.h>
11 #include <SUIT_Desktop.h>
12 #include <QApplication>
13 #include <HYDROGUI_InputPanel.h>
14 #include <HYDROGUI_ObjSelector.h>
16 extern "C" HYDRO_EXPORT CAM_Module* createModule()
18 return new HYDROGUI_Module();
21 HYDROGUI_Module::HYDROGUI_Module()
22 : LightApp_Module( "HYDRO GUI" )
26 HYDROGUI_Module::~HYDROGUI_Module()
30 void HYDROGUI_Module::initialize( CAM_Application* theApp )
32 LightApp_Module::initialize( theApp );
39 setMenuShown( false );
41 HYDROGUI_InputPanel* aDlg = new HYDROGUI_InputPanel( this, "Fuse Images" );
42 HYDROGUI_ObjSelector* aSel1 = new HYDROGUI_ObjSelector( this, aDlg );
43 HYDROGUI_ObjSelector* aSel2 = new HYDROGUI_ObjSelector( this, aDlg );
44 aDlg->addWidget( "Image 1", aSel1 );
45 aDlg->addWidget( "Image 2", aSel2 );
46 application()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aDlg );
48 qApp->processEvents();
51 bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
54 return LightApp_Module::activateModule( theStudy );
57 void HYDROGUI_Module::windows( QMap<int, int>& theMap ) const
60 theMap.insert( LightApp_Application::WT_LogWindow, Qt::BottomDockWidgetArea );
61 theMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
64 void HYDROGUI_Module::viewManagers( QStringList& theTypesList ) const
66 theTypesList << GraphicsView_Viewer::Type();
69 void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theMgr )
71 LightApp_Module::onViewManagerAdded( theMgr );
72 connect( theMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
73 this, SLOT( onViewWindowAdded( SUIT_ViewWindow* ) ) );
76 void HYDROGUI_Module::onViewWindowAdded( SUIT_ViewWindow* theWnd )
78 GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theWnd );
80 LightApp_SelectionMgr* aSelMgr = getApp()->selectionMgr();
81 LightApp_GVSelector* aSelector = new LightApp_GVSelector( aViewFrame->getViewer(), aSelMgr );
83 GraphicsView_ViewPort* aViewPort = aViewFrame->getViewPort();
85 GraphicsView_PrsImage* aPrs1 = new GraphicsView_PrsImage();
86 QImage anImage1( "W:/Work/HYDRO/data/samples/1.bmp" );
87 aPrs1->setImage( anImage1 );
88 aPrs1->setName( "example_1" );
90 aViewPort->addItem( aPrs1 );
92 GraphicsView_PrsImage* aPrs2 = new GraphicsView_PrsImage();
93 QImage anImage2( "W:/Work/HYDRO/data/samples/2.bmp" );
94 aPrs2->setImage( anImage2 );
95 aPrs2->setName( "example_2" );
96 aPrs2->setRotationAngle( 30 );
97 aPrs2->setPosition( 200, 50 );
99 aViewPort->addItem( aPrs2 );
101 //qApp->processEvents();