]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
GraphicsView: invert the Y axis direction from down to up.
authorouv <ouv@opencascade.com>
Fri, 4 Oct 2013 11:17:05 +0000 (11:17 +0000)
committerouv <ouv@opencascade.com>
Fri, 4 Oct 2013 11:17:05 +0000 (11:17 +0000)
src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Shape.cxx

index 01a4b1552cd60cd8bbd84ae0d156c5d7c32fc288..795d099b6dba95c607b5443511bca09d128ff9a1 100644 (file)
@@ -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++ )
index 43e1b1ecfbff7f71fb3627f5ae878a13fbfe186a..51b899a7fef7142b1166c99632d28bcdef3eda79 100644 (file)
@@ -625,8 +625,14 @@ void HYDROGUI_Module::customEvent( QEvent* e )
     {
       if( GraphicsView_Viewer* aViewer = dynamic_cast<GraphicsView_Viewer*>( 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 );
 
index 4b78aae4c5b7f3b550be93306509c71440716011..6bc515f38564a422d5802dd5da56a8efd0bb4cdd 100644 (file)
@@ -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 );