]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Merge with VISU 2008
authorvsv <vsv@opencascade.com>
Mon, 29 Sep 2008 15:07:11 +0000 (15:07 +0000)
committervsv <vsv@opencascade.com>
Mon, 29 Sep 2008 15:07:11 +0000 (15:07 +0000)
src/LightApp/LightApp_Application.cxx
src/LightApp/resources/LightApp.xml
src/LightApp/resources/LightApp_msg_en.ts
src/SalomeApp/resources/SalomeApp.xml
src/VTKViewer/VTKViewer_GeometryFilter.cxx

index 9b726fd1cee12218a5fa1ec6030db8f5d8de0f37..fdc6d42483e849dab2037a00849f1ddbf69a341c 100644 (file)
@@ -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<SVTK_Viewer*>( 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<QVariant> 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<QVariant> 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<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->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<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->setProjectionMode( mode );
+    }
+#endif
+  }
+#endif
+
+#ifndef DISABLE_VTKVIEWER
+  if ( sec == QString( "VTKViewer" ) && param == QString( "navigation_mode" ) )
+  {
+    int mode = resMgr->integerValue( "VTKViewer", "navigation_mode", 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->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<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->setSpacemouseButtons( btn1, btn2, btn3 );
+    }
+#endif
+  }
+#endif
+
 #ifndef DISABLE_OCCVIEWER
   if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) )
   {
index b4832037088a68714c84035889e0be9d0c18764a..f95f18552a1b30d9c2fab47de549de1952971557 100644 (file)
     <parameter name="trihedron_size" value="100" />
  </section>
  <section name="VTKViewer" >
-    <!-- OCC viewer preferences -->
+    <!-- VTK viewer preferences -->
     <parameter name="background"     value="0, 0, 0"/>
+    <parameter name="projection_mode" value="0" />
     <parameter name="trihedron_size" value="100" />
     <parameter name="relative_size"  value="true" />
     <parameter name="use_advanced_selection_algorithm" value="true" />
+    <parameter name="navigation_mode" value="0" />
+    <parameter name="speed_value" val ue="10" />
+    <parameter name="speed_mode" value="0" />
+    <parameter name="spacemouse_func1_btn" value="1" />
+    <parameter name="spacemouse_func2_btn" value="2" />
+    <parameter name="spacemouse_func5_btn" value="9" />
  </section>
  <section name="Plot2d" >
     <!-- Plot2d viewer preferences -->
index 4e14d719fc15c6ac4d42c9230996746949a9037b..4ec13897c82259feb3aa9bab1fdd5252834ac43b 100644 (file)
@@ -81,6 +81,138 @@ CEA/DEN, CEDRAT, EDF R&amp;D, LEG, PRINCIPIA R&amp;D, BUREAU VERITAS</translatio
         <source>PREF_STORE_POS</source>
         <translation>Store positions of windows</translation>
     </message>
+    <message>
+        <source>PREF_PROJECTION_MODE</source>
+        <translation>Projection mode:</translation>
+    </message>
+    <message>
+        <source>PREF_ORTHOGRAPHIC</source>
+        <translation>Orthogonal</translation>
+    </message>
+    <message>
+        <source>PREF_PERSPECTIVE</source>
+        <translation>Perspective</translation>
+    </message>
+    <message>
+        <source>PREF_NAVIGATION</source>
+        <translation>Navigation:</translation>
+    </message>
+    <message>
+        <source>PREF_STANDARD_STYLE</source>
+        <translation>Salome standard controls</translation>
+    </message>
+    <message>
+        <source>PREF_KEYFREE_STYLE</source>
+        <translation>Keyboard free style</translation>
+    </message>
+    <message>
+        <source>PREF_INCREMENTAL_SPEED</source>
+        <translation>Speed increment:</translation>
+    </message>
+    <message>
+        <source>PREF_INCREMENTAL_SPEED_MODE</source>
+        <translation>Modification mode:</translation>
+    </message>
+    <message>
+        <source>PREF_ARITHMETIC</source>
+        <translation>Arithmetic progression</translation>
+    </message>
+    <message>
+        <source>PREF_GEOMETRICAL</source>
+        <translation>Geometrical progression</translation>
+    </message>
+    <message>
+        <source>PREF_FRAME_SPACEMOUSE</source>
+        <translation>Spacemouse</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_FUNC_1</source>
+        <translation>Decrease speed increment</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_FUNC_2</source>
+        <translation>Increase speed increment</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_FUNC_3</source>
+        <translation>Dominant / combined switch</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_1</source>
+        <translation>Button 1</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_2</source>
+        <translation>Button 2</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_3</source>
+        <translation>Button 3</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_4</source>
+        <translation>Button 4</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_5</source>
+        <translation>Button 5</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_6</source>
+        <translation>Button 6</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_7</source>
+        <translation>Button 7</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_8</source>
+        <translation>Button 8</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_*</source>
+        <translation>Button *</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_10</source>
+        <translation>Button 10</translation>
+    </message>
+    <message>
+        <source>PREF_SPACEMOUSE_BTN_11</source>
+        <translation>Button 11</translation>
+    </message>
+    <message>
+        <source>PREF_FRAME_RECORDING</source>
+        <translation>AVI Recording</translation>
+    </message>
+    <message>
+        <source>PREF_ALL_DISLPAYED_FRAMES</source>
+        <translation>Recording all displayed frames</translation>
+    </message>
+    <message>
+        <source>PREF_FPS</source>
+        <translation>FPS</translation>
+    </message>
+    <message>
+        <source>PREF_GROUP_TTL</source>
+        <translation>Settings</translation>
+    </message>
+    <message>
+        <source>PREF_PROGRESSIVE</source>
+        <translation>Progressive</translation>
+    </message>
+    <message>
+        <source>PREF_QUALITY</source>
+        <translation>Quality</translation>
+    </message>
+    <message>
+        <source>PREF_RECORDING_MODE</source>
+        <translation>Mode</translation>
+    </message>
+    <message>
+        <source>PREF_SKIPPED_FRAMES</source>
+        <translation>Recording at a given FPS</translation>
+    </message>
     <message>
         <source>PREF_BOTTOM</source>
         <translation>Bottom</translation>
index 373ab093b3975a01e7cbd6d8181ff049201f499f..3c428dbc7a9ae3e224234982b95a90d66a4f6792 100644 (file)
     <parameter name="trihedron_size" value="105" />
     <parameter name="relative_size"  value="true" />
     <parameter name="use_advanced_selection_algorithm" value="true" />
+    <parameter name="recorder_mode"        value="1"    />
+    <parameter name="recorder_fps"         value="17.3" />
+    <parameter name="recorder_quality"     value="100"  />
+    <parameter name="recorder_progressive" value="true" />
  </section>
  <section name="Plot2d" >
     <!-- Plot2d viewer preferences -->
index 3d6182e96292a3728780c2d937093f38bd210fa9..a5342141053af0f06c6b9903928fcdd9374a93fd 100755 (executable)
@@ -24,7 +24,7 @@
 //  File   : VTKViewer_GeometryFilter.cxx
 //  Author : Michael ZORIN
 //  Module : SALOME
-//  $Header$
+//  $Header$ 
 
 #include "VTKViewer_GeometryFilter.h"
 #include "VTKViewer_ConvexTool.h"