X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FOCCViewer%2FOCCViewer_ViewWindow.cxx;h=dbd2618b68992499665918c424e6def5fc522e40;hb=101fd10f1e736daa5d7f0f0ee5499b951460832a;hp=4b5593cca73d1106c435dd6986c35cb92828f615;hpb=a417d603a8e2cf55c40bbff57ef86511e1a96d81;p=modules%2Fgui.git diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 4b5593cca..dbd2618b6 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -24,6 +24,7 @@ #include "OCCViewer_ViewModel.h" #include "OCCViewer_ViewPort3d.h" #include "OCCViewer_CreateRestoreViewDlg.h" +#include "OCCViewer_ClippingDlg.h" #include "SUIT_Desktop.h" #include "SUIT_Session.h" @@ -33,8 +34,6 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_MessageBox.h" -#include "LightApp_ClippingDlg.h" - #include #include #include @@ -161,19 +160,6 @@ const char* imageCrossCursor[] = { "................................", "................................", "................................"}; - - -QPixmap zoomPixmap(imageZoomCursor); -QPixmap rotatePixmap(imageRotateCursor); -QPixmap globalPanPixmap(imageCrossCursor); - -QCursor defCursor(Qt::ArrowCursor); -QCursor handCursor(Qt::PointingHandCursor); -QCursor panCursor(Qt::SizeAllCursor); -QCursor zoomCursor(zoomPixmap); -QCursor rotCursor(rotatePixmap); -QCursor glPanCursor(globalPanPixmap); - ////////////////////////////////////////////////////////////////////// @@ -345,6 +331,8 @@ void OCCViewer_ViewWindow::activateZoom() myCursor = cursor(); /* save old cursor */ if ( myOperation != ZOOMVIEW ) { + QPixmap zoomPixmap (imageZoomCursor); + QCursor zoomCursor (zoomPixmap); setTransformRequested ( ZOOMVIEW ); setCursor( zoomCursor ); } @@ -361,6 +349,7 @@ void OCCViewer_ViewWindow::activatePanning() myCursor = cursor(); // save old cursor if ( myOperation != PANVIEW ) { + QCursor panCursor (Qt::SizeAllCursor); setTransformRequested ( PANVIEW ); setCursor( panCursor ); } @@ -376,6 +365,8 @@ void OCCViewer_ViewWindow::activateRotation() myCursor = cursor(); // save old cursor if ( myOperation != ROTATE ) { + QPixmap rotatePixmap (imageRotateCursor); + QCursor rotCursor (rotatePixmap); setTransformRequested ( ROTATE ); setCursor( rotCursor ); } @@ -386,6 +377,8 @@ void OCCViewer_ViewWindow::activateGlobalPanning() { Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { + QPixmap globalPanPixmap (imageCrossCursor); + QCursor glPanCursor (globalPanPixmap); myCurScale = aView3d->Scale(); aView3d->FitAll(0.01, false); myCursor = cursor(); // save old cursor @@ -405,6 +398,7 @@ void OCCViewer_ViewWindow::activateWindowFit() myCursor = cursor(); /* save old cursor */ if ( myOperation != WINDOWFIT ) { + QCursor handCursor (Qt::PointingHandCursor); setTransformRequested ( WINDOWFIT ); setCursor ( handCursor ); myCursorIsHand = true; @@ -461,6 +455,7 @@ void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent) if ( myDrawRect ) { drawRect(); if ( !myCursorIsHand ) { // we are going to sketch a rectangle + QCursor handCursor (Qt::PointingHandCursor); myCursorIsHand = true; myCursor = cursor(); setCursor( handCursor ); @@ -840,7 +835,7 @@ void OCCViewer_ViewWindow::onClipping( bool on ) if ( on ) { if ( !myClippingDlg ) - myClippingDlg = new LightApp_ClippingDlg( this, myDesktop ); + myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop ); if ( !myClippingDlg->isShown() ) myClippingDlg->show(); @@ -856,37 +851,7 @@ void OCCViewer_ViewWindow::onClipping( bool on ) //**************************************************************** void OCCViewer_ViewWindow::onMemorizeView() { - double centerX, centerY, projX, projY, projZ, twist; - double atX, atY, atZ, eyeX, eyeY, eyeZ; - - Handle(V3d_View) aView3d = myViewPort->getView(); - - aView3d->Center( centerX, centerY ); - aView3d->Proj( projX, projY, projZ ); - aView3d->At( atX, atY, atZ ); - aView3d->Eye( eyeX, eyeY, eyeZ ); - twist = aView3d->Twist(); - - viewAspect params; - QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" ); - - params.scale = aView3d->Scale(); - params.centerX = centerX; - params.centerY = centerY; - params.projX = projX; - params.projY = projY; - params.projZ = projZ; - params.twist = twist; - params.atX = atX; - params.atY = atY; - params.atZ = atZ; - params.eyeX = eyeX; - params.eyeY = eyeY; - params.eyeZ = eyeZ; - params.name = aName; - - myModel->appendViewAspect( params ); - + myModel->appendViewAspect( getViewParams() ); } //**************************************************************** @@ -909,11 +874,11 @@ void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem ) Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False ); aView3d->SetScale( anItem.scale ); aView3d->SetCenter( anItem.centerX, anItem.centerY ); - aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ ); aView3d->SetTwist( anItem.twist ); aView3d->SetAt( anItem.atX, anItem.atY, anItem.atZ ); aView3d->SetImmediateUpdate( prev ); aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ ); + aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ ); myRestoreFlag = 0; } @@ -985,3 +950,77 @@ void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const dou v->Update(); v->Redraw(); } + +/*! The method returns the visual parameters of this view as a viewAspect object + */ +viewAspect OCCViewer_ViewWindow::getViewParams() const +{ + double centerX, centerY, projX, projY, projZ, twist; + double atX, atY, atZ, eyeX, eyeY, eyeZ; + + Handle(V3d_View) aView3d = myViewPort->getView(); + + aView3d->Center( centerX, centerY ); + aView3d->Proj( projX, projY, projZ ); + aView3d->At( atX, atY, atZ ); + aView3d->Eye( eyeX, eyeY, eyeZ ); + twist = aView3d->Twist(); + + QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" ); + + viewAspect params; + params.scale = aView3d->Scale(); + params.centerX = centerX; + params.centerY = centerY; + params.projX = projX; + params.projY = projY; + params.projZ = projZ; + params.twist = twist; + params.atX = atX; + params.atY = atY; + params.atZ = atZ; + params.eyeX = eyeX; + params.eyeY = eyeY; + params.eyeZ = eyeZ; + params.name = aName; + + return params; +} + + +/*! The method returns the visual parameters of this view as a formated string + */ +QString OCCViewer_ViewWindow::getVisualParameters() +{ + viewAspect params = getViewParams(); + QString retStr; + retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale, + params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist, + params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ ); + return retStr; +} + +/* The method restors visual parameters of this view from a formated string + */ +void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) +{ + QStringList paramsLst = QStringList::split( '*', parameters, true ); + if ( paramsLst.size() == 13 ) { + viewAspect params; + params.scale = paramsLst[0].toDouble(); + params.centerX = paramsLst[1].toDouble(); + params.centerY = paramsLst[2].toDouble(); + params.projX = paramsLst[3].toDouble(); + params.projY = paramsLst[4].toDouble(); + params.projZ = paramsLst[5].toDouble(); + params.twist = paramsLst[6].toDouble(); + params.atX = paramsLst[7].toDouble(); + params.atY = paramsLst[8].toDouble(); + params.atZ = paramsLst[9].toDouble(); + params.eyeX = paramsLst[10].toDouble(); + params.eyeY = paramsLst[11].toDouble(); + params.eyeZ = paramsLst[12].toDouble(); + + performRestoring( params ); + } +}