From: ouv Date: Fri, 4 Oct 2013 11:17:05 +0000 (+0000) Subject: GraphicsView: invert the Y axis direction from down to up. X-Git-Tag: BR_hydro_v_0_3~96 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0f3d2b6bce74f3bfe172795c678e3d6ee20cf45c;p=modules%2Fhydro.git GraphicsView: invert the Y axis direction from down to up. --- diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx index 01a4b155..795d099b 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx @@ -520,13 +520,13 @@ void HYDROGUI_ImportImageDlg::initializePointSelection() blockSignalsCartesian( true ); myCartPointXMap[ HYDROGUI_PrsImage::PointA ]->setValue( aCartX0 ); - myCartPointYMap[ HYDROGUI_PrsImage::PointA ]->setValue( aCartY0 ); + myCartPointYMap[ HYDROGUI_PrsImage::PointA ]->setValue( aCartY0 + 500 ); myCartPointXMap[ HYDROGUI_PrsImage::PointB ]->setValue( aCartX0 + 500 ); - myCartPointYMap[ HYDROGUI_PrsImage::PointB ]->setValue( aCartY0 ); + myCartPointYMap[ HYDROGUI_PrsImage::PointB ]->setValue( aCartY0 + 500 ); myCartPointXMap[ HYDROGUI_PrsImage::PointC ]->setValue( aCartX0 ); - myCartPointYMap[ HYDROGUI_PrsImage::PointC ]->setValue( aCartY0 + 500 ); + myCartPointYMap[ HYDROGUI_PrsImage::PointC ]->setValue( aCartY0 ); for( int aPointType = HYDROGUI_PrsImage::PointA; aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ ) diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 43e1b1ec..51b899a7 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -625,8 +625,14 @@ void HYDROGUI_Module::customEvent( QEvent* e ) { if( GraphicsView_Viewer* aViewer = dynamic_cast( aViewFrame->getViewer() ) ) { + SUIT_ViewManager* aViewManager = aViewer->getViewManager(); + ViewManagerRole aRole = getViewManagerRole( aViewManager ); + if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() ) { + if( aRole != VMR_TransformImage ) + aViewPort->scale( 1, -1 ); // invert the Y axis direction from down to up + aViewPort->setInteractionFlag( GraphicsView_ViewPort::TraceBoundingRect ); aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateContextMenu ); aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateSelection ); @@ -635,8 +641,6 @@ void HYDROGUI_Module::customEvent( QEvent* e ) //aViewPort->setViewLabelPosition( GraphicsView_ViewPort::VLP_BottomLeft, true ); } - SUIT_ViewManager* aViewManager = aViewer->getViewManager(); - ViewManagerRole aRole = getViewManagerRole( aViewManager ); if( aRole != VMR_TransformImage ) update( UF_Viewer ); diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 4b78aae4..6bc515f3 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -140,7 +140,8 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer ) int aWidth = anImage.width(); int aHeight = anImage.height(); - anImage = anImage.transformed( aTrsf, Qt::SmoothTransformation ); + QTransform anInversion = QTransform::fromScale( -1, -1 ); + anImage = anImage.transformed( anYInversion * aTrsf, Qt::SmoothTransformation ); // temporary optimization, to reduce the saved image size (and the texture quality) QImage anImageToSave = reduceTexture( anImage, 500 );