]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
basic implementation of images operations support
authorasl <asl@opencascade.com>
Fri, 26 Jul 2013 09:35:01 +0000 (09:35 +0000)
committerasl <asl@opencascade.com>
Fri, 26 Jul 2013 09:35:01 +0000 (09:35 +0000)
20 files changed:
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_ColorWidget.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ColorWidget.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ImportImageDlg.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ImportImageOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ImportImageOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_InputPanel.cxx
src/HYDROGUI/HYDROGUI_InputPanel.h
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_ObjSelector.cxx
src/HYDROGUI/HYDROGUI_ObjSelector.h
src/HYDROGUI/HYDROGUI_Operation.cxx
src/HYDROGUI/HYDROGUI_Operation.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_TwoImagesDlg.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_TwoImagesOp.h [new file with mode: 0644]

index 9f2554a3044a3cf38019291223b67aa6222f9937..b6c0cc711e6b53a29b3c4621560814ee8a89d3b1 100644 (file)
@@ -8,6 +8,11 @@ set(PROJECT_HEADERS
     HYDROGUI_ObjSelector.h
     HYDROGUI_Operation.h
     HYDROGUI_Operations.h
+    HYDROGUI_ImportImageOp.h
+    HYDROGUI_ImportImageDlg.h
+    HYDROGUI_TwoImagesOp.h
+    HYDROGUI_TwoImagesDlg.h
+    HYDROGUI_ColorWidget.h
 )
 
 QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
@@ -18,6 +23,11 @@ set(PROJECT_SOURCES
     HYDROGUI_ObjSelector.cxx
     HYDROGUI_Operation.cxx
     HYDROGUI_Operations.cxx
+    HYDROGUI_ImportImageOp.cxx
+    HYDROGUI_ImportImageDlg.cxx
+    HYDROGUI_TwoImagesOp.cxx
+    HYDROGUI_TwoImagesDlg.cxx
+    HYDROGUI_ColorWidget.cxx
 )
 
 add_definitions(
@@ -33,10 +43,11 @@ include_directories(
   ${GUI_ROOT_DIR}/include/salome
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROData
+  ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROOperations
 )
 
 add_library(HYDROGUI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_HEADERS_MOC})
-target_link_libraries(HYDROGUI ${CAS_OCAF})
+target_link_libraries(HYDROGUI ${CAS_OCAF} HYDROData HYDROOperations)
 
 set(PROJECT_LIBRARIES HYDROGUI)
 
diff --git a/src/HYDROGUI/HYDROGUI_ColorWidget.cxx b/src/HYDROGUI/HYDROGUI_ColorWidget.cxx
new file mode 100644 (file)
index 0000000..312b928
--- /dev/null
@@ -0,0 +1,56 @@
+
+#include <HYDROGUI_ColorWidget.h>
+#include <QColorDialog>
+
+HYDROGUI_ColorWidget::HYDROGUI_ColorWidget( QWidget* parent )
+: QFrame( parent )
+{
+  setFrameShape( QFrame::Box );
+  //setFixedSize( 40, 20 );
+  //commented for correct layout management
+  //(otherwise the column with color widget can not be resized
+  //and all free space is arranged on sides
+}
+
+HYDROGUI_ColorWidget::~HYDROGUI_ColorWidget()
+{
+}
+
+QColor HYDROGUI_ColorWidget::color() const
+{
+  QPalette aPalette = palette();
+  return aPalette.color( QPalette::Window );
+}
+
+void HYDROGUI_ColorWidget::setColor( const QColor& c )
+{
+  QPalette aPalette = palette();
+  aPalette.setColor( QPalette::Window, c );
+  setAutoFillBackground( true );
+  setPalette( aPalette );
+}
+
+void HYDROGUI_ColorWidget::mouseDoubleClickEvent( QMouseEvent* )
+{
+  QColor c = QColorDialog::getColor( color(), this );
+  if( c.isValid() )
+  {
+    setColor( c );
+    emit colorChanged( c );
+  }
+}
+/*
+int HYDROGUI_ColorWidget::intColor() const
+{
+  return HYDROGUI_Tools::color2int( color() );
+}
+
+void HYDROGUI_ColorWidget::setColor( const int col )
+{
+  setColor( HYDROGUI_Tools::int2color( col ) );
+}
+*/
+/*void HYDROGUI_ColorWidget::setRandColor()
+{
+  setColor( HYDROGUI_Tools::randColor() );
+}*/
diff --git a/src/HYDROGUI/HYDROGUI_ColorWidget.h b/src/HYDROGUI/HYDROGUI_ColorWidget.h
new file mode 100644 (file)
index 0000000..6cb802e
--- /dev/null
@@ -0,0 +1,42 @@
+
+#ifndef HYDROGUI_COLOR_WIDGET_HEADER
+#define HYDROGUI_COLOR_WIDGET_HEADER
+
+#include <QFrame>
+
+/** \class HYDROGUI_ColorWidget
+ * \brief The class representing widget for color selection
+ */
+class HYDROGUI_ColorWidget : public QFrame
+{
+  Q_OBJECT
+
+public:
+  /** Constructor 
+   * \param parent - parent widget
+   */
+  HYDROGUI_ColorWidget( QWidget* parent );
+  /** Destructor */
+  virtual ~HYDROGUI_ColorWidget();
+
+  /** \return color value */
+  QColor color() const;
+  /** Sets color value */
+  void   setColor( const QColor& );
+  /** \return color value in the integer form */
+  //int    intColor() const;
+  /** Sets color value in the integer form */
+  //void   setColor( const int );
+  /** Sets a randomized color as current value */
+  //void   setRandColor();
+
+signals:
+  /** is emitted when signal is changed */
+  void colorChanged( const QColor& );
+
+protected:
+  /** mouse double click event handler, activates the standard color dialog for color choice */
+  virtual void mouseDoubleClickEvent( QMouseEvent* );
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.h b/src/HYDROGUI/HYDROGUI_ImportImageDlg.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx
new file mode 100644 (file)
index 0000000..9b0093c
--- /dev/null
@@ -0,0 +1,16 @@
+
+#include <HYDROGUI_ImportImageOp.h>
+
+HYDROGUI_ImportImageOp::HYDROGUI_ImportImageOp( HYDROGUI_Module* theModule )
+  : HYDROGUI_Operation( theModule )
+{
+}
+
+HYDROGUI_ImportImageOp::~HYDROGUI_ImportImageOp()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_ImportImageOp::createInputPanel() const
+{
+  return 0;
+}
diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.h b/src/HYDROGUI/HYDROGUI_ImportImageOp.h
new file mode 100644 (file)
index 0000000..d9011c5
--- /dev/null
@@ -0,0 +1,17 @@
+
+#ifndef HYDROGUI_IMPORT_IMAGE_OP_HEADER
+#define HYDROGUI_IMPORT_IMAGE_OP_HEADER
+
+#include <HYDROGUI_Operation.h>
+
+class HYDROGUI_ImportImageOp : public HYDROGUI_Operation
+{
+public:
+  HYDROGUI_ImportImageOp( HYDROGUI_Module* theModule );
+  virtual ~HYDROGUI_ImportImageOp();
+
+protected:
+  virtual HYDROGUI_InputPanel* createInputPanel() const;
+};
+
+#endif
index a48f65adfb72c7e6edc1f55b4b901732d3328954..6e3181f93e409b6b0d1c7dc4f291335e87c14b36 100644 (file)
@@ -46,12 +46,19 @@ HYDROGUI_InputPanel::~HYDROGUI_InputPanel()
 {
 }
 
+HYDROGUI_Module* HYDROGUI_InputPanel::module() const
+{
+  return myModule;
+}
+
 void HYDROGUI_InputPanel::OnApply()
 {
+  emit panelApply(); 
 }
 
 void HYDROGUI_InputPanel::OnCancel()
 {
+  emit panelCancel();
 }
 
 void HYDROGUI_InputPanel::OnHelp()
@@ -65,3 +72,22 @@ void HYDROGUI_InputPanel::addWidget( const QString& theLabel, QWidget* theWidget
   aMainLayout->addWidget( new QLabel( theLabel, this ), aRow, 0 );
   aMainLayout->addWidget( theWidget, aRow, 1 );
 }
+
+void HYDROGUI_InputPanel::addSeparator()
+{
+  QGridLayout* aMainLayout = dynamic_cast<QGridLayout*>( myMainFrame->layout() );
+  int aRow = aMainLayout->rowCount();
+
+  QFrame* aLine = new QFrame();
+  aLine->setFrameShape( QFrame::HLine );
+  aLine->setFrameShadow( QFrame::Sunken );
+
+  aMainLayout->addWidget( aLine, aRow, 0, 1, 2 );
+}
+
+void HYDROGUI_InputPanel::setRowStretch()
+{
+  QGridLayout* aMainLayout = dynamic_cast<QGridLayout*>( myMainFrame->layout() );
+  int aRow = aMainLayout->rowCount();
+  aMainLayout->setRowStretch( aRow, 1 );
+}
index e1801c1023c3a6ed54db725c51e00356f99d13f8..33d362175a8e399d907eb6ef10b024946b7eb440 100644 (file)
@@ -21,6 +21,14 @@ public:
   virtual ~HYDROGUI_InputPanel();
 
   void addWidget( const QString& theLabel, QWidget* theWidget );
+  void addSeparator();
+  void setRowStretch();
+
+  HYDROGUI_Module* module() const;
+
+signals:
+  void panelApply();
+  void panelCancel();
 
 protected slots:
   void OnApply();
index 1ddd42d38d4b39e29ba4ac80bc8cd37cc4f46f9e..bad6da24a1fa6a190d6cf1beaa8a05d38a17b2e5 100644 (file)
@@ -12,6 +12,7 @@
 #include <QApplication>
 #include <HYDROGUI_InputPanel.h>
 #include <HYDROGUI_ObjSelector.h>
+#include <HYDROGUI_Operations.h>
 
 extern "C" HYDRO_EXPORT CAM_Module* createModule()
 {
@@ -29,6 +30,7 @@ HYDROGUI_Module::~HYDROGUI_Module()
 
 void HYDROGUI_Module::initialize( CAM_Application* theApp )
 {
+  printf( "Initialization of the HYDROGUI module\n" );
   LightApp_Module::initialize( theApp );
 
   CreateActions();
@@ -38,14 +40,8 @@ void HYDROGUI_Module::initialize( CAM_Application* theApp )
 
   setMenuShown( false );
 
-  HYDROGUI_InputPanel* aDlg = new HYDROGUI_InputPanel( this, "Fuse Images" );
-  HYDROGUI_ObjSelector* aSel1 = new HYDROGUI_ObjSelector( this, aDlg );
-  HYDROGUI_ObjSelector* aSel2 = new HYDROGUI_ObjSelector( this, aDlg );
-  aDlg->addWidget( "Image 1", aSel1 );
-  aDlg->addWidget( "Image 2", aSel2 );
-  application()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aDlg );
-
-  qApp->processEvents();
+  //startOperation( ImportImageId );
+  startOperation( FuseId );
 }
 
 bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
index 9a6016eea887e7f5c1eb04e77f24a3a9783a7fad..02c737bb29c98ccf7aed5bf48c546bb70ff78f96 100644 (file)
@@ -75,3 +75,8 @@ void HYDROGUI_ObjSelector::OnSelectionChanged()
   }
   myObjName->setText( anObjName );
 }
+
+QString HYDROGUI_ObjSelector::GetName() const
+{
+  return myObjName->text();
+}
index 55c463b4ddb2b8cddd1430bbd36069ccae600591..427ddd9379de4d10f368720b580ed6074aade76a 100644 (file)
@@ -16,6 +16,8 @@ public:
   HYDROGUI_ObjSelector( HYDROGUI_Module* theModule, QWidget* theParent );
   virtual ~HYDROGUI_ObjSelector();
 
+  QString GetName() const;
+
 protected:
   virtual void paintEvent( QPaintEvent* );
   virtual bool hitButton( const QPoint& thePnt ) const;
index 6bd7e444d313a14d21c85bc4209da9eebc53854b..3b74134f0574b26fa0fda0a142bb02ed8013dd04 100644 (file)
@@ -2,12 +2,15 @@
 #include <HYDROGUI_Operation.h>
 #include <HYDROGUI_Module.h>
 #include <HYDROGUI_InputPanel.h>
+#include <HYDROData_Document.h>
+#include <HYDROData_Iterator.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <SUIT_Desktop.h>
+#include <SUIT_Study.h>
 
 HYDROGUI_Operation::HYDROGUI_Operation( HYDROGUI_Module* theModule )
-: SUIT_Operation( theModule->getApp() ), myModule( theModule ), myPanel( 0 )
+: LightApp_Operation(), myModule( theModule ), myPanel( 0 )
 {
 }
 
@@ -20,31 +23,57 @@ SUIT_SelectionMgr* HYDROGUI_Operation::selectionMgr() const
   return myModule->getApp()->selectionMgr();
 }
 
-void HYDROGUI_Operation::startOperation()
+HYDROGUI_Module* HYDROGUI_Operation::module() const
 {
-  /*TODO: if( myIsTransactional && doc() )
-    doc()->OpenTransaction();*/
+  return myModule;
+}
 
-  if( selectionMgr() )
-    connect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( OnSelectionDone() ) );
+void HYDROGUI_Operation::startOperation()
+{
+  doc()->StartOperation();
 
   if( inputPanel() )
   {
-    //TODO: connect( inputPanel(), SIGNAL( dlgOk() ),     this, SLOT( onOk() ) );
-    //TODO: connect( inputPanel(), SIGNAL( dlgCancel() ), this, SLOT( abort()  ) );
+    connect( inputPanel(), SIGNAL( panelApply() ),  this, SLOT( OnApply() ) );
+    connect( inputPanel(), SIGNAL( panelCancel() ), this, SLOT( OnCancel() ) );
 
     inputPanel()->show();
     myModule->getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, inputPanel() );
   }
 }
 
-void HYDROGUI_Operation::OnSelectionDone()
-{
-}
-
 HYDROGUI_InputPanel* HYDROGUI_Operation::inputPanel() const
 {
   if( !myPanel )
     ( ( HYDROGUI_Operation* )this )->myPanel = createInputPanel();
   return myPanel;
 }
+
+Handle_HYDROData_Document HYDROGUI_Operation::doc() const
+{
+  int aStudyId = myModule->application()->activeStudy()->id();
+  return HYDROData_Document::Document( aStudyId );
+}
+
+void HYDROGUI_Operation::OnApply()
+{
+  doc()->CommitOperation();
+  inputPanel()->hide();
+}
+
+void HYDROGUI_Operation::OnCancel()
+{
+  doc()->AbortOperation();
+  inputPanel()->hide();
+}
+
+Handle_HYDROData_Object HYDROGUI_Operation::FindObjectByName( const QString& theName, int theKind ) const
+{
+  HYDROData_Iterator anIt( doc(), theKind );
+  for( ; anIt.More(); anIt.Next() )
+  {
+    if( anIt.Current()->GetName() == theName )
+      return anIt.Current();
+  }
+  return Handle_HYDROData_Object();
+}
index 04db8eadf04eef874e8a9d7b4c9e004c84d50960..67938e59ed72bd05681c59134ce12a1863f03c4f 100644 (file)
@@ -3,13 +3,15 @@
 #define HYDROGUI_OPERATION_HEADER
 
 #include <HYDROGUI.h>
-#include <SUIT_Operation.h>
+#include <LightApp_Operation.h>
 
 class HYDROGUI_Module;
 class HYDROGUI_InputPanel;
 class SUIT_SelectionMgr;
+class Handle_HYDROData_Document;
+class Handle_HYDROData_Object;
 
-class HYDROGUI_Operation : public SUIT_Operation
+class HYDROGUI_Operation : public LightApp_Operation
 {
   Q_OBJECT
 
@@ -19,13 +21,18 @@ public:
 
   HYDROGUI_InputPanel* inputPanel() const;
   SUIT_SelectionMgr* selectionMgr() const;
+  HYDROGUI_Module* module() const;
 
 protected:
   virtual void startOperation();
   virtual HYDROGUI_InputPanel* createInputPanel() const = 0;
 
+  Handle_HYDROData_Document doc() const;
+  Handle_HYDROData_Object FindObjectByName( const QString& theName, int theKind ) const;
+
 protected slots:
-  virtual void OnSelectionDone();
+  virtual void OnApply();
+  virtual void OnCancel();
 
 private:
   HYDROGUI_Module* myModule;
index 9b7b0c1d6fc85dfda167d7b1e8b983a32dacf7b5..0a23fe33902d704005b60e5f649ceb6efbb7654e 100644 (file)
@@ -1,6 +1,9 @@
 
 #include <HYDROGUI_Module.h>
 #include <HYDROGUI_Operations.h>
+#include <HYDROGUI_ImportImageOp.h>
+#include <HYDROGUI_TwoImagesOp.h>
+
 #include <CAM_Application.h>
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_Desktop.h>
@@ -60,7 +63,13 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   switch( theId )
   {
   case ImportImageId:
-    anOp = 0;
+    anOp = new HYDROGUI_ImportImageOp( aModule );
+    break;
+  case FuseId:
+    anOp = new HYDROGUI_TwoImagesOp( aModule, tr( "FUSE_OP" ) );
+    break;
+  case CutId:
+    anOp = new HYDROGUI_TwoImagesOp( aModule, tr( "CUT_OP" ) );
     break;
   }
 
index 75fa4146858786a4ada087e20c16e8180d3e6d15..ad5aab33f7e0030ca4b1bba79e2265626ddd90b2 100644 (file)
@@ -6,7 +6,9 @@ enum OperationId
 {
   FirstId,
 
-  ImportImageId
+  ImportImageId,
+  FuseId,
+  CutId,
 };
 
 #endif
diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx
new file mode 100644 (file)
index 0000000..98ab08c
--- /dev/null
@@ -0,0 +1,45 @@
+
+#include <HYDROGUI_TwoImagesDlg.h>
+#include <HYDROGUI_ObjSelector.h>
+#include <HYDROGUI_ColorWidget.h>
+#include <QLineEdit>
+#include <QRadioButton>
+#include <QLayout>
+
+HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle )
+{
+  printf( "two images operation\n" );
+  myName = new QLineEdit();
+  myImage1 = new HYDROGUI_ObjSelector( module(), 0 );
+  myImage2 = new HYDROGUI_ObjSelector( module(), 0 );
+  myTransparent = new QRadioButton( tr( "TRANSPARENT" ) );
+  myTransparent->setChecked( true );
+  myColor = new QRadioButton( tr( "COLOR" ) );
+  myColorBox = new HYDROGUI_ColorWidget( 0 );
+
+  addWidget( tr( "NAME" ), myName );
+  addSeparator();
+  addWidget( tr( "IMAGE_1" ), myImage1 );
+  addWidget( tr( "IMAGE_2" ), myImage2 );
+
+  QFrame* aBackground = new QFrame();
+  QGridLayout* aLayout = new QGridLayout( aBackground );
+  aLayout->addWidget( myTransparent, 0, 0 );
+  aLayout->addWidget( myColor, 1, 0 );
+  aLayout->addWidget( myColorBox, 1, 1 );
+
+  addWidget( tr( "BACKGROUND" ), aBackground );
+  addSeparator();
+  setRowStretch();
+}
+
+HYDROGUI_TwoImagesDlg::~HYDROGUI_TwoImagesDlg()
+{
+}
+
+void HYDROGUI_TwoImagesDlg::GetSelectedImages( QString& theName1, QString& theName2 ) const
+{
+  theName1 = myImage1->GetName();
+  theName2 = myImage2->GetName();
+}
diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.h b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.h
new file mode 100644 (file)
index 0000000..0bd57bc
--- /dev/null
@@ -0,0 +1,27 @@
+
+#ifndef HYDROGUI_TWO_IMAGE_DLG_HEADER
+#define HYDROGUI_TWO_IMAGE_DLG_HEADER
+
+#include <HYDROGUI_InputPanel.h>
+
+class QLineEdit;
+class HYDROGUI_ObjSelector;
+class QRadioButton;
+class HYDROGUI_ColorWidget;
+
+class HYDROGUI_TwoImagesDlg : public HYDROGUI_InputPanel
+{
+public:
+  HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+  virtual ~HYDROGUI_TwoImagesDlg();
+
+  void GetSelectedImages( QString& theEntry1, QString& theEntry2 ) const;
+
+private:
+  QLineEdit* myName;
+  HYDROGUI_ObjSelector *myImage1, *myImage2;
+  QRadioButton *myTransparent, *myColor;
+  HYDROGUI_ColorWidget* myColorBox;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx b/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx
new file mode 100644 (file)
index 0000000..5a9a171
--- /dev/null
@@ -0,0 +1,40 @@
+
+#include <HYDROGUI_TwoImagesOp.h>
+#include <HYDROGUI_TwoImagesDlg.h>
+#include <HYDROData_Image.h>
+#include <HYDROData_Document.h>
+#include <HYDROOperations_Factory.h>
+
+HYDROGUI_TwoImagesOp::HYDROGUI_TwoImagesOp( HYDROGUI_Module* theModule, const QString& theTitle )
+  : HYDROGUI_Operation( theModule ), myTitle( theTitle )
+{
+}
+
+HYDROGUI_TwoImagesOp::~HYDROGUI_TwoImagesOp()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_TwoImagesOp::createInputPanel() const
+{
+  return new HYDROGUI_TwoImagesDlg( module(), myTitle );
+}
+
+void HYDROGUI_TwoImagesOp::OnApply()
+{
+  HYDROGUI_TwoImagesDlg* aPanel = dynamic_cast<HYDROGUI_TwoImagesDlg*>( inputPanel() );
+  QString aName1, aName2;
+  aPanel->GetSelectedImages( aName1, aName2 );
+
+  Handle_HYDROData_Image anImage1 = Handle_HYDROData_Image::DownCast(
+    FindObjectByName( aName1, KIND_IMAGE ) );
+  Handle_HYDROData_Image anImage2 = Handle_HYDROData_Image::DownCast(
+    FindObjectByName( aName2, KIND_IMAGE ) );
+
+  HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory();
+  ImageComposer_Operator* anOperator = 0; //TODO
+
+  Handle(HYDROData_Image) aResult = aFactory->CreateImage( doc(), anOperator );
+  aResult->AppendReference( anImage1 );
+  aResult->AppendReference( anImage2 );
+  aFactory->UpdateImage( doc(), aResult );
+}
diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesOp.h b/src/HYDROGUI/HYDROGUI_TwoImagesOp.h
new file mode 100644 (file)
index 0000000..59404f6
--- /dev/null
@@ -0,0 +1,25 @@
+
+#ifndef HYDROGUI_TWO_IMAGE_OP_HEADER
+#define HYDROGUI_TWO_IMAGE_OP_HEADER
+
+#include <HYDROGUI_Operation.h>
+
+class HYDROGUI_TwoImagesOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_TwoImagesOp( HYDROGUI_Module* theModule, const QString& theTitle );
+  virtual ~HYDROGUI_TwoImagesOp();
+
+protected:
+  virtual HYDROGUI_InputPanel* createInputPanel() const;
+
+protected slots:
+  virtual void OnApply();
+
+private:
+  QString myTitle;
+};
+
+#endif