1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HYDROGUI_Module.h"
25 #include "HYDROGUI_DataModel.h"
26 #include "HYDROGUI_InputPanel.h"
27 #include "HYDROGUI_ObjSelector.h"
28 #include "HYDROGUI_Operations.h"
30 #include <GraphicsView_PrsImage.h>
31 #include <GraphicsView_ViewFrame.h>
32 #include <GraphicsView_ViewPort.h>
33 #include <GraphicsView_Viewer.h>
35 #include <LightApp_Application.h>
36 #include <LightApp_GVSelector.h>
37 #include <LightApp_SelectionMgr.h>
39 #include <SUIT_Desktop.h>
40 #include <SUIT_Study.h>
41 #include <SUIT_ViewManager.h>
43 #include <QApplication>
45 extern "C" HYDRO_EXPORT CAM_Module* createModule()
47 return new HYDROGUI_Module();
50 HYDROGUI_Module::HYDROGUI_Module()
51 : LightApp_Module( "HYDRO GUI" )
55 HYDROGUI_Module::~HYDROGUI_Module()
59 int HYDROGUI_Module::getStudyId() const
61 LightApp_Application* anApp = getApp();
62 return anApp ? anApp->activeStudy()->id() : 0;
65 void HYDROGUI_Module::initialize( CAM_Application* theApp )
67 printf( "Initialization of the HYDROGUI module\n" );
68 LightApp_Module::initialize( theApp );
75 setMenuShown( false );
77 //startOperation( ImportImageId );
78 startOperation( FuseId );
81 bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
84 return LightApp_Module::activateModule( theStudy );
87 void HYDROGUI_Module::windows( QMap<int, int>& theMap ) const
90 theMap.insert( LightApp_Application::WT_LogWindow, Qt::BottomDockWidgetArea );
91 theMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
94 void HYDROGUI_Module::viewManagers( QStringList& theTypesList ) const
96 theTypesList << GraphicsView_Viewer::Type();
99 HYDROGUI_DataModel* HYDROGUI_Module::getModel() const
101 return (HYDROGUI_DataModel*)dataModel();
104 CAM_DataModel* HYDROGUI_Module::createDataModel()
106 return new HYDROGUI_DataModel( this );
109 void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theMgr )
111 LightApp_Module::onViewManagerAdded( theMgr );
112 connect( theMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
113 this, SLOT( onViewWindowAdded( SUIT_ViewWindow* ) ) );
116 void HYDROGUI_Module::onViewWindowAdded( SUIT_ViewWindow* theWnd )
118 GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theWnd );
120 LightApp_SelectionMgr* aSelMgr = getApp()->selectionMgr();
121 LightApp_GVSelector* aSelector = new LightApp_GVSelector( aViewFrame->getViewer(), aSelMgr );
123 GraphicsView_ViewPort* aViewPort = aViewFrame->getViewPort();
125 GraphicsView_PrsImage* aPrs1 = new GraphicsView_PrsImage();
126 QImage anImage1( "W:/Work/HYDRO/data/samples/1.bmp" );
127 aPrs1->setImage( anImage1 );
128 aPrs1->setName( "example_1" );
130 aViewPort->addItem( aPrs1 );
132 GraphicsView_PrsImage* aPrs2 = new GraphicsView_PrsImage();
133 QImage anImage2( "W:/Work/HYDRO/data/samples/2.bmp" );
134 aPrs2->setImage( anImage2 );
135 aPrs2->setName( "example_2" );
136 aPrs2->setRotationAngle( 30 );
137 aPrs2->setPosition( 200, 50 );
139 aViewPort->addItem( aPrs2 );
141 //qApp->processEvents();