X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ImportImageDlg.cxx;h=74fcfc1cf8f3de45f09bad785c77cb45f24b1197;hb=de7cf9bb0a7a41d6487013c87f4a54d0664cd303;hp=a65d5015ddf6f8a69f21417182bd48d7715e8488;hpb=c874fabf131c86df3f867c094ed3a2a0813a784e;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx index a65d5015..74fcfc1c 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx @@ -24,12 +24,16 @@ #include "HYDROGUI_PrsImage.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Module.h" #include #include +#include #include #include +#include +#include #include #include @@ -134,11 +138,11 @@ 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( aManualGeodesicBtn, SIGNAL( toggled( bool ) ), aLambertLabel, SLOT( setVisible ( bool ) ) ); - connect( aManualGeodesicBtn, SIGNAL( toggled( bool ) ), aGeodesicLabel, 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 ) ) ); @@ -177,7 +181,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co << aPointXSecLabel << aPointYSecLabel; QtxIntSpinBox* aPointXDeg = new QtxIntSpinBox( -180, 180, 1, myTransformGroup ); - QtxIntSpinBox* aPointYDeg = new QtxIntSpinBox( -90, 90, 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 ); @@ -284,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 @@ -303,7 +309,7 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co connect( myRefImage, SIGNAL( activated( const QString& ) ), this, SLOT( onRefImageActivated( const QString& ) ) ); - setTransformationMode( HYDROData_Image::ManualGeodesic ); + //setTransformationMode( HYDROData_Image::ManualCartesian ); setMinimumWidth( 350 ); } @@ -312,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 ); @@ -352,7 +368,7 @@ void HYDROGUI_ImportImageDlg::reset() myTransformGroup->setEnabled( false ); myRefImage->clear(); - setTransformationMode( HYDROData_Image::ManualGeodesic ); + setTransformationMode( HYDROData_Image::ManualCartesian ); myPrsPointDataList.clear(); @@ -450,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 ); @@ -508,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; @@ -545,50 +561,16 @@ void HYDROGUI_ImportImageDlg::initializePointSelection() myPointBtnMap[ HYDROGUI_PrsImage::PointA ]->setChecked( true ); - // ouv: tmp - /* - blockSignalsGeodesic( 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++ ) - onGeodesicCoordChanged( aPointType ); - - blockSignalsGeodesic( 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 ); @@ -614,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 ); @@ -639,7 +622,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 );