Salome HOME
refs #430: incorrect coordinates in dump polyline
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_TwoImagesOp.cxx
index def6f125d65f33131c22b13850072e659661ecda..990673a64a649ebcf7070fc41513c59d85d7f571 100644 (file)
@@ -26,6 +26,7 @@
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_TwoImagesDlg.h"
 #include "HYDROGUI_UpdateFlags.h"
+#include <HYDROGUI_DataObject.h>
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
 #include <ImageComposer_CropOperator.h>
 #include <ImageComposer_FuseOperator.h>
 
+#include <LightApp_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+
 HYDROGUI_TwoImagesOp::HYDROGUI_TwoImagesOp( HYDROGUI_Module* theModule,
                                             const int theType,
                                             const bool theIsEdit )
@@ -71,10 +76,14 @@ void HYDROGUI_TwoImagesOp::startOperation()
   HYDROGUI_TwoImagesDlg* aPanel = (HYDROGUI_TwoImagesDlg*)inputPanel();
   aPanel->reset();
 
-  if( myType == Fuse || myType == Cut )
-    aPanel->setMode( HYDROGUI_TwoImagesDlg::TwoImages, myIsEdit );
+  int aMode;
+  if( myType == Fuse )
+    aMode = HYDROGUI_TwoImagesDlg::TwoFuseImage;
+  if ( myType == Cut )
+    aMode = HYDROGUI_TwoImagesDlg::TwoCutImage;
   else if( myType == Split )
-    aPanel->setMode( HYDROGUI_TwoImagesDlg::ImageAndPolyline, myIsEdit );
+    aMode = HYDROGUI_TwoImagesDlg::ImageAndPolyline;
+  aPanel->setMode( aMode, myIsEdit );
 
   QString anImageName;
   if( myIsEdit )
@@ -132,10 +141,19 @@ void HYDROGUI_TwoImagesOp::startOperation()
       aPanel->setPreselectedObject( aSelectedName );
     }
   }
+  connect( aPanel, SIGNAL( alreadySelected( const QString& ) ), SLOT( onAlreadySelected( const QString& ) ) );
+}
+
+void HYDROGUI_TwoImagesOp::onAlreadySelected( const QString& theName )
+{
+  QString aTitle = tr( "INSUFFICIENT_INPUT_DATA" );
+  QString aMessage = tr( "OBJECT_ALREADY_SELECTED" ).arg( theName );
+  SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, aMessage );
 }
 
 bool HYDROGUI_TwoImagesOp::processApply( int& theUpdateFlags,
-                                         QString& theErrorMsg )
+                                         QString& theErrorMsg,
+                                         QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_TwoImagesDlg* aPanel = dynamic_cast<HYDROGUI_TwoImagesDlg*>( inputPanel() );
 
@@ -192,6 +210,8 @@ bool HYDROGUI_TwoImagesOp::processApply( int& theUpdateFlags,
     anOperator = aFactory->Operator( anOperatorName );
 
     aResult = aFactory->CreateImage( doc(), anOperator );
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aResult );
+    theBrowseObjectsEntries.append( anEntry );
   }
 
   if( aResult.IsNull() || !anOperator )