-// Copyright (C) 2007-2013 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
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <vtkActorCollection.h>
//#include "SUIT_Session.h"
-#include "SVTK_Selection.h"
#include "SVTK_ViewModel.h"
#include "SVTK_ViewWindow.h"
#include "SVTK_View.h"
myIncrementSpeed = 10;
myIncrementMode = 0;
myProjMode = 0;
+ myStereoType = 0;
+ myAnaglyphFilter = 0;
myStyle = 0;
myZoomingStyle = 0;
- myDynamicPreSelection = false;
+ mySelectionEnabled = true;
+ myPreSelectionMode = Standard_Preselection;
mySpaceBtn[0] = 1;
mySpaceBtn[1] = 2;
mySpaceBtn[2] = 9;
myDefaultBackground = Qtx::BackgroundData( Qt::black );
+ myQuadBufferSupport = false;
}
/*!
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->SetQuadBufferSupport( isQuadBufferSupport() );
aViewWindow->SetInteractionStyle( interactionStyle() );
aViewWindow->SetZoomingStyle( zoomingStyle() );
- aViewWindow->SetDynamicPreSelection( dynamicPreSelection() );
+ aViewWindow->SetPreSelectionMode( preSelectionMode() );
+ aViewWindow->SetSelectionEnabled( isSelectionEnabled() );
aViewWindow->SetIncrementalSpeed( incrementalSpeed(), incrementalSpeedMode() );
aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) );
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 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<SUIT_ViewWindow*> aViews = aViewManager->getViews();
+ for ( uint i = 0; i < aViews.count(); i++ )
+ {
+ if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
+ aView->SetQuadBufferSupport( theEnable );
+ }
+ }
+ }
+}
/*!
\return interaction style
*/
}
/*!
- \return dynamic preselection
+ \return current preselection mode
*/
-bool SVTK_Viewer::dynamicPreSelection() const
+Preselection_Mode SVTK_Viewer::preSelectionMode() const
{
- return myDynamicPreSelection;
+ return myPreSelectionMode;
}
/*!
- Sets dynamic preselection
- \param theMode - new dynamic preselection mode
+ Sets preselection mode
+ \param theMode - new preselection mode
*/
-void SVTK_Viewer::setDynamicPreSelection( const bool theMode )
+void SVTK_Viewer::setPreSelectionMode( Preselection_Mode theMode )
{
- myDynamicPreSelection = theMode;
+ myPreSelectionMode = theMode;
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->SetDynamicPreSelection( theMode );
+ aView->SetPreSelectionMode( theMode );
}
}
}
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
//Support of several toolbars in the popup menu
- QList<QToolBar*> lst = qFindChildren<QToolBar*>( aView );
+ QList<QToolBar*> lst = aView->findChildren<QToolBar*>();
QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
for( ; it!=last; it++ )
thePopup->addAction( (*it)->toggleViewAction() );
{
mySelectionEnabled = isEnabled;
//!! To be done for view windows
+
+ 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->SetSelectionEnabled( isEnabled );
+ }
+ }
+
+ if(!isEnabled) {
+ //clear current selection in the viewer
+ bool blocked = blockSignals( true );
+ if ( SUIT_ViewManager* aViewMgr = getViewManager() ) {
+ if( SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( aViewMgr->getActiveView() ) ){
+ if( SVTK_Selector* aSelector = aViewWindow->GetSelector() ) {
+ if(SVTK_View* aView = aViewWindow->getView()){
+ aSelector->ClearIObjects();
+ aView->onSelectionChanged();
+ }
+ }
+ }
+ }
+ blockSignals( blocked );
+ }
+
}
/*!
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
//Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
//if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
// ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
- if(forced)
+ if(forced){
if(SVTK_Renderer* aRnd = aView->GetRenderer())
aRnd->RemoveActor(anAct);
- else{
+ }else{
// just erase actor
anAct->SetVisibility( false );
// erase dependent actors
}
}
}
+
+ SALOME_View::EraseAll( d, forced );
+
Repaint();
}
*/
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<SVTK_ViewWindow*>(getViewManager()->getActiveView()))
if(SVTK_View* aView = aViewWindow->getView()){