Salome HOME
Fix for the bug #255: VTK viewer is not updated after modification of objects.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageDlg.cxx
index f326790d17f0ed1de013aab808ba1fa03554bed3..0b63f5f45c84d6b108c42d302c1bb0eafab47c62 100644 (file)
 
 #include "HYDROGUI_PrsImage.h"
 #include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Module.h"
 
 #include <HYDROData_Lambert93.h>
+#include <HYDROData_Image.h>
 
+#include <LightApp_Application.h>
 #include <SUIT_FileDlg.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
 #include <SUIT_Session.h>
 
 #include <QtxDoubleSpinBox.h>
@@ -97,14 +102,14 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   aPainter.drawPixmap( 0, 0, anArrowPixmap );
   aPainter.end();
 
-  QRadioButton* aManualCartesianBtn = new QRadioButton( tr( "MANUALLY_CARTESIAN" ), myTransformGroup );
-  QRadioButton* aManualLambertBtn = new QRadioButton( tr( "MANUALLY_LAMBERT93" ), myTransformGroup );
+  QRadioButton* aManualGeodesicBtn = new QRadioButton( tr( "MANUALLY_GEODESIC" ), myTransformGroup );
+  QRadioButton* aManualCartesianBtn = new QRadioButton( tr( "MANUALLY_LAMBERT93" ), myTransformGroup );
   QRadioButton* aRefImageBtn = new QRadioButton( tr( "BY_REFERENCE_IMAGE" ), myTransformGroup );
 
   myModeGroup = new QButtonGroup( myTransformGroup );
-  myModeGroup->addButton( aManualCartesianBtn, ManualCartesian );
-  myModeGroup->addButton( aManualLambertBtn, ManualLambert );
-  myModeGroup->addButton( aRefImageBtn, RefImage );
+  myModeGroup->addButton( aManualGeodesicBtn, HYDROData_Image::ManualGeodesic );
+  myModeGroup->addButton( aManualCartesianBtn, HYDROData_Image::ManualCartesian );
+  myModeGroup->addButton( aRefImageBtn, HYDROData_Image::ReferenceImage );
 
   myRefImage = new QComboBox( myTransformGroup );
 
@@ -115,8 +120,8 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   QGridLayout* aModeLayout = new QGridLayout( myTransformGroup );
   aModeLayout->setMargin( 0 );
   aModeLayout->setSpacing( 5 );
-  aModeLayout->addWidget( aManualCartesianBtn, 0, 0 );
-  aModeLayout->addWidget( aManualLambertBtn,   1, 0 );
+  aModeLayout->addWidget( aManualGeodesicBtn,   0, 0 );
+  aModeLayout->addWidget( aManualCartesianBtn, 1, 0 );
   aModeLayout->addWidget( aRefImageBtn,        2, 0 );
   aModeLayout->addWidget( myRefImage,          2, 1 );
   aModeLayout->setColumnStretch( 1, 1 );
@@ -133,12 +138,12 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   aTransformLayout->addWidget( aLambertLabel,  2, 3, 1, 6 );
   aTransformLayout->addWidget( aRefImageLabel, 2, 3, 1, 6 );
 
-  connect( aManualCartesianBtn, SIGNAL( toggled( bool ) ), aGeodesicLabel, SLOT( setVisible ( bool ) ) );
-  connect( aManualCartesianBtn, SIGNAL( toggled( bool ) ), aLambertLabel, SLOT( setHidden ( bool ) ) );
+  connect( aManualCartesianBtn, SIGNAL( toggled( bool ) ), aLambertLabel, SLOT( setVisible ( bool ) ) );
+  connect( aManualCartesianBtn, SIGNAL( toggled( bool ) ), aGeodesicLabel, SLOT( setHidden ( bool ) ) );
   connect( aManualCartesianBtn, SIGNAL( toggled( bool ) ), aRefImageLabel, SLOT( setHidden ( bool ) ) );
-  connect( aManualLambertBtn, SIGNAL( toggled( bool ) ), aLambertLabel, SLOT( setVisible ( bool ) ) );
-  connect( aManualLambertBtn, SIGNAL( toggled( bool ) ), aGeodesicLabel, SLOT( setHidden ( bool ) ) );
-  connect( aManualLambertBtn, SIGNAL( toggled( bool ) ), aRefImageLabel, SLOT( setHidden ( bool ) ) );
+  connect( aManualGeodesicBtn, SIGNAL( toggled( bool ) ), aGeodesicLabel, SLOT( setVisible ( bool ) ) );
+  connect( aManualGeodesicBtn, SIGNAL( toggled( bool ) ), aLambertLabel, SLOT( setHidden ( bool ) ) );
+  connect( aManualGeodesicBtn, SIGNAL( toggled( bool ) ), aRefImageLabel, SLOT( setHidden ( bool ) ) );
   connect( aRefImageBtn, SIGNAL( toggled( bool ) ), aRefImageLabel, SLOT( setVisible ( bool ) ) );
   connect( aRefImageBtn, SIGNAL( toggled( bool ) ), aGeodesicLabel, SLOT( setHidden ( bool ) ) );
   connect( aRefImageBtn, SIGNAL( toggled( bool ) ), aLambertLabel, SLOT( setHidden ( bool ) ) );
@@ -171,12 +176,15 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
     QLabel* aPointYMinLabel = new QLabel( "'", myTransformGroup );
     QLabel* aPointXSecLabel = new QLabel( "\"", myTransformGroup );
     QLabel* aPointYSecLabel = new QLabel( "\"", myTransformGroup );
-    myLambertLabels << aPointXDegLabel << aPointYDegLabel
+    QLabel* aPointLatLabel = new QLabel( tr( "POINT_LATITUDE" ), myTransformGroup );
+    QLabel* aPointLonLabel = new QLabel( tr( "POINT_LONGITUDE" ), myTransformGroup );
+    myGeodesicLabels << aPointXDegLabel << aPointYDegLabel
                     << aPointXMinLabel << aPointYMinLabel
-                    << aPointXSecLabel << aPointYSecLabel;
+                    << aPointXSecLabel << aPointYSecLabel
+                    << aPointLonLabel << aPointLatLabel;
 
-    QtxIntSpinBox* aPointXDeg = new QtxIntSpinBox( -180, 180, 1, myTransformGroup );
-    QtxIntSpinBox* aPointYDeg = new QtxIntSpinBox( -90, 90, 1, myTransformGroup );
+    QtxIntSpinBox* aPointXDeg = new QtxIntSpinBox( -179, 179, 1, myTransformGroup );
+    QtxIntSpinBox* aPointYDeg = new QtxIntSpinBox( 0, 89, 1, myTransformGroup );
     QtxIntSpinBox* aPointXMin = new QtxIntSpinBox( 0, 59, 1, myTransformGroup );
     QtxIntSpinBox* aPointYMin = new QtxIntSpinBox( 0, 59, 1, myTransformGroup );
     QtxDoubleSpinBox* aPointXSec = new QtxDoubleSpinBox( 0, 59.9999, 1, 4, 4, myTransformGroup );
@@ -193,11 +201,11 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
     {
       myPointCEnabler = new QCheckBox( myTransformGroup );
       aTransformLayout->addWidget( myPointCEnabler, aRow,    0, 1, 2, Qt::AlignHCenter );
-      aTransformLayout->addWidget( aPointBtn,      aRow,     2, 1, 7 );
+      aTransformLayout->addWidget( aPointBtn,      aRow,     2, 1, 8 );
     }
     else
     {
-      aTransformLayout->addWidget( aPointBtn,      aRow,     0, 1, 9 );
+      aTransformLayout->addWidget( aPointBtn,      aRow,     0, 1, 10 );
     }
 
     aTransformLayout->addWidget( aPointXLabel,     aRow + 1, 0 );
@@ -209,6 +217,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
     aTransformLayout->addWidget( aPointXMinLabel,  aRow + 1, 6 );
     aTransformLayout->addWidget( aPointXSec,       aRow + 1, 7 );
     aTransformLayout->addWidget( aPointXSecLabel,  aRow + 1, 8 );
+    aTransformLayout->addWidget( aPointLonLabel,   aRow + 1, 9 );
 
     aTransformLayout->addWidget( aCartPointX,      aRow + 1, 3, 1, 6 );
     aTransformLayout->addWidget( aRefPointX,       aRow + 1, 3, 1, 6 );
@@ -221,6 +230,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
     aTransformLayout->addWidget( aPointYMinLabel,  aRow + 2, 6 );
     aTransformLayout->addWidget( aPointYSec,       aRow + 2, 7 );
     aTransformLayout->addWidget( aPointYSecLabel,  aRow + 2, 8 );
+    aTransformLayout->addWidget( aPointLatLabel,   aRow + 2, 9 );
 
     aTransformLayout->addWidget( aCartPointY,      aRow + 2, 3, 1, 6 );
     aTransformLayout->addWidget( aRefPointY,       aRow + 2, 3, 1, 6 );
@@ -230,7 +240,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
       QFrame* aLine = new QFrame( myTransformGroup );
       aLine->setFrameShape( QFrame::HLine );
       aLine->setFrameShadow( QFrame::Sunken );
-      aTransformLayout->addWidget( aLine, aRow + 3, 0, 1, 9 );
+      aTransformLayout->addWidget( aLine, aRow + 3, 0, 1, 10 );
     }
 
     myPointBtnMap[ aPointType ] = aPointBtn;
@@ -254,12 +264,12 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
     connect( aPointX, SIGNAL( valueChanged( int ) ), this, SLOT( onPointCoordChanged( int ) ) );
     connect( aPointY, SIGNAL( valueChanged( int ) ), this, SLOT( onPointCoordChanged( int ) ) );
 
-    connect( aPointXDeg, SIGNAL( valueChanged( int ) ), this, SLOT( onLambertCoordChanged() ) );
-    connect( aPointYDeg, SIGNAL( valueChanged( int ) ), this, SLOT( onLambertCoordChanged() ) );
-    connect( aPointXMin, SIGNAL( valueChanged( int ) ), this, SLOT( onLambertCoordChanged() ) );
-    connect( aPointYMin, SIGNAL( valueChanged( int ) ), this, SLOT( onLambertCoordChanged() ) );
-    connect( aPointXSec, SIGNAL( valueChanged( double ) ), this, SLOT( onLambertCoordChanged() ) );
-    connect( aPointYSec, SIGNAL( valueChanged( double ) ), this, SLOT( onLambertCoordChanged() ) );
+    connect( aPointXDeg, SIGNAL( valueChanged( int ) ), this, SLOT( onGeodesicCoordChanged() ) );
+    connect( aPointYDeg, SIGNAL( valueChanged( int ) ), this, SLOT( onGeodesicCoordChanged() ) );
+    connect( aPointXMin, SIGNAL( valueChanged( int ) ), this, SLOT( onGeodesicCoordChanged() ) );
+    connect( aPointYMin, SIGNAL( valueChanged( int ) ), this, SLOT( onGeodesicCoordChanged() ) );
+    connect( aPointXSec, SIGNAL( valueChanged( double ) ), this, SLOT( onGeodesicCoordChanged() ) );
+    connect( aPointYSec, SIGNAL( valueChanged( double ) ), this, SLOT( onGeodesicCoordChanged() ) );
 
     connect( aCartPointX, SIGNAL( valueChanged( double ) ), this, SLOT( onCartesianCoordChanged() ) );
     connect( aCartPointY, SIGNAL( valueChanged( double ) ), this, SLOT( onCartesianCoordChanged() ) );
@@ -283,6 +293,8 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myRefPointXMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
   connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myRefPointYMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
 
+  connect( myPointCEnabler, SIGNAL( toggled( bool ) ), SLOT( onSetCIsUsed( bool ) ) );
+
   aTransformLayout->setColumnStretch( 1, 1 ); // double
   aTransformLayout->setColumnStretch( 3, 1 ); // degrees
   aTransformLayout->setColumnStretch( 5, 1 ); // minutes
@@ -302,7 +314,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   connect( myRefImage, SIGNAL( activated( const QString& ) ),
            this, SLOT( onRefImageActivated( const QString& ) ) );
 
-  setTransformationMode( ManualLambert );
+  //setTransformationMode( HYDROData_Image::ManualCartesian );
 
   setMinimumWidth( 350 );
 }
@@ -311,6 +323,16 @@ HYDROGUI_ImportImageDlg::~HYDROGUI_ImportImageDlg()
 {
 }
 
+void HYDROGUI_ImportImageDlg::onSetCIsUsed( bool theCIsUsed )
+{
+  if ( !theCIsUsed  && myPointBtnMap[ HYDROGUI_PrsImage::PointC ]->isChecked() )
+  {
+    // Turn on point A selection if point C selection has been activated and we disable point C.
+    myPointBtnMap[ HYDROGUI_PrsImage::PointA ]->toggle();
+  }
+  emit setCIsUsed( theCIsUsed );
+}
+
 void HYDROGUI_ImportImageDlg::setIsEdit( const bool theIsEdit )
 {
   myFileNameGroup->setVisible( !theIsEdit );
@@ -346,12 +368,32 @@ void HYDROGUI_ImportImageDlg::reset()
     myCartPointXMap[ aPointType ]->clear();
     myCartPointYMap[ aPointType ]->clear();
   }
-  myPointCEnabler->setChecked( true );
-  myPointCEnabler->toggle();
+  
+  // Emulate turning off C point usage
+  myPointCEnabler->blockSignals( true );
+  
+  myPointCEnabler->setChecked( false );
+  myPointBtnMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myPointXMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myPointYMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myPointXDegMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myPointYDegMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myPointXMinMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myPointYMinMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myPointXSecMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myPointYSecMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myCartPointXMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myCartPointYMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myRefPointXMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  myRefPointYMap[ HYDROGUI_PrsImage::PointC ]->setEnabled( false );
+  onSetCIsUsed( false );
+
+  myPointCEnabler->blockSignals( false );
+  
   myTransformGroup->setEnabled( false );
   myRefImage->clear();
 
-  setTransformationMode( ManualLambert );
+  setTransformationMode( HYDROData_Image::ManualCartesian );
 
   myPrsPointDataList.clear();
 
@@ -368,6 +410,16 @@ QString HYDROGUI_ImportImageDlg::getImageName() const
   return myImageName->text();
 }
 
+void HYDROGUI_ImportImageDlg::setRefImageName( const QString& theName )
+{
+  myRefImage->setCurrentIndex( myRefImage->findText( theName ) );
+}
+
+QString HYDROGUI_ImportImageDlg::getRefImageName() const
+{
+  return myRefImage->currentText();
+}
+
 QString HYDROGUI_ImportImageDlg::getFileName() const
 {
   return myFileName->text();
@@ -405,11 +457,21 @@ int HYDROGUI_ImportImageDlg::getTransformationMode() const
   return myModeGroup->checkedId();
 }
 
+void HYDROGUI_ImportImageDlg::setByTwoPoints( const bool theIsByTwoPoints )
+{
+  myPointCEnabler->setChecked( !theIsByTwoPoints );
+}
+
+bool HYDROGUI_ImportImageDlg::isByTwoPoints() const
+{
+  return !myPointCEnabler->isChecked();
+}
+
 void HYDROGUI_ImportImageDlg::setTransformationDataMap( const TransformationDataMap& theMap,
                                                         const bool theIsOnlyInput,
                                                         const bool theIsRefImage )
 {
-  blockSignalsLambert( true );
+  blockSignalsGeodesic( true );
   blockSignalsCartesian( true );
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
@@ -425,12 +487,12 @@ void HYDROGUI_ImportImageDlg::setTransformationDataMap( const TransformationData
 
       if( !theIsOnlyInput && !theIsRefImage )
       {
-        QPointF aLPoint = aData.LambertPoint;
+        QPointF aLPoint = aData.GeodesicPoint;
         int aXDeg = 0, aYDeg = 0;
         int aXMin = 0, aYMin = 0;
         double aXSec = 0, aYSec = 0;
-        HYDROData_Lambert93::secToDMS( aLPoint.x(), aXDeg, aXMin, aXSec );
-        HYDROData_Lambert93::secToDMS( aLPoint.y(), aYDeg, aYMin, aYSec );
+        HYDROData_Lambert93::degToDMS( aLPoint.x(), aXDeg, aXMin, aXSec );
+        HYDROData_Lambert93::degToDMS( aLPoint.y(), aYDeg, aYMin, aYSec );
 
         myPointXDegMap[ aPointType ]->setValue( aXDeg );
         myPointYDegMap[ aPointType ]->setValue( aYDeg );
@@ -445,7 +507,7 @@ void HYDROGUI_ImportImageDlg::setTransformationDataMap( const TransformationData
       }
     }
   }
-  blockSignalsLambert( false );
+  blockSignalsGeodesic( false );
   blockSignalsCartesian( false );
 }
 
@@ -487,8 +549,8 @@ bool HYDROGUI_ImportImageDlg::getTransformationDataMap( TransformationDataMap& t
         return false;
 
     double aX2 = 0, aY2 = 0;
-    HYDROData_Lambert93::DMSToSec( aXDeg, aXMin, aXSec, aX2 );
-    HYDROData_Lambert93::DMSToSec( aYDeg, aYMin, aYSec, aY2 );
+    HYDROData_Lambert93::DMSToDeg( aXDeg, aXMin, aXSec, aX2 );
+    HYDROData_Lambert93::DMSToDeg( aYDeg, aYMin, aYSec, aY2 );
 
     TransformationData aData( QPoint( aX1, aY1 ), QPointF( aX2, aY2 ), QPointF( aXCart, aYCart ) );
     theMap[ aPointType ] = aData;
@@ -496,18 +558,13 @@ bool HYDROGUI_ImportImageDlg::getTransformationDataMap( TransformationDataMap& t
   return true;
 }
 
-QString HYDROGUI_ImportImageDlg::getRefImageName() const
-{
-  return myRefImage->currentText();
-}
-
 void HYDROGUI_ImportImageDlg::setPrsPointDataList( const PrsPointDataList& theList )
 {
   myPrsPointDataList = theList;
 
   if( !myPrsPointDataList.isEmpty() )
   {
-    myModeGroup->button( RefImage )->setEnabled( true );
+    myModeGroup->button( HYDROData_Image::ReferenceImage )->setEnabled( true );
 
     myRefImage->clear();
     myRefImage->addItem( "" ); // first empty item
@@ -517,7 +574,7 @@ void HYDROGUI_ImportImageDlg::setPrsPointDataList( const PrsPointDataList& theLi
       myRefImage->addItem( anIter.next().first );
   }
   else
-    myModeGroup->button( RefImage )->setEnabled( false );
+    myModeGroup->button( HYDROData_Image::ReferenceImage )->setEnabled( false );
 }
 
 void HYDROGUI_ImportImageDlg::initializePointSelection()
@@ -529,50 +586,16 @@ void HYDROGUI_ImportImageDlg::initializePointSelection()
 
   myPointBtnMap[ HYDROGUI_PrsImage::PointA ]->setChecked( true );
 
-  // ouv: tmp
-  /*
-  blockSignalsLambert( true );
-
-  myPointXDegMap[ HYDROGUI_PrsImage::PointA ]->setValue( 50 );
-  myPointXMinMap[ HYDROGUI_PrsImage::PointA ]->setValue( 0 );
-  myPointXSecMap[ HYDROGUI_PrsImage::PointA ]->setValue( 0 );
-  myPointYDegMap[ HYDROGUI_PrsImage::PointA ]->setValue( 50 );
-  myPointYMinMap[ HYDROGUI_PrsImage::PointA ]->setValue( 0 );
-  myPointYSecMap[ HYDROGUI_PrsImage::PointA ]->setValue( 0 );
-
-  myPointXDegMap[ HYDROGUI_PrsImage::PointB ]->setValue( 50 );
-  myPointXMinMap[ HYDROGUI_PrsImage::PointB ]->setValue( 1 );
-  myPointXSecMap[ HYDROGUI_PrsImage::PointB ]->setValue( 0 );
-  myPointYDegMap[ HYDROGUI_PrsImage::PointB ]->setValue( 50 );
-  myPointYMinMap[ HYDROGUI_PrsImage::PointB ]->setValue( 0 );
-  myPointYSecMap[ HYDROGUI_PrsImage::PointB ]->setValue( 0 );
-
-  myPointXDegMap[ HYDROGUI_PrsImage::PointC ]->setValue( 50 );
-  myPointXMinMap[ HYDROGUI_PrsImage::PointC ]->setValue( 0 );
-  myPointXSecMap[ HYDROGUI_PrsImage::PointC ]->setValue( 0 );
-  myPointYDegMap[ HYDROGUI_PrsImage::PointC ]->setValue( 50 );
-  myPointYMinMap[ HYDROGUI_PrsImage::PointC ]->setValue( 1 );
-  myPointYSecMap[ HYDROGUI_PrsImage::PointC ]->setValue( 0 );
-
-  for( int aPointType = HYDROGUI_PrsImage::PointA;
-       aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
-    onLambertCoordChanged( aPointType );
-
-  blockSignalsLambert( false );
-  */
-
-  //double aCartX0 = 600000;
-  //double aCartY0 = 6800000;
-  double aCartX0 = 0;
-  double aCartY0 = 0;
+  double aCartX0 = LAMBERT_X0;
+  double aCartY0 = LAMBERT_Y0;
 
   blockSignalsCartesian( true );
 
   myCartPointXMap[ HYDROGUI_PrsImage::PointA ]->setValue( aCartX0 );
-  myCartPointYMap[ HYDROGUI_PrsImage::PointA ]->setValue( aCartY0 + 500 );
+  myCartPointYMap[ HYDROGUI_PrsImage::PointA ]->setValue( aCartY0 + IMG_DELTA );
 
-  myCartPointXMap[ HYDROGUI_PrsImage::PointB ]->setValue( aCartX0 + 500 );
-  myCartPointYMap[ HYDROGUI_PrsImage::PointB ]->setValue( aCartY0 + 500 );
+  myCartPointXMap[ HYDROGUI_PrsImage::PointB ]->setValue( aCartX0 + IMG_DELTA );
+  myCartPointYMap[ HYDROGUI_PrsImage::PointB ]->setValue( aCartY0 + IMG_DELTA );
 
   myCartPointXMap[ HYDROGUI_PrsImage::PointC ]->setValue( aCartX0 );
   myCartPointYMap[ HYDROGUI_PrsImage::PointC ]->setValue( aCartY0 );
@@ -584,6 +607,39 @@ void HYDROGUI_ImportImageDlg::initializePointSelection()
   blockSignalsCartesian( false );
 }
 
+HYDROGUI_ImportImageDlg::TransformationData HYDROGUI_ImportImageDlg::ComputeTrsfData(
+  const int      theMode,
+  const QPoint&  theLocalPoint,
+  const QPointF& theGlobalPoint )
+{
+  TransformationData aResTrsfData;
+  aResTrsfData.ImagePoint = theLocalPoint;
+
+  double arx = theGlobalPoint.x();
+  double ary = theGlobalPoint.y();
+  if ( theMode == HYDROData_Image::ManualGeodesic )
+  {
+    // Geodesic to Cartesian
+    double aXCart = 0, aYCart = 0;
+    // Interpreting arY as attitude and arX as longitude
+    HYDROData_Lambert93::toXY( ary, arx, aXCart, aYCart );
+
+    aResTrsfData.GeodesicPoint = theGlobalPoint;
+    aResTrsfData.CartesianPoint = QPointF( aXCart, aYCart );
+  }
+  else if ( theMode == HYDROData_Image::ManualCartesian )
+  {
+    // Cartesian to Geodesic
+    double aLonDeg = 0, aLatDeg = 0;
+    HYDROData_Lambert93::toGeo( arx, ary, aLatDeg, aLonDeg );
+
+    aResTrsfData.CartesianPoint = theGlobalPoint;
+    aResTrsfData.GeodesicPoint = QPointF( aLonDeg, aLatDeg );
+  }
+
+  return aResTrsfData;
+}
+
 void HYDROGUI_ImportImageDlg::onBrowse()
 {
   QString aFilter( tr( "IMAGE_FILTER" ) );
@@ -591,7 +647,14 @@ void HYDROGUI_ImportImageDlg::onBrowse()
   if( !aFileName.isEmpty() )
   {
     QImage anImage( aFileName );
-    if( !anImage.isNull() )
+    if( anImage.isNull() )
+    {
+      QString aTitle = QObject::tr( "INPUT_VALID_DATA" );
+      QString aMessage = QObject::tr( "FILE_CAN_NOT_BE_IMPORTED" ).
+        arg( aFileName ).arg( QFileInfo( aFileName ).suffix() );
+      SUIT_MessageBox::warning( module()->getApp()->desktop(), aTitle, aMessage );
+    }
+    else
     {
       myFileName->setText( aFileName );
       emit createPreview( anImage );
@@ -603,21 +666,21 @@ void HYDROGUI_ImportImageDlg::onBrowse()
 
 void HYDROGUI_ImportImageDlg::onModeActivated( int theMode )
 {
-  bool anIsManualLambert = theMode == ManualLambert;
-  bool anIsManualCartesian = theMode == ManualCartesian;
-  bool anIsRefImage = theMode == RefImage;
+  bool anIsManualGeodesic = theMode == HYDROData_Image::ManualGeodesic;
+  bool anIsManualCartesian = theMode == HYDROData_Image::ManualCartesian;
+  bool anIsRefImage = theMode == HYDROData_Image::ReferenceImage;
 
   myRefImage->setEnabled( anIsRefImage );
 
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
   {
-    myPointXDegMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointYDegMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointXMinMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointYMinMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointXSecMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointYSecMap[ aPointType ]->setVisible( anIsManualLambert );
+    myPointXDegMap[ aPointType ]->setVisible( anIsManualGeodesic );
+    myPointYDegMap[ aPointType ]->setVisible( anIsManualGeodesic );
+    myPointXMinMap[ aPointType ]->setVisible( anIsManualGeodesic );
+    myPointYMinMap[ aPointType ]->setVisible( anIsManualGeodesic );
+    myPointXSecMap[ aPointType ]->setVisible( anIsManualGeodesic );
+    myPointYSecMap[ aPointType ]->setVisible( anIsManualGeodesic );
 
     myCartPointXMap[ aPointType ]->setVisible( anIsManualCartesian );
     myCartPointYMap[ aPointType ]->setVisible( anIsManualCartesian );
@@ -626,9 +689,9 @@ void HYDROGUI_ImportImageDlg::onModeActivated( int theMode )
     myRefPointYMap[ aPointType ]->setVisible( anIsRefImage );
   }
 
-  QListIterator<QLabel*> anIter( myLambertLabels );
+  QListIterator<QLabel*> anIter( myGeodesicLabels );
   while( anIter.hasNext() )
-    anIter.next()->setVisible( anIsManualLambert );
+    anIter.next()->setVisible( anIsManualGeodesic );
 
   emit modeActivated( theMode );
 }
@@ -685,7 +748,7 @@ void HYDROGUI_ImportImageDlg::onPointCoordChanged( int theValue )
   }
 }
 
-void HYDROGUI_ImportImageDlg::onLambertCoordChanged()
+void HYDROGUI_ImportImageDlg::onGeodesicCoordChanged()
 {
   QObject* aSender = sender();
   if( !aSender )
@@ -701,13 +764,13 @@ void HYDROGUI_ImportImageDlg::onLambertCoordChanged()
         aSender == myPointXSecMap[ aPointType ] ||
         aSender == myPointYSecMap[ aPointType ] )
     {
-      onLambertCoordChanged( aPointType );
+      onGeodesicCoordChanged( aPointType );
       return;
     }
   }
 }
 
-void HYDROGUI_ImportImageDlg::onLambertCoordChanged( const int thePointType )
+void HYDROGUI_ImportImageDlg::onGeodesicCoordChanged( const int thePointType )
 {
   bool anIsOk[6];
   for( int i = 0; i < 6; i++ )
@@ -779,7 +842,7 @@ void HYDROGUI_ImportImageDlg::onCartesianCoordChanged( const int thePointType )
   HYDROData_Lambert93::degToDMS( aLonDeg, aXDeg, aXMin, aXSec );
   HYDROData_Lambert93::degToDMS( aLatDeg, aYDeg, aYMin, aYSec );
 
-  blockSignalsLambert( true );
+  blockSignalsGeodesic( true );
 
   myPointXDegMap[ thePointType ]->setValue( aXDeg );
   myPointYDegMap[ thePointType ]->setValue( aYDeg );
@@ -788,10 +851,10 @@ void HYDROGUI_ImportImageDlg::onCartesianCoordChanged( const int thePointType )
   myPointXSecMap[ thePointType ]->setValue( aXSec );
   myPointYSecMap[ thePointType ]->setValue( aYSec );
 
-  blockSignalsLambert( false );
+  blockSignalsGeodesic( false );
 }
 
-void HYDROGUI_ImportImageDlg::blockSignalsLambert( const bool theState )
+void HYDROGUI_ImportImageDlg::blockSignalsGeodesic( const bool theState )
 {
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )