Salome HOME
Fix for the bug #42: point C is not activated, but point C is shown in preview in...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageDlg.cxx
index 862876e6b2436d87e70e8efe96451a0d9cf47cb3..74fcfc1cf8f3de45f09bad785c77cb45f24b1197 100644 (file)
@@ -180,8 +180,8 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
                     << aPointXMinLabel << aPointYMinLabel
                     << aPointXSecLabel << aPointYSecLabel;
 
-    QtxIntSpinBox* aPointXDeg = new QtxIntSpinBox( 0, 360, 1, myTransformGroup );
-    QtxIntSpinBox* aPointYDeg = new QtxIntSpinBox( 0, 180, 1, myTransformGroup );
+    QtxIntSpinBox* aPointXDeg = new QtxIntSpinBox( -180, 180, 1, myTransformGroup );
+    QtxIntSpinBox* aPointYDeg = new QtxIntSpinBox( 0, 90, 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 );
@@ -288,6 +288,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
@@ -316,6 +318,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 );
@@ -454,8 +466,8 @@ void HYDROGUI_ImportImageDlg::setTransformationDataMap( const TransformationData
         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 );
@@ -512,8 +524,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;
@@ -584,7 +596,8 @@ HYDROGUI_ImportImageDlg::TransformationData HYDROGUI_ImportImageDlg::ComputeTrsf
   {
     // Geodesic to Cartesian
     double aXCart = 0, aYCart = 0;
-    HYDROData_Lambert93::toXY( arx, ary, aXCart, aYCart );
+    // Interpreting arY as attitude and arX as longitude
+    HYDROData_Lambert93::toXY( ary, arx, aXCart, aYCart );
 
     aResTrsfData.GeodesicPoint = theGlobalPoint;
     aResTrsfData.CartesianPoint = QPointF( aXCart, aYCart );