if( vm )
{
vm->setProjectionMode( resMgr->integerValue( "VTKViewer", "projection_mode", vm->projectionMode() ) );
+ vm->setStereoType( resMgr->integerValue( "VTKViewer", "stereo_type", vm->stereoType() ) );
+ vm->setAnaglyphFilter( resMgr->integerValue( "VTKViewer", "anaglyph_filter", vm->anaglyphFilter() ) );
vm->setBackground( resMgr->backgroundValue( "VTKViewer", "background", vm->background() ) );
vm->setTrihedronSize( resMgr->doubleValue( "3DViewer", "trihedron_size", vm->trihedronSize() ),
resMgr->booleanValue( "3DViewer", "relative_size", vm->trihedronRelative() ) );
pref->setItemProperty( "strings", aValuesList, mruLinkType );
pref->setItemProperty( "indexes", anIndicesList, mruLinkType );
// ... "MRU" preferences group <<end>>
+ // ... "Full-screen" group <<start>>
+ int fullScreenGroup = pref->addPreference( tr( "PREF_GROUP_FULL_SCREEN" ), genTab );
+ pref->setItemProperty( "columns", 2, fullScreenGroup );
+ // .... -> automatic hiding toolbars
+ pref->addPreference( tr( "PREF_FULL_SCREEN_AUTO" ), fullScreenGroup,
+ LightApp_Preferences::Bool, "OCCViewer", "automatic_hiding" );
+ // ... "Full-screen" group <<end>>
// .. "General" preferences tab <<end>>
// .. "3D viewer" group <<start>>
anIndicesList << 0 << 1;
pref->setItemProperty( "strings", aValuesList, vtkProjMode );
pref->setItemProperty( "indexes", anIndicesList, vtkProjMode );
+
+ // .... -> Stereo group
+ int vtkStereoGroup = pref->addPreference( tr( "PREF_GROUP_STEREO" ), vtkGroup);
+ pref->setItemProperty( "columns", 2, vtkStereoGroup );
+ // .... -> Stereo type
+ int vtkStereoType = pref->addPreference( tr( "PREF_STEREO_TYPE" ), vtkStereoGroup,
+ LightApp_Preferences::Selector, "VTKViewer", "stereo_type" );
+ aValuesList.clear();
+ anIndicesList.clear();
+ idList.clear();
+ SVTK_Viewer::stereoData( aValuesList, idList);
+ foreach( int gid, idList ) anIndicesList << gid;
+ pref->setItemProperty( "strings", aValuesList, vtkStereoType );
+ pref->setItemProperty( "indexes", anIndicesList, vtkStereoType );
+ // .... -> Anaglyph filter
+ int vtkAnaglyphFilter = pref->addPreference( tr( "PREF_ANAGLYPH_FILTER" ), vtkStereoGroup,
+ LightApp_Preferences::Selector, "VTKViewer", "anaglyph_filter" );
+ aValuesList.clear();
+ anIndicesList.clear();
+ aValuesList << tr("PREF_ANAGLYPH_RED_CYAN") << tr("PREF_ANAGLYPH_YELLOW_BLUE") << tr("PREF_ANAGLYPH_GREEN_MAGENTA");
+ anIndicesList << 0 << 1 << 2;
+
+ pref->setItemProperty( "strings", aValuesList, vtkAnaglyphFilter );
+ pref->setItemProperty( "indexes", anIndicesList, vtkAnaglyphFilter );
+
+ // .... -> Enable quad-buffer support
+ pref->addPreference( tr( "PREF_ENABLE_QUAD_BUFFER_SUPPORT" ), vtkStereoGroup,
+ LightApp_Preferences::Bool, "VTKViewer", "enable_quad_buffer_support" );
+
// .... -> background
aValuesList.clear();
anIndicesList.clear();
txtList.clear();
+ idList.clear();
#ifndef DISABLE_SALOMEOBJECT
formats = SVTK_Viewer::backgroundData( aValuesList, idList, txtList );
#endif
}
#endif
+#ifndef DISABLE_VTKVIEWER
+ if ( sec == QString( "VTKViewer" ) && param == QString( "stereo_type" ) )
+ {
+ int mode = resMgr->integerValue( "VTKViewer", "stereo_type", 0 );
+ QList<SUIT_ViewManager*> lst;
+#ifndef DISABLE_SALOMEOBJECT
+ viewManagers( SVTK_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
+ continue;
+
+ SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
+ if( vtkVM ) vtkVM->setStereoType( mode );
+ }
+#endif
+ }
+#endif
+
+#ifndef DISABLE_VTKVIEWER
+ if ( sec == QString( "VTKViewer" ) && param == QString( "anaglyph_filter" ) )
+ {
+ int mode = resMgr->integerValue( "VTKViewer", "anaglyph_filter", 0 );
+ QList<SUIT_ViewManager*> lst;
+#ifndef DISABLE_SALOMEOBJECT
+ viewManagers( SVTK_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
+ continue;
+
+ SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
+ if( vtkVM ) vtkVM->setAnaglyphFilter( mode );
+ }
+#endif
+ }
+#endif
+
#ifndef DISABLE_VTKVIEWER
if ( sec == QString( "VTKViewer" ) && param == QString( "preselection" ) )
{
#include <QAction>
#include <QMenuBar>
#include <QStatusBar>
+#include <QToolBar>
+
+#include <QtxWorkstack.h>
#include <STD_Application.h>
+#include <STD_TabDesktop.h>
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_DataBrowser.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_ResourceMgr.h>
#include "LightApp_FullScreenHelper.h"
#include "LightApp_Application.h"
if(!desktop)
return;
+ STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop );
+
+ QtxWorkstack* wgStack = desk->workstack();
+ wgStack->showActiveTabBar(false);
+ myWindowsList.clear();
+ bool isHidding = false;
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if ( resMgr )
+ isHidding = resMgr->booleanValue( "OCCViewer", "automatic_hiding", true );
+ //Hide all toolbars and inactive window
+ QList<SUIT_ViewWindow*> aWindowList = desk->windows();
+ SUIT_ViewWindow* anActiveWindow = desk->activeWindow();
+ QList<SUIT_ViewWindow*>::const_iterator it = aWindowList.begin();
+ for ( ; it!=aWindowList.end(); it++ ) {
+ QList<QToolBar*> lst = (*it)->findChildren<QToolBar*>();
+ if ( *it ) {
+ myWindowsList.push_back(*it);
+ ( *it )->hide();
+ }
+ if ( isHidding ) {
+ QList<QToolBar*>::const_iterator iter = lst.begin();
+ for ( ; iter!=lst.end(); iter++ ) {
+ (*iter)->hide();
+ }
+ }
+ }
+ if (anActiveWindow)
+ anActiveWindow->show();
+
desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen);
if(desktop->menuBar())
myDocWidgetMap.clear();
QWidget* ob = app->objectBrowser();
- QObject* obParent = ob ? ob->parent() : 0;
+ QObject* obParent = (ob && !isHidding)? ob->parent() : 0;
foreach(QDockWidget* aWidget, aDocWidgets) {
if(aWidget && aWidget->parent() == desktop) {
desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen);
+ STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop );
+
+ QtxWorkstack* wgStack = desk->workstack();
+ wgStack->showActiveTabBar(true);
+
+ bool isHidding = false;
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if ( resMgr )
+ isHidding = resMgr->booleanValue( "OCCViewer", "automatic_hiding", true );
+ //Show all toolbars and windows
+ QList<SUIT_ViewWindow*>::const_iterator itr = myWindowsList.begin();
+ for ( ; itr!=myWindowsList.end(); itr++ ) {
+ QList<QToolBar*> lst = (*itr)->findChildren<QToolBar*>();
+ if (*itr && !(*itr)->isVisible())
+ (*itr)->show();
+ if ( isHidding ) {
+ QList<QToolBar*>::const_iterator iter = lst.begin();
+ for ( ; iter!=lst.end(); iter++ ) {
+ (*iter)->show();
+ }
+ }
+ }
DocWidgetMap::iterator it = myDocWidgetMap.begin();
for( ;it != myDocWidgetMap.end() ; it++ ) {
private:
typedef QMap<QDockWidget*,bool> DocWidgetMap;
DocWidgetMap myDocWidgetMap;
-
typedef QMap<QToolBar*, bool> ToolBarMap;
ToolBarMap myToolBarMap;
-
+ QList<SUIT_ViewWindow*> myWindowsList;
bool myStatusBarVisibility;
<!-- VTK viewer preferences -->
<parameter name="background" value="0, 0, 0"/>
<parameter name="projection_mode" value="0"/>
+ <parameter name="stereo_type" value="0"/>
+ <parameter name="anaglyph_filter" value="0"/>
+ <parameter name="enable_quad_buffer_support" value="false"/>
<parameter name="preselection" value="0"/>
<parameter name="enable_selection" value="true"/>
<parameter name="speed_value" value="10"/>
<source>PREF_GROUP_OCCVIEWER</source>
<translation>OCC 3D Viewer</translation>
</message>
+ <message>
+ <source>PREF_GROUP_STEREO</source>
+ <translation>Stereo render</translation>
+ </message>
+ <message>
+ <source>PREF_STEREO_TYPE</source>
+ <translation>Stereo type</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_FILTER</source>
+ <translation>Anaglyph filter</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_RED_CYAN</source>
+ <translation>Red-Cyan</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_YELLOW_BLUE</source>
+ <translation>Yellow-Blue</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_GREEN_MAGENTA</source>
+ <translation>Green-Magenta</translation>
+ </message>
+ <message>
+ <source>PREF_ENABLE_QUAD_BUFFER_SUPPORT</source>
+ <translation>Enable quad-buffer support</translation>
+ </message>
<message>
<source>PREF_LOGARITHMIC</source>
<translation>Logarithmic</translation>
<source>PREF_GROUP_SHORTCUTS</source>
<translation>Shortcuts settings</translation>
</message>
+ <message>
+ <source>PREF_GROUP_FULL_SCREEN</source>
+ <translation>Full-screen</translation>
+ </message>
+ <message>
+ <source>PREF_FULL_SCREEN_AUTO</source>
+ <translation>Hide object browser and viewers toolbars</translation>
+ </message>
<message>
<source>PREF_TAB_PYEDITOR</source>
<translation>Python Viewer</translation>
<source>PREF_GROUP_OCCVIEWER</source>
<translation>Scène OCC 3D</translation>
</message>
+ <message>
+ <source>PREF_GROUP_STEREO</source>
+ <translation type="unfinished">Stereo render</translation>
+ </message>
+ <message>
+ <source>PREF_STEREO_TYPE</source>
+ <translation type="unfinished">Stereo type</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_FILTER</source>
+ <translation type="unfinished">Anaglyph filter</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_RED_CYAN</source>
+ <translation type="unfinished">Red-Cyan</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_YELLOW_BLUE</source>
+ <translation type="unfinished">Yellow-Blue</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_GREEN_MAGENTA</source>
+ <translation type="unfinished">Green-Magenta</translation>
+ </message>
+ <message>
+ <source>PREF_ENABLE_QUAD_BUFFER_SUPPORT</source>
+ <translation type="unfinished">Enable quad-buffer support</translation>
+ </message>
<message>
<source>PREF_LOGARITHMIC</source>
<translation>Logarithmique</translation>
<source>PREF_GROUP_SHORTCUTS</source>
<translation>Réglage des raccourcis clavier</translation>
</message>
+ <message>
+ <source>PREF_GROUP_FULL_SCREEN</source>
+ <translation type="unfinished">Full-screen</translation>
+ </message>
+ <message>
+ <source>PREF_FULL_SCREEN_AUTO</source>
+ <translation type="unfinished">Hide object browser and viewers toolbars</translation>
+ </message>
<message>
<source>PREF_TAB_PYEDITOR</source>
<translation>Editeur python</translation>
<source>PREF_GROUP_OCCVIEWER</source>
<translation>OCC 3D Viewer</translation>
</message>
+ <message>
+ <source>PREF_GROUP_STEREO</source>
+ <translation type="unfinished">Stereo render</translation>
+ </message>
+ <message>
+ <source>PREF_STEREO_TYPE</source>
+ <translation type="unfinished">Stereo type</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_FILTER</source>
+ <translation type="unfinished">Anaglyph filter</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_RED_CYAN</source>
+ <translation type="unfinished">Red-Cyan</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_YELLOW_BLUE</source>
+ <translation type="unfinished">Yellow-Blue</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_GREEN_MAGENTA</source>
+ <translation type="unfinished">Green-Magenta</translation>
+ </message>
+ <message>
+ <source>PREF_ENABLE_QUAD_BUFFER_SUPPORT</source>
+ <translation type="unfinished">Enable quad-buffer support</translation>
+ </message>
<message>
<source>PREF_LOGARITHMIC</source>
<translation>対数</translation>
<source>PREF_GROUP_SHORTCUTS</source>
<translation>ショートカットの設定</translation>
</message>
+ <message>
+ <source>PREF_GROUP_FULL_SCREEN</source>
+ <translation type="unfinished">Full-screen</translation>
+ </message>
+ <message>
+ <source>PREF_FULL_SCREEN_AUTO</source>
+ <translation type="unfinished">Hide object browser and viewers toolbars</translation>
+ </message>
<message>
<source>PREF_TAB_PYEDITOR</source>
<translation>Python Viewer</translation>
base->setMargin( frameWidth() );
base->setSpacing( 0 );
- QWidget* top = new QWidget( this );
- base->addWidget( top );
+ myTop = new QWidget( this );
+ base->addWidget( myTop );
- QHBoxLayout* tl = new QHBoxLayout( top );
+ QHBoxLayout* tl = new QHBoxLayout( myTop );
tl->setMargin( 0 );
- myBar = new QtxWorkstackTabBar( top );
+ myBar = new QtxWorkstackTabBar( myTop );
tl->addWidget( myBar, 1 );
- CloseButton* close = new CloseButton( top );
+ CloseButton* close = new CloseButton( myTop );
close->setIcon( style()->standardIcon( QStyle::SP_TitleBarCloseButton ) );
myClose = close;
tl->addWidget( myClose );
return true;
}
+/*!
+ \brief Show/Hide tab bar.
+*/
+void QtxWorkstackArea::showTabBar( bool visible)
+{
+ myTop->setVisible(visible);
+ myBar->setVisible(visible);
+}
+
+
/*!
\brief Get rectangle to be drawn when highlighting drop area.
\return area drop rectangle
return mySplit->opaqueResize();
}
+/*!
+ \brief Show/Hide active tab bar.
+*/
+void QtxWorkstack::showActiveTabBar( bool visible )
+{
+ QList<QtxWorkstackArea*> areaList;
+ areas( mySplit, areaList, true );
+ QList<QtxWorkstackArea*>::ConstIterator it;
+ for ( it = areaList.begin(); it != areaList.end(); ++it )
+ {
+ (*it)->showTabBar( visible );
+ }
+ QList<QSplitter*> recList;
+ splitters( mySplit, recList, true );
+ for ( QList<QSplitter*>::iterator itr = recList.begin(); itr != recList.end(); ++itr )
+ (*itr)->setVisible(visible);
+}
/*!
\fn void QtxWorkstack::windowActivated( QWidget* w )
void setOpaqueResize( bool = true );
bool opaqueResize() const;
+ void showActiveTabBar( bool = true );
+
void Split( QWidget* wid, const Qt::Orientation o, const SplitType type );
void Attract( QWidget* wid1, QWidget* wid2, const bool all );
void SetRelativePosition( QWidget* wid, const Qt::Orientation o, const double pos );
void saveState( QDataStream& ) const;
bool restoreState( QDataStream&, QMap<QString, QtxWorkstackChild*>& );
+ void showTabBar( bool = true);
+
signals:
void activated( QWidget* );
void contextMenuRequested( QWidget*, QPoint );
typedef QList<QtxWorkstackChild*> ChildList;
private:
+ QWidget* myTop; //!< workarea top widget
QtxWorkstackTabBar* myBar; //!< workarea tab bar header
ChildList myList; //!< child widgets list
QAbstractButton* myClose; //!< close button
resources/vtk_view_rotation_point.png
resources/vtk_view_scaling.png
resources/vtk_view_selection.png
+ resources/vtk_view_stereo.png
resources/vtk_view_style_switch.png
resources/vtk_view_update_rate.png
resources/vtk_view_zooming_style_switch.png
if( anActorCollection )
{
- if( !myShiftState &&
- anActorCollection->GetNumberOfItems () > 1 &&
- myLastHighlitedActor.GetPointer() ) {
- anActorCollection->RemoveItem ( myLastHighlitedActor.GetPointer() );
- }
anActorCollection->InitTraversal();
while( vtkActor* aVTKActor = anActorCollection->GetNextActor() )
{
myIncrementSpeed = 10;
myIncrementMode = 0;
myProjMode = 0;
+ myStereoType = 0;
+ myAnaglyphFilter = 0;
myStyle = 0;
myZoomingStyle = 0;
mySelectionEnabled = true;
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
{
aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() );
aViewWindow->SetStaticTrihedronVisible( isStaticTrihedronVisible() );
aViewWindow->SetProjectionMode( projectionMode() );
+ aViewWindow->SetStereoType( stereoType() );
+ aViewWindow->SetAnaglyphFilter( anaglyphFilter() );
aViewWindow->SetInteractionStyle( interactionStyle() );
aViewWindow->SetZoomingStyle( zoomingStyle() );
aViewWindow->SetPreSelectionMode( preSelectionMode() );
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<SUIT_ViewWindow*> aViews = aViewManager->getViews();
for ( uint i = 0; i < aViews.count(); i++ )
}
}
+/*!
+ \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<SUIT_ViewWindow*> aViews = aViewManager->getViews();
+ for ( uint i = 0; i < aViews.count(); i++ )
+ {
+ if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(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<SUIT_ViewWindow*> aViews = aViewManager->getViews();
+ for ( uint i = 0; i < aViews.count(); i++ )
+ {
+ if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
+ aView->SetAnaglyphFilter( theFilter );
+ }
+ }
+ }
+}
+
/*!
\return interaction style
*/
LastGradient = FourthCornerGradient,
};
+ enum {
+ CrystalEyesType, RedBlueType,
+ InterlacedType, LeftType,
+ RightType, DresdenType,
+ AnaglyphType, CheckerboardType,
+ SplitViewPortHorizontalType
+ };
typedef SVTK_ViewWindow TViewWindow;
//! Define string representation of the viewer type
static QString Type() { return "VTKViewer"; }
static QString backgroundData( QStringList&, QIntList&, QIntList& );
+ static void stereoData( QStringList&, QIntList&);
SVTK_Viewer();
virtual ~SVTK_Viewer();
//! Sets projection mode
void setProjectionMode( const int );
+ //! Gets stereo type
+ int stereoType() const;
+
+ //! Sets stereo type
+ void setStereoType( const int );
+
+ //! Gets anaglyph filter
+ int anaglyphFilter() const;
+
+ //! Sets anaglyph filter
+ void setAnaglyphFilter( const int );
+
//! Gets interaction style
int interactionStyle() const;
int myIncrementSpeed;
int myIncrementMode;
int myProjMode;
+ int myStereoType;
+ int myAnaglyphFilter;
int myStyle;
int myZoomingStyle;
Preselection_Mode myPreSelectionMode;
vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
aCamera->SetParallelProjection(aBtn == 0);
-
- myMainWindow->activateProjectionMode(aBtn);
+ if (!myBusy)
+ myMainWindow->activateProjectionMode(!aBtn);
// update view
myRWInteractor->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
#include <OpenGLUtils_FrameBuffer.h>
+#include <GL/gl.h>
+
namespace SVTK
{
int convertAction( const int accelAction )
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" );
/*!
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 );
+ SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
+
+ if ( theMode != Stereo ) {
+ aViewer->setProjectionMode(theMode);
+ bool anIsParallelMode = (theMode == Parallel);
+ vtkCamera* aCamera = getRenderer()->GetActiveCamera();
+ aCamera->SetParallelProjection(anIsParallelMode);
+ GetInteractor()->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
+ getRenderWindow()->SetStereoRender(0);
+ }
+ else {
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ SetStereoType( aResMgr->integerValue( "VTKViewer", "stereo_type", 0 ) );
+ getRenderWindow()->SetStereoRender(1);
+ }
+ Repaint();
+
+ // update action state if method is called outside
+ QtxAction* aParallelAction = dynamic_cast<QtxAction*>( toolMgr()->action( ParallelModeId ) );
+ QtxAction* aProjectionAction = dynamic_cast<QtxAction*>( toolMgr()->action( ProjectionModeId ) );
+ QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoModeId ) );
+ QtxAction* aSwitchZoomingStyle = dynamic_cast<QtxAction*>( 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 ){
+ SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ), tr( "WRN_SUPPORT_QUAD_BUFFER" ) );
+ }
+ }
+ else {
+ aProjectionAction->setEnabled( true );
+ aStereoAction->setChecked( false );
+ aProjectionAction->setChecked( aViewer->projectionMode() == Projection );
+ onPerspectiveMode();
+ }
+ }
+ 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;
+ }
}
+/*!
+ \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
void SVTK_ViewWindow::activateProjectionMode(int theMode)
{
+ QtxAction* aParallelAction = dynamic_cast<QtxAction*>( toolMgr()->action( ParallelModeId ) );
+ QtxAction* aProjectionAction = dynamic_cast<QtxAction*>( 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 );
}
/*!
*/
void SVTK_ViewWindow::onPerspectiveMode()
{
- bool anIsParallelMode = toolMgr()->action( ParallelModeId )->isChecked();
-
- // advanced zooming is not available in perspective mode
- if( QtxAction* anAction = getAction( SwitchZoomingStyleId ) )
- anAction->setEnabled( anIsParallelMode );
-
- vtkCamera* aCamera = getRenderer()->GetActiveCamera();
- aCamera->SetParallelProjection(anIsParallelMode);
- GetInteractor()->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
-
+ if (toolMgr()->action( ParallelModeId )->isChecked())
+ SetProjectionMode( Parallel);
+ if (toolMgr()->action( ProjectionModeId )->isChecked())
+ SetProjectionMode( Projection);
+ if (toolMgr()->action( StereoModeId )->isChecked())
+ SetProjectionMode( Stereo);
emit transformed( this );
}
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()));
+ //connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode()));
mgr->registerAction( anAction, ParallelModeId );
anAction = new QtxAction(tr("MNU_SVTK_PERSPECTIVE_MODE"),
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()));
+ //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(toggled(bool)), this, SLOT(onPerspectiveMode()));
+ mgr->registerAction( anAction, StereoModeId );
+
QActionGroup* aPerspectiveGroup = new QActionGroup( this );
aPerspectiveGroup->addAction( mgr->action( ParallelModeId ) );
aPerspectiveGroup->addAction( mgr->action( ProjectionModeId ) );
+ aPerspectiveGroup->addAction( mgr->action( StereoModeId ) );
+ connect(aPerspectiveGroup, SIGNAL(triggered(QAction*)), this, SLOT(onPerspectiveMode()));
// View Parameters
anAction = new QtxAction(tr("MNU_VIEWPARAMETERS_VIEW"),
mgr->append( ParallelModeId, myToolBar );
mgr->append( ProjectionModeId, myToolBar );
+ mgr->append( StereoModeId, myToolBar );
mgr->append( StartRecordingId, myRecordingToolBar );
mgr->append( PlayRecordingId, myRecordingToolBar );
//! Set current projection mode
virtual void SetProjectionMode( const int );
+ //! Sets stereo type
+ virtual void SetStereoType( const int );
+
+ //! Sets anaglyph filter
+ virtual void SetAnaglyphFilter( const int );
+
//! Set interactive style
virtual void SetInteractionStyle( const int );
void onMouseReleased(QMouseEvent* event);
void onMouseMoving(QMouseEvent* event);
+public:
+ enum ProjectionType { Parallel, Projection, Stereo };
+
+ enum StereoType { CrystalEyes, RedBlue, Interlaced, Left, Right, Dresden, Anaglyph, Checkerboard, SplitViewPortHorizontal };
+
+ enum AnaglyphFilter { RedCyan, YellowBlue, GreenMagenta };
+
protected:
virtual void Initialize(SVTK_View* theView,
SVTK_ViewModelBase* theModel);
void* clientdata,
void* calldata);
+ bool isOpenGlStereoSupport() const;
+
void doSetVisualParameters( const QString&, bool = false );
void SetEventDispatcher(vtkObject* theDispatcher);
enum { DumpId, FitAllId, FitRectId, FitSelectionId, ZoomId, PanId, GlobalPanId,
ChangeRotationPointId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId, ResetId,
- ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
- ParallelModeId, ProjectionModeId, ViewParametersId, SynchronizeId, SwitchInteractionStyleId,
+ ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
+ ParallelModeId, ProjectionModeId, StereoModeId, ViewParametersId, SynchronizeId, SwitchInteractionStyleId,
SwitchZoomingStyleId,
PreselectionId, StandardPreselectionId, DynamicPreselectionId, DisablePreselectionId,
EnableSelectionId,
<source>ICON_SVTK_VIEW_PERSPECTIVE</source>
<translation>vtk_view_perspective.png</translation>
</message>
+ <message>
+ <source>ICON_SVTK_VIEW_STEREO</source>
+ <translation>vtk_view_stereo.png</translation>
+ </message>
<message>
<source>ICON_SVTK_STYLE_SWITCH</source>
<translation>vtk_view_style_switch.png</translation>
<source>DSC_SVTK_PERSPECTIVE_MODE</source>
<translation>Set the perspective projection type</translation>
</message>
+ <message>
+ <source>MNU_SVTK_STEREO_MODE</source>
+ <translation>Stereo Mode</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_STEREO_MODE</source>
+ <translation>Set the stereo projection type</translation>
+ </message>
<message>
<source>DSC_SVTK_STYLE_SWITCH</source>
<translation>Interaction style switch</translation>
<message>
<source>MNU_SVTK_ENABLE_SELECTION</source>
<translation>Enable/Disable selection</translation>
- </message>
+ </message>
+ <message>
+ <source>WRN_SUPPORT_QUAD_BUFFER</source>
+ <translation>Graphic driver not support quad-buffer</translation>
+ </message>
</context>
<context>
<name>SVTK_FontWidget</name>
<source>BG_IMAGE_FILES</source>
<translation>Image files (*.png *.jpg *.jpeg *.bmp *.tif *.tiff *.mhd *.mha)</translation>
</message>
+ <message>
+ <source>ST_CRYSTALEYES</source>
+ <translation>Crystal Eyes</translation>
+ </message>
+ <message>
+ <source>ST_REDBLUE</source>
+ <translation>Red-Blue</translation>
+ </message>
+ <message>
+ <source>ST_INTERLACED</source>
+ <translation>Interlaced</translation>
+ </message>
+ <message>
+ <source>ST_LEFT</source>
+ <translation>Left</translation>
+ </message>
+ <message>
+ <source>ST_RIGHT</source>
+ <translation>Right</translation>
+ </message>
+ <message>
+ <source>ST_DRESDEN</source>
+ <translation>Dresden</translation>
+ </message>
+ <message>
+ <source>ST_ANAGLYPH</source>
+ <translation>Anaglyph</translation>
+ </message>
+ <message>
+ <source>ST_CHECKERBOARD</source>
+ <translation>Checkerboard</translation>
+ </message>
+ <message>
+ <source>ST_SPLITVIEWPORTHORIZONTAL</source>
+ <translation>Split View Port Horizontal</translation>
+ </message>
</context>
</TS>
<source>DSC_SVTK_PERSPECTIVE_MODE</source>
<translation>Choisir la projection en perspective</translation>
</message>
+ <message>
+ <source>MNU_SVTK_STEREO_MODE</source>
+ <translation type="unfinished">Stereo Mode</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_STEREO_MODE</source>
+ <translation type="unfinished">Set the stereo projection type</translation>
+ </message>
<message>
<source>DSC_SVTK_STYLE_SWITCH</source>
<translation>Changer le style d'intéraction</translation>
<message>
<source>MNU_SVTK_ENABLE_SELECTION</source>
<translation>Enable/Disable selection</translation>
- </message>
+ </message>
+ <message>
+ <source>WRN_SUPPORT_QUAD_BUFFER</source>
+ <translation type="unfinished">Graphic driver not support quad-buffer</translation>
+ </message>
</context>
<context>
<name>SVTK_FontWidget</name>
<source>BG_IMAGE_FILES</source>
<translation>Fichiers images (*.png *.jpg *.jpeg *.bmp *.tif *.tiff *.mhd *.mha)</translation>
</message>
+ <message>
+ <source>ST_CRYSTALEYES</source>
+ <translation type="unfinished">Crystal Eyes</translation>
+ </message>
+ <message>
+ <source>ST_REDBLUE</source>
+ <translation type="unfinished">Red-Blue</translation>
+ </message>
+ <message>
+ <source>ST_INTERLACED</source>
+ <translation type="unfinished">Interlaced</translation>
+ </message>
+ <message>
+ <source>ST_LEFT</source>
+ <translation type="unfinished">Left</translation>
+ </message>
+ <message>
+ <source>ST_RIGHT</source>
+ <translation type="unfinished">Right</translation>
+ </message>
+ <message>
+ <source>ST_DRESDEN</source>
+ <translation type="unfinished">Dresden</translation>
+ </message>
+ <message>
+ <source>ST_ANAGLYPH</source>
+ <translation type="unfinished">Anaglyph</translation>
+ </message>
+ <message>
+ <source>ST_CHECKERBOARD</source>
+ <translation type="unfinished">Checkerboard</translation>
+ </message>
+ <message>
+ <source>ST_SPLITVIEWPORTHORIZONTAL</source>
+ <translation type="unfinished">Split View Port Horizontal</translation>
+ </message>
</context>
</TS>
<source>DSC_SVTK_PERSPECTIVE_MODE</source>
<translation>透視投影を選択します。</translation>
</message>
+ <message>
+ <source>MNU_SVTK_STEREO_MODE</source>
+ <translation type="unfinished">Stereo Mode</translation>
+ </message>
+ <message>
+ <source>DSC_SVTK_STEREO_MODE</source>
+ <translation type="unfinished">Set the stereo projection type</translation>
+ </message>
<message>
<source>DSC_SVTK_STYLE_SWITCH</source>
<translation>相互作用のスタイルを変更します。</translation>
<source>MNU_SVTK_ENABLE_SELECTION</source>
<translation>選択を有効/無効にします。</translation>
</message>
+ <message>
+ <source>WRN_SUPPORT_QUAD_BUFFER</source>
+ <translation type="unfinished">Graphic driver not support quad-buffer</translation>
+ </message>
</context>
<context>
<name>SVTK_FontWidget</name>
<source>BG_IMAGE_FILES</source>
<translation>ファイル (*.png *.jpg *.jpeg、*.bmp, *.tif, *.tiff *.mhd *.mha)</translation>
</message>
+ <message>
+ <source>ST_CRYSTALEYES</source>
+ <translation type="unfinished">Crystal Eyes</translation>
+ </message>
+ <message>
+ <source>ST_REDBLUE</source>
+ <translation type="unfinished">Red-Blue</translation>
+ </message>
+ <message>
+ <source>ST_INTERLACED</source>
+ <translation type="unfinished">Interlaced</translation>
+ </message>
+ <message>
+ <source>ST_LEFT</source>
+ <translation type="unfinished">Left</translation>
+ </message>
+ <message>
+ <source>ST_RIGHT</source>
+ <translation type="unfinished">Right</translation>
+ </message>
+ <message>
+ <source>ST_DRESDEN</source>
+ <translation type="unfinished">Dresden</translation>
+ </message>
+ <message>
+ <source>ST_ANAGLYPH</source>
+ <translation type="unfinished">Anaglyph</translation>
+ </message>
+ <message>
+ <source>ST_CHECKERBOARD</source>
+ <translation type="unfinished">Checkerboard</translation>
+ </message>
+ <message>
+ <source>ST_SPLITVIEWPORTHORIZONTAL</source>
+ <translation type="unfinished">Split View Port Horizontal</translation>
+ </message>
</context>
</TS>