Salome HOME
basic implementation of images operations support
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_TwoImagesOp.cxx
1
2 #include <HYDROGUI_TwoImagesOp.h>
3 #include <HYDROGUI_TwoImagesDlg.h>
4 #include <HYDROData_Image.h>
5 #include <HYDROData_Document.h>
6 #include <HYDROOperations_Factory.h>
7
8 HYDROGUI_TwoImagesOp::HYDROGUI_TwoImagesOp( HYDROGUI_Module* theModule, const QString& theTitle )
9   : HYDROGUI_Operation( theModule ), myTitle( theTitle )
10 {
11 }
12
13 HYDROGUI_TwoImagesOp::~HYDROGUI_TwoImagesOp()
14 {
15 }
16
17 HYDROGUI_InputPanel* HYDROGUI_TwoImagesOp::createInputPanel() const
18 {
19   return new HYDROGUI_TwoImagesDlg( module(), myTitle );
20 }
21
22 void HYDROGUI_TwoImagesOp::OnApply()
23 {
24   HYDROGUI_TwoImagesDlg* aPanel = dynamic_cast<HYDROGUI_TwoImagesDlg*>( inputPanel() );
25   QString aName1, aName2;
26   aPanel->GetSelectedImages( aName1, aName2 );
27
28   Handle_HYDROData_Image anImage1 = Handle_HYDROData_Image::DownCast(
29     FindObjectByName( aName1, KIND_IMAGE ) );
30   Handle_HYDROData_Image anImage2 = Handle_HYDROData_Image::DownCast(
31     FindObjectByName( aName2, KIND_IMAGE ) );
32
33   HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory();
34   ImageComposer_Operator* anOperator = 0; //TODO
35
36   Handle(HYDROData_Image) aResult = aFactory->CreateImage( doc(), anOperator );
37   aResult->AppendReference( anImage1 );
38   aResult->AppendReference( anImage2 );
39   aFactory->UpdateImage( doc(), aResult );
40 }