X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSVTK%2FSVTK_ViewModel.cxx;h=28bc07177cc4b7979a05a8d4d885bae60918a659;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=2f2477e9965f81284ada715bf90b25ec6fb64d07;hpb=cac0b4571c951b557e1956d4777cf1e5199637c3;p=modules%2Fgui.git diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 2f2477e99..28bc07177 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.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 @@ -84,6 +84,8 @@ SVTK_Viewer::SVTK_Viewer() myIncrementSpeed = 10; myIncrementMode = 0; myProjMode = 0; + myStereoType = 0; + myAnaglyphFilter = 0; myStyle = 0; myZoomingStyle = 0; mySelectionEnabled = true; @@ -92,6 +94,7 @@ SVTK_Viewer::SVTK_Viewer() mySpaceBtn[1] = 2; mySpaceBtn[2] = 9; myDefaultBackground = Qtx::BackgroundData( Qt::black ); + myQuadBufferSupport = false; } /*! @@ -126,6 +129,21 @@ QString SVTK_Viewer::backgroundData( QStringList& gradList, QIntList& idList, QI return tr("BG_IMAGE_FILES"); } +/*! Get data for supported background modes: gradient types, identifiers and supported image formats */ +void SVTK_Viewer::stereoData( QStringList& typeList, QIntList& idList ) +{ + typeList << tr("ST_CRYSTALEYES") << tr("ST_REDBLUE") << + tr("ST_INTERLACED") << tr("ST_LEFT") << + tr("ST_RIGHT") << tr("ST_DRESDEN") << + tr("ST_ANAGLYPH") << tr("ST_CHECKERBOARD") << + tr("ST_SPLITVIEWPORTHORIZONTAL"); + idList << CrystalEyesType << RedBlueType << + InterlacedType << LeftType << + RightType << DresdenType << + AnaglyphType << CheckerboardType << + SplitViewPortHorizontalType; +} + //! Get background color of the viewer [obsolete] QColor SVTK_Viewer::backgroundColor() const { @@ -177,6 +195,9 @@ SUIT_ViewWindow* SVTK_Viewer::createView( SUIT_Desktop* theDesktop ) aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() ); aViewWindow->SetStaticTrihedronVisible( isStaticTrihedronVisible() ); aViewWindow->SetProjectionMode( projectionMode() ); + aViewWindow->SetStereoType( stereoType() ); + aViewWindow->SetAnaglyphFilter( anaglyphFilter() ); + aViewWindow->SetQuadBufferSupport( isQuadBufferSupport() ); aViewWindow->SetInteractionStyle( interactionStyle() ); aViewWindow->SetZoomingStyle( zoomingStyle() ); aViewWindow->SetPreSelectionMode( preSelectionMode() ); @@ -270,8 +291,8 @@ int SVTK_Viewer::projectionMode() const void SVTK_Viewer::setProjectionMode( const int theMode ) { if ( myProjMode != theMode ) { - myProjMode = theMode; - + if ( theMode != SVTK_ViewWindow::Stereo ) + myProjMode = theMode; if (SUIT_ViewManager* aViewManager = getViewManager()) { QVector aViews = aViewManager->getViews(); for ( uint i = 0; i < aViews.count(); i++ ) @@ -283,6 +304,89 @@ void SVTK_Viewer::setProjectionMode( const int theMode ) } } +/*! + \return stereo type +*/ +int SVTK_Viewer::stereoType() const +{ + return myStereoType; +} + +/*! + Sets stereo type + \param theType - new stereo type +*/ +void SVTK_Viewer::setStereoType( const int theType ) +{ + if ( myStereoType != theType ) { + myStereoType = theType; + + if (SUIT_ViewManager* aViewManager = getViewManager()) { + QVector aViews = aViewManager->getViews(); + for ( uint i = 0; i < aViews.count(); i++ ) + { + if ( TViewWindow* aView = dynamic_cast(aViews.at( i )) ) + aView->SetStereoType( theType ); + } + } + } +} + +/*! + \return anaglyph filter +*/ +int SVTK_Viewer::anaglyphFilter() const +{ + return myAnaglyphFilter; +} + +/*! + Sets anaglyph filter + \param theFilter - new anaglyph filter +*/ +void SVTK_Viewer::setAnaglyphFilter( const int theFilter ) +{ + if ( myAnaglyphFilter != theFilter ) { + myAnaglyphFilter = theFilter; + + if (SUIT_ViewManager* aViewManager = getViewManager()) { + QVector aViews = aViewManager->getViews(); + for ( uint i = 0; i < aViews.count(); i++ ) + { + if ( TViewWindow* aView = dynamic_cast(aViews.at( i )) ) + aView->SetAnaglyphFilter( theFilter ); + } + } + } +} + +/*! + \return support quad-buffered stereo +*/ +bool SVTK_Viewer::isQuadBufferSupport() const +{ + return myQuadBufferSupport; +} + +/*! + Set support quad-buffered stereo + \param theEnable - enable/disable support quad-buffered stereo +*/ +void SVTK_Viewer::setQuadBufferSupport( const bool theEnable ) +{ + if ( myQuadBufferSupport != theEnable ) { + myQuadBufferSupport = theEnable; + + if (SUIT_ViewManager* aViewManager = getViewManager()) { + QVector aViews = aViewManager->getViews(); + for ( uint i = 0; i < aViews.count(); i++ ) + { + if ( TViewWindow* aView = dynamic_cast(aViews.at( i )) ) + aView->SetQuadBufferSupport( theEnable ); + } + } + } +} /*! \return interaction style */ @@ -461,7 +565,7 @@ void SVTK_Viewer::contextMenuPopup( QMenu* thePopup ) if(TViewWindow* aView = dynamic_cast(myViewManager->getActiveView())){ //Support of several toolbars in the popup menu - QList lst = qFindChildren( aView ); + QList lst = aView->findChildren(); QList::const_iterator it = lst.begin(), last = lst.end(); for( ; it!=last; it++ ) thePopup->addAction( (*it)->toggleViewAction() ); @@ -670,7 +774,7 @@ void SVTK_Viewer::Erase( const SALOME_VTKPrs* prs, const bool forced ) Erase all presentations \param forced - removes all objects from view */ -void SVTK_Viewer::EraseAll( const bool forced ) +void SVTK_Viewer::EraseAll( SALOME_Displayer* d, const bool forced ) { // Temporarily commented to avoid awful dependecy on SALOMEDS // TODO: better mechanism of storing display/erse status in a study @@ -711,6 +815,9 @@ void SVTK_Viewer::EraseAll( const bool forced ) } } } + + SALOME_View::EraseAll( d, forced ); + Repaint(); } @@ -720,7 +827,7 @@ void SVTK_Viewer::EraseAll( const bool forced ) */ SALOME_Prs* SVTK_Viewer::CreatePrs( const char* entry ) { - SVTK_Prs* prs = new SVTK_Prs(); + SVTK_Prs* prs = new SVTK_Prs( entry ); if ( entry ) { if(SVTK_ViewWindow* aViewWindow = dynamic_cast(getViewManager()->getActiveView())) if(SVTK_View* aView = aViewWindow->getView()){