From f507f44f89c557f30cbc4c5815d4c014e74afa4d Mon Sep 17 00:00:00 2001 From: dmv Date: Wed, 21 Jan 2009 09:57:15 +0000 Subject: [PATCH] 0020137: EDF 931 VISU : Trihedron Issues --- src/OCCViewer/OCCViewer_ViewModel.h | 2 ++ src/OCCViewer/OCCViewer_ViewWindow.cxx | 19 ++++++++++++++++--- src/SVTK/SVTK_ViewWindow.cxx | 13 +++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index 88e7f5b17..f68363fd2 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -58,6 +58,8 @@ public: double scaleX; double scaleY; double scaleZ; + bool isVisible; + double size; }; typedef QValueList viewAspectList; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index fe5b3ec8d..f5f7144ea 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -1281,7 +1281,10 @@ void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem ) aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ ); aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ ); aView3d->SetAxialScale( anItem.scaleX, anItem.scaleY, anItem.scaleZ ); - + // Trihedron + myModel->setTrihedronShown( anItem.isVisible ); + myModel->setTrihedronSize( anItem.size ); + myRestoreFlag = 0; } @@ -1371,6 +1374,8 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const double centerX, centerY, projX, projY, projZ, twist; double atX, atY, atZ, eyeX, eyeY, eyeZ; Standard_Real aScaleX, aScaleY, aScaleZ; + bool isShown; + double size; Handle(V3d_View) aView3d = myViewPort->getView(); @@ -1382,6 +1387,9 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const aView3d->AxialScale(aScaleX,aScaleY,aScaleZ); + isShown = myModel->isTrihedronVisible(); + size = myModel->trihedronSize(); + QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" ); viewAspect params; @@ -1402,6 +1410,8 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const params.scaleX = aScaleX; params.scaleY = aScaleY; params.scaleZ = aScaleZ; + params.isVisible= isShown; + params.size = size; return params; } @@ -1418,6 +1428,7 @@ QString OCCViewer_ViewWindow::getVisualParameters() params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist, params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ, params.scaleX, params.scaleY, params.scaleZ ); + retStr += QString().sprintf("*%u*%.2f", params.isVisible, params.size ); return retStr; } @@ -1427,7 +1438,7 @@ QString OCCViewer_ViewWindow::getVisualParameters() void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) { QStringList paramsLst = QStringList::split( '*', parameters, true ); - if ( paramsLst.size() >= 13 ) { + if ( paramsLst.size() >= 15 ) { viewAspect params; params.scale = paramsLst[0].toDouble(); params.centerX = paramsLst[1].toDouble(); @@ -1442,7 +1453,7 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) params.eyeX = paramsLst[10].toDouble(); params.eyeY = paramsLst[11].toDouble(); params.eyeZ = paramsLst[12].toDouble(); - if(paramsLst.size() == 16) { + if(paramsLst.size() == 18) { params.scaleX = paramsLst[13].toDouble(); params.scaleY = paramsLst[14].toDouble(); params.scaleZ = paramsLst[15].toDouble(); @@ -1451,6 +1462,8 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) params.scaleY = 1.; params.scaleZ = 1.; } + params.isVisible = paramsLst[16].toDouble(); + params.size = paramsLst[17].toDouble(); performRestoring( params ); } diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 9b6bb579f..2f29b6336 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -46,6 +46,7 @@ #include "SUIT_Accel.h" #include "VTKViewer_Utilities.h" +#include "VTKViewer_Trihedron.h" #include "SVTK_View.h" #include "SVTK_MainWindow.h" @@ -991,6 +992,11 @@ SVTK_ViewWindow retStr += ::getGradAxisVisualParams( gradAxesActor->GetZAxisActor2D() ); } + // save trihedron parameters + bool isVisible = isTrihedronDisplayed(); + vtkFloatingPointType size = GetTrihedronSize(); + retStr += QString().sprintf("* Trihedron: *%u*%.2f", isVisible, size); + return retStr; } @@ -1060,6 +1066,13 @@ SVTK_ViewWindow else gradAxesActor->VisibilityOff(); } + + if ( paramsLst[14].toUShort() ) + GetTrihedron()->VisibilityOn(); + else + GetTrihedron()->VisibilityOff(); + + SetTrihedronSize(paramsLst[15].toDouble()); } } -- 2.39.2