From 5e9db0468e18202a54d6d0913c6532d7761aa035 Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 22 Aug 2014 04:42:10 +0000 Subject: [PATCH] refs #427: format for coordinates is updated --- src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx | 4 ++-- src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx | 12 ++++++------ src/HYDROGUI/HYDROGUI_Module.cxx | 8 ++++---- src/HYDROGUI/HYDROGUI_ProfileDlg.cxx | 4 ++-- src/HYDROGUI/HYDROGUI_Tool.cxx | 12 ++++++++---- src/HYDROGUI/HYDROGUI_Tool.h | 2 +- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx b/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx index 48ed4378..58f4fe0e 100644 --- a/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx @@ -58,8 +58,8 @@ void HYDROGUI_CopyPastePositionOp::startOperation() SUIT_ViewWindow* aViewWindow = aViewMgr ? aViewMgr->getActiveView() : 0; double aX, aY, aZ; if ( aDisplayer->GetCursorViewCoordinates( aViewWindow, aX, aY, aZ ) ) { - QString aXStr = HYDROGUI_Tool::GetCoordinateString( aX ); - QString anYStr = HYDROGUI_Tool::GetCoordinateString( aY ); + QString aXStr = HYDROGUI_Tool::GetCoordinateString( aX, false ); + QString anYStr = HYDROGUI_Tool::GetCoordinateString( aY, false ); aResult = tr( "%1,%2" ).arg( aXStr ).arg( anYStr ); } } diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx b/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx index 7bb035f0..082505cb 100644 --- a/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx @@ -228,10 +228,10 @@ void HYDROGUI_GeoreferencementDlg::setData( const ProfilesGeoDataList& theData ) // Get georeferencement data for the current profile QString aXg, anYg, aXd, anYd; if ( !aGeoData.isEmpty ) { - aXg = HYDROGUI_Tool::GetCoordinateString( aGeoData.Xg ); - anYg = HYDROGUI_Tool::GetCoordinateString( aGeoData.Yg ); - aXd = HYDROGUI_Tool::GetCoordinateString( aGeoData.Xd ); - anYd = HYDROGUI_Tool::GetCoordinateString( aGeoData.Yd ); + aXg = HYDROGUI_Tool::GetCoordinateString( aGeoData.Xg, false ); + anYg = HYDROGUI_Tool::GetCoordinateString( aGeoData.Yg, false ); + aXd = HYDROGUI_Tool::GetCoordinateString( aGeoData.Xd, false ); + anYd = HYDROGUI_Tool::GetCoordinateString( aGeoData.Yd, false ); } // Insert row with the data @@ -316,8 +316,8 @@ void HYDROGUI_GeoreferencementDlg::onMousePress( int aColumnX = aColumn < 3 ? 1 : 3; int aColumnY = aColumnX + 1; - QString aXStr = HYDROGUI_Tool::GetCoordinateString( aPnt.X() ); - QString anYStr = HYDROGUI_Tool::GetCoordinateString( aPnt.Y() ); + QString aXStr = HYDROGUI_Tool::GetCoordinateString( aPnt.X(), false ); + QString anYStr = HYDROGUI_Tool::GetCoordinateString( aPnt.Y(), false ); myTable->item( aRow, aColumnX )->setText( aXStr ); myTable->item( aRow, aColumnY )->setText( anYStr ); } diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 4aef231e..bd3b1a16 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -1519,10 +1519,10 @@ void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* HYDROData_Document::Document( aStudyId )->Transform( aWPnt, false ); double WX = aWPnt.X(), WY = aWPnt.Y(); - QString aXStr = HYDROGUI_Tool::GetCoordinateString( X ); - QString anYStr = HYDROGUI_Tool::GetCoordinateString( Y ); - QString aWXStr = HYDROGUI_Tool::GetCoordinateString( WX ); - QString aWYStr = HYDROGUI_Tool::GetCoordinateString( WY ); + QString aXStr = HYDROGUI_Tool::GetCoordinateString( X, true ); + QString anYStr = HYDROGUI_Tool::GetCoordinateString( Y, true ); + QString aWXStr = HYDROGUI_Tool::GetCoordinateString( WX, true ); + QString aWYStr = HYDROGUI_Tool::GetCoordinateString( WY, true ); QString aMsg = tr( "COORDINATES_INFO" ); aMsg = aMsg.arg( aXStr ).arg( anYStr ).arg( aWXStr ).arg( aWYStr ); aDesktop->statusBar()->showMessage( aMsg ); diff --git a/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx b/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx index f3bc6b9a..0829ac44 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx @@ -220,8 +220,8 @@ void HYDROGUI_ProfileDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEve theEvent->x(), theEvent->y(), anOCCViewWindow->getViewPort()->getView() ); // Show the coordinates - QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X() ); - QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y() ); + QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X(), true ); + QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y(), true ); myCoordLabel->setText( tr("UZ_COORDINATES_INFO").arg( aX ).arg( anY ) ); } } diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index 5252cb2f..51404eae 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -707,10 +707,14 @@ QStringList HYDROGUI_Tool::FindExistingObjectsNames( const Handle(HYDROData_Docu return aNames; } -QString HYDROGUI_Tool::GetCoordinateString( const double theNumber ) +QString HYDROGUI_Tool::GetCoordinateString( const double theNumber, bool isInLocale ) { - //return QString::number( theNumber, 'f', 2 ); - static QLocale aLocale( QLocale::English, QLocale::France ); - return aLocale.toString( theNumber, 'f', 2 ); + if( isInLocale ) + { + static QLocale aLocale( QLocale::English, QLocale::France ); + return aLocale.toString( theNumber, 'f', 2 ); + } + else + return QString::number( theNumber, 'f', 2 ); } diff --git a/src/HYDROGUI/HYDROGUI_Tool.h b/src/HYDROGUI/HYDROGUI_Tool.h index 7e0efdd8..e1565e72 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.h +++ b/src/HYDROGUI/HYDROGUI_Tool.h @@ -342,7 +342,7 @@ public: * \param theNumber coordinate as a number * \return coordinate as a string */ - static QString GetCoordinateString( const double theNumber ); + static QString GetCoordinateString( const double theNumber, bool isInLocale ); }; #endif -- 2.39.2