otherwise a system locale will be used. The locale change will come in force only after
the application is restarted.
- <b>Look and feel</b>
- - <b>Show splash screen at start-up</b> - allows to show or not splash screen at start-up.
+ - <b>Show splash screen at start-up</b> - allows showing or hiding the splash screen at start-up.
- <b>Opaque resize</b> - force opaque resize mode for viewers area (tabbed workspace).
Clear this checkbox for less perfomant workstations.
- <b>Drop-down buttons in toolbars for action groups</b> - when
the SALOME platform.
- <b>ASCII save</b> - if checked in, your study will be saved in
ASCII format file (or files).
+ - <b>Automatic loading of light modules when opening study</b> - if checked in,
+ Light Modules of the current study will be automatically loaded at the next study
+ opening, allowing completion of object browser.
- <b>Store positions of windows</b> - if checked in, positions of windows
will be saved in a special file at the end of the current session and
then restored for a new session.
- \b Parameters - additional parameters required for launching of
the external browser (if applicable).
- <b>Python console</b>
- - \b Font - allows quickly set the parameters (style, size, face) of the
+ - \b Font - allows quickly setting the parameters (style, size, face) of the
\ref font_color_dlg "font" used in embedded Python console.
- <b>Show banner</b> - this option allows to show/hide the Python banner
- in the top of the console window.
+ on top of the console window.
- <b>Show MRU items</b> - allows to define the maximum \b Number of
items in <b>Most Recently Used</b> list and the <b>Link type</b>:
- \b Long - shows the full path to the file.
- \b Short - shows the file name only.
- \b Auto - shows full paths to the files only if some files from
different locations have the same name.
+ - <b>Full-screen</b> - options concerned full-screen mode:
+ - <b>Hide object browser and viewers toolbars</b> - switches automatic hiding of
+ Object Browser and OCC viewer toolbar in full-screen mode.
<h2>3D Viewer Preferences</h2>
\image html pref_salome_occviewer.png
+ - <b>Projection mode</b> - sets the default projection mode for the viewers: Orthogonal or Perpective.
+ - <b>Stereo render</b> - group of stereoscopic view settings:
+ - <b>Stereo type</b> - specifies a stereo pair type:
+ - Shutter glasses (OpenGL quad-buffer)
+ - Anaglyph
+ - Row-interlaced
+ - Column-interlaced
+ - Chess-board stereo for DLP TVs
+ - Horizontal-anamorphic (side-by-side)
+ - Vertical-anamorphic (Half OverUnder)
+ \note The stereo pair type selected in this combobox is applied
+ for all existing OCC 3D views with stereo rendering already turned on
+ within the same SALOME GUI session. It is not possible to use
+ different stereo modes in several OCC 3D views at the same time
+ within the same SALOME GUI session.
+ - <b>Anaglyph filter</b> - specifies format of anaglyph stereo pair:
+ - Red-Cyan (default)
+ - Yellow-Blue
+ - Green-Magenta
+ - <b>Convergence distance type</b>: Absolute or Relative (default).
+ - <b>Stereographic focus value</b> - 1 by default.
+ - <b>IOD type</b> - Absolute or Relative (default).
+ - <b>Interocular distance (IOD) value</b> - 0.05 by default.
+ - <b>Reverse stereo</b> - option to swap left and right frames.
+ - <b>Enable V-Sync</b> - activates vertical synchronization.
+ - <b>Enable quad-buffer support</b> - allows quad-buffered rendering.
+ \note It is neccessary to enable quad-buffered stereoscopic rendering
+ manually in graphic driver settings. SALOME does not do it automatically.
+ \note All existing OCC 3D views should be re-created for quad-buffer support.
+
- <b>Background</b> - specifies the default background for the viewers,
separately for (for more details, refer to the \ref viewer_background
"this page"):
- <b>Color</b> - allows to change the color of the clipped region.
- <b>Use default texture</b> - if this option is switched on, the default texture
will be used for clipping texture, otherwise - the texture specified in "Texture" field.
- - <b>Texture</b> - allows to change the texture of the clipped region
- (enable if "Use default texture" is switched off).
- - <b>Modulate</b> - controls if "Texture" should be mixed with "Color" parameter or no.
+ - <b>Texture</b> - allows to change the texture of the clipped region (enable if "Use default texture" is switched off).
+ - <b>Modulate</b> - controls if "Texture" should be mixed with "Color" parameter or not.
- <b>Scale factor</b> - sets the scale factor for default and custom textures.
\anchor vtk_preferences
or [-] keyboard buttons.
- <b>Modification Mode</b> - allows choosing between \b Arithmetic
and \b Geometrical progression used for zooming.
+ - <b>Stereo render</b> - group of stereoscopic view settings:
+ - <b>Stereo type</b> - specifies a stereo pair type:
+ - Crystal Eyes
+ - Red-Blue
+ - Interlaced
+ - Left
+ - Right
+ - Dresden
+ - Anaglyph
+ - Checkerboard
+ - Split View Port Horizontal
+ \note The stereo pair type selected in this combobox is applied
+ for all existing VTK 3D views with stereo rendering already turned on
+ within the same SALOME GUI session. It is not possible to use
+ different stereo modes in several VTK 3D views at the same time
+ within the same SALOME GUI session.
+ - <b>Anaglyph filter</b> - specifies format of anaglyph stereo pair:
+ - Red-Cyan (default)
+ - Yellow-Blue
+ - Green-Magenta
+ - <b>Enable quad-buffer support</b> - allows quad-buffered rendering.
+ \note It is neccessary to enable quad-buffered stereoscopic rendering
+ manually in graphic driver settings. SALOME does not do it automatically.
+ \note All existing VTK 3D views should be re-created for quad-buffer support.
- <b>Selection</b>
- - <b>Preselection</b> - allows to choose preselection mode from three regimes:
- - <b>Standard</b> - this preselection mode works quickly, by checking only
- bounding boxes of objects, not dealing with the order of the actors in the view
- and not dealing with their data (points/ cells).
- - <b>Dynamic</b> - works directly with cells of actors that allows to have the
- exact area of preselection. But this mode is much more slower.
- - <b>Disabled</b> - allows to switch off the preselection.
+ - <b>Preselection</b> - allows to choose among three possible preselection modes:
+ - <b>Standard</b> - this mode works quickly, by checking only
+ bounding boxes of objects. It does not deal with the order of actors in the view
+ or with their data (points/ cells).
+ - <b>Dynamic</b> - works directly with cells of actors, which provides the
+ exact area of preselection. This mode is much more slower.
+ - <b>Disabled</b> - switches off the preselection.
- <b>Enable selection</b> - switches selection on/off.
- <b>Spacemouse</b> - a mouse-like manipulator device specially designed
for working with 3D presentations, objects, etc. You can reassign the
\image html pref_salome_pythonviewer.png
- \note The following settings are default and will be applied for a new created Python viewers only. Customization of already opened viewers can be done using local \ref custom_python_preferences "Preferences dialog box" that is called by click on corresponding icon of \ref python_viewer_page "Python viewer toolbar".
+ \note The following settings are default and will be applied only for newly created Python viewers. Customization of already opened viewers can be done using local \ref custom_python_preferences "Preferences dialog box" called by clicking on the corresponding icon of \ref python_viewer_page "Python viewer toolbar".
- <b>Font settings</b> allows setting font variant, size and style.
- <b>Display settings</b> specifies the script representation in the viewer:
- - <b>Enable current line highlight</b> switches on a background coloring of current line.
- - <b>Enable text wrapping</b> allows lines wrapping at the view border of the editor.
+ - <b>Enable current line highlight</b> switches on background coloring of the current line.
+ - <b>Enable text wrapping</b> wraps lines at the view border of the editor.
- <b>Center cursor on scroll</b> scrolls the script vertically to make the cursor visible at the center of the viewer.
- - <b>Display line numbers area</b> will make a panel displaying the line numbers of the script visible in the left border of the editor.
+ - <b>Display line numbers area</b> shows a panel with line numbers of the script at the left border of the editor.
- - <b>Tab settings</b> allows to display tab indentation as a set of desirable number of white spaces.
+ - <b>Tab settings</b> allows displaying tab indentation as a certain number of white-spaces.
- - <b>Vertical edge settings</b> manages drawing of vertical line at the specified column of the viewer.
+ - <b>Vertical edge settings</b> manages drawing of a vertical line at the specified column of the viewer.
<h2>Directories Preferences</h2>
#ifndef DISABLE_OCCVIEWER
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewFrame.h>
+ #include <OCCViewer_ViewPort3d.h>
#ifndef DISABLE_SALOMEOBJECT
#include <SOCC_ViewModel.h>
#else
myAutoSaveTimer->setSingleShot( true );
connect( myAutoSaveTimer, SIGNAL( timeout() ), this, SLOT( onSaveDoc() ) );
+ //connect( this, SIGNAL( moving() ), this, SLOT( onMoved() ) );
+
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap aLogo = aResMgr->loadPixmap( "LightApp", tr( "APP_DEFAULT_ICO" ), false );
updateWindows();
updateViewManagers();
- if ( activeStudy() && activeStudy()->root() && objectBrowser() && objectBrowser()->root() != activeStudy()->root() ) {
- objectBrowser()->setRoot( activeStudy()->root() );
+ if ( activeStudy() && activeStudy()->root() && objectBrowser() ) {
+ if ( objectBrowser()->root() != activeStudy()->root() )
+ objectBrowser()->setRoot( activeStudy()->root() );
updateObjectBrowser( true );
}
return true;
createActionForViewer( NewGraphicsViewId, newWinMenu, QString::number( 5 ), Qt::ALT+Qt::Key_C );
#endif
#ifndef DISABLE_PVVIEWER
- QStringList aModuleNames;
- modules( aModuleNames, false );
- if ( aModuleNames.contains( "ParaViS", Qt::CaseInsensitive ) )
- createActionForViewer( NewPVViewId, newWinMenu, QString::number( 6 ), Qt::ALT+Qt::Key_A );
+ createActionForViewer( NewPVViewId, newWinMenu, QString::number( 6 ), Qt::ALT+Qt::Key_A );
#endif
#ifndef DISABLE_PYVIEWER
createActionForViewer( NewPyViewerId, newWinMenu, QString::number( 7 ), Qt::ALT+Qt::Key_Y );
vm->setTrihedronSize( resMgr->doubleValue( "3DViewer", "trihedron_size", vm->trihedronSize() ),
resMgr->booleanValue( "3DViewer", "relative_size", vm->trihedronRelative() ));
vm->setInteractionStyle( resMgr->integerValue( "3DViewer", "navigation_mode", vm->interactionStyle() ) );
+ vm->setProjectionType( resMgr->integerValue( "OCCViewer", "projection_mode", vm->projectionType() ) );
+ #if OCC_VERSION_LARGE > 0x06090000
+ vm->setStereoType( resMgr->integerValue( "OCCViewer", "stereo_type", vm->stereoType() ) );
+ vm->setAnaglyphFilter( resMgr->integerValue( "OCCViewer", "anaglyph_filter", vm->anaglyphFilter() ) );
+ vm->setStereographicFocus( resMgr->integerValue( "OCCViewer", "focus_type", vm->stereographicFocusType() ),
+ resMgr->doubleValue( "OCCViewer", "focus_value", vm->stereographicFocusValue() ));
+ vm->setInterocularDistance( resMgr->integerValue( "OCCViewer", "iod_type", vm->interocularDistanceType() ),
+ resMgr->doubleValue( "OCCViewer", "iod_value", vm->interocularDistanceValue() ));
+
+ vm->setReverseStereo( resMgr->booleanValue( "OCCViewer", "reverse_stereo", vm->isReverseStereo() ) );
+ vm->setVSync( resMgr->booleanValue( "OCCViewer", "enable_vsync", vm->isVSync() ) );
+ vm->setQuadBufferSupport( resMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", vm->isQuadBufferSupport() ) );
+ #endif
vm->setZoomingStyle( resMgr->integerValue( "3DViewer", "zooming_mode", vm->zoomingStyle() ) );
vm->enablePreselection( resMgr->booleanValue( "OCCViewer", "enable_preselection", vm->isPreselectionEnabled() ) );
vm->enableSelection( resMgr->booleanValue( "OCCViewer", "enable_selection", vm->isSelectionEnabled() ) );
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->setQuadBufferSupport( resMgr->booleanValue( "VTKViewer", "enable_quad_buffer_support", vm->isQuadBufferSupport() ) );
vm->setBackground( resMgr->backgroundValue( "VTKViewer", "background", vm->background() ) );
vm->setTrihedronSize( resMgr->doubleValue( "3DViewer", "trihedron_size", vm->trihedronSize() ),
resMgr->booleanValue( "3DViewer", "relative_size", vm->trihedronRelative() ) );
updateActions();
}
+ // IMN 08.07.2015 : issue 002556: Some stereo outputs are affected by window position.
+ // To prevent reversion the window should be either aligned during movement and resize.
+ /*!Private SLOT. Update actions after rename object.*/
+ /*void LightApp_Application::onMoved()
+ {
+ OCCViewer_ViewManager* viewMgr = 0;
+ viewMgr = dynamic_cast<OCCViewer_ViewManager*>( getViewManager( OCCViewer_Viewer::Type(), false ) );
+ if (viewMgr) {
+ OCCViewer_ViewWindow* view = 0;
+ view = dynamic_cast<OCCViewer_ViewWindow*>( viewMgr->getActiveView() );
+ if (view) {
+ view->getViewPort()->repaintViewAfterMove();
+ }
+ }
+ }
+ */
/*!Private SLOT. Support drag-and-drop operation.*/
void LightApp_Application::onDropped( const QList<SUIT_DataObject*>& objects, SUIT_DataObject* parent, int row, Qt::DropAction action )
{
}
pref->setItemProperty( "strings", aLangs, curLang );
pref->setItemProperty( "icons", aIcons, curLang );
+ pref->setItemProperty( "restart", true, curLang );
int curLocale = pref->addPreference( tr( "PREF_CURRENT_LOCALE" ), langGroup,
LightApp_Preferences::Bool, "language", "locale" );
+ pref->setItemProperty( "restart", true, curLocale );
// ... "Language" group <<end>>
// ... "Look and feel" group <<start>>
// .... -> ascii save mode
pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "ascii_file" );
// .... -> store windows geometry
+ pref->addPreference( tr( "PREF_LOAD_LIGHT" ), studyGroup, LightApp_Preferences::Bool, "Study", "autoload_light_modules" );
pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" );
pref->addPreference( "", studyGroup, LightApp_Preferences::Space );
pref->addPreference( tr( "PREF_STORE_TOOL_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_tool_positions" );
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>>
// .. "OCC viewer" group <<start>>
int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), salomeCat );
+ // .... -> Projection mode
+ int occProjMode = pref->addPreference( tr( "PREF_PROJECTION_MODE" ), occGroup,
+ LightApp_Preferences::Selector, "OCCViewer", "projection_mode" );
+ aValuesList.clear();
+ anIndicesList.clear();
+ aValuesList << tr("PREF_ORTHOGRAPHIC") << tr("PREF_PERSPECTIVE");
+ anIndicesList << 0 << 1;
+ pref->setItemProperty( "strings", aValuesList, occProjMode );
+ pref->setItemProperty( "indexes", anIndicesList, occProjMode );
+ #if OCC_VERSION_LARGE > 0x06090000
+ // .... -> Stereo group
+ int stereoGroup = pref->addPreference( tr( "PREF_GROUP_STEREO" ), occGroup);
+ pref->setItemProperty( "columns", 2, stereoGroup );
+ // .... -> Stereo type
+ int stereoType = pref->addPreference( tr( "PREF_STEREO_TYPE" ), stereoGroup,
+ LightApp_Preferences::Selector, "OCCViewer", "stereo_type" );
+ aValuesList.clear();
+ anIndicesList.clear();
+ idList.clear();
+ OCCViewer_Viewer::stereoData( aValuesList, idList);
+ foreach( int gid, idList ) anIndicesList << gid;
+ pref->setItemProperty( "strings", aValuesList, stereoType );
+ pref->setItemProperty( "indexes", anIndicesList, stereoType );
+
+ // .... -> Anaglyph filter
+ int anaglyphFilter = pref->addPreference( tr( "PREF_ANAGLYPH_FILTER" ), stereoGroup,
+ LightApp_Preferences::Selector, "OCCViewer", "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, anaglyphFilter );
+ pref->setItemProperty( "indexes", anIndicesList, anaglyphFilter );
+
+ // .... -> Convergence distance type
+ int occFocusType = pref->addPreference( tr( "PREF_FOCUS_TYPE" ), stereoGroup,
+ LightApp_Preferences::Selector, "OCCViewer", "focus_type" );
+ aValuesList.clear();
+ anIndicesList.clear();
+ aValuesList << tr("PREF_ABSOLUTE") << tr("PREF_RELATIVE");
+ anIndicesList << 0 << 1;
+ pref->setItemProperty( "strings", aValuesList, occFocusType );
+ pref->setItemProperty( "indexes", anIndicesList, occFocusType );
+
+ // .... -> Stereographic focus value
+ int focusValue = pref->addPreference( tr( "PREF_FOCUS_VALUE" ), stereoGroup,
+ LightApp_Preferences::DblSpin, "OCCViewer", "focus_value" );
+ pref->setItemProperty( "precision", 3, focusValue );
+ pref->setItemProperty( "min", 1.0E-03, focusValue );
+ pref->setItemProperty( "max", 1.0E03, focusValue );
+ pref->setItemProperty( "step", 0.05, focusValue );
+
+ // .... -> IOD type
+ int occIODType = pref->addPreference( tr( "PREF_IOD_TYPE" ), stereoGroup,
+ LightApp_Preferences::Selector, "OCCViewer", "iod_type" );
+ aValuesList.clear();
+ anIndicesList.clear();
+ aValuesList << tr("PREF_ABSOLUTE") << tr("PREF_RELATIVE");
+ anIndicesList << 0 << 1;
+ pref->setItemProperty( "strings", aValuesList, occIODType );
+ pref->setItemProperty( "indexes", anIndicesList, occIODType );
+
+ // .... -> Interocular distance (IOD) value
+ int IODValue = pref->addPreference( tr( "PREF_IOD_VALUE" ), stereoGroup,
+ LightApp_Preferences::DblSpin, "OCCViewer", "iod_value" );
+ pref->setItemProperty( "precision", 3, IODValue );
+ pref->setItemProperty( "min", 1.0E-03, IODValue );
+ pref->setItemProperty( "max", 1.0E03, IODValue );
+ pref->setItemProperty( "step", 0.05, IODValue );
+
+ // .... -> Reverse stereo
+ pref->addPreference( tr( "PREF_REVERSE_STEREO" ), stereoGroup,
+ LightApp_Preferences::Bool, "OCCViewer", "reverse_stereo" );
+ // .... -> Enable V-Sync
+ pref->addPreference( tr( "PREF_ENABLE_VSYNC" ), stereoGroup,
+ LightApp_Preferences::Bool, "OCCViewer", "enable_vsync" );
+ // .... -> Enable quad-buffer support
+ pref->addPreference( tr( "PREF_ENABLE_QUAD_BUFFER_SUPPORT" ), stereoGroup,
+ LightApp_Preferences::Bool, "OCCViewer", "enable_quad_buffer_support" );
+ #endif
// ... "Background" group <<start>>
int bgGroup = pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup );
// pref->setItemProperty( "columns", 2, bgGroup );
aValuesList.clear();
anIndicesList.clear();
txtList.clear();
+ idList.clear();
formats = OCCViewer_Viewer::backgroundData( aValuesList, idList, txtList );
foreach( int gid, idList ) anIndicesList << gid;
// .... -> 3D viewer background
pref->setItemProperty( "margin", 0, occGen );
pref->setItemProperty( "columns", 2, occGen );
// ... -> empty frame (for layout) <<end>>
+
// .. "OCC viewer" group <<end>>
#endif
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_OCCVIEWER
+ if ( sec == QString( "OCCViewer" ) && param == QString( "projection_mode" ) )
+ {
+ int mode = resMgr->integerValue( "OCCViewer", "projection_mode", 0 );
+ QList<SUIT_ViewManager*> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setProjectionType( mode );
+ }
+ }
+ #endif
+ #if OCC_VERSION_LARGE > 0x06090000
+ #ifndef DISABLE_OCCVIEWER
+ if ( sec == QString( "OCCViewer" ) && param == QString( "stereo_type" ) )
+ {
+ int mode = resMgr->integerValue( "OCCViewer", "stereo_type", 0 );
+ QList<SUIT_ViewManager*> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setStereoType( mode );
+ }
+ }
+ #endif
+
+ #ifndef DISABLE_OCCVIEWER
+ if ( sec == QString( "OCCViewer" ) && param == QString( "anaglyph_filter" ) )
+ {
+ int mode = resMgr->integerValue( "OCCViewer", "anaglyph_filter", 0 );
+ QList<SUIT_ViewManager*> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setAnaglyphFilter( mode );
+ }
+ }
+ #endif
+
+ #ifndef DISABLE_OCCVIEWER
+ if ( sec == QString( "OCCViewer" ) && ( param == QString( "focus_type" ) ||
+ param == QString( "focus_value" ) ) )
+ {
+ int aType = resMgr->integerValue( "OCCViewer", "focus_type" );
+ double aValue = resMgr->doubleValue( "OCCViewer", "focus_value" );
+ QList<SUIT_ViewManager*> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setStereographicFocus( aType, aValue );
+ }
+ }
+ #endif
+
+ #ifndef DISABLE_OCCVIEWER
+ if ( sec == QString( "OCCViewer" ) && ( param == QString( "iod_type" ) ||
+ param == QString( "iod_value" ) ) )
+ {
+ int aType = resMgr->integerValue( "OCCViewer", "iod_type" );
+ double aValue = resMgr->doubleValue( "OCCViewer", "iod_value" );
+ QList<SUIT_ViewManager*> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setInterocularDistance( aType, aValue );
+ }
+ }
+ #endif
+
+ #ifndef DISABLE_OCCVIEWER
+ if ( sec == QString( "OCCViewer" ) && param == QString( "reverse_stereo" ) )
+ {
+ bool reverse = resMgr->booleanValue( "OCCViewer", "reverse_stereo", false );
+ QList<SUIT_ViewManager*> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setReverseStereo( reverse );
+ }
+ }
+ #endif
+
+ #ifndef DISABLE_OCCVIEWER
+ if ( sec == QString( "OCCViewer" ) && param == QString( "enable_vsync" ) )
+ {
+ bool enable = resMgr->booleanValue( "OCCViewer", "enable_vsync", true );
+ QList<SUIT_ViewManager*> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setVSync( enable );
+ }
+ }
+ #endif
+
+ #ifndef DISABLE_OCCVIEWER
+ if ( sec == QString( "OCCViewer" ) && param == QString( "enable_quad_buffer_support" ) )
+ {
+ bool enable = resMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", false );
+ QList<SUIT_ViewManager*> lst;
+ viewManagers( OCCViewer_Viewer::Type(), lst );
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() )
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setQuadBufferSupport( enable );
+ }
+ }
+ #endif
+ #endif
if ( sec == QString( "3DViewer" ) && param == QString( "zooming_mode" ) )
{
int mode = resMgr->integerValue( "3DViewer", "zooming_mode", 0 );
}
#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( "enable_quad_buffer_support" ) )
+ {
+ int enable = resMgr->booleanValue( "VTKViewer", "enable_quad_buffer_support", false );
+ 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->setQuadBufferSupport( enable );
+ }
+ #endif
+ }
+ #endif
+
#ifndef DISABLE_VTKVIEWER
if ( sec == QString( "VTKViewer" ) && param == QString( "preselection" ) )
{
}
if ( sec == "language" && param == "language" )
{
- SUIT_MessageBox::information( desktop(), tr( "WRN_WARNING" ), tr( "LANG_CHANGED" ) );
+ // VSR 18.06.2015 : commented out : single warning dialog box is now shown by the LightApp_PreferencesDlg
+ //SUIT_MessageBox::information( desktop(), tr( "WRN_WARNING" ), tr( "LANG_CHANGED" ) );
}
if ( sec == "language" && param == "locale")
{
- SUIT_MessageBox::information( desktop(), tr( "WRN_WARNING" ), tr( "LOCALE_CHANGED" ) );
+ // VSR 18.06.2015: commented out : single warning dialog box is now shown by the LightApp_PreferencesDlg
+ //SUIT_MessageBox::information( desktop(), tr( "WRN_WARNING" ), tr( "LOCALE_CHANGED" ) );
}
if ( sec == "desktop" && param == "opaque_resize" ) {
bool opaqueResize = resMgr->booleanValue( "desktop", "opaque_resize", false );
this, SLOT( onDesktopMessage( const QString& ) ), Qt::UniqueConnection );
connect( desk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
+ /* connect( desk, SIGNAL( windowMoved( SUIT_ViewWindow* ) ),
+ this, SLOT( onWindowMoved( SUIT_ViewWindow* ) ), Qt::UniqueConnection ); */
}
}
</section>
<section name="Study">
<!-- General study settings -->
+ <parameter name="autoload_light_modules" value="true" />
<parameter name="store_positions" value="true" />
<parameter name="store_tool_positions" value="true" />
<parameter name="auto_save_interval" value="0" />
</section>
<section name="OCCViewer" >
<!-- OCC viewer preferences -->
+ <parameter name="projection_mode" value="0"/>
+ <parameter name="stereo_type" value="0"/>
+ <parameter name="anaglyph_filter" value="0"/>
+ <parameter name="focus_type" value="1"/>
+ <parameter name="focus_value" value="1.0"/>
+ <parameter name="iod_type" value="1"/>
+ <parameter name="iod_value" value="0.05"/>
+ <parameter name="reverse_stereo" value="false"/>
+ <parameter name="enable_vsync" value="true"/>
+ <parameter name="enable_quad_buffer_support" value="false"/>
<parameter name="enable_preselection" value="true"/>
<parameter name="enable_selection" value="true"/>
<parameter name="clipping_color" value="50, 50, 50"/>
<!-- 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_VTKVIEWER</source>
<translation>VTK 3D Viewer</translation>
</message>
+ <message>
+ <source>PREF_LOAD_LIGHT</source>
+ <translation>Automatic loading of light modules when opening study</translation>
+ </message>
<message>
<source>PREF_STORE_POS</source>
<translation>Store positions of windows</translation>
<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_FOCUS_TYPE</source>
+ <translation>Convergence distance type</translation>
+ </message>
+ <message>
+ <source>PREF_FOCUS_VALUE</source>
+ <translation>Stereographic focus value</translation>
+ </message>
+ <message>
+ <source>PREF_IOD_TYPE</source>
+ <translation>IOD type</translation>
+ </message>
+ <message>
+ <source>PREF_IOD_VALUE</source>
+ <translation>Interocular distance (IOD) value</translation>
+ </message>
+ <message>
+ <source>PREF_ABSOLUTE</source>
+ <translation>Absolute</translation>
+ </message>
+ <message>
+ <source>PREF_RELATIVE</source>
+ <translation>Relative</translation>
+ </message>
+ <message>
+ <source>PREF_REVERSE_STEREO</source>
+ <translation>Reverse stereo</translation>
+ </message>
+ <message>
+ <source>PREF_ENABLE_VSYNC</source>
+ <translation>Enable V-Sync</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>DEFAULT_BTN_TEXT</source>
<translation>Defaults</translation>
</message>
+ <message>
+ <source>PREF_NEED_RESTART</source>
+ <translation>Some changes will take effect only after application restart</translation>
+ </message>
</context>
<context>
<name>LightApp_ModuleAction</name>
<source>PREF_GROUP_VTKVIEWER</source>
<translation>Scène VTK 3D</translation>
</message>
+ <message>
+ <source>PREF_LOAD_LIGHT</source>
+ <translation>Chargement automatique des modules Light à l'ouverture d'étude</translation>
+ </message>
<message>
<source>PREF_STORE_POS</source>
<translation>Enregistrer la position des fenêtres</translation>
<source>PREF_GROUP_OCCVIEWER</source>
<translation>Scène OCC 3D</translation>
</message>
+ <message>
+ <source>PREF_GROUP_STEREO</source>
+ <translation>Rendu stéréo</translation>
+ </message>
+ <message>
+ <source>PREF_STEREO_TYPE</source>
+ <translation>Type de rendu stéréo</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_FILTER</source>
+ <translation>Filtre anaglyphique</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_RED_CYAN</source>
+ <translation>Rouge-Cyan</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_YELLOW_BLUE</source>
+ <translation>Jaune-Bleu</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_GREEN_MAGENTA</source>
+ <translation>Vert-Magenta</translation>
+ </message>
+ <message>
+ <source>PREF_FOCUS_TYPE</source>
+ <translation> type="unfinished"Convergence distance type</translation>
+ </message>
+ <message>
+ <source>PREF_FOCUS_VALUE</source>
+ <translation>Valeur de la focalisation stéréographique</translation>
+ </message>
+ <message>
+ <source>PREF_IOD_TYPE</source>
+ <translation>Type de distance intraoculaire</translation>
+ </message>
+ <message>
+ <source>PREF_IOD_VALUE</source>
+ <translation>Valeur de la distance intraoculaire</translation>
+ </message>
+ <message>
+ <source>PREF_ABSOLUTE</source>
+ <translation>Absolu</translation>
+ </message>
+ <message>
+ <source>PREF_RELATIVE</source>
+ <translation>Relatif</translation>
+ </message>
+ <message>
+ <source>PREF_REVERSE_STEREO</source>
+ <translation>Stéréo inversée</translation>
+ </message>
+ <message>
+ <source>PREF_ENABLE_VSYNC</source>
+ <translation>Activer la synchronisation verticale</translation>
+ </message>
+ <message>
+ <source>PREF_ENABLE_QUAD_BUFFER_SUPPORT</source>
+ <translation>Activer le support du quad-buffer</translation>
+ </message>
<message>
<source>PREF_LOGARITHMIC</source>
<translation>Logarithmique</translation>
</message>
<message>
<source>PREF_CLIPPING_SCALE</source>
- <translation>Facteur d'échelle</translation>
+ <translation>Facteur d'échelle</translation>
</message>
<message>
<source>TOT_CLOSE</source>
<source>PREF_GROUP_SHORTCUTS</source>
<translation>Réglage des raccourcis clavier</translation>
</message>
+ <message>
+ <source>PREF_GROUP_FULL_SCREEN</source>
+ <translation>Plein écran</translation>
+ </message>
+ <message>
+ <source>PREF_FULL_SCREEN_AUTO</source>
+ <translation>Cacher l'arbre d'étude and les barres d'outils des vues</translation>
+ </message>
<message>
<source>PREF_TAB_PYEDITOR</source>
<translation>Editeur python</translation>
</message>
<message>
<source>PREF_GROUP_PY_DISPLAY</source>
- <translation>Paramètres d'affichage</translation>
+ <translation>Paramètres d'affichage</translation>
</message>
<message>
<source>PREF_PY_CURRLINE_HIGHLIGHT</source>
</message>
<message>
<source>PREF_PY_TAB_WHITESPACES</source>
- <translation>Affiche les guides d'indentation</translation>
+ <translation>Affiche les guides d'indentation</translation>
</message>
<message>
<source>PREF_PY_TAB_SIZE</source>
- <translation>Largeur d'intentation:</translation>
+ <translation>Largeur d'intentation:</translation>
</message>
<message>
<source>PREF_GROUP_VERT_EDGE</source>
<source>DEFAULT_BTN_TEXT</source>
<translation>Défauts</translation>
</message>
+ <message>
+ <source>PREF_NEED_RESTART</source>
+ <translation>Des changements prendront effets seulement après un redémarrage de l'application</translation>
+ </message>
</context>
<context>
<name>LightApp_ModuleAction</name>
<source>PREF_GROUP_VTKVIEWER</source>
<translation>VTK 3D Viewer</translation>
</message>
+ <message>
+ <source>PREF_LOAD_LIGHT</source>
+ <translation>Automatic loading of light modules when opening study</translation>
+ </message>
<message>
<source>PREF_STORE_POS</source>
<translation>ウィンドウの位置を保存</translation>
<source>PREF_GROUP_OCCVIEWER</source>
<translation>OCC 3D Viewer</translation>
</message>
+ <message>
+ <source>PREF_GROUP_STEREO</source>
+ <translation>ステレオレンダリング</translation>
+ </message>
+ <message>
+ <source>PREF_STEREO_TYPE</source>
+ <translation>ステレオタイプ</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_FILTER</source>
+ <translation>Anaglyph filter</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_RED_CYAN</source>
+ <translation>赤-シアン投影</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_YELLOW_BLUE</source>
+ <translation>黄-青投影</translation>
+ </message>
+ <message>
+ <source>PREF_ANAGLYPH_GREEN_MAGENTA</source>
+ <translation>緑-マゼンタ投影</translation>
+ </message>
+ <message>
+ <source>PREF_FOCUS_TYPE</source>
+ <translation>一致距離型</translation>
+ </message>
+ <message>
+ <source>PREF_FOCUS_VALUE</source>
+ <translation>立体画法焦点値</translation>
+ </message>
+ <message>
+ <source>PREF_IOD_TYPE</source>
+ <translation>眼間距離(IOD)型</translation>
+ </message>
+ <message>
+ <source>PREF_IOD_VALUE</source>
+ <translation>眼間距離(IOD)値</translation>
+ </message>
+ <message>
+ <source>PREF_ABSOLUTE</source>
+ <translation>絶対</translation>
+ </message>
+ <message>
+ <source>PREF_RELATIVE</source>
+ <translation>早退</translation>
+ </message>
+ <message>
+ <source>PREF_REVERSE_STEREO</source>
+ <translation>Reverse stereo</translation>
+ </message>
+ <message>
+ <source>PREF_ENABLE_VSYNC</source>
+ <translation>V-Syncを有効</translation>
+ </message>
+ <message>
+ <source>PREF_ENABLE_QUAD_BUFFER_SUPPORT</source>
+ <translation>quad-buffer サポートを有効</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>全画面表示</translation>
+ </message>
+ <message>
+ <source>PREF_FULL_SCREEN_AUTO</source>
+ <translation>オブジェクトブラウザと表示ツールバーを隠す</translation>
+ </message>
<message>
<source>PREF_TAB_PYEDITOR</source>
<translation>Python Viewer</translation>
<source>DEFAULT_BTN_TEXT</source>
<translation>デフォルト</translation>
</message>
+ <message>
+ <source>PREF_NEED_RESTART</source>
+ <translation>幾つかの変更はアプリケーションを再起動後に有効になります</translation>
+ </message>
</context>
<context>
<name>LightApp_ModuleAction</name>
#include "OCCViewer_CubeAxesDlg.h"
#include "OCCViewer_ClippingDlg.h"
- #include <Basics_OCCTVersion.hxx>
-
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
#include <QtxMultiAction.h>
#include <QtxRubberBand.h>
- #include <OpenGLUtils_FrameBuffer.h>
+ #include <Basics_OCCTVersion.hxx>
#include <QPainter>
#include <QTime>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QApplication>
+ #include <QActionGroup>
#include <QMenu>
#include <AIS_ListOfInteractive.hxx>
#include <GProp_GProps.hxx>
#include <TopoDS.hxx>
+ #include <Graphic3d_SequenceOfHClipPlane.hxx>
+ #include <Graphic3d_ClipPlane.hxx>
+ #include <OpenGl_GraphicDriver.hxx>
+ #include <OpenGLUtils_FrameBuffer.h>
+
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
#include <Graphic3d_MapOfStructure.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_ExportFormat.hxx>
+ #if OCC_VERSION_LARGE > 0x06090000
+ #include <Graphic3d_StereoMode.hxx>
+ #include <Graphic3d_RenderingParams.hxx>
+ #endif
+
#include <Visual3d_View.hxx>
#include <V3d_Plane.hxx>
#include <gp_GTrsf.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
- #include <Graphic3d_SequenceOfHClipPlane.hxx>
- #include <Graphic3d_ClipPlane.hxx>
-
#include <Image_PixMap.hxx>
#include <Standard_Version.hxx>
#include <GL/gl.h>
+ // To avoid conflict between KeyPress from the X.h (define KeyPress 2)
+ // and QEvent::KeyPress (qevent.h)
+ #ifdef KeyPress
+ #undef KeyPress
+ #endif
+
const char* imageZoomCursor[] = {
"32 32 3 1",
". c None",
myModel = theModel;
myRestoreFlag = 0;
myEnableDrawMode = false;
+ myDrawRectEnabled = true;
myDrawRect=false;
updateEnabledDrawMode();
myScalingDlg = 0;
mySetRotationPointDlg = 0;
myRectBand = 0;
-
+
IsSketcherStyle = false;
myIsKeyFree = false;
myCursorIsHand = false;
clearViewAspects();
-
}
/*!
QtxAction* anAction = dynamic_cast<QtxAction*>( toolMgr()->action( GraduatedAxesId ) );
myCubeAxesDlg = new OCCViewer_CubeAxesDlg( anAction, this, "OCCViewer_CubeAxesDlg" );
myCubeAxesDlg->initialize();
-
+
connect( myViewPort, SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), this, SLOT( emitViewModified() ) );
}
case QEvent::Wheel:
{
QWheelEvent* aEvent = (QWheelEvent*) e;
-
+
if ( aEvent->modifiers().testFlag(Qt::ControlModifier) ) {
Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
if ( isPreselectionEnabled() && ic->HasOpenedContext() ) {
ic->HilightPreviousDetected( myViewPort->getView() );
}
}
- } else {
+ }
+ else {
+ emit vpTransformationStarted ( ZOOMVIEW );
myViewPort->startZoomAtPoint( aEvent->x(), aEvent->y() );
double delta = (double)( aEvent->delta() ) / ( 15 * 8 );
int x = aEvent->x();
int y1 = (int)( aEvent->y() + height()*delta/100 );
myViewPort->zoom( x, y, x1, y1 );
myViewPort->getView()->ZFitAll();
+ emit vpTransformationFinished ( ZOOMVIEW );
}
}
return true;
return SUIT_ViewWindow::eventFilter(watched, e);
}
+ /*!
+ \brief Enable / disable draw rect (rubber band) mode
+ */
+ bool OCCViewer_ViewWindow::enableDrawMode( bool on )
+ {
+ bool prev = myDrawRectEnabled;
+ myDrawRectEnabled = on;
+ updateEnabledDrawMode();
+ return prev;
+ }
+
/*!
\brief Update state of enable draw mode state.
*/
void OCCViewer_ViewWindow::updateEnabledDrawMode()
{
+ myEnableDrawMode = myDrawRectEnabled;
if ( myModel )
- myEnableDrawMode = myModel->isSelectionEnabled() && myModel->isMultiSelectionEnabled();
+ myEnableDrawMode = myEnableDrawMode && myModel->isSelectionEnabled() && myModel->isMultiSelectionEnabled();
}
/*!
int anInteractionStyle = interactionStyle();
// in "key free" interaction style zoom operation is activated by two buttons (simultaneously pressed),
- // which are assigned for pan and rotate - these operations are activated immediately after pressing
+ // which are assigned for pan and rotate - these operations are activated immediately after pressing
// of the first button, so it is necessary to switch to zoom when the second button is pressed
bool aSwitchToZoom = false;
- if ( anInteractionStyle == SUIT_ViewModel::KEY_FREE &&
+ if ( anInteractionStyle == SUIT_ViewModel::KEY_FREE &&
( myOperation == PANVIEW || myOperation == ROTATE ) ) {
aSwitchToZoom = getButtonState( theEvent, anInteractionStyle ) == ZOOMVIEW;
}
}
/* notify that we start a transformation */
if ( transformRequested() )
- emit vpTransformationStarted ( myOperation );
+ emit vpTransformationStarted ( myOperation );
}
if ( transformRequested() )
setTransformInProcess( true );
for( ; aStructureIt.More(); aStructureIt.Next() ) {
const Handle(Graphic3d_Structure)& aStructure = aStructureIt.Key();
- if ( aStructure->IsEmpty() ) {
+ if ( aStructure->IsEmpty() || !aStructure->IsVisible() || aStructure->CStructure()->IsForHighlight )
continue;
- }
#if OCC_VERSION_LARGE > 0x06070100
Bnd_Box aBox = aStructure->MinMaxValues();
{
bool ok = transformEnabled( op );
myOperation = ok ? op : NOTHING;
- myViewPort->setMouseTracking( myOperation == NOTHING );
+ myViewPort->setMouseTracking( myOperation == NOTHING );
return ok;
}
//myRectBand->setPalette(palette);
}
//myRectBand->hide();
-
+
myRectBand->setUpdatesEnabled ( false );
QRect aRect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY);
myRectBand->initGeometry( aRect );
{
if( !toolMgr()->isEmpty() )
return;
-
+
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ if( !aResMgr )
+ return;
QtxAction* aAction;
aAction->setStatusTip(tr("DSC_FITRECT"));
connect(aAction, SIGNAL(triggered()), this, SLOT(activateWindowFit()));
toolMgr()->registerAction( aAction, FitRectId );
-
+
// FitSelection
aAction = new QtxAction(tr("MNU_FITSELECTION"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FITSELECTION" ) ),
tr( "MNU_FITSELECTION" ), 0, this);
connect(aAction, SIGNAL(triggered()), this, SLOT(onBottomView()));
this->addAction(aAction);
toolMgr()->registerAction( aAction, BottomId );
-
+
aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_LEFT" ) ),
tr( "MNU_LEFT_VIEW" ), 0, this, false, "Viewers:Left view");
aAction->setStatusTip(tr("DSC_LEFT_VIEW"));
this->addAction(aAction);
toolMgr()->registerAction( aAction, ClockWiseId );
+ // Projection mode group
+
+ // - orthographic projection
+ aAction = new QtxAction(tr("MNU_ORTHOGRAPHIC_MODE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_ORTHOGRAPHIC" ) ),
+ tr( "MNU_ORTHOGRAPHIC_MODE" ), 0, this);
+ aAction->setStatusTip(tr("DSC_ORTHOGRAPHIC_MODE"));
+ aAction->setCheckable(true);
+ toolMgr()->registerAction( aAction, OrthographicId );
+
+ // - perspective projection
+ aAction = new QtxAction(tr("MNU_PERSPECTIVE_MODE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_PERSPECTIVE" ) ),
+ tr( "MNU_PERSPECTIVE_MODE" ), 0, this);
+ aAction->setStatusTip(tr("DSC_PERSPECTIVE_MODE"));
+ aAction->setCheckable(true);
+ toolMgr()->registerAction( aAction, PerspectiveId );
+ #if OCC_VERSION_LARGE > 0x06090000
+ // - stereo projection
+ aAction = new QtxAction(tr("MNU_STEREO_MODE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_STEREO" ) ),
+ tr( "MNU_STEREO_MODE" ), 0, this);
+ aAction->setStatusTip(tr("DSC_STEREO_MODE"));
+ aAction->setCheckable(true);
+ toolMgr()->registerAction( aAction, StereoId );
+ connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onStereoType(bool)));
+ #endif
+ // - add exclusive action group
+ QActionGroup* aProjectionGroup = new QActionGroup( this );
+ aProjectionGroup->addAction( toolMgr()->action( OrthographicId ) );
+ aProjectionGroup->addAction( toolMgr()->action( PerspectiveId ) );
+ connect(aProjectionGroup, SIGNAL(triggered(QAction*)), this, SLOT(onProjectionType(QAction*)));
+
// Reset
aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RESET" ) ),
tr( "MNU_RESET_VIEW" ), 0, this, false, "Viewers:Reset view");
connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchSelection(bool)));
toolMgr()->registerAction( aAction, SwitchSelectionId );
- // Graduated axes
+ // Graduated axes
aAction = new QtxAction(tr("MNU_GRADUATED_AXES"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_GRADUATED_AXES" ) ),
tr( "MNU_GRADUATED_AXES" ), 0, this);
aAction->setStatusTip(tr("DSC_GRADUATED_AXES"));
toolMgr()->registerAction( aAction, ReturnTo3dViewId );
}
- // Synchronize View
+ // Synchronize View
toolMgr()->registerAction( synchronizeAction(), SynchronizeId );
}
toolMgr()->append( AntiClockWiseId, tid );
toolMgr()->append( ClockWiseId, tid );
+ toolMgr()->append( OrthographicId, tid );
+ toolMgr()->append( PerspectiveId, tid );
+ #if OCC_VERSION_LARGE > 0x06090000
+ toolMgr()->append( StereoId, tid );
+ #endif
+
toolMgr()->append( ResetId, tid );
}
toolMgr()->append( toolMgr()->separator(), tid );
toolMgr()->append( CloneId, tid );
-
+
toolMgr()->append( toolMgr()->separator(), tid );
toolMgr()->append( ClippingId, tid );
toolMgr()->append( AxialScaleId, tid );
myViewPort->getView()->Reset( false );
myViewPort->fitAll( false, true, false );
myViewPort->getView()->SetImmediateUpdate( upd );
+ onProjectionType(); // needed to apply projection type properly after reset
myViewPort->getView()->Update();
emit vpTransformationFinished( RESETVIEW );
}
+ /*!
+ \brief Set the given projection mode.
+
+ Set the given projection mode: Orthographic or Perspective.
+ */
+ void OCCViewer_ViewWindow::onProjectionType( QAction* theAction )
+ {
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ if (theAction == toolMgr()->action( OrthographicId )) {
+ myModel->setProjectionType(Orthographic);
+ aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Orthographic );
+ aCamera->SetFOVy(45.0);
+ }
+ else if (theAction == toolMgr()->action( PerspectiveId )) {
+ myModel->setProjectionType(Perspective);
+ aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Perspective );
+ aCamera->SetFOVy(30.0);
+ }
+ #if OCC_VERSION_LARGE > 0x06090000
+ if (toolMgr()->action( StereoId )->isChecked()) {
+ aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo );
+ aCamera->SetFOVy(30.0);
+ }
+ #endif
+ aView3d->Redraw();
+ onViewFitAll();
+ }
+ }
+
+ /*!
+ \brief Sets Stereo projection mode.
+
+ Sets Stereo projection mode.
+ */
+ void OCCViewer_ViewWindow::onStereoType( bool activate )
+ {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ if (activate) {
+ toolMgr()->action( PerspectiveId )->setChecked(true);
+ aCamera->SetProjectionType(Graphic3d_Camera::Projection_Perspective);
+ toolMgr()->action( PerspectiveId )->actionGroup()->setEnabled(false);
+
+ aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo );
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ setStereoType( aResMgr->integerValue( "OCCViewer", "stereo_type", 0 ) );
+ setAnaglyphFilter( aResMgr->integerValue( "OCCViewer", "anaglyph_filter", 0 ) );
+ setReverseStereo( aResMgr->booleanValue( "OCCViewer", "reverse_stereo", false ) );
+ setVSync( aResMgr->booleanValue( "OCCViewer", "enable_vsync", true ) );
+ setQuadBufferSupport( aResMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", false ) );
+ }
+ else {
+ toolMgr()->action( PerspectiveId )->actionGroup()->setEnabled(true);
+ if (myModel->projectionType() == Orthographic) {
+ toolMgr()->action( OrthographicId )->setChecked(true);
+ aCamera->SetProjectionType(Graphic3d_Camera::Projection_Orthographic);
+ }
+ else if (myModel->projectionType() == Perspective) {
+ toolMgr()->action( PerspectiveId )->setChecked(true);
+ aCamera->SetProjectionType(Graphic3d_Camera::Projection_Perspective);
+ }
+ }
+ aView3d->Redraw();
+ onViewFitAll();
+ }
+
+ if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer &&
+ toolMgr()->action( StereoId )->isChecked() )
+ SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ), tr( "WRN_SUPPORT_QUAD_BUFFER" ) );
+ #endif
+ }
+
+ /*!
+ \brief Restore the view.
+
+ Restore the projection mode based on tool-buttons states.
+ */
+ void OCCViewer_ViewWindow::onProjectionType()
+ {
+ emit vpTransformationStarted( PROJECTION );
+ if (toolMgr()->action( OrthographicId )->isChecked())
+ setProjectionType( Orthographic );
+ if (toolMgr()->action( PerspectiveId )->isChecked())
+ setProjectionType( Perspective );
+ #if OCC_VERSION_LARGE > 0x06090000
+ if (toolMgr()->action( StereoId )->isChecked())
+ setProjectionType( Stereo );
+ #endif
+ emit vpTransformationFinished( PROJECTION );
+ }
+
+ void OCCViewer_ViewWindow::setProjectionType( int mode )
+ {
+ QtxAction* anOrthographicAction = dynamic_cast<QtxAction*>( toolMgr()->action( OrthographicId ) );
+ QtxAction* aPerspectiveAction = dynamic_cast<QtxAction*>( toolMgr()->action( PerspectiveId ) );
+ #if OCC_VERSION_LARGE > 0x06090000
+ QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoId ) );
+ #endif
+ switch ( mode ) {
+ case Orthographic:
+ onProjectionType( anOrthographicAction );
+ break;
+ case Perspective:
+ onProjectionType( aPerspectiveAction );
+ break;
+ case Stereo:
+ onStereoType( true );
+ break;
+ }
+ // update action state if method is called outside
+ if ( mode == Orthographic && !anOrthographicAction->isChecked() ) {
+ anOrthographicAction->setChecked( true );
+ #if OCC_VERSION_LARGE > 0x06090000
+ aStereoAction->setChecked( false );
+ #endif
+ }
+ if ( mode == Perspective && !aPerspectiveAction->isChecked() ) {
+ aPerspectiveAction->setChecked( true );
+ #if OCC_VERSION_LARGE > 0x06090000
+ aStereoAction->setChecked( false );
+ #endif
+ }
+ #if OCC_VERSION_LARGE > 0x06090000
+ if ( mode == Stereo ) {
+ aStereoAction->setChecked( true );
+ if ( anOrthographicAction->isEnabled() ) {
+ anOrthographicAction->setEnabled( false );
+ anOrthographicAction->setChecked( false );
+ aStereoAction->setChecked( false );
+ }
+ else {
+ anOrthographicAction->setEnabled( true );
+ aStereoAction->setChecked( false );
+ anOrthographicAction->setChecked(myModel->projectionType() == Orthographic);
+ }
+ if ( aPerspectiveAction->isEnabled() ) {
+ aPerspectiveAction->setEnabled( false );
+ aPerspectiveAction->setChecked( true );
+ if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer &&
+ toolMgr()->action( StereoId )->isChecked() )
+ SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ), tr( "WRN_SUPPORT_QUAD_BUFFER" ) );
+ }
+ else {
+ aPerspectiveAction->setEnabled( true );
+ aStereoAction->setChecked( false );
+ aPerspectiveAction->setChecked(myModel->projectionType() == Perspective);
+ onProjectionType();
+ }
+ }
+ else {
+ if ( !anOrthographicAction->isEnabled() )
+ anOrthographicAction->setEnabled( true );
+ if ( !aPerspectiveAction->isEnabled() )
+ aPerspectiveAction->setEnabled( true );
+ }
+ #endif
+ }
+
/*!
\brief Perform "fit all" transformation.
*/
{
if ( !myScalingDlg )
myScalingDlg = new OCCViewer_AxialScaleDlg( this );
-
+
if ( !myScalingDlg->isVisible() )
{
myScalingDlg->Update();
myModel->setTrihedronShown( anItem.isVisible );
myModel->setTrihedronSize( anItem.size );
-
+
// graduated trihedron
bool anIsVisible = anItem.gtIsVisible;
OCCViewer_AxisWidget::AxisData anAxisData[3];
{
mySelectionEnabled = on;
myModel->setSelectionOptions( myModel->isPreselectionEnabled(), isSelectionEnabled() );
-
+
// update action state if method is called outside
// preselection
// update action state if method is called outside
QtxAction* a = dynamic_cast<QtxAction*>( toolMgr()->action( SwitchInteractionStyleId ) );
- if ( a->isChecked() != on )
+ if ( a && a->isChecked() != on )
a->setChecked( on );
}
// update action state if method is called outside
QtxAction* a = dynamic_cast<QtxAction*>( toolMgr()->action( SwitchZoomingStyleId ) );
- if ( a->isChecked() != on )
+ if ( a && a->isChecked() != on )
a->setChecked( on );
}
Handle(V3d_View) view = myViewPort->getView();
if ( view.IsNull() )
return QImage();
-
+
int aWidth = myViewPort->width();
int aHeight = myViewPort->height();
// rnv: An old approach to dump the OCCViewer content
// Now used OCCT built-in procedure.
- /*
+ /*
QApplication::syncX();
view->Redraw(); // In order to reactivate GL context
//view->Update();
+ #ifndef DISABLE_GLVIEWER
OpenGLUtils_FrameBuffer aFrameBuffer;
if( aFrameBuffer.init( aWidth, aHeight ) )
{
QImage anImage( aWidth, aHeight, QImage::Format_RGB32 );
-
+
glPushAttrib( GL_VIEWPORT_BIT );
glViewport( 0, 0, aWidth, aHeight );
aFrameBuffer.bind();
glReadPixels( p.x(), p.y(), aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE,
data);
+ #endif
*/
-
+
Image_PixMap aPix;
view->ToPixMap(aPix,aWidth, aHeight,Graphic3d_BT_RGBA);
return anImage;
}
- bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img,
- const QString& fileName,
+ bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img,
+ const QString& fileName,
const QString& format )
{
if ( format != "PS" && format != "EPS")
gp_Pln pln (gp_Pnt(x, y, z), gp_Dir(dx, dy, dz));
double a, b, c, d;
pln.Coefficients(a, b, c, d);
-
+
Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes();
if(aPlanes.Size() > 0 ) {
Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes);
params.isVisible = data.count() > idx ? data[idx++].toInt() : 1;
params.size = data.count() > idx ? data[idx++].toDouble() : 100.0;
}
- performRestoring( params );
+ performRestoring( params );
setBackground( bgData );
myModel->setClipPlanes(aClipPlanes);
}
QAction* anAction2 = toolMgr()->action( ReturnTo3dViewId );
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
if ( toMaximize ) {
- anAction->setText( tr( "MNU_MINIMIZE_VIEW" ) );
- anAction->setToolTip( tr( "MNU_MINIMIZE_VIEW" ) );
+ anAction->setText( tr( "MNU_MINIMIZE_VIEW" ) );
+ anAction->setToolTip( tr( "MNU_MINIMIZE_VIEW" ) );
anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ) );
anAction->setStatusTip( tr( "DSC_MINIMIZE_VIEW" ) );
if ( anAction2 && my2dMode != No2dMode ) toolMgr()->show( ReturnTo3dViewId );
}
}
else {
- anAction->setText( tr( "MNU_MAXIMIZE_VIEW" ) );
- anAction->setToolTip( tr( "MNU_MAXIMIZE_VIEW" ) );
+ anAction->setText( tr( "MNU_MAXIMIZE_VIEW" ) );
+ anAction->setToolTip( tr( "MNU_MAXIMIZE_VIEW" ) );
anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MAXIMIZE" ) ) );
anAction->setStatusTip( tr( "DSC_MAXIMIZE_VIEW" ) );
if ( anAction2 && my2dMode != No2dMode ) toolMgr()->hide( ReturnTo3dViewId );
}
void OCCViewer_ViewWindow::setSketcherStyle( bool enable )
- {
- IsSketcherStyle = enable;
+ {
+ IsSketcherStyle = enable;
}
- bool OCCViewer_ViewWindow::isSketcherStyle() const
- {
- return IsSketcherStyle;
+ bool OCCViewer_ViewWindow::isSketcherStyle() const
+ {
+ return IsSketcherStyle;
}
my2dMode = theType;
}
- // obsolete
+ int OCCViewer_ViewWindow::projectionType() const
+ {
+ int mode = Orthographic;
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Perspective)
+ mode = Perspective;
+ if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Orthographic)
+ mode = Orthographic;
+ #if OCC_VERSION_LARGE > 0x06090000
+ if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo)
+ mode = Stereo;
+ #endif
+ }
+ return mode;
+ }
+
+ void OCCViewer_ViewWindow::setStereoType( int type )
+ {
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
+ aParams->StereoMode = (Graphic3d_StereoMode)type;
+ #endif
+ }
+ }
+
+ int OCCViewer_ViewWindow::stereoType() const
+ {
+ int type = QuadBuffer;
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
+ type = (OCCViewer_ViewWindow::StereoType)aParams->StereoMode;
+ #endif
+ }
+ return type;
+ }
+
+ void OCCViewer_ViewWindow::setAnaglyphFilter( int type )
+ {
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
+ if (type == RedCyan)
+ aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized;
+ if (type == YellowBlue)
+ aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_YellowBlue_Optimized;
+ if (type == GreenMagenta)
+ aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple;
+ #endif
+ }
+ }
+
+ int OCCViewer_ViewWindow::anaglyphFilter() const
+ {
+ int type = RedCyan;
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
+ if (aParams->AnaglyphFilter == Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized)
+ type = RedCyan;
+ if (aParams->AnaglyphFilter == Graphic3d_RenderingParams::Anaglyph_YellowBlue_Optimized)
+ type = YellowBlue;
+ if (aParams->AnaglyphFilter == Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple)
+ type = GreenMagenta;
+ #endif
+ }
+ return type;
+ }
+
+ void OCCViewer_ViewWindow::setStereographicFocus( int type, double value )
+ {
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ aCamera->SetZFocus( (Graphic3d_Camera::FocusType) type, value );
+ #endif
+ }
+ }
+
+ int OCCViewer_ViewWindow::stereographicFocusType() const
+ {
+ int type = Relative;
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ type = (OCCViewer_ViewWindow::FocusIODType)aCamera->ZFocusType();
+ #endif
+ }
+ return type;
+ }
+
+ double OCCViewer_ViewWindow::stereographicFocusValue() const
+ {
+ double value = 1.0;
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ value = aCamera->ZFocus();
+ #endif
+ }
+ return value;
+ }
+
+ void OCCViewer_ViewWindow::setInterocularDistance( int type, double value )
+ {
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ aCamera->SetIOD( (Graphic3d_Camera::IODType) type, value );
+ #endif
+ }
+ }
+
+ int OCCViewer_ViewWindow::interocularDistanceType() const
+ {
+ int type = Relative;
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ type = (OCCViewer_ViewWindow::FocusIODType)aCamera->GetIODType();
+ #endif
+ }
+ return type;
+ }
+
+ double OCCViewer_ViewWindow::interocularDistanceValue() const
+ {
+ double value = 0.05;
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+ value = aCamera->IOD();
+ #endif
+ }
+ return value;
+ }
+
+ void OCCViewer_ViewWindow::setReverseStereo( bool reverse )
+ {
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
+ aParams->ToReverseStereo = reverse;
+ #endif
+ }
+ }
+
+ bool OCCViewer_ViewWindow::isReverseStereo() const
+ {
+ int reverse = false;
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if ( !aView3d.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
+ reverse = aParams->ToReverseStereo;
+ #endif
+ }
+ return reverse;
+ }
+
+ void OCCViewer_ViewWindow::setVSync( bool enable )
+ {
+ Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext();
+ if ( !anIntCont.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver());
+ OpenGl_Caps* aCaps = &aDriver->ChangeOptions();
+ aCaps->swapInterval = enable;
+ #endif
+ }
+ }
+
+ bool OCCViewer_ViewWindow::isVSync() const
+ {
+ int enable = true;
+ Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext();
+ if ( !anIntCont.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver());
+ OpenGl_Caps* aCaps = &aDriver->ChangeOptions();
+ enable = aCaps->swapInterval;
+ #endif
+ }
+ return enable;
+ }
+
+ void OCCViewer_ViewWindow::setQuadBufferSupport( bool enable )
+ {
+ Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext();
+ if ( !anIntCont.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver());
+ OpenGl_Caps* aCaps = &aDriver->ChangeOptions();
+ aCaps->contextStereo = enable;
+ #endif
+ }
+ }
+
+ bool OCCViewer_ViewWindow::isQuadBufferSupport() const
+ {
+ int enable = true;
+ Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext();
+ if ( !anIntCont.IsNull() ) {
+ #if OCC_VERSION_LARGE > 0x06090000
+ Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver());
+ OpenGl_Caps* aCaps = &aDriver->ChangeOptions();
+ enable = aCaps->contextStereo;
+ #endif
+ }
+ return enable;
+ }
+
+
+ bool OCCViewer_ViewWindow::isOpenGlStereoSupport() const
+ {
+ GLboolean support[1];
+ glGetBooleanv (GL_STEREO, support);
+ if ( support[0] )
+ return true;
+ return false;
+ }
+
+ // obsolete
QColor OCCViewer_ViewWindow::backgroundColor() const
{
return myViewPort ? myViewPort->backgroundColor() : Qt::black;
}
-
+
// obsolete
void OCCViewer_ViewWindow::setBackgroundColor( const QColor& theColor )
{
{
return myViewPort ? myViewPort->background() : Qtx::BackgroundData();
}
-
+
void OCCViewer_ViewWindow::setBackground( const Qtx::BackgroundData& theBackground )
{
if ( myViewPort ) myViewPort->setBackground( theBackground );
{
if(!myModel) return;
OCCViewer_ClippingDlg* aClippingDlg = myModel->getClippingDlg();
-
+
if (theIsOn) {
if (!aClippingDlg) {
aClippingDlg = new OCCViewer_ClippingDlg (this, myModel);