+
+void HYDROGUI_ImportImageDlg::onGeodesicCoordChanged()
+{
+ QObject* aSender = sender();
+ if( !aSender )
+ return;
+
+ for( int aPointType = HYDROGUI_PrsImage::PointA;
+ aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
+ {
+ if( aSender == myPointXDegMap[ aPointType ] ||
+ aSender == myPointYDegMap[ aPointType ] ||
+ aSender == myPointXMinMap[ aPointType ] ||
+ aSender == myPointYMinMap[ aPointType ] ||
+ aSender == myPointXSecMap[ aPointType ] ||
+ aSender == myPointYSecMap[ aPointType ] )
+ {
+ onGeodesicCoordChanged( aPointType );
+ return;
+ }
+ }
+}
+
+void HYDROGUI_ImportImageDlg::onGeodesicCoordChanged( const int thePointType )
+{
+ bool anIsOk[6];
+ for( int i = 0; i < 6; i++ )
+ anIsOk[ i ] = true;
+
+ int aXDeg = myPointXDegMap[ thePointType ]->text().toInt( &anIsOk[0] );
+ int aYDeg = myPointYDegMap[ thePointType ]->text().toInt( &anIsOk[1] );
+ int aXMin = myPointXMinMap[ thePointType ]->text().toInt( &anIsOk[2] );
+ int aYMin = myPointYMinMap[ thePointType ]->text().toInt( &anIsOk[3] );
+ double aXSec = myPointXSecMap[ thePointType ]->text().toDouble( &anIsOk[4] );
+ double aYSec = myPointYSecMap[ thePointType ]->text().toDouble( &anIsOk[5] );
+
+ for( int i = 0; i < 6; i++ )
+ if( !anIsOk[ i ] )
+ return;
+
+ double aLonDeg = 0, aLatDeg = 0;
+ HYDROData_Lambert93::DMSToDeg( aXDeg, aXMin, aXSec, aLonDeg );
+ HYDROData_Lambert93::DMSToDeg( aYDeg, aYMin, aYSec, aLatDeg );
+
+ double aXCart = 0, aYCart = 0;
+ HYDROData_Lambert93::toXY( aLatDeg, aLonDeg, aXCart, aYCart );
+
+ blockSignalsCartesian( true );
+
+ myCartPointXMap[ thePointType ]->setValue( aXCart );
+ myCartPointYMap[ thePointType ]->setValue( aYCart );
+
+ blockSignalsCartesian( false );
+}
+
+void HYDROGUI_ImportImageDlg::onCartesianCoordChanged()
+{
+ QObject* aSender = sender();
+ if( !aSender )
+ return;
+
+ for( int aPointType = HYDROGUI_PrsImage::PointA;
+ aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
+ {
+ if( aSender == myCartPointXMap[ aPointType ] ||
+ aSender == myCartPointYMap[ aPointType ] )
+ {
+ onCartesianCoordChanged( aPointType );
+ return;
+ }
+ }
+}
+
+void HYDROGUI_ImportImageDlg::onCartesianCoordChanged( const int thePointType )
+{
+ bool anIsOk[2];
+ for( int i = 0; i < 2; i++ )
+ anIsOk[ i ] = true;
+
+ double aXCart = myCartPointXMap[ thePointType ]->text().toDouble( &anIsOk[0] );
+ double aYCart = myCartPointYMap[ thePointType ]->text().toDouble( &anIsOk[1] );
+
+ for( int i = 0; i < 2; i++ )
+ if( !anIsOk[ i ] )
+ return;
+
+ double aLonDeg = 0, aLatDeg = 0;
+ HYDROData_Lambert93::toGeo( aXCart, aYCart, aLatDeg, aLonDeg );
+
+ int aXDeg = 0, aYDeg = 0;
+ int aXMin = 0, aYMin = 0;
+ double aXSec = 0, aYSec = 0;
+ HYDROData_Lambert93::degToDMS( aLonDeg, aXDeg, aXMin, aXSec );
+ HYDROData_Lambert93::degToDMS( aLatDeg, aYDeg, aYMin, aYSec );
+
+ blockSignalsGeodesic( true );
+
+ myPointXDegMap[ thePointType ]->setValue( aXDeg );
+ myPointYDegMap[ thePointType ]->setValue( aYDeg );
+ myPointXMinMap[ thePointType ]->setValue( aXMin );
+ myPointYMinMap[ thePointType ]->setValue( aYMin );
+ myPointXSecMap[ thePointType ]->setValue( aXSec );
+ myPointYSecMap[ thePointType ]->setValue( aYSec );
+
+ blockSignalsGeodesic( false );
+}
+
+void HYDROGUI_ImportImageDlg::clearSpins( QAbstractSpinBox* theSpin )
+{
+ if ( dynamic_cast<QtxIntSpinBox*>( theSpin ) )
+ {
+ QtxIntSpinBox* aSpin = dynamic_cast<QtxIntSpinBox*>( theSpin );
+ aSpin->setValue( aSpin->minimum() );
+ }
+ else if ( dynamic_cast<QtxIntSpinBox*>( theSpin ) )
+ {
+ QtxDoubleSpinBox* aDblSpin = dynamic_cast<QtxDoubleSpinBox*>( theSpin );
+ aDblSpin->setValue( aDblSpin->minimum() );
+ }
+
+ theSpin->clear();
+}
+
+bool HYDROGUI_ImportImageDlg::blockSignalsPoints( const bool theState )
+{
+ bool isBlocked = false;
+ for( int aPointType = HYDROGUI_PrsImage::PointA;
+ aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
+ {
+ isBlocked =
+ myPointXMap[ aPointType ]->blockSignals( theState ) || isBlocked;
+ myPointYMap[ aPointType ]->blockSignals( theState );
+
+ myRefPointXMap[ aPointType ]->blockSignals( theState );
+ myRefPointYMap[ aPointType ]->blockSignals( theState );
+ }
+ return isBlocked;
+}
+
+bool HYDROGUI_ImportImageDlg::blockSignalsGeodesic( const bool theState )
+{
+ bool isBlocked = false;
+ for( int aPointType = HYDROGUI_PrsImage::PointA;
+ aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
+ {
+ isBlocked =
+ myPointXDegMap[ aPointType ]->blockSignals( theState ) || isBlocked;
+ myPointXMinMap[ aPointType ]->blockSignals( theState );
+ myPointXSecMap[ aPointType ]->blockSignals( theState );
+ myPointYDegMap[ aPointType ]->blockSignals( theState );
+ myPointYMinMap[ aPointType ]->blockSignals( theState );
+ myPointYSecMap[ aPointType ]->blockSignals( theState );
+ }
+ return isBlocked;
+}
+
+bool HYDROGUI_ImportImageDlg::blockSignalsCartesian( const bool theState )
+{
+ bool isBlocked = false;
+ for( int aPointType = HYDROGUI_PrsImage::PointA;
+ aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
+ {
+ isBlocked =
+ myCartPointXMap[ aPointType ]->blockSignals( theState ) || isBlocked;
+ myCartPointYMap[ aPointType ]->blockSignals( theState );
+ }
+ return isBlocked;
+}