]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To provide a way to introduce new type of presentation
authorapo <apo@opencascade.com>
Thu, 25 Aug 2005 11:16:01 +0000 (11:16 +0000)
committerapo <apo@opencascade.com>
Thu, 25 Aug 2005 11:16:01 +0000 (11:16 +0000)
src/VISUGUI/VISUM_msg_en.po
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Module.h
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h

index 1b0b0fc3733e877914d1eed56382df36d7a517fd..13cc9994d37c83ea99d0a927c8aa01c8d384ce5c 100644 (file)
@@ -91,7 +91,7 @@ msgid "VisuGUI_Module::VISU_CAMERA_MOVE_PREF"
 msgstr "Number of steps between two positions"
 
 msgid "VisuGUI_Module::MEN_GAUSS_CREATE_PRS"
-msgstr "Create Gauss Points"
+msgstr "Gauss Points"
 
 msgid "VVTK_ViewManager::VTK_VIEW_TITLE"
 msgstr "VISU scene:%1 - viewer:%2"
index 5b77c115b6db3aab4a810eca3b642b254edcb456..b26c268658c69f5283c06c7846af43bf954060bb 100644 (file)
 
 #include "VisuGUI_Prs3dTools.h"
 
-#include "VISU_ScalarMap_i.hh"
+#include "VISU_GaussPoints_i.hh"
 #include "VisuGUI_ScalarBarDlg.h"
 
 #include "VISU_Gen_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_CutLines_i.hh"
 
-#include "VisuGUI_Tools.h"
 #include "VISU_Actor.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ActionsDef.h"
 
 #ifdef _DEBUG_
 static int MYDEBUG = 1;
@@ -63,6 +64,10 @@ static int MYDEBUG = 0;
 
 #define GAUSS_NEW_VIEWER         5100
 #define GAUSS_CREATE_PRS         5200
+#define GAUSS_EDIT_PRS           5300
+#define GAUSS_ERASE_PRS          5400
+#define GAUSS_DISPLAY_PRS        5500
+#define GAUSS_DISPLAY_ONLY_PRS   5600
 
 void
 CreateCurves( SalomeApp_Module* theModule,
@@ -152,16 +157,57 @@ VisuGUI_Module
   createAction( GAUSS_NEW_VIEWER, tr("MEN_GAUSS_NEW_VIEWER"), QIconSet(),
                 tr("MEN_GAUSS_NEW_VIEWER"), "", 0, this, false,
                 this, SLOT(onCreateViewManager()));
-  createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), QIconSet(),
-                tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false,
-                this, SLOT(OnCreateGaussPoints()));
-
   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 );
   
+  // Add actions to menus
   int aMenuId = createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
-  createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
+  //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
+
+  // 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;
+
+  createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), QIconSet(),
+                tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false,
+                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 );
+
+  createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIconSet(),
+                VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
+                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 );
+
+  aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
+
+  createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_ERASE"), QIconSet(),
+                VisuGUI::tr("MEN_ERASE"), "", 0, this, false,
+                this, SLOT(OnErasePrs()));
+  mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
+  mgr->setRule( action( GAUSS_ERASE_PRS ), 
+               aRule + " and (isVisible=true)", true );
+
+  createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_DISPLAY"), QIconSet(),
+                VisuGUI::tr("MEN_DISPLAY"), "", 0, this, false,
+                this, SLOT(OnDisplayPrs()));
+  mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
+  mgr->setRule( action( GAUSS_DISPLAY_PRS ), 
+               aRule + " and ((isVisible=false and isActiveView=true) or (isActiveView=false))", true );
+
+  createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIconSet(),
+                VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
+                this, SLOT(OnDisplayOnlyPrs()));
+  mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
+  mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ), 
+               aRule, true );
 }
 
 //---------------------------------------------------------------
@@ -281,6 +327,18 @@ void
 VisuGUI_Module
 ::OnCreateGaussPoints()
 {
-  CreatePrs3d<VISU::ScalarMap_i,VVTK_Viewer,VisuGUI_ScalarBarDlg,1>(this);
+  CreatePrs3d<VISU::GaussPoints_i,VVTK_Viewer,VisuGUI_ScalarBarDlg,1>(this);
 }
 
+void
+VisuGUI_Module::
+OnEditGaussPoints()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+    EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
+  }
+}
index 034c31ae68aba2021b48e41914a19db5ae3c5f03..25c665403740db20ee2eb21c0a553ee171e048c6 100644 (file)
@@ -86,6 +86,10 @@ protected slots:
   void
   OnCreateGaussPoints();
 
+  virtual
+  void
+  OnEditGaussPoints();
+
 protected:
   VISU::TViewerMap myViewerMap;
 };
index cdc0d8197c49818b185bee7878952f14a928587c..72f3d95ae8daa14bd0f92f39c2976dcbdd11ba52 100644 (file)
@@ -31,6 +31,8 @@
 
 #include "VisuGUI_ViewTools.h"
 
+#include <vtkRenderer.h>
+
 namespace VISU
 {
   class CutLines_i;
@@ -80,13 +82,12 @@ namespace VISU
     VISU::Result_var aResult;
     if (CheckResult(theModule,theTimeStamp,aResult)){
       QApplication::setOverrideCursor(Qt::waitCursor);
-      typedef typename TPrs3d_i::TInterface TPrs3d;
-      typename TPrs3d::_var_type aPrs3d =
-       GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
+      TPrs3d_i* aPrs3d =
+       GetVisuGen(theModule)->template CreatePrs3d<TPrs3d_i>
        (aResult,theMeshName,theEntity,theFieldName,theTimeId);
       QApplication::restoreOverrideCursor();
-      if (!CORBA::is_nil(aPrs3d.in()))
-       return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
+      if(aPrs3d)
+       return aPrs3d;
     }
     SUIT_MessageBox::warn1(GetDesktop(theModule),
                           QObject::tr("WRN_VISU"),
index 4606134bce3fa591e69b75e922ec4b656bd2a48e..a4f91d61cd546399d2e7d124e65c8b9ccdea5a56 100644 (file)
@@ -162,7 +162,7 @@ namespace VISU
     return aStr;
   }
 
-  //************************************************************
+  //------------------------------------------------------------
   // Selection
   CORBA::Object_var
   GetSelectedObj(const SalomeApp_Study* theStudy,
@@ -206,6 +206,25 @@ namespace VISU
     return CORBA::Object::_nil();
   }
 
+  VISU::Prs3d_i*
+  GetPrsToModify(const SalomeApp_Module* theModule,
+                Handle(SALOME_InteractiveObject)* theIO,
+                VISU::Storable::TRestoringMap* theMap)
+  {
+    if (CheckLock(GetCStudy(GetAppStudy(theModule))))
+      return NULL;
+    
+    CORBA::Object_var anObject = GetSelectedObj(theModule, theIO);
+    if (CORBA::is_nil(anObject)) 
+      return NULL;
+
+    PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+    if (!aServant.in()) 
+      return NULL;
+    
+    return dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+  }
+
   void
   Add(SalomeApp_SelectionMgr* theSelectionMgr,
       const Handle(SALOME_InteractiveObject)& theIO)
index 2af898e6bf4478c0da081d42a8add422b7d1f788..63a767f41f5d341bfdc591d39330bd9afd17fb15 100644 (file)
@@ -82,6 +82,9 @@ namespace VISU {
   CORBA::Object_var                    GetSelectedObj(const SalomeApp_Module* theModule,
                                                      Handle(SALOME_InteractiveObject)* theIO = NULL,
                                                      VISU::Storable::TRestoringMap* theMap = NULL);
+  VISU::Prs3d_i*                       GetPrsToModify(const SalomeApp_Module* theModule,
+                                                     Handle(SALOME_InteractiveObject)* theIO = NULL,
+                                                     VISU::Storable::TRestoringMap* theMap = NULL);
 
   void                                 Add(SalomeApp_SelectionMgr* theSelectionMgr,
                                           const Handle(SALOME_InteractiveObject)& theIO);