From: Paul RASCLE Date: Mon, 1 Feb 2016 10:37:45 +0000 (+0100) Subject: Merge branch 'V7_7_BR' into hydro/imps_2015 X-Git-Tag: V8_2_0a1~6^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8dc06f253c1d6a0bb3cc999842fa5a7848c79f40;hp=-c;p=modules%2Fgui.git Merge branch 'V7_7_BR' into hydro/imps_2015 --- 8dc06f253c1d6a0bb3cc999842fa5a7848c79f40 diff --combined doc/salome/gui/input/setting_preferences.doc index ab26c2df5,b1c6bea10..c953e355c --- a/doc/salome/gui/input/setting_preferences.doc +++ b/doc/salome/gui/input/setting_preferences.doc @@@ -39,7 -39,7 +39,7 @@@ the whole GUI SALOME session otherwise a system locale will be used. The locale change will come in force only after the application is restarted. - Look and feel - - Show splash screen at start-up - allows to show or not splash screen at start-up. + - Show splash screen at start-up - allows showing or hiding the splash screen at start-up. - Opaque resize - force opaque resize mode for viewers area (tabbed workspace). Clear this checkbox for less perfomant workstations. - Drop-down buttons in toolbars for action groups - when @@@ -59,9 -59,6 +59,9 @@@ the SALOME platform. - ASCII save - if checked in, your study will be saved in ASCII format file (or files). + - Automatic loading of light modules when opening study - if checked in, + Light Modules of the current study will be automatically loaded at the next study + opening, allowing completion of object browser. - Store positions of windows - 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. @@@ -94,16 -91,19 +94,19 @@@ - \b Parameters - additional parameters required for launching of the external browser (if applicable). - Python console - - \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. - Show banner - this option allows to show/hide the Python banner - in the top of the console window. + on top of the console window. - Show MRU items - allows to define the maximum \b Number of items in Most Recently Used list and the Link type: - \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. + - Full-screen - options concerned full-screen mode: + - Hide object browser and viewers toolbars - switches automatic hiding of + Object Browser and OCC viewer toolbar in full-screen mode.

3D Viewer Preferences

@@@ -139,6 -139,36 +142,36 @@@ \image html pref_salome_occviewer.png + - Projection mode - sets the default projection mode for the viewers: Orthogonal or Perpective. + - Stereo render - group of stereoscopic view settings: + - Stereo type - 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. + - Anaglyph filter - specifies format of anaglyph stereo pair: + - Red-Cyan (default) + - Yellow-Blue + - Green-Magenta + - Convergence distance type: Absolute or Relative (default). + - Stereographic focus value - 1 by default. + - IOD type - Absolute or Relative (default). + - Interocular distance (IOD) value - 0.05 by default. + - Reverse stereo - option to swap left and right frames. + - Enable V-Sync - activates vertical synchronization. + - Enable quad-buffer support - 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. + - Background - specifies the default background for the viewers, separately for (for more details, refer to the \ref viewer_background "this page"): @@@ -153,9 -183,8 +186,8 @@@ - Color - allows to change the color of the clipped region. - Use default texture - if this option is switched on, the default texture will be used for clipping texture, otherwise - the texture specified in "Texture" field. - - Texture - allows to change the texture of the clipped region - (enable if "Use default texture" is switched off). - - Modulate - controls if "Texture" should be mixed with "Color" parameter or no. + - Texture - allows to change the texture of the clipped region (enable if "Use default texture" is switched off). + - Modulate - controls if "Texture" should be mixed with "Color" parameter or not. - Scale factor - sets the scale factor for default and custom textures. \anchor vtk_preferences @@@ -172,14 -201,38 +204,38 @@@ or [-] keyboard buttons. - Modification Mode - allows choosing between \b Arithmetic and \b Geometrical progression used for zooming. + - Stereo render - group of stereoscopic view settings: + - Stereo type - 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. + - Anaglyph filter - specifies format of anaglyph stereo pair: + - Red-Cyan (default) + - Yellow-Blue + - Green-Magenta + - Enable quad-buffer support - 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. - Selection - - Preselection - allows to choose preselection mode from three regimes: - - Standard - 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). - - Dynamic - works directly with cells of actors that allows to have the - exact area of preselection. But this mode is much more slower. - - Disabled - allows to switch off the preselection. + - Preselection - allows to choose among three possible preselection modes: + - Standard - 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). + - Dynamic - works directly with cells of actors, which provides the + exact area of preselection. This mode is much more slower. + - Disabled - switches off the preselection. - Enable selection - switches selection on/off. - Spacemouse - a mouse-like manipulator device specially designed for working with 3D presentations, objects, etc. You can reassign the @@@ -257,22 -310,22 +313,22 @@@ selected object in the viewer \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". - Font settings allows setting font variant, size and style. - Display settings specifies the script representation in the viewer: - - Enable current line highlight switches on a background coloring of current line. - - Enable text wrapping allows lines wrapping at the view border of the editor. + - Enable current line highlight switches on background coloring of the current line. + - Enable text wrapping wraps lines at the view border of the editor. - Center cursor on scroll scrolls the script vertically to make the cursor visible at the center of the viewer. - - Display line numbers area will make a panel displaying the line numbers of the script visible in the left border of the editor. + - Display line numbers area shows a panel with line numbers of the script at the left border of the editor. - - Tab settings allows to display tab indentation as a set of desirable number of white spaces. + - Tab settings allows displaying tab indentation as a certain number of white-spaces. - - Vertical edge settings manages drawing of vertical line at the specified column of the viewer. + - Vertical edge settings manages drawing of a vertical line at the specified column of the viewer.

Directories Preferences

diff --combined src/LightApp/LightApp_Application.cxx index a65329cfe,f50576ea8..fe0ef5cfa --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@@ -116,6 -116,7 +116,7 @@@ #ifndef DISABLE_OCCVIEWER #include #include + #include #ifndef DISABLE_SALOMEOBJECT #include #else @@@ -317,6 -318,8 +318,8 @@@ LightApp_Application::LightApp_Applicat 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 ); @@@ -512,8 -515,9 +515,9 @@@ bool LightApp_Application::activateModu 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; @@@ -754,10 -758,7 +758,7 @@@ void LightApp_Application::createAction 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 ); @@@ -1533,6 -1534,19 +1534,19 @@@ SUIT_ViewManager* LightApp_Application: 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() ) ); @@@ -1560,6 -1574,9 +1574,9 @@@ 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() ) ); @@@ -1835,6 -1852,22 +1852,22 @@@ void LightApp_Application::onRenamed( 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( getViewManager( OCCViewer_Viewer::Type(), false ) ); + if (viewMgr) { + OCCViewer_ViewWindow* view = 0; + view = dynamic_cast( viewMgr->getActiveView() ); + if (view) { + view->getViewPort()->repaintViewAfterMove(); + } + } + } + */ /*!Private SLOT. Support drag-and-drop operation.*/ void LightApp_Application::onDropped( const QList& objects, SUIT_DataObject* parent, int row, Qt::DropAction action ) { @@@ -2179,9 -2212,11 +2212,11 @@@ void LightApp_Application::createPrefer } 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 <> // ... "Look and feel" group <> @@@ -2203,7 -2238,6 +2238,7 @@@ // .... -> 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" ); @@@ -2255,6 -2289,15 +2290,15 @@@ pref->setItemProperty( "strings", aValuesList, mruLinkType ); pref->setItemProperty( "indexes", anIndicesList, mruLinkType ); // ... "MRU" preferences group <> + + // ... "Full-screen" group <> + 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 <> + // .. "General" preferences tab <> // .. "3D viewer" group <> @@@ -2298,12 -2341,94 +2342,94 @@@ // .. "OCC viewer" group <> 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 <> 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 @@@ -2395,6 -2520,7 +2521,7 @@@ pref->setItemProperty( "margin", 0, occGen ); pref->setItemProperty( "columns", 2, occGen ); // ... -> empty frame (for layout) <> + // .. "OCC viewer" group <> #endif @@@ -2414,10 -2540,40 +2541,40 @@@ 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 @@@ -2952,6 -3108,162 +3109,162 @@@ void LightApp_Application::preferencesC } #endif + #ifndef DISABLE_OCCVIEWER + if ( sec == QString( "OCCViewer" ) && param == QString( "projection_mode" ) ) + { + int mode = resMgr->integerValue( "OCCViewer", "projection_mode", 0 ); + QList lst; + viewManagers( OCCViewer_Viewer::Type(), lst ); + QListIterator 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 lst; + viewManagers( OCCViewer_Viewer::Type(), lst ); + QListIterator 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 lst; + viewManagers( OCCViewer_Viewer::Type(), lst ); + QListIterator 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 lst; + viewManagers( OCCViewer_Viewer::Type(), lst ); + QListIterator 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 lst; + viewManagers( OCCViewer_Viewer::Type(), lst ); + QListIterator 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 lst; + viewManagers( OCCViewer_Viewer::Type(), lst ); + QListIterator 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 lst; + viewManagers( OCCViewer_Viewer::Type(), lst ); + QListIterator 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 lst; + viewManagers( OCCViewer_Viewer::Type(), lst ); + QListIterator 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 ); @@@ -3029,6 -3341,69 +3342,69 @@@ } #endif + #ifndef DISABLE_VTKVIEWER + if ( sec == QString( "VTKViewer" ) && param == QString( "stereo_type" ) ) + { + int mode = resMgr->integerValue( "VTKViewer", "stereo_type", 0 ); + QList lst; + #ifndef DISABLE_SALOMEOBJECT + viewManagers( SVTK_Viewer::Type(), lst ); + QListIterator it( lst ); + while ( it.hasNext() ) + { + SUIT_ViewModel* vm = it.next()->getViewModel(); + if ( !vm || !vm->inherits( "SVTK_Viewer" ) ) + continue; + + SVTK_Viewer* vtkVM = dynamic_cast( 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 lst; + #ifndef DISABLE_SALOMEOBJECT + viewManagers( SVTK_Viewer::Type(), lst ); + QListIterator it( lst ); + while ( it.hasNext() ) + { + SUIT_ViewModel* vm = it.next()->getViewModel(); + if ( !vm || !vm->inherits( "SVTK_Viewer" ) ) + continue; + + SVTK_Viewer* vtkVM = dynamic_cast( 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 lst; + #ifndef DISABLE_SALOMEOBJECT + viewManagers( SVTK_Viewer::Type(), lst ); + QListIterator it( lst ); + while ( it.hasNext() ) + { + SUIT_ViewModel* vm = it.next()->getViewModel(); + if ( !vm || !vm->inherits( "SVTK_Viewer" ) ) + continue; + + SVTK_Viewer* vtkVM = dynamic_cast( vm ); + if( vtkVM ) vtkVM->setQuadBufferSupport( enable ); + } + #endif + } + #endif + #ifndef DISABLE_VTKVIEWER if ( sec == QString( "VTKViewer" ) && param == QString( "preselection" ) ) { @@@ -3164,11 -3539,13 +3540,13 @@@ } 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 ); @@@ -3815,6 -4192,8 +4193,8 @@@ void LightApp_Application::setDesktop( 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 ); */ } } diff --combined src/LightApp/resources/LightApp.xml index 30d484b26,e8a0858e1..38ddb3ccb --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@@ -125,7 -125,6 +125,7 @@@
+ @@@ -145,6 -144,16 +145,16 @@@
+ + + + + + + + + + @@@ -160,6 -169,9 +170,9 @@@ + + + diff --combined src/LightApp/resources/LightApp_msg_en.ts index 0607c457e,987657246..3129ba0cf --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@@ -155,10 -155,6 +155,10 @@@ The changes will be applied on the nex PREF_GROUP_VTKVIEWER VTK 3D Viewer + + PREF_LOAD_LIGHT + Automatic loading of light modules when opening study + PREF_STORE_POS Store positions of windows @@@ -631,6 -627,66 +631,66 @@@ PREF_GROUP_OCCVIEWER OCC 3D Viewer + + PREF_GROUP_STEREO + Stereo render + + + PREF_STEREO_TYPE + Stereo type + + + PREF_ANAGLYPH_FILTER + Anaglyph filter + + + PREF_ANAGLYPH_RED_CYAN + Red-Cyan + + + PREF_ANAGLYPH_YELLOW_BLUE + Yellow-Blue + + + PREF_ANAGLYPH_GREEN_MAGENTA + Green-Magenta + + + PREF_FOCUS_TYPE + Convergence distance type + + + PREF_FOCUS_VALUE + Stereographic focus value + + + PREF_IOD_TYPE + IOD type + + + PREF_IOD_VALUE + Interocular distance (IOD) value + + + PREF_ABSOLUTE + Absolute + + + PREF_RELATIVE + Relative + + + PREF_REVERSE_STEREO + Reverse stereo + + + PREF_ENABLE_VSYNC + Enable V-Sync + + + PREF_ENABLE_QUAD_BUFFER_SUPPORT + Enable quad-buffer support + PREF_LOGARITHMIC Logarithmic @@@ -892,6 -948,14 +952,14 @@@ File does not existPREF_GROUP_SHORTCUTS Shortcuts settings + + PREF_GROUP_FULL_SCREEN + Full-screen + + + PREF_FULL_SCREEN_AUTO + Hide object browser and viewers toolbars + PREF_TAB_PYEDITOR Python Viewer @@@ -1057,6 -1121,10 +1125,10 @@@ DEFAULT_BTN_TEXT Defaults + + PREF_NEED_RESTART + Some changes will take effect only after application restart + LightApp_ModuleAction diff --combined src/LightApp/resources/LightApp_msg_fr.ts index a56730731,526ecd7d2..33cac5ea4 --- a/src/LightApp/resources/LightApp_msg_fr.ts +++ b/src/LightApp/resources/LightApp_msg_fr.ts @@@ -155,10 -155,6 +155,10 @@@ Les modifications seront appliquées à PREF_GROUP_VTKVIEWER Scène VTK 3D + + PREF_LOAD_LIGHT + Chargement automatique des modules Light à l'ouverture d'étude + PREF_STORE_POS Enregistrer la position des fenêtres @@@ -631,6 -627,66 +631,66 @@@ PREF_GROUP_OCCVIEWER Scène OCC 3D + + PREF_GROUP_STEREO + Rendu stéréo + + + PREF_STEREO_TYPE + Type de rendu stéréo + + + PREF_ANAGLYPH_FILTER + Filtre anaglyphique + + + PREF_ANAGLYPH_RED_CYAN + Rouge-Cyan + + + PREF_ANAGLYPH_YELLOW_BLUE + Jaune-Bleu + + + PREF_ANAGLYPH_GREEN_MAGENTA + Vert-Magenta + + + PREF_FOCUS_TYPE + type="unfinished"Convergence distance type + + + PREF_FOCUS_VALUE + Valeur de la focalisation stéréographique + + + PREF_IOD_TYPE + Type de distance intraoculaire + + + PREF_IOD_VALUE + Valeur de la distance intraoculaire + + + PREF_ABSOLUTE + Absolu + + + PREF_RELATIVE + Relatif + + + PREF_REVERSE_STEREO + Stéréo inversée + + + PREF_ENABLE_VSYNC + Activer la synchronisation verticale + + + PREF_ENABLE_QUAD_BUFFER_SUPPORT + Activer le support du quad-buffer + PREF_LOGARITHMIC Logarithmique @@@ -793,7 -849,7 +853,7 @@@ PREF_CLIPPING_SCALE - Facteur d'échelle + Facteur d'échelle TOT_CLOSE @@@ -892,6 -948,14 +952,14 @@@ Le fichier n'existe pasPREF_GROUP_SHORTCUTS Réglage des raccourcis clavier + + PREF_GROUP_FULL_SCREEN + Plein écran + + + PREF_FULL_SCREEN_AUTO + Cacher l'arbre d'étude and les barres d'outils des vues + PREF_TAB_PYEDITOR Editeur python @@@ -906,7 -970,7 +974,7 @@@ PREF_GROUP_PY_DISPLAY - Paramètres d'affichage + Paramètres d'affichage PREF_PY_CURRLINE_HIGHLIGHT @@@ -930,11 -994,11 +998,11 @@@ PREF_PY_TAB_WHITESPACES - Affiche les guides d'indentation + Affiche les guides d'indentation PREF_PY_TAB_SIZE - Largeur d'intentation: + Largeur d'intentation: PREF_GROUP_VERT_EDGE @@@ -1057,6 -1121,10 +1125,10 @@@ DEFAULT_BTN_TEXT Défauts + + PREF_NEED_RESTART + Des changements prendront effets seulement après un redémarrage de l'application + LightApp_ModuleAction diff --combined src/LightApp/resources/LightApp_msg_ja.ts index 3d4965313,29a70c646..453155bad --- a/src/LightApp/resources/LightApp_msg_ja.ts +++ b/src/LightApp/resources/LightApp_msg_ja.ts @@@ -155,10 -155,6 +155,10 @@@ CEA/DEN, CEDRAT, EDF R&D, LEG, PRIN PREF_GROUP_VTKVIEWER VTK 3D Viewer + + PREF_LOAD_LIGHT + Automatic loading of light modules when opening study + PREF_STORE_POS ウィンドウの位置を保存 @@@ -631,6 -627,66 +631,66 @@@ PREF_GROUP_OCCVIEWER OCC 3D Viewer + + PREF_GROUP_STEREO + ステレオレンダリング + + + PREF_STEREO_TYPE + ステレオタイプ + + + PREF_ANAGLYPH_FILTER + Anaglyph filter + + + PREF_ANAGLYPH_RED_CYAN + 赤-シアン投影 + + + PREF_ANAGLYPH_YELLOW_BLUE + 黄-青投影 + + + PREF_ANAGLYPH_GREEN_MAGENTA + 緑-マゼンタ投影 + + + PREF_FOCUS_TYPE + 一致距離型 + + + PREF_FOCUS_VALUE + 立体画法焦点値 + + + PREF_IOD_TYPE + 眼間距離(IOD)型 + + + PREF_IOD_VALUE + 眼間距離(IOD)値 + + + PREF_ABSOLUTE + 絶対 + + + PREF_RELATIVE + 早退 + + + PREF_REVERSE_STEREO + Reverse stereo + + + PREF_ENABLE_VSYNC + V-Syncを有効 + + + PREF_ENABLE_QUAD_BUFFER_SUPPORT + quad-buffer サポートを有効 + PREF_LOGARITHMIC 対数 @@@ -891,6 -947,14 +951,14 @@@ PREF_GROUP_SHORTCUTS ショートカットの設定 + + PREF_GROUP_FULL_SCREEN + 全画面表示 + + + PREF_FULL_SCREEN_AUTO + オブジェクトブラウザと表示ツールバーを隠す + PREF_TAB_PYEDITOR Python Viewer @@@ -1055,6 -1119,10 +1123,10 @@@ DEFAULT_BTN_TEXT デフォルト + + PREF_NEED_RESTART + 幾つかの変更はアプリケーションを再起動後に有効になります + LightApp_ModuleAction diff --combined src/OCCViewer/OCCViewer_ViewWindow.cxx index 6dfe7d49d,a0e96792b..0852d0b29 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@@ -35,8 -35,6 +35,6 @@@ #include "OCCViewer_CubeAxesDlg.h" #include "OCCViewer_ClippingDlg.h" - #include - #include #include #include @@@ -49,7 -47,7 +47,7 @@@ #include #include - #include + #include #include #include @@@ -57,6 -55,7 +55,7 @@@ #include #include #include + #include #include #include @@@ -69,10 -68,20 +68,20 @@@ #include #include + #include + #include + #include + #include + #include #include #include #include + #if OCC_VERSION_LARGE > 0x06090000 + #include + #include + #endif + #include #include @@@ -83,9 -92,6 +92,6 @@@ #include #include - #include - #include - #include #include @@@ -104,6 -110,12 +110,12 @@@ static QEvent* l_mbPressEvent = 0 #include + // 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", @@@ -231,12 -243,13 +243,13 @@@ OCCViewer_ViewWindow::OCCViewer_ViewWin myModel = theModel; myRestoreFlag = 0; myEnableDrawMode = false; + myDrawRectEnabled = true; myDrawRect=false; updateEnabledDrawMode(); myScalingDlg = 0; mySetRotationPointDlg = 0; myRectBand = 0; - + IsSketcherStyle = false; myIsKeyFree = false; @@@ -251,7 -264,6 +264,6 @@@ myCursorIsHand = false; clearViewAspects(); - } /*! @@@ -300,7 -312,7 +312,7 @@@ void OCCViewer_ViewWindow::initLayout( QtxAction* anAction = dynamic_cast( toolMgr()->action( GraduatedAxesId ) ); myCubeAxesDlg = new OCCViewer_CubeAxesDlg( anAction, this, "OCCViewer_CubeAxesDlg" ); myCubeAxesDlg->initialize(); - + connect( myViewPort, SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), this, SLOT( emitViewModified() ) ); } @@@ -364,7 -376,7 +376,7 @@@ bool OCCViewer_ViewWindow::eventFilter case QEvent::Wheel: { QWheelEvent* aEvent = (QWheelEvent*) e; - + if ( aEvent->modifiers().testFlag(Qt::ControlModifier) ) { Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); if ( isPreselectionEnabled() && ic->HasOpenedContext() ) { @@@ -374,7 -386,9 +386,9 @@@ 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(); @@@ -383,6 -397,7 +397,7 @@@ int y1 = (int)( aEvent->y() + height()*delta/100 ); myViewPort->zoom( x, y, x1, y1 ); myViewPort->getView()->ZFitAll(); + emit vpTransformationFinished ( ZOOMVIEW ); } } return true; @@@ -406,13 -421,25 +421,25 @@@ 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(); } /*! @@@ -426,10 -453,10 +453,10 @@@ void OCCViewer_ViewWindow::vpMousePress 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; } @@@ -551,7 -578,7 +578,7 @@@ } /* notify that we start a transformation */ if ( transformRequested() ) - emit vpTransformationStarted ( myOperation ); + emit vpTransformationStarted ( myOperation ); } if ( transformRequested() ) setTransformInProcess( true ); @@@ -660,9 -687,8 +687,8 @@@ bool OCCViewer_ViewWindow::computeGravi 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(); @@@ -870,7 -896,7 +896,7 @@@ bool OCCViewer_ViewWindow::setTransform { bool ok = transformEnabled( op ); myOperation = ok ? op : NOTHING; - myViewPort->setMouseTracking( myOperation == NOTHING ); + myViewPort->setMouseTracking( myOperation == NOTHING ); return ok; } @@@ -1106,7 -1132,7 +1132,7 @@@ void OCCViewer_ViewWindow::drawRect( //myRectBand->setPalette(palette); } //myRectBand->hide(); - + myRectBand->setUpdatesEnabled ( false ); QRect aRect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY); myRectBand->initGeometry( aRect ); @@@ -1146,10 -1172,8 +1172,10 @@@ void OCCViewer_ViewWindow::createAction { if( !toolMgr()->isEmpty() ) return; - + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + if( !aResMgr ) + return; QtxAction* aAction; @@@ -1173,7 -1197,7 +1199,7 @@@ 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); @@@ -1245,7 -1269,7 +1271,7 @@@ 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")); @@@ -1276,6 -1300,36 +1302,36 @@@ 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"); @@@ -1344,7 -1398,7 +1400,7 @@@ 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")); @@@ -1390,7 -1444,7 +1446,7 @@@ toolMgr()->registerAction( aAction, ReturnTo3dViewId ); } - // Synchronize View + // Synchronize View toolMgr()->registerAction( synchronizeAction(), SynchronizeId ); } @@@ -1456,6 -1510,12 +1512,12 @@@ void OCCViewer_ViewWindow::createToolBa 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 ); } @@@ -1466,7 -1526,7 +1528,7 @@@ toolMgr()->append( toolMgr()->separator(), tid ); toolMgr()->append( CloneId, tid ); - + toolMgr()->append( toolMgr()->separator(), tid ); toolMgr()->append( ClippingId, tid ); toolMgr()->append( AxialScaleId, tid ); @@@ -1589,10 -1649,173 +1651,173 @@@ void OCCViewer_ViewWindow::onResetView( 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( toolMgr()->action( OrthographicId ) ); + QtxAction* aPerspectiveAction = dynamic_cast( toolMgr()->action( PerspectiveId ) ); + #if OCC_VERSION_LARGE > 0x06090000 + QtxAction* aStereoAction = dynamic_cast( 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. */ @@@ -1665,7 -1888,7 +1890,7 @@@ void OCCViewer_ViewWindow::onAxialScale { if ( !myScalingDlg ) myScalingDlg = new OCCViewer_AxialScaleDlg( this ); - + if ( !myScalingDlg->isVisible() ) { myScalingDlg->Update(); @@@ -1768,7 -1991,7 +1993,7 @@@ void OCCViewer_ViewWindow::performResto myModel->setTrihedronShown( anItem.isVisible ); myModel->setTrihedronSize( anItem.size ); - + // graduated trihedron bool anIsVisible = anItem.gtIsVisible; OCCViewer_AxisWidget::AxisData anAxisData[3]; @@@ -1863,7 -2086,7 +2088,7 @@@ void OCCViewer_ViewWindow::onSwitchSele { mySelectionEnabled = on; myModel->setSelectionOptions( myModel->isPreselectionEnabled(), isSelectionEnabled() ); - + // update action state if method is called outside // preselection @@@ -1888,7 -2111,7 +2113,7 @@@ void OCCViewer_ViewWindow::onSwitchInte // update action state if method is called outside QtxAction* a = dynamic_cast( toolMgr()->action( SwitchInteractionStyleId ) ); - if ( a->isChecked() != on ) + if ( a && a->isChecked() != on ) a->setChecked( on ); } @@@ -1901,7 -2124,7 +2126,7 @@@ void OCCViewer_ViewWindow::onSwitchZoom // update action state if method is called outside QtxAction* a = dynamic_cast( toolMgr()->action( SwitchZoomingStyleId ) ); - if ( a->isChecked() != on ) + if ( a && a->isChecked() != on ) a->setChecked( on ); } @@@ -1950,22 -2173,23 +2175,23 @@@ QImage OCCViewer_ViewWindow::dumpView( 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(); @@@ -1993,8 -2217,9 +2219,9 @@@ 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); @@@ -2003,8 -2228,8 +2230,8 @@@ 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") @@@ -2054,7 -2279,7 +2281,7 @@@ void OCCViewer_ViewWindow::setCuttingPl 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); @@@ -2461,7 -2686,7 +2688,7 @@@ void OCCViewer_ViewWindow::setVisualPar 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); } @@@ -2705,8 -2930,8 +2932,8 @@@ void OCCViewer_ViewWindow::setMaximized 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 ); @@@ -2715,8 -2940,8 +2942,8 @@@ } } 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 ); @@@ -2732,13 -2957,13 +2959,13 @@@ bool OCCViewer_ViewWindow::isMaximized( } void OCCViewer_ViewWindow::setSketcherStyle( bool enable ) - { - IsSketcherStyle = enable; + { + IsSketcherStyle = enable; } - bool OCCViewer_ViewWindow::isSketcherStyle() const - { - return IsSketcherStyle; + bool OCCViewer_ViewWindow::isSketcherStyle() const + { + return IsSketcherStyle; } @@@ -2747,12 -2972,248 +2974,248 @@@ void OCCViewer_ViewWindow::set2dMode(Mo 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 ) { @@@ -2763,7 -3224,7 +3226,7 @@@ Qtx::BackgroundData OCCViewer_ViewWindo { return myViewPort ? myViewPort->background() : Qtx::BackgroundData(); } - + void OCCViewer_ViewWindow::setBackground( const Qtx::BackgroundData& theBackground ) { if ( myViewPort ) myViewPort->setBackground( theBackground ); @@@ -3065,7 -3526,7 +3528,7 @@@ void OCCViewer_ViewWindow::onClipping ( { if(!myModel) return; OCCViewer_ClippingDlg* aClippingDlg = myModel->getClippingDlg(); - + if (theIsOn) { if (!aClippingDlg) { aClippingDlg = new OCCViewer_ClippingDlg (this, myModel);