X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSVTK%2FSVTK_ViewWindow.cxx;h=c2daba5045dcc4cf43307be95d073df0957c7a20;hb=4444aae1f5322eae93be1257dcad646596a4b032;hp=bd64d9aa803b6ab189e9d846ed5f4220e080f512;hpb=541d3637fed062228c2ae0b2224ea698a3114cc5;p=modules%2Fgui.git diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index bd64d9aa8..c2daba504 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -23,6 +23,7 @@ #include "SVTK_NonIsometricDlg.h" #include "SVTK_UpdateRateDlg.h" #include "SVTK_CubeAxesDlg.h" +#include "SVTK_PsOptionsDlg.h" #include "SVTK_SetRotationPointDlg.h" #include "SVTK_ViewParameterDlg.h" #include "SVTK_ViewModel.h" @@ -76,6 +77,7 @@ #include "VTKViewer_Utilities.h" #include "VTKViewer_Trihedron.h" +#include "VTKViewer_Actor.h" #include "SVTK_View.h" #include "SVTK_Selector.h" @@ -93,16 +95,21 @@ #include "SVTK_Recorder.h" #include "SVTK_RecorderDlg.h" -#include "vtkPVAxesWidget.h" -#include "vtkPVAxesActor.h" +#include "salomevtkPVAxesWidget.h" +#include "salomevtkPVAxesActor.h" -#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOME_ListIO.hxx" #include "VTKViewer_Algorithm.h" #include "SVTK_Functor.h" #include +#ifdef __APPLE__ +#include +#else +#include +#endif namespace SVTK { @@ -124,10 +131,6 @@ namespace SVTK } } - - - - /*! Constructor */ @@ -150,7 +153,7 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel) { myModel = theModel; myInteractor = new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor"); - + SVTK_Selector* aSelector = SVTK_Selector::New(); int aPreselectionMode = SUIT_Session::session()->resourceMgr()-> integerValue( "VTKViewer", "preselection", Standard_Preselection ); @@ -159,37 +162,40 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel) bool isSelectionEnabled = SUIT_Session::session()->resourceMgr()-> booleanValue( "VTKViewer", "enable_selection", true ); aSelector->SetSelectionEnabled( isSelectionEnabled ); - + SVTK_GenericRenderWindowInteractor* aDevice = SVTK_GenericRenderWindowInteractor::New(); aDevice->SetRenderWidget(myInteractor); aDevice->SetSelector(aSelector); - + SVTK_Renderer* aRenderer = SVTK_Renderer::New(); aRenderer->Initialize(aDevice,aSelector); - + myInteractor->Initialize(aDevice,aRenderer,aSelector); - + aDevice->Delete(); aRenderer->Delete(); aSelector->Delete(); - + myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), // title (language-dependant) - QString( "VTKViewerViewOperations" ), // name (language-independant) - false ); // disable floatable toolbar + QString( "VTKViewerViewOperations" ), // name (language-independant) + false ); // disable floatable toolbar myRecordingToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_RECORD_LABEL"), // title (language-dependant) - QString( "VTKRecordingOperations" ), // name (language-independant) - false ); // disable floatable toolbar - + QString( "VTKRecordingOperations" ), // name (language-independant) + false ); // disable floatable toolbar + createActions( SUIT_Session::session()->resourceMgr() ); createToolBar(); - + SetEventDispatcher(myInteractor->GetDevice()); myInteractor->setBackgroundRole( QPalette::NoRole );//NoBackground myInteractor->setFocusPolicy(Qt::StrongFocus); myInteractor->setFocus(); + bool isSupportQuadBuffer = SUIT_Session::session()->resourceMgr()-> + booleanValue( "VTKViewer", "enable_quad_buffer_support", false ); + myInteractor->getRenderWindow()->SetStereoCapableWindow((int)isSupportQuadBuffer); setFocusProxy(myInteractor); - + myUpdateRateDlg = new SVTK_UpdateRateDlg( getAction( UpdateRate ), this, "SVTK_UpdateRateDlg" ); myNonIsometricDlg = new SVTK_NonIsometricDlg( getAction( NonIsometric ), this, "SVTK_NonIsometricDlg" ); myCubeAxesDlg = new SVTK_CubeAxesDlg( getAction( GraduatedAxes ), this, "SVTK_CubeAxesDlg" ); @@ -213,14 +219,14 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel) setCentralWidget(myInteractor); - myAxesWidget = vtkPVAxesWidget::New(); + myAxesWidget = salomevtk::vtkPVAxesWidget::New(); myAxesWidget->SetParentRenderer(aRenderer->GetDevice()); myAxesWidget->SetViewport(0, 0, 0.25, 0.25); myAxesWidget->SetInteractor(myInteractor->GetDevice()); myAxesWidget->SetEnabled(1); myAxesWidget->SetInteractive(0); - vtkPVAxesActor* anAxesActor = myAxesWidget->GetAxesActor(); + salomevtk::vtkPVAxesActor* anAxesActor = myAxesWidget->GetAxesActor(); anAxesActor->GetXAxisTipProperty()->SetColor( 1.0, 0.0, 0.0 ); anAxesActor->GetXAxisShaftProperty()->SetColor( 1.0, 0.0, 0.0 ); anAxesActor->GetXAxisLabelProperty()->SetColor( 1.0, 0.0, 0.0 ); @@ -239,13 +245,13 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel) myEventCallbackCommand->SetCallback(SVTK_ViewWindow::ProcessEvents); myEventCallbackCommand->Delete(); - GetInteractor()->GetInteractorStyle()->AddObserver(SVTK::OperationFinished, - myEventCallbackCommand.GetPointer(), 0.0); - myKeyFreeInteractorStyle->AddObserver(SVTK::OperationFinished, - myEventCallbackCommand.GetPointer(), 0.0); + GetInteractor()->GetInteractorStyle()->AddObserver(SVTK::OperationFinished, + myEventCallbackCommand.GetPointer(), 0.0); + myKeyFreeInteractorStyle->AddObserver(SVTK::OperationFinished, + myEventCallbackCommand.GetPointer(), 0.0); + - myInteractor->getRenderWindow()->Render(); setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background onResetView(); @@ -443,6 +449,16 @@ void SVTK_ViewWindow::onFitAll() emit transformed( this ); } +/*! + Processes transformation "fit selection" +*/ +void SVTK_ViewWindow::onFitSelection() +{ + GetRenderer()->onFitSelection(); + Repaint(); + emit transformed( this ); +} + /*! SLOT: called if selection is changed */ @@ -594,17 +610,17 @@ void SVTK_ViewWindow::setBackground( const Qtx::BackgroundData& bgData ) switch ( bgData.mode() ) { case Qtx::ColorBackground: { - QColor c = bgData.color(); - if ( c.isValid() ) { - // show solid-colored background - getRenderer()->SetTexturedBackground( false ); // cancel texture mode - getRenderer()->SetGradientBackground( false ); // cancel gradient mode - getRenderer()->SetBackground( c.red()/255.0, - c.green()/255.0, - c.blue()/255.0 ); // set background color - ok = true; - } - break; + QColor c = bgData.color(); + if ( c.isValid() ) { + // show solid-colored background + getRenderer()->SetTexturedBackground( false ); // cancel texture mode + getRenderer()->SetGradientBackground( false ); // cancel gradient mode + getRenderer()->SetBackground( c.red()/255.0, + c.green()/255.0, + c.blue()/255.0 ); // set background color + ok = true; + } + break; } case Qtx::SimpleGradientBackground: { @@ -633,11 +649,11 @@ void SVTK_ViewWindow::setBackground( const Qtx::BackgroundData& bgData ) } case Qtx::CustomGradientBackground: { - // NOT IMPLEMENTED YET - getRenderer()->SetTexturedBackground( false ); // cancel texture mode - getRenderer()->SetGradientBackground( false ); // cancel gradient mode - // ......... - break; + // NOT IMPLEMENTED YET + getRenderer()->SetTexturedBackground( false ); // cancel texture mode + getRenderer()->SetGradientBackground( false ); // cancel gradient mode + // ......... + break; } default: break; @@ -647,71 +663,71 @@ void SVTK_ViewWindow::setBackground( const Qtx::BackgroundData& bgData ) int textureMode = bgData.texture( fileName ); QFileInfo fi( fileName ); if ( !fileName.isEmpty() && fi.exists() ) { - // read texture from file - QString extension = fi.suffix().toLower(); - vtkImageReader2* aReader = 0; - if ( extension == "jpg" || extension == "jpeg" ) - aReader = vtkJPEGReader::New(); - else if ( extension == "bmp" ) - aReader = vtkBMPReader::New(); - else if ( extension == "tif" || extension == "tiff" ) - aReader = vtkTIFFReader::New(); - else if ( extension == "png" ) - aReader = vtkPNGReader::New(); - else if ( extension == "mhd" || extension == "mha" ) - aReader = vtkMetaImageReader::New(); - if ( aReader ) { - // create texture - aReader->SetFileName( fi.absoluteFilePath().toLatin1().constData() ); - aReader->Update(); - VTKViewer_Texture* aTexture = VTKViewer_Texture::New(); - vtkImageMapToColors* aMap = 0; - vtkAlgorithmOutput* anOutput; - /* - // special processing for BMP reader - vtkBMPReader* aBMPReader = (vtkBMPReader*)aReader; - if ( aBMPReader ) { - // Special processing for BMP file - aBMPReader->SetAllow8BitBMP(1); - - aMap = vtkImageMapToColors::New(); - aMap->SetInputConnection( aBMPReader->GetOutputPort() ); - aMap->SetLookupTable( (vtkScalarsToColors*)aBMPReader->GetLookupTable() ); - aMap->SetOutputFormatToRGB(); - - anOutput = aMap->GetOutputPort(); - } - else { - } - */ - anOutput = aReader->GetOutputPort( 0 ); - aTexture->SetInputConnection( anOutput ); - // set texture mode - // VSR: Currently, VTK only supports Stretch mode, so below code will give - // the same results for all modes - switch ( textureMode ) { - case Qtx::TileTexture: - aTexture->SetPosition((int)VTKViewer_Texture::Tiled); - break; - case Qtx::StretchTexture: - aTexture->SetPosition((int)VTKViewer_Texture::Stretched); - break; - case Qtx::CenterTexture: - aTexture->SetPosition((int)VTKViewer_Texture::Centered); - default: - break; - } - // show textured background - getRenderer()->SetTexturedBackground( true ); - getRenderer()->SetBackgroundTexture( aTexture ); - - // clean-up resources - if ( aMap ) - aMap->Delete(); - aReader->Delete(); - aTexture->Delete(); - ok = true; - } + // read texture from file + QString extension = fi.suffix().toLower(); + vtkImageReader2* aReader = 0; + if ( extension == "jpg" || extension == "jpeg" ) + aReader = vtkJPEGReader::New(); + else if ( extension == "bmp" ) + aReader = vtkBMPReader::New(); + else if ( extension == "tif" || extension == "tiff" ) + aReader = vtkTIFFReader::New(); + else if ( extension == "png" ) + aReader = vtkPNGReader::New(); + else if ( extension == "mhd" || extension == "mha" ) + aReader = vtkMetaImageReader::New(); + if ( aReader ) { + // create texture + aReader->SetFileName( fi.absoluteFilePath().toLatin1().constData() ); + aReader->Update(); + VTKViewer_Texture* aTexture = VTKViewer_Texture::New(); + vtkImageMapToColors* aMap = 0; + vtkAlgorithmOutput* anOutput; + /* + // special processing for BMP reader + vtkBMPReader* aBMPReader = (vtkBMPReader*)aReader; + if ( aBMPReader ) { + // Special processing for BMP file + aBMPReader->SetAllow8BitBMP(1); + + aMap = vtkImageMapToColors::New(); + aMap->SetInputConnection( aBMPReader->GetOutputPort() ); + aMap->SetLookupTable( (vtkScalarsToColors*)aBMPReader->GetLookupTable() ); + aMap->SetOutputFormatToRGB(); + + anOutput = aMap->GetOutputPort(); + } + else { + } + */ + anOutput = aReader->GetOutputPort( 0 ); + aTexture->SetInputConnection( anOutput ); + // set texture mode + // VSR: Currently, VTK only supports Stretch mode, so below code will give + // the same results for all modes + switch ( textureMode ) { + case Qtx::TileTexture: + aTexture->SetPosition((int)VTKViewer_Texture::Tiled); + break; + case Qtx::StretchTexture: + aTexture->SetPosition((int)VTKViewer_Texture::Stretched); + break; + case Qtx::CenterTexture: + aTexture->SetPosition((int)VTKViewer_Texture::Centered); + default: + break; + } + // show textured background + getRenderer()->SetTexturedBackground( true ); + getRenderer()->SetBackgroundTexture( aTexture ); + + // clean-up resources + if ( aMap ) + aMap->Delete(); + aReader->Delete(); + aTexture->Delete(); + ok = true; + } } } } @@ -845,13 +861,153 @@ double SVTK_ViewWindow::GetTrihedronSize() const /*! Sets projection mode - \param theMode - projection mode ( 0 - orthogonal, 1 - perspective ) + \param theMode - projection mode ( 0 - orthogonal, 1 - perspective, 2 - stereo ) */ void SVTK_ViewWindow::SetProjectionMode(const int theMode) { - activateProjectionMode( theMode ); + QtxAction* aParallelAction = dynamic_cast( toolMgr()->action( ParallelModeId ) ); + QtxAction* aProjectionAction = dynamic_cast( toolMgr()->action( ProjectionModeId ) ); + QtxAction* aStereoAction = dynamic_cast( toolMgr()->action( StereoModeId ) ); + + switch ( theMode ) { + case Parallel: + onProjectionMode( aParallelAction ); + break; + case Projection: + onProjectionMode( aProjectionAction ); + break; + case Stereo: + onStereoMode( true ); + break; + } + + // update action state if method is called outside + SVTK_Viewer* aViewer = dynamic_cast(myModel); + QtxAction* aSwitchZoomingStyle = dynamic_cast( toolMgr()->action( SwitchZoomingStyleId ) ); + if ( theMode == Parallel && !aParallelAction->isChecked() ) { + aParallelAction->setChecked( true ); + aSwitchZoomingStyle->setEnabled(true); + aStereoAction->setChecked( false ); + } + if ( theMode == Projection && !aProjectionAction->isChecked() ) { + aProjectionAction->setChecked( true ); + aSwitchZoomingStyle->setEnabled(false); + } + if ( theMode == Stereo ) { + aStereoAction->setChecked( true ); + if ( aParallelAction->isEnabled() ) { + aParallelAction->setEnabled( false ); + aParallelAction->setChecked( false ); + aStereoAction->setChecked( false ); + } + else { + aParallelAction->setEnabled( true ); + aStereoAction->setChecked( false ); + aParallelAction->setChecked( aViewer->projectionMode() == Parallel ); + } + if ( aProjectionAction->isEnabled() ) { + aProjectionAction->setEnabled( false ); + aProjectionAction->setChecked( true ); + if ( getRenderWindow()->GetStereoCapableWindow() == 1 && !isOpenGlStereoSupport() && + strcmp( "CrystalEyes", getRenderWindow()->GetStereoTypeAsString() ) == 0 && + toolMgr()->action( StereoModeId )->isChecked() ) { + SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ), tr( "WRN_SUPPORT_QUAD_BUFFER" ) ); + } + } + else { + aProjectionAction->setEnabled( true ); + aStereoAction->setChecked( false ); + aProjectionAction->setChecked( aViewer->projectionMode() == Projection ); + onProjectionMode(); + } + } + else { + if ( !aParallelAction->isEnabled() ) + aParallelAction->setEnabled( true ); + if ( !aProjectionAction->isEnabled() ) + aProjectionAction->setEnabled( true ); + } } +/*! + Sets stereo type + \param theType - stereo type +*/ +void SVTK_ViewWindow::SetStereoType(const int theType) +{ + vtkRenderWindow* aWindow = getRenderWindow(); + switch (theType ) { + case CrystalEyes: + aWindow->SetStereoTypeToCrystalEyes(); + break; + case RedBlue: + aWindow->SetStereoTypeToRedBlue(); + break; + case Interlaced: + aWindow->SetStereoTypeToInterlaced(); + break; + case Left: + aWindow->SetStereoTypeToLeft(); + break; + case Right: + aWindow->SetStereoTypeToRight(); + break; + case Dresden: + aWindow->SetStereoTypeToDresden(); + break; + case Anaglyph: + aWindow->SetStereoTypeToAnaglyph(); + break; + case Checkerboard: + aWindow->SetStereoTypeToCheckerboard(); + break; + case SplitViewPortHorizontal: + aWindow->SetStereoTypeToSplitViewportHorizontal(); + break; + } +} + +/*! + Sets anaglyph filter + \param theFilter - anaglyph filter +*/ +void SVTK_ViewWindow::SetAnaglyphFilter(const int theFilter) +{ + vtkRenderWindow* aWindow = getRenderWindow(); + switch (theFilter ) { + case RedCyan: + aWindow->SetAnaglyphColorMask(4,3); + break; + case YellowBlue: + aWindow->SetAnaglyphColorMask(6,1); + break; + case GreenMagenta: + aWindow->SetAnaglyphColorMask(2,5); + break; + } +} + +/*! + Set support quad-buffered stereo + \param theEnable - enable/disable support quad-buffered stereo +*/ +void SVTK_ViewWindow::SetQuadBufferSupport(const bool theEnable) +{ + vtkRenderWindow* aWindow = getRenderWindow(); + aWindow->SetStereoCapableWindow((int)theEnable); +} + +/*! + \return OpenGl stereo support +*/ +bool SVTK_ViewWindow::isOpenGlStereoSupport() const +{ + GLboolean support[1]; + glGetBooleanv (GL_STEREO, support); + if ( support[0] ) + return true; + return false; +} /*! Set the gravity center as a focal point @@ -879,10 +1035,17 @@ void SVTK_ViewWindow::activateStartFocalPointSelection() void SVTK_ViewWindow::activateProjectionMode(int theMode) { + QtxAction* aParallelAction = dynamic_cast( toolMgr()->action( ParallelModeId ) ); + QtxAction* aProjectionAction = dynamic_cast( toolMgr()->action( ProjectionModeId ) ); if (theMode) - toolMgr()->action( ProjectionModeId )->setChecked( true ); + aParallelAction->setChecked( true ); else - toolMgr()->action( ParallelModeId )->setChecked( true ); + aProjectionAction->setChecked( true ); + + if ( !aParallelAction->isEnabled() ) + aParallelAction->setEnabled( true ); + if ( !aProjectionAction->isEnabled() ) + aProjectionAction->setEnabled( true ); } /*! @@ -926,6 +1089,14 @@ void SVTK_ViewWindow::SetSelectionEnabled( bool theEnable ) dynamic_cast( getAction( PreselectionId ) ); if ( aPreselectionGroup ) aPreselectionGroup->setEnabled( theEnable ); + + // notify actors + vtkActorCollection *actors = getRenderer()->GetActors(); + for (int i = 0; i < actors->GetNumberOfItems(); ++i ) + if (VTKViewer_Actor *actor = dynamic_cast(actors->GetItemAsObject(i))) + { + actor->EnableSelection( theEnable ); + } } /*! @@ -1159,6 +1330,7 @@ QImage SVTK_ViewWindow::dumpViewContent() int aWidth = aSize[0]; int aHeight = aSize[1]; +#ifndef DISABLE_GLVIEWER OpenGLUtils_FrameBuffer aFrameBuffer; if( aFrameBuffer.init( aWidth, aHeight ) ) { @@ -1182,6 +1354,7 @@ QImage SVTK_ViewWindow::dumpViewContent() anImage = anImage.mirrored(); return anImage; } +#endif // if frame buffers are unsupported, use old functionality unsigned char *aData = @@ -1216,33 +1389,43 @@ bool SVTK_ViewWindow::dumpViewToFormat( const QImage& img, const QString& fileNa if ( format != "PS" && format != "EPS" && format != "PDF" ) return SUIT_ViewWindow::dumpViewToFormat( img, fileName, format ); - SUIT_OverrideCursor wc; - - vtkGL2PSExporter *anExporter = vtkGL2PSExporter::New(); - anExporter->SetRenderWindow(getRenderWindow()); + SVTK_PsOptionsDlg* optionsDlg = new SVTK_PsOptionsDlg(this); + if ( optionsDlg->exec() == QDialog::Accepted ) { + SUIT_OverrideCursor wc; - if ( format == "PS" ) { - anExporter->SetFileFormatToPS(); - anExporter->CompressOff(); - } + vtkGL2PSExporter *anExporter = vtkGL2PSExporter::New(); + anExporter->SetRenderWindow(getRenderWindow()); - if ( format == "EPS" ) { - anExporter->SetFileFormatToEPS(); - anExporter->CompressOff(); - } + // Set options + anExporter->SetLineWidthFactor(optionsDlg->getLineFactor()); + anExporter->SetPointSizeFactor(optionsDlg->getPointFactor()); + anExporter->SetSort((vtkGL2PSExporter::SortScheme)optionsDlg->getSortType()); + anExporter->SetWrite3DPropsAsRasterImage((int)optionsDlg->isRasterize3D()); + anExporter->SetPS3Shading((int)optionsDlg->isPs3Shading()); + + if ( format == "PS" ) { + anExporter->SetFileFormatToPS(); + anExporter->CompressOff(); + } + + if ( format == "EPS" ) { + anExporter->SetFileFormatToEPS(); + anExporter->CompressOff(); + } - if ( format == "PDF" ) { - anExporter->SetFileFormatToPDF(); + if ( format == "PDF" ) { + anExporter->SetFileFormatToPDF(); + } + + QString aFilePrefix(fileName); + QString anExtension(SUIT_Tools::extension(fileName)); + aFilePrefix.truncate(aFilePrefix.length() - 1 - anExtension.length()); + anExporter->SetFilePrefix(aFilePrefix.toLatin1().data()); + anExporter->Write(); + anExporter->Delete(); } - - QString aFilePrefix(fileName); - QString anExtension(SUIT_Tools::extension(fileName)); - aFilePrefix.truncate(aFilePrefix.length() - 1 - anExtension.length()); - anExporter->SetFilePrefix(aFilePrefix.toLatin1().data()); - anExporter->Write(); - anExporter->Delete(); - - return true; + delete optionsDlg; + return true; } /*! @@ -1687,7 +1870,7 @@ void SVTK_ViewWindow::setVisualParameters( const QString& parameters ) */ void SVTK_ViewWindow::doSetVisualParameters( const QString& parameters, bool baseParamsOnly ) { - + double pos[3], focalPnt[3], viewUp[3], parScale, scale[3]; QXmlStreamReader aReader(parameters); @@ -1698,7 +1881,7 @@ void SVTK_ViewWindow::doSetVisualParameters( const QString& parameters, bool bas if (aReader.isStartElement()) { QXmlStreamAttributes aAttr = aReader.attributes(); //printf("### Name = %s\n", qPrintable(aReader.name().toString())); - if (aReader.name() == "Position") { + if (aReader.name() == "Position") { pos[0] = aAttr.value("X").toString().toDouble(); pos[1] = aAttr.value("Y").toString().toDouble(); pos[2] = aAttr.value("Z").toString().toDouble(); @@ -1722,38 +1905,38 @@ void SVTK_ViewWindow::doSetVisualParameters( const QString& parameters, bool bas scale[1] = aAttr.value("Y").toString().toDouble(); scale[2] = aAttr.value("Z").toString().toDouble(); //printf("#### ViewScale %f; %f; %f\n", scale[0], scale[1], scale[2]); - } + } else if (aReader.name() == "DisplayCubeAxis") { - if ( !baseParamsOnly ) { - if (aAttr.value("Show") == "0") - gradAxesActor->VisibilityOff(); - else - gradAxesActor->VisibilityOn(); - } + if ( !baseParamsOnly ) { + if (aAttr.value("Show") == "0") + gradAxesActor->VisibilityOff(); + else + gradAxesActor->VisibilityOn(); + } } else if (aReader.name() == "GraduatedAxis") { - if ( !baseParamsOnly ) { - if(aAttr.value("Axis") == "X") - setGradAxisVisualParams(aReader, gradAxesActor->GetXAxisActor2D()); - else if(aAttr.value("Axis") == "Y") - setGradAxisVisualParams(aReader, gradAxesActor->GetYAxisActor2D()); - else if(aAttr.value("Axis") == "Z") - setGradAxisVisualParams(aReader, gradAxesActor->GetZAxisActor2D()); - } - } + if ( !baseParamsOnly ) { + if(aAttr.value("Axis") == "X") + setGradAxisVisualParams(aReader, gradAxesActor->GetXAxisActor2D()); + else if(aAttr.value("Axis") == "Y") + setGradAxisVisualParams(aReader, gradAxesActor->GetYAxisActor2D()); + else if(aAttr.value("Axis") == "Z") + setGradAxisVisualParams(aReader, gradAxesActor->GetZAxisActor2D()); + } + } else if (aReader.name() == "Trihedron") { - if ( !baseParamsOnly ) { - if (aAttr.value("isShown") == "0") - GetTrihedron()->VisibilityOff(); - else - GetTrihedron()->VisibilityOn(); - SetTrihedronSize(aAttr.value("Size").toString().toDouble()); - } + if ( !baseParamsOnly ) { + if (aAttr.value("isShown") == "0") + GetTrihedron()->VisibilityOff(); + else + GetTrihedron()->VisibilityOn(); + SetTrihedronSize(aAttr.value("Size").toString().toDouble()); + } } else if (aReader.name() == "Background") { - if ( !baseParamsOnly ) { - setBackground( Qtx::stringToBackground( aAttr.value("Value").toString() ) ); - } + if ( !baseParamsOnly ) { + setBackground( Qtx::stringToBackground( aAttr.value("Value").toString() ) ); + } } } } @@ -1783,7 +1966,7 @@ void SVTK_ViewWindow::doSetVisualParameters( const QString& parameters, bool bas scale[0] = paramsLst[10].toDouble(); scale[1] = paramsLst[11].toDouble(); scale[2] = paramsLst[12].toDouble(); - + // applying parameters vtkCamera* camera = getRenderer()->GetActiveCamera(); camera->SetPosition( pos ); @@ -1792,31 +1975,31 @@ void SVTK_ViewWindow::doSetVisualParameters( const QString& parameters, bool bas camera->SetParallelScale( parScale ); GetRenderer()->SetScale( scale ); //SetScale( scale ); - + // apply graduated axes parameters if ( !baseParamsOnly ) { - SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes(); - if ( gradAxesActor && paramsLst.size() == nAllParams ) { - int i = nNormalParams+1, j = i + nGradAxisParams - 1; - ::setGradAxisVisualParams( gradAxesActor->GetXAxisActor2D(), parameters.section( '*', i, j ) ); - i = j + 1; j += nGradAxisParams; - ::setGradAxisVisualParams( gradAxesActor->GetYAxisActor2D(), parameters.section( '*', i, j ) ); - i = j + 1; j += nGradAxisParams; - ::setGradAxisVisualParams( gradAxesActor->GetZAxisActor2D(), parameters.section( '*', i, j ) ); - - if ( paramsLst[13].toUShort() ) - gradAxesActor->VisibilityOn(); - else - gradAxesActor->VisibilityOff(); - } - else if ( paramsLst.size() == nAllParams ) { - if ( paramsLst[90].toUShort() ) - GetTrihedron()->VisibilityOn(); - else - GetTrihedron()->VisibilityOff(); - - SetTrihedronSize(paramsLst[91].toDouble()); - } + SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes(); + if ( gradAxesActor && paramsLst.size() == nAllParams ) { + int i = nNormalParams+1, j = i + nGradAxisParams - 1; + ::setGradAxisVisualParams( gradAxesActor->GetXAxisActor2D(), parameters.section( '*', i, j ) ); + i = j + 1; j += nGradAxisParams; + ::setGradAxisVisualParams( gradAxesActor->GetYAxisActor2D(), parameters.section( '*', i, j ) ); + i = j + 1; j += nGradAxisParams; + ::setGradAxisVisualParams( gradAxesActor->GetZAxisActor2D(), parameters.section( '*', i, j ) ); + + if ( paramsLst[13].toUShort() ) + gradAxesActor->VisibilityOn(); + else + gradAxesActor->VisibilityOff(); + } + else if ( paramsLst.size() == nAllParams ) { + if ( paramsLst[90].toUShort() ) + GetTrihedron()->VisibilityOn(); + else + GetTrihedron()->VisibilityOff(); + + SetTrihedronSize(paramsLst[91].toDouble()); + } } } } @@ -1880,20 +2063,71 @@ void SVTK_ViewWindow::activateStartPointSelection( Selection_Mode theSelectionMo } /*! - Set the view projection mode: orthogonal or perspective + \brief Set the given projection mode. + + Set the given projection mode: Orthographic or Perspective. */ -void SVTK_ViewWindow::onPerspectiveMode() +void SVTK_ViewWindow::onProjectionMode( QAction* theAction ) { - bool anIsParallelMode = toolMgr()->action( ParallelModeId )->isChecked(); - - // advanced zooming is not available in perspective mode - if( QtxAction* anAction = getAction( SwitchZoomingStyleId ) ) - anAction->setEnabled( anIsParallelMode ); - + int aMode = Parallel; + if (theAction == toolMgr()->action( ProjectionModeId )) + aMode = Projection; + SVTK_Viewer* aViewer = dynamic_cast(myModel); + aViewer->setProjectionMode(aMode); + bool anIsParallelMode = (aMode == Parallel); vtkCamera* aCamera = getRenderer()->GetActiveCamera(); aCamera->SetParallelProjection(anIsParallelMode); GetInteractor()->GetDevice()->CreateTimer(VTKI_TIMER_FIRST); + getRenderWindow()->SetStereoRender(0); + Repaint(); +} + +/*! + \brief Sets Stereo projection mode. + Sets Stereo projection mode. +*/ +void SVTK_ViewWindow::onStereoMode( bool activate ) +{ + if (activate) { + toolMgr()->action( ProjectionModeId )->setChecked(true); + vtkCamera* aCamera = getRenderer()->GetActiveCamera(); + aCamera->SetParallelProjection(false); + toolMgr()->action( ProjectionModeId )->actionGroup()->setEnabled(false); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + SetStereoType( aResMgr->integerValue( "VTKViewer", "stereo_type", 0 ) ); + getRenderWindow()->SetStereoRender(1); + Repaint(); + } + else { + toolMgr()->action( ProjectionModeId )->actionGroup()->setEnabled(true); + SVTK_Viewer* aViewer = dynamic_cast(myModel); + if (aViewer->projectionMode() == Parallel) { + toolMgr()->action( ParallelModeId )->setChecked(true); + onProjectionMode(toolMgr()->action( ParallelModeId )); + } + else if (aViewer->projectionMode() == Projection) { + toolMgr()->action( ProjectionModeId )->setChecked(true); + onProjectionMode(toolMgr()->action( ProjectionModeId )); + } + } + if ( getRenderWindow()->GetStereoCapableWindow() == 1 && !isOpenGlStereoSupport() && + strcmp( "CrystalEyes", getRenderWindow()->GetStereoTypeAsString() ) == 0 && + toolMgr()->action( StereoModeId )->isChecked() ) + SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ), tr( "WRN_SUPPORT_QUAD_BUFFER" ) ); +} + +/*! + Set the view projection mode: orthogonal or perspective +*/ +void SVTK_ViewWindow::onProjectionMode() +{ + if (toolMgr()->action( ParallelModeId )->isChecked()) + SetProjectionMode( Parallel); + if (toolMgr()->action( ProjectionModeId )->isChecked()) + SetProjectionMode( Projection); + if (toolMgr()->action( StereoModeId )->isChecked()) + SetProjectionMode( Stereo); emit transformed( this ); } @@ -1915,7 +2149,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ), tr( "MNU_DUMP_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_DUMP_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(onDumpView())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onDumpView())); mgr->registerAction( anAction, DumpId ); // FitAll @@ -1923,7 +2157,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ), tr( "MNU_FITALL" ), 0, this); anAction->setStatusTip(tr("DSC_FITALL")); - connect(anAction, SIGNAL(activated()), this, SLOT(onFitAll())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onFitAll())); mgr->registerAction( anAction, FitAllId ); // FitRect @@ -1931,15 +2165,23 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ), tr( "MNU_FITRECT" ), 0, this); anAction->setStatusTip(tr("DSC_FITRECT")); - connect(anAction, SIGNAL(activated()), this, SLOT(activateWindowFit())); + connect(anAction, SIGNAL(triggered()), this, SLOT(activateWindowFit())); mgr->registerAction( anAction, FitRectId ); + // FitSelection + anAction = new QtxAction(tr("MNU_FITSELECTION"), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITSELECTION" ) ), + tr( "MNU_FITSELECTION" ), 0, this); + anAction->setStatusTip(tr("DSC_FITSELECTION")); + connect(anAction, SIGNAL(triggered()), this, SLOT(onFitSelection())); + mgr->registerAction( anAction, FitSelectionId ); + // Zoom anAction = new QtxAction(tr("MNU_ZOOM_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ), tr( "MNU_ZOOM_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_ZOOM_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(activateZoom())); + connect(anAction, SIGNAL(triggered()), this, SLOT(activateZoom())); mgr->registerAction( anAction, ZoomId ); // Panning @@ -1947,7 +2189,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ), tr( "MNU_PAN_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_PAN_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(activatePanning())); + connect(anAction, SIGNAL(triggered()), this, SLOT(activatePanning())); mgr->registerAction( anAction, PanId ); // Global Panning @@ -1955,7 +2197,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ), tr( "MNU_GLOBALPAN_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning())); + connect(anAction, SIGNAL(triggered()), this, SLOT(activateGlobalPanning())); mgr->registerAction( anAction, GlobalPanId ); // Change rotation point @@ -1972,7 +2214,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ), tr( "MNU_ROTATE_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_ROTATE_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(activateRotation())); + connect(anAction, SIGNAL(triggered()), this, SLOT(activateRotation())); mgr->registerAction( anAction, RotationId ); // Projections @@ -1980,53 +2222,53 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ), tr( "MNU_FRONT_VIEW" ), 0, this, false, "Viewers:Front view"); anAction->setStatusTip(tr("DSC_FRONT_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(onFrontView())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onFrontView())); this->addAction(anAction); mgr->registerAction( anAction, FrontId ); - anAction = new QtxAction(tr("MNU_BACK_VIEW"), + anAction = new QtxAction(tr("MNU_BACK_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ), tr( "MNU_BACK_VIEW" ), 0, this, false, "Viewers:Back view"); anAction->setStatusTip(tr("DSC_BACK_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(onBackView())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onBackView())); this->addAction(anAction); mgr->registerAction( anAction, BackId ); - anAction = new QtxAction(tr("MNU_TOP_VIEW"), + anAction = new QtxAction(tr("MNU_TOP_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ), tr( "MNU_TOP_VIEW" ), 0, this, false, "Viewers:Top view"); anAction->setStatusTip(tr("DSC_TOP_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(onTopView())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onTopView())); this->addAction(anAction); mgr->registerAction( anAction, TopId ); - anAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), + anAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ), tr( "MNU_BOTTOM_VIEW" ), 0, this, false, "Viewers:Bottom view"); anAction->setStatusTip(tr("DSC_BOTTOM_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(onBottomView())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onBottomView())); this->addAction(anAction); mgr->registerAction( anAction, BottomId ); - anAction = new QtxAction(tr("MNU_LEFT_VIEW"), + anAction = new QtxAction(tr("MNU_LEFT_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ), tr( "MNU_LEFT_VIEW" ), 0, this, false, "Viewers:Left view"); anAction->setStatusTip(tr("DSC_LEFT_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(onLeftView())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onLeftView())); this->addAction(anAction); mgr->registerAction( anAction, LeftId ); - anAction = new QtxAction(tr("MNU_RIGHT_VIEW"), + anAction = new QtxAction(tr("MNU_RIGHT_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ), tr( "MNU_RIGHT_VIEW" ), 0, this, false, "Viewers:Right view"); anAction->setStatusTip(tr("DSC_RIGHT_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(onRightView())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onRightView())); this->addAction(anAction); mgr->registerAction( anAction, RightId ); // rotate anticlockwise anAction = new QtxAction(tr("MNU_ANTICLOCKWISE_VIEW"), - theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ANTICLOCKWISE" ) ), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ANTICLOCKWISE" ) ), tr( "MNU_ANTICLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate anticlockwise"); anAction->setStatusTip(tr("DSC_ANTICLOCKWISE_VIEW")); connect(anAction, SIGNAL(triggered()), this, SLOT(onAntiClockWiseView())); @@ -2035,7 +2277,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) // rotate clockwise anAction = new QtxAction(tr("MNU_CLOCKWISE_VIEW"), - theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_CLOCKWISE" ) ), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_CLOCKWISE" ) ), tr( "MNU_CLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate clockwise"); anAction->setStatusTip(tr("DSC_CLOCKWISE_VIEW")); connect(anAction, SIGNAL(triggered()), this, SLOT(onClockWiseView())); @@ -2047,7 +2289,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ), tr( "MNU_RESET_VIEW" ), 0, this, false, "Viewers:Reset view"); anAction->setStatusTip(tr("DSC_RESET_VIEW")); - connect(anAction, SIGNAL(activated()), this, SLOT(onResetView())); + connect(anAction, SIGNAL(triggered()), this, SLOT(onResetView())); this->addAction(anAction); mgr->registerAction( anAction, ResetId ); @@ -2095,7 +2337,6 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) tr( "MNU_SVTK_PARALLEL_MODE" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_PARALLEL_MODE")); anAction->setCheckable(true); - connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode())); mgr->registerAction( anAction, ParallelModeId ); anAction = new QtxAction(tr("MNU_SVTK_PERSPECTIVE_MODE"), @@ -2103,12 +2344,20 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) tr( "MNU_SVTK_PERSPECTIVE_MODE" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_PERSPECTIVE_MODE")); anAction->setCheckable(true); - connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode())); mgr->registerAction( anAction, ProjectionModeId ); + anAction = new QtxAction(tr("MNU_SVTK_STEREO_MODE"), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_STEREO" ) ), + tr( "MNU_SVTK_STEREO_MODE" ), 0, this); + anAction->setStatusTip(tr("DSC_SVTK_STEREO_MODE")); + anAction->setCheckable(true); + connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onStereoMode(bool))); + mgr->registerAction( anAction, StereoModeId ); + QActionGroup* aPerspectiveGroup = new QActionGroup( this ); aPerspectiveGroup->addAction( mgr->action( ParallelModeId ) ); aPerspectiveGroup->addAction( mgr->action( ProjectionModeId ) ); + connect(aPerspectiveGroup, SIGNAL(triggered(QAction*)), this, SLOT(onProjectionMode(QAction*))); // View Parameters anAction = new QtxAction(tr("MNU_VIEWPARAMETERS_VIEW"), @@ -2149,7 +2398,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) tr( "MNU_SVTK_PRESELECTION_STANDARD" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_STANDARD")); anAction->setCheckable(true); - connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map())); + connect(anAction, SIGNAL(triggered()), aSignalMapper, SLOT(map())); aSignalMapper->setMapping( anAction, Standard_Preselection ); mgr->registerAction( anAction, StandardPreselectionId ); @@ -2158,7 +2407,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) tr( "MNU_SVTK_PRESELECTION_DYNAMIC" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_DYNAMIC")); anAction->setCheckable(true); - connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map())); + connect(anAction, SIGNAL(triggered()), aSignalMapper, SLOT(map())); aSignalMapper->setMapping( anAction, Dynamic_Preselection ); mgr->registerAction( anAction, DynamicPreselectionId ); @@ -2167,7 +2416,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) tr( "MNU_SVTK_PRESELECTION_DISABLED" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_DISABLED")); anAction->setCheckable(true); - connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map())); + connect(anAction, SIGNAL(triggered()), aSignalMapper, SLOT(map())); aSignalMapper->setMapping( anAction, Preselection_Disabled ); mgr->registerAction( anAction, DisablePreselectionId ); @@ -2245,6 +2494,7 @@ void SVTK_ViewWindow::createToolBar() QtxMultiAction* aScaleAction = new QtxMultiAction( this ); aScaleAction->insertAction( getAction( FitAllId ) ); aScaleAction->insertAction( getAction( FitRectId ) ); + aScaleAction->insertAction( getAction( FitSelectionId ) ); aScaleAction->insertAction( getAction( ZoomId ) ); mgr->append( aScaleAction, myToolBar ); @@ -2282,6 +2532,7 @@ void SVTK_ViewWindow::createToolBar() mgr->append( ParallelModeId, myToolBar ); mgr->append( ProjectionModeId, myToolBar ); + mgr->append( StereoModeId, myToolBar ); mgr->append( StartRecordingId, myRecordingToolBar ); mgr->append( PlayRecordingId, myRecordingToolBar ); @@ -2463,9 +2714,9 @@ void SVTK_ViewWindow::emitTransformed() { Processes events */ void SVTK_ViewWindow::ProcessEvents(vtkObject* vtkNotUsed(theObject), - unsigned long theEvent, - void* theClientData, - void* theCallData) + unsigned long theEvent, + void* theClientData, + void* theCallData) { SVTK_ViewWindow* self = reinterpret_cast(theClientData); if(self)