From 86454b734148af879ea5276d2d327f573b8857c4 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 29 Sep 2008 15:07:11 +0000 Subject: [PATCH] Merge with VISU 2008 --- src/LightApp/LightApp_Application.cxx | 230 ++++++++++++++++++++- src/LightApp/resources/LightApp.xml | 9 +- src/LightApp/resources/LightApp_msg_en.ts | 132 ++++++++++++ src/SalomeApp/resources/SalomeApp.xml | 4 + src/VTKViewer/VTKViewer_GeometryFilter.cxx | 2 +- 5 files changed, 366 insertions(+), 11 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 9b726fd1c..fdc6d4248 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -564,6 +564,7 @@ void LightApp_Application::createActions() moduleAction->insertModule( *it, icon ); } + connect( moduleAction, SIGNAL( moduleActivated( const QString& ) ), this, SLOT( onModuleActivation( const QString& ) ) ); registerAction( ModulesListId, moduleAction ); } @@ -1309,9 +1310,16 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType SVTK_Viewer* vm = dynamic_cast( viewMgr->getViewModel() ); if( vm ) { + vm->setProjectionMode( resMgr->integerValue( "VTKViewer", "projection_mode", vm->projectionMode() ) ); vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) ); vm->setTrihedronSize( resMgr->doubleValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ), resMgr->booleanValue( "VTKViewer", "relative_size", vm->trihedronRelative() ) ); + vm->setInteractionStyle( resMgr->integerValue( "VTKViewer", "navigation_mode", vm->interactionStyle() ) ); + vm->setIncrementalSpeed( resMgr->integerValue( "VTKViewer", "speed_value", vm->incrementalSpeed() ), + resMgr->integerValue( "VTKViewer", "speed_mode", vm->incrementalSpeedMode() ) ); + vm->setSpacemouseButtons( resMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", vm->spacemouseBtn(1) ), + resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", vm->spacemouseBtn(2) ), + resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", vm->spacemouseBtn(3) ) ); new LightApp_VTKSelector( vm, mySelMgr ); } #else @@ -1781,10 +1789,11 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int supervGroup = pref->addPreference( tr( "PREF_GROUP_SUPERV" ), viewTab ); - pref->setItemProperty( "columns", 2, occGroup ); - pref->setItemProperty( "columns", 2, vtkGroup ); - pref->setItemProperty( "columns", 2, plot2dGroup ); + pref->setItemProperty( "columns", 4, occGroup ); + pref->setItemProperty( "columns", 1, vtkGroup ); + pref->setItemProperty( "columns", 4, plot2dGroup ); + // OCC Viewer int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup, LightApp_Preferences::DblSpin, "OCCViewer", "trihedron_size" ); pref->setItemProperty( "min", 1.0E-06, occTS ); @@ -1804,17 +1813,131 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->setItemProperty( "min", 0, isoV ); pref->setItemProperty( "max", 100000, isoV ); - int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup, - LightApp_Preferences::DblSpin, "VTKViewer", "trihedron_size" ); - pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup, + // VTK Viewer + int vtkGen = pref->addPreference( "", vtkGroup, LightApp_Preferences::Frame ); + pref->setItemProperty( "columns", 2, vtkGen ); + + int vtkProjMode = pref->addPreference( tr( "PREF_PROJECTION_MODE" ), vtkGen, + LightApp_Preferences::Selector, "VTKViewer", "projection_mode" ); + QStringList aProjModeList; + aProjModeList.append( tr("PREF_ORTHOGRAPHIC") ); + aProjModeList.append( tr("PREF_PERSPECTIVE") ); + + QList aModeIndexesList; + aModeIndexesList.append(0); + aModeIndexesList.append(1); + + pref->setItemProperty( "strings", aProjModeList, vtkProjMode ); + pref->setItemProperty( "indexes", aModeIndexesList, vtkProjMode ); + + pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGen, LightApp_Preferences::Color, "VTKViewer", "background" ); - pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGroup, LightApp_Preferences::Bool, "VTKViewer", "relative_size" ); - pref->addPreference( tr( "PREF_USE_ADVANCED_SELECTION_ALGORITHM" ), vtkGroup, - LightApp_Preferences::Bool, "VTKViewer", "use_advanced_selection_algorithm" ); + + int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGen, + LightApp_Preferences::DblSpin, "VTKViewer", "trihedron_size" ); pref->setItemProperty( "min", 1.0E-06, vtkTS ); pref->setItemProperty( "max", 150, vtkTS ); + pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGen, LightApp_Preferences::Bool, "VTKViewer", "relative_size" ); + + int vtkStyleMode = pref->addPreference( tr( "PREF_NAVIGATION" ), vtkGen, + LightApp_Preferences::Selector, "VTKViewer", "navigation_mode" ); + QStringList aStyleModeList; + aStyleModeList.append( tr("PREF_STANDARD_STYLE") ); + aStyleModeList.append( tr("PREF_KEYFREE_STYLE") ); + + pref->setItemProperty( "strings", aStyleModeList, vtkStyleMode ); + pref->setItemProperty( "indexes", aModeIndexesList, vtkStyleMode ); + + pref->addPreference( "", vtkGroup, LightApp_Preferences::Space ); + + int vtkSpeed = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED" ), vtkGen, + LightApp_Preferences::IntSpin, "VTKViewer", "speed_value" ); + + pref->setItemProperty( "min", 1, vtkSpeed ); + pref->setItemProperty( "max", 1000, vtkSpeed ); + + int vtkSpeedMode = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED_MODE" ), vtkGen, + LightApp_Preferences::Selector, "VTKViewer", "speed_mode" ); + QStringList aSpeedModeList; + aSpeedModeList.append( tr("PREF_ARITHMETIC") ); + aSpeedModeList.append( tr("PREF_GEOMETRICAL") ); + + pref->setItemProperty( "strings", aSpeedModeList, vtkSpeedMode ); + pref->setItemProperty( "indexes", aModeIndexesList, vtkSpeedMode ); + + int vtkSM = pref->addPreference( tr( "PREF_FRAME_SPACEMOUSE" ), vtkGroup, LightApp_Preferences::GroupBox ); + pref->setItemProperty( "columns", 2, vtkSM ); + int spacemousePref1 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_1" ), vtkSM, + LightApp_Preferences::Selector, "VTKViewer", + "spacemouse_func1_btn" ); //decrease_speed_increment + int spacemousePref2 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_2" ), vtkSM, + LightApp_Preferences::Selector, "VTKViewer", + "spacemouse_func2_btn" ); //increase_speed_increment + int spacemousePref3 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_3" ), vtkSM, + LightApp_Preferences::Selector, "VTKViewer", + "spacemouse_func5_btn" ); //dominant_combined_switch + + QStringList values; + values.append( tr( "PREF_SPACEMOUSE_BTN_1" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_2" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_3" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_4" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_5" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_6" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_7" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_8" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_*" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_10" ) ); + values.append( tr( "PREF_SPACEMOUSE_BTN_11" ) ); + QList indices; + indices.append( 1 ); + indices.append( 2 ); + indices.append( 3 ); + indices.append( 4 ); + indices.append( 5 ); + indices.append( 6 ); + indices.append( 7 ); + indices.append( 8 ); + indices.append( 9 ); // == button_* + indices.append( 10 ); + indices.append( 11 ); + pref->setItemProperty( "strings", values, spacemousePref1 ); + pref->setItemProperty( "indexes", indices, spacemousePref1 ); + pref->setItemProperty( "strings", values, spacemousePref2 ); + pref->setItemProperty( "indexes", indices, spacemousePref2 ); + pref->setItemProperty( "strings", values, spacemousePref3 ); + pref->setItemProperty( "indexes", indices, spacemousePref3 ); + + int vtkRec = pref->addPreference( tr( "PREF_FRAME_RECORDING" ), vtkGroup, LightApp_Preferences::GroupBox ); + pref->setItemProperty( "columns", 2, vtkRec ); + + int modePref = pref->addPreference( tr( "PREF_RECORDING_MODE" ), vtkRec, + LightApp_Preferences::Selector, "VTKViewer", "recorder_mode" ); + values.clear(); + values.append( tr( "PREF_SKIPPED_FRAMES" ) ); + values.append( tr( "PREF_ALL_DISLPAYED_FRAMES" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + pref->setItemProperty( "strings", values, modePref ); + pref->setItemProperty( "indexes", indices, modePref ); + + int fpsPref = pref->addPreference( tr( "PREF_FPS" ), vtkRec, + LightApp_Preferences::DblSpin, "VTKViewer", "recorder_fps" ); + pref->setItemProperty( "min", 0.1, fpsPref ); + pref->setItemProperty( "max", 100, fpsPref ); + + int qualityPref = pref->addPreference( tr( "PREF_QUALITY" ), vtkRec, + LightApp_Preferences::IntSpin, "VTKViewer", "recorder_quality" ); + pref->setItemProperty( "min", 1, qualityPref ); + pref->setItemProperty( "max", 100, qualityPref ); + + pref->addPreference( tr( "PREF_PROGRESSIVE" ), vtkRec, + LightApp_Preferences::Bool, "VTKViewer", "recorder_progressive" ); + + // Plot2d pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup, LightApp_Preferences::Bool, "Plot2d", "ShowLegend" ); @@ -2027,6 +2150,95 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString } #endif +#ifndef DISABLE_VTKVIEWER + if ( sec == QString( "VTKViewer" ) && (param == QString( "speed_value" ) || param == QString( "speed_mode" )) ) + { + int speed = resMgr->integerValue( "VTKViewer", "speed_value", 10 ); + int mode = resMgr->integerValue( "VTKViewer", "speed_mode", 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->setIncrementalSpeed( speed, mode ); + } +#endif + } +#endif + +#ifndef DISABLE_VTKVIEWER + if ( sec == QString( "VTKViewer" ) && param == QString( "projection_mode" ) ) + { + int mode = resMgr->integerValue( "VTKViewer", "projection_mode", 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->setProjectionMode( mode ); + } +#endif + } +#endif + +#ifndef DISABLE_VTKVIEWER + if ( sec == QString( "VTKViewer" ) && param == QString( "navigation_mode" ) ) + { + int mode = resMgr->integerValue( "VTKViewer", "navigation_mode", 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->setInteractionStyle( mode ); + } +#endif + } +#endif + +#ifndef DISABLE_VTKVIEWER + if ( sec == QString( "VTKViewer" ) && (param == QString( "spacemouse_func1_btn" ) || + param == QString( "spacemouse_func2_btn" ) || + param == QString( "spacemouse_func5_btn" ) ) ) + { + int btn1 = resMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", 1 ); + int btn2 = resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", 2 ); + int btn3 = resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", 9 ); + 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->setSpacemouseButtons( btn1, btn2, btn3 ); + } +#endif + } +#endif + #ifndef DISABLE_OCCVIEWER if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) ) { diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index b48320370..f95f18552 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -94,11 +94,18 @@
- + + + + + + + +
diff --git a/src/LightApp/resources/LightApp_msg_en.ts b/src/LightApp/resources/LightApp_msg_en.ts index 4e14d719f..4ec13897c 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -81,6 +81,138 @@ CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITASPREF_STORE_POS Store positions of windows + + PREF_PROJECTION_MODE + Projection mode: + + + PREF_ORTHOGRAPHIC + Orthogonal + + + PREF_PERSPECTIVE + Perspective + + + PREF_NAVIGATION + Navigation: + + + PREF_STANDARD_STYLE + Salome standard controls + + + PREF_KEYFREE_STYLE + Keyboard free style + + + PREF_INCREMENTAL_SPEED + Speed increment: + + + PREF_INCREMENTAL_SPEED_MODE + Modification mode: + + + PREF_ARITHMETIC + Arithmetic progression + + + PREF_GEOMETRICAL + Geometrical progression + + + PREF_FRAME_SPACEMOUSE + Spacemouse + + + PREF_SPACEMOUSE_FUNC_1 + Decrease speed increment + + + PREF_SPACEMOUSE_FUNC_2 + Increase speed increment + + + PREF_SPACEMOUSE_FUNC_3 + Dominant / combined switch + + + PREF_SPACEMOUSE_BTN_1 + Button 1 + + + PREF_SPACEMOUSE_BTN_2 + Button 2 + + + PREF_SPACEMOUSE_BTN_3 + Button 3 + + + PREF_SPACEMOUSE_BTN_4 + Button 4 + + + PREF_SPACEMOUSE_BTN_5 + Button 5 + + + PREF_SPACEMOUSE_BTN_6 + Button 6 + + + PREF_SPACEMOUSE_BTN_7 + Button 7 + + + PREF_SPACEMOUSE_BTN_8 + Button 8 + + + PREF_SPACEMOUSE_BTN_* + Button * + + + PREF_SPACEMOUSE_BTN_10 + Button 10 + + + PREF_SPACEMOUSE_BTN_11 + Button 11 + + + PREF_FRAME_RECORDING + AVI Recording + + + PREF_ALL_DISLPAYED_FRAMES + Recording all displayed frames + + + PREF_FPS + FPS + + + PREF_GROUP_TTL + Settings + + + PREF_PROGRESSIVE + Progressive + + + PREF_QUALITY + Quality + + + PREF_RECORDING_MODE + Mode + + + PREF_SKIPPED_FRAMES + Recording at a given FPS + PREF_BOTTOM Bottom diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 373ab093b..3c428dbc7 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -108,6 +108,10 @@ + + + +
diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx index 3d6182e96..a53421410 100755 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -24,7 +24,7 @@ // File : VTKViewer_GeometryFilter.cxx // Author : Michael ZORIN // Module : SALOME -// $Header$ +// $Header$ #include "VTKViewer_GeometryFilter.h" #include "VTKViewer_ConvexTool.h" -- 2.39.2