]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To improve popup management
authorapo <apo@opencascade.com>
Mon, 10 Oct 2005 05:56:03 +0000 (05:56 +0000)
committerapo <apo@opencascade.com>
Mon, 10 Oct 2005 05:56:03 +0000 (05:56 +0000)
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_PopupTools.cxx
src/VISUGUI/VisuGUI_PopupTools.h

index be93971c21a9501c1efce23431dc56c7a579958a..6dc6997da7fa571a63ad09b3b99e9f4ea34da844 100644 (file)
@@ -191,10 +191,10 @@ VisuGUI_Module
                SLOT(onCreateViewManager()));
   int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
   int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
-  int gaussMenu = createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
+  createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
   
   // Add actions to menus
-  int aMenuId = createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
+  createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
   //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
 
   QString aViewerType = VVTK_Viewer::Type();
@@ -215,9 +215,6 @@ VisuGUI_Module
   connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
 
   // Prepare popup menus
-  QString aSel_One_ObjBr("client='ObjectBrowser' and selcount=1");
-  QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
-                   "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TGAUSSPOINTS'");
   QtxPopupMgr* mgr = popupMgr();
   QString aRule;
 
@@ -227,7 +224,11 @@ VisuGUI_Module
                 this, SLOT(OnCreateGaussPoints()));
   mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 );
   mgr->setRule( action( GAUSS_CREATE_PRS ), 
-               aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'", true );
+               "client='ObjectBrowser' and selcount=1 "
+               "and type='VISU::TTIMESTAMP' "
+               "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} "
+               "and $medSource in {'eImportFile' 'eCopyAndImportFile'} ",
+               true );
 
   createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
   createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
@@ -237,7 +238,8 @@ VisuGUI_Module
                 this, SLOT(OnEditGaussPoints()));
   mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 );
   mgr->setRule( action( GAUSS_EDIT_PRS ), 
-               "selcount=1 and type='VISU::TGAUSSPOINTS'", true );
+               "selcount=1 and type='VISU::TGAUSSPOINTS'", 
+               true );
 
   aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
 
@@ -365,11 +367,11 @@ VisuGUI_Module
   setPreferenceProperty( clampPref, "min", 1 );
   setPreferenceProperty( clampPref, "max", 512 );
 
-  int mainTexturePref = addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
-                                      SalomeApp_Preferences::File, "VISU", "point_sprite_main_texture" );
+  addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
+                SalomeApp_Preferences::File, "VISU", "point_sprite_main_texture" );
 
-  int alphaTexturePref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
-                                       SalomeApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
+  addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
+                SalomeApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
 
   int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
                                          SalomeApp_Preferences::DblSpin, "VISU", "point_sprite_alpha_threshold" );
@@ -408,8 +410,8 @@ VisuGUI_Module
   setPreferenceProperty( sizePref, "min", 1 );
   setPreferenceProperty( sizePref, "max", 100 );
 
-  int colorPref = addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
-                                SalomeApp_Preferences::Color, "VISU", "point_sprite_color" );
+  addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
+                SalomeApp_Preferences::Color, "VISU", "point_sprite_color" );
 }
 
 
@@ -434,8 +436,8 @@ VisuGUI_Module
   setPreferenceProperty( activeBarPref, "strings", values );
   setPreferenceProperty( activeBarPref, "indexes", indices );
 
-  int diplayGlobalPref = addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
-                                       SalomeApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
+  addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
+                SalomeApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
 
   int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr,
                                 SalomeApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" );
@@ -473,11 +475,11 @@ VisuGUI_Module
   setPreferenceProperty( clampPref, "min", 1 );
   setPreferenceProperty( clampPref, "max", 512 );
 
-  int mainTexturePref = addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
-                                      SalomeApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" );
+  addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
+                SalomeApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" );
 
-  int alphaTexturePref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
-                                       SalomeApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
+  addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
+                SalomeApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
 
   int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
                                          SalomeApp_Preferences::DblSpin, "VISU", "outside_point_sprite_alpha_threshold" );  setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
@@ -493,8 +495,8 @@ VisuGUI_Module
 
   int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab );
 
-  int colorPref = addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr,
-                                SalomeApp_Preferences::Color, "VISU", "outside_point_sprite_color" );
+  addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr,
+                SalomeApp_Preferences::Color, "VISU", "outside_point_sprite_color" );
 }
 
 
index 9cdb25ad3232edde0bd2c1134e0beb1b2ca41934..8517e0b30b30f26509ff43e0703363bb44b17c43 100644 (file)
@@ -29,6 +29,9 @@
 #include "VisuGUI_ViewTools.h"
 #include "VisuGUI_Tools.h"
 
+#include "VISU_Result_i.hh"
+#include "SalomeApp_Study.h"
+
 using namespace VISU;
 
 //////////////////////////////////////////////////
@@ -41,6 +44,8 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const
   if ( !val.isValid() ) {
     if      ( p == "type"           ) val = QtxValue( type( ind ) );
     else if ( p == "nbComponents"   ) val = QtxValue( nbComponents( ind ) );
+    else if ( p == "medEntity"   ) val = QtxValue( medEntity( ind ) );
+    else if ( p == "medSource"   ) val = QtxValue( medSource( ind ) );
     else if ( p == "representation" ) val = QtxValue( representation( ind ) );
     else if ( p == "nbTimeStamps"   ) val = QtxValue( nbTimeStamps( ind ) );
     else if ( p == "nbChildren"     ) val = QtxValue( nbChildren( ind ) );
@@ -124,6 +129,56 @@ QString VisuGUI_Selection::nbComponents( const int ind ) const
   return aResStr;
 }
 
+QString VisuGUI_Selection::medEntity( const int ind ) const
+{
+  bool isExist;
+  VISU::Storable::TRestoringMap aMap;
+  GetSelectedObj( study(), entry( ind ), &aMap );  
+  const QString& aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
+  if ( isExist ) {
+    using namespace VISU;
+    TEntity anEntityId = TEntity(aVal.toInt());
+    switch(anEntityId){
+    case NODE_ENTITY :
+      return "NODE_ENTITY";
+    case EDGE_ENTITY :
+      return "EDGE_ENTITY";
+    case FACE_ENTITY :
+      return "FACE_ENTITY";
+    case CELL_ENTITY :
+      return "CELL_ENTITY";
+    default:
+      return QString();
+    }
+  }
+  return QString();
+}
+
+QString VisuGUI_Selection::medSource( const int ind ) const
+{
+  _PTR(Study) aStudyDS = study()->studyDS();
+  if(_PTR(SObject) aSObject = aStudyDS->FindObjectID(entry(ind))){
+    VISU::Result_var aRes;
+    if(VISU::Result_i* aResult = CheckResult(myModule,aSObject,aRes)){
+      using namespace VISU;
+      Result_i::ECreationId aCreationId = aResult->GetCreationId();
+      switch(aCreationId){
+      case Result_i::eImportFile :
+       return "eImportFile";
+      case Result_i::eCopyAndImportFile :
+       return "eCopyAndImportFile";
+      case Result_i::eImportMed :
+       return "eImportMed";
+      case Result_i::eImportMedField :
+       return "eImportMedField";
+      default:
+       return QString();
+      }      
+    }
+  }
+  return QString();
+}
+
 QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
 {
   QString aResStr;
index f93d8810b3444d13d3683812724632a9d01127c1..42b6a839874f557991b9ddc89c2e86edaed81eb9 100644 (file)
@@ -47,6 +47,8 @@ public:
 private:
   QString          type( const int ) const;
   QString          nbComponents( const int ) const;
+  QString          medEntity( const int ) const;
+  QString          medSource( const int ) const;
   QString          nbTimeStamps( const int ) const;
   QString          representation( const int ) const;
   QString          nbChildren( const int ) const;