X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ImportImageDlg.cxx;h=4286978d8d517ba799d5f2e9e5985419a104a463;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=e39985b3675e23eb1fcf61d8f7dfc1e561afd468;hpb=216439f38d7dd618833b75c5dcb640915a62ba77;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx index e39985b3..4286978d 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx @@ -385,6 +385,9 @@ void HYDROGUI_ImportImageDlg::reset() myImageName->clear(); myImageNameGroup->setEnabled( false ); myGeoFileName->clear(); + bool isPBlocked = blockSignalsPoints( true ); + bool isGBlocked = blockSignalsGeodesic( true ); + bool isCBlocked = blockSignalsCartesian( true ); for( int aPointType = HYDROGUI_PrsImage::PointA; aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ ) { @@ -393,21 +396,24 @@ void HYDROGUI_ImportImageDlg::reset() aBtn->setChecked( false ); aBtn->blockSignals( anIsBlocked ); - myPointXMap[ aPointType ]->clear(); - myPointYMap[ aPointType ]->clear(); - myPointXDegMap[ aPointType ]->clear(); - myPointYDegMap[ aPointType ]->clear(); - myPointXMinMap[ aPointType ]->clear(); - myPointYMinMap[ aPointType ]->clear(); - myPointXSecMap[ aPointType ]->clear(); - myPointYSecMap[ aPointType ]->clear(); + clearSpins( myPointXMap[ aPointType ] ); + clearSpins( myPointYMap[ aPointType ] ); + clearSpins( myPointXDegMap[ aPointType ] ); + clearSpins( myPointYDegMap[ aPointType ] ); + clearSpins( myPointXMinMap[ aPointType ] ); + clearSpins( myPointYMinMap[ aPointType ] ); + clearSpins( myPointXSecMap[ aPointType ] ); + clearSpins( myPointYSecMap[ aPointType ] ); - myRefPointXMap[ aPointType ]->clear(); - myRefPointYMap[ aPointType ]->clear(); + clearSpins( myRefPointXMap[ aPointType ] ); + clearSpins( myRefPointYMap[ aPointType ] ); - myCartPointXMap[ aPointType ]->clear(); - myCartPointYMap[ aPointType ]->clear(); + clearSpins( myCartPointXMap[ aPointType ] ); + clearSpins( myCartPointYMap[ aPointType ] ); } + blockSignalsPoints( isPBlocked ); + blockSignalsGeodesic( isGBlocked ); + blockSignalsCartesian( isCBlocked ); // Emulate turning off C point usage myPointCEnabler->blockSignals( true ); @@ -465,6 +471,13 @@ QString HYDROGUI_ImportImageDlg::getFileName() const return myFileName->text(); } +void HYDROGUI_ImportImageDlg::setFileName( const QString& theName ) +{ + myFileName->setText( theName ); + myImageNameGroup->setEnabled( true ); + myTransformGroup->setEnabled( true ); +} + QString HYDROGUI_ImportImageDlg::getGeoreferencementFileName() const { return myGeoFileName->text(); @@ -701,10 +714,8 @@ void HYDROGUI_ImportImageDlg::onBrowse() } else { - myFileName->setText( aFileName ); + setFileName( aFileName ); emit createPreview( anImage ); - myImageNameGroup->setEnabled( true ); - myTransformGroup->setEnabled( true ); } } } @@ -908,26 +919,64 @@ void HYDROGUI_ImportImageDlg::onCartesianCoordChanged( const int thePointType ) blockSignalsGeodesic( false ); } -void HYDROGUI_ImportImageDlg::blockSignalsGeodesic( const bool theState ) +void HYDROGUI_ImportImageDlg::clearSpins( QAbstractSpinBox* theSpin ) +{ + if ( dynamic_cast( theSpin ) ) + { + QtxIntSpinBox* aSpin = dynamic_cast( theSpin ); + aSpin->setValue( aSpin->minimum() ); + } + else if ( dynamic_cast( theSpin ) ) + { + QtxDoubleSpinBox* aDblSpin = dynamic_cast( 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++ ) { - myPointXDegMap[ aPointType ]->blockSignals( theState ); + 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; } -void HYDROGUI_ImportImageDlg::blockSignalsCartesian( const bool theState ) +bool HYDROGUI_ImportImageDlg::blockSignalsCartesian( const bool theState ) { + bool isBlocked = false; for( int aPointType = HYDROGUI_PrsImage::PointA; aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ ) { - myCartPointXMap[ aPointType ]->blockSignals( theState ); + isBlocked = + myCartPointXMap[ aPointType ]->blockSignals( theState ) || isBlocked; myCartPointYMap[ aPointType ]->blockSignals( theState ); } + return isBlocked; }