From: asv Date: Mon, 30 Jan 2006 12:44:12 +0000 (+0000) Subject: further implementation of get/setVisualParameters() X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=247790153d4acd23b96ac83ecde68241e77b85c3;p=modules%2Fgui.git further implementation of get/setVisualParameters() --- diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index d3e98ac4b..24c477451 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -871,14 +871,16 @@ void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem ) { Handle(V3d_View) aView3d = myViewPort->getView(); + printf( "-- performRestoring, proj = %f %f %f \n", anItem.atX, anItem.atY, anItem.atZ ); + 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; } @@ -993,10 +995,13 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const QString OCCViewer_ViewWindow::getVisualParameters() { viewAspect params = getViewParams(); - return QString( "%1*%2*%3*%4*%5*%6*%7*%8*%9*%10*%11*%12*%13" ).arg( - params.scale ).arg( params.centerX ).arg( params.centerY ).arg( params.projX ).arg( - params.projY ).arg( params.projZ ).arg( params.twist ).arg( params.atX ).arg( - params.atY ).arg( params.atZ ).arg( params.eyeX ).arg( params.eyeY ).arg( params.eyeZ ); + QString retStr; + retStr.sprintf( "%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f", 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 ); + + // printf( "-- OCC::getVisualParameters() = %s \n", retStr.latin1() ); + return retStr; } /* The method restors visual parameters of this view from a formated string @@ -1005,11 +1010,10 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) { QStringList paramsLst = QStringList::split( '*', parameters, true ); if ( paramsLst.size() == 13 ) { - printf( "-- OCC::setVisualParameters = %f %f %f %f %f %f %f %f %f %f %f %f %f\n", paramsLst[0].toDouble(), - paramsLst[1].toDouble(), paramsLst[2].toDouble(), paramsLst[3].toDouble(), paramsLst[4].toDouble(), - paramsLst[5].toDouble(), paramsLst[6].toDouble(), paramsLst[7].toDouble(), paramsLst[8].toDouble(), - paramsLst[9].toDouble(), paramsLst[10].toDouble(), paramsLst[11].toDouble(), paramsLst[12].toDouble() ); - + // printf( "-- OCC::setVisualParameters = %f %f %f %f %f %f %f %f %f %f %f %f %f\n", paramsLst[0].toDouble(), + // paramsLst[1].toDouble(), paramsLst[2].toDouble(), paramsLst[3].toDouble(), paramsLst[4].toDouble(), + // paramsLst[5].toDouble(), paramsLst[6].toDouble(), paramsLst[7].toDouble(), paramsLst[8].toDouble(), + // paramsLst[9].toDouble(), paramsLst[10].toDouble(), paramsLst[11].toDouble(), paramsLst[12].toDouble() ); viewAspect params; params.scale = paramsLst[0].toDouble(); params.centerX = paramsLst[1].toDouble(); diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index df7766392..26cd656a9 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -1098,10 +1098,12 @@ SVTK_ViewWindow parScale = camera->GetParallelScale(); GetScale( scale ); - return QString( "%1*%2*%3*%4*%5*%6*%7*%8*%9*%10*%11*%12*%13" ).arg( - pos[0] ).arg( pos[1] ).arg( pos[2] ).arg( focalPnt[0] ).arg( focalPnt[1] ).arg( - focalPnt[2] ).arg( viewUp[0] ).arg( viewUp[1] ).arg( viewUp[2] ).arg( parScale ).arg( - scale[0] ).arg( scale[1] ).arg( scale[2] ); + QString retStr; + retStr.sprintf( "%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f", + pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1], + viewUp[2], parScale, scale[0], scale[1], scale[2] ); + printf( "-- SVTK::getVisualParameters() = %s \n", retStr.latin1() ); + return retStr; } //---------------------------------------------------------------------------- @@ -1113,7 +1115,7 @@ SVTK_ViewWindow { QStringList paramsLst = QStringList::split( '*', parameters, true ); if ( paramsLst.size() == 13 ) { - printf( "-- VTK::setVisualParameters = %f %f %f %f %f %f %f %f %f %f %f %f %f\n", paramsLst[0].toDouble(), + printf( "-- SVTK::setVisualParameters = %f %f %f %f %f %f %f %f %f %f %f %f %f\n", paramsLst[0].toDouble(), paramsLst[1].toDouble(), paramsLst[2].toDouble(), paramsLst[3].toDouble(), paramsLst[4].toDouble(), paramsLst[5].toDouble(), paramsLst[6].toDouble(), paramsLst[7].toDouble(), paramsLst[8].toDouble(), paramsLst[9].toDouble(), paramsLst[10].toDouble(), paramsLst[11].toDouble(), paramsLst[12].toDouble() ); diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx index 83b5e5615..2d51252fa 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.cxx +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -573,10 +573,12 @@ QString VTKViewer_ViewWindow::getVisualParameters() parScale = camera->GetParallelScale(); GetScale( scale ); - return QString( "%1*%2*%3*%4*%5*%6*%7*%8*%9*%10*%11*%12*%13" ).arg( - pos[0] ).arg( pos[1] ).arg( pos[2] ).arg( focalPnt[0] ).arg( focalPnt[1] ).arg( - focalPnt[2] ).arg( viewUp[0] ).arg( viewUp[1] ).arg( viewUp[2] ).arg( parScale ).arg( - scale[0] ).arg( scale[1] ).arg( scale[2] ); + QString retStr; + retStr.sprintf( "%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f*%.12f", + pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1], + viewUp[2], parScale, scale[0], scale[1], scale[2] ); + printf( "-- SVTK::getVisualParameters() = %s \n", retStr.latin1() ); + return retStr; } /* The method restors visual parameters of this view from a formated string