]> 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:15:15 +0000 (11:15 +0000)
committerapo <apo@opencascade.com>
Thu, 25 Aug 2005 11:15:15 +0000 (11:15 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISUGUI/VisuGUI_PopupTools.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h

index 6e66cf129dea91b95213da2ea7115bef21f5d639..0596d493adddd74705f83ac8d444325bf33e8487 100644 (file)
@@ -680,57 +680,119 @@ OnErasePrs()
   QApplication::restoreOverrideCursor();
 }
 
+
 void
 VisuGUI::
-OnEditPrs()
+OnEditScalarMap()
 {
-  if (CheckLock(GetCStudy(GetAppStudy(this))))
-    return;
-
   Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
+  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);
+    }
+  }
+}
 
-  VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-  if (!aPrs3d) return;
 
-  switch (aPrs3d->GetType()) {
-  case VISU::TMESH:
-    break;
-  case VISU::TSCALARMAP:
-    EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
-    break;
-  case VISU::TDEFORMEDSHAPE:
+void
+VisuGUI::
+OnEditDeformedShape()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
-    break;
-  case VISU::TCUTPLANES:
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
+  }
+}
+
+
+void
+VisuGUI::
+OnEditCutPlanes()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
-    break;
-  case VISU::TCUTLINES:
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
+  }
+}
+
+
+void
+VisuGUI::
+OnEditCutLines()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
-    break;
-  case VISU::TISOSURFACE:
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
+  }
+}
+
+
+void
+VisuGUI::
+OnEditIsoSurfaces()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
-    break;
-  case VISU::TVECTORS:
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
+  }
+}
+
+
+void
+VisuGUI::
+OnEditVectors()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
-    break;
-  case VISU::TSTREAMLINES:
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
+  }
+}
+
+
+void
+VisuGUI::
+OnEditStreamLines()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
-    break;
-  case VISU::TPLOT3D:
-    EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg>(this, aPrs3d);
-    break;
-  default:
-    return;
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
   }
+}
 
-  if (SVTK_ViewWindow* vw = GetViewWindow())
-    vw->highlight(anIO, 1);
+
+void
+VisuGUI::
+OnEditPlot3D()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+    EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg>(this, aPrs3d);
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+      aViewWindow->highlight(anIO, 1);
+    }
+  }
 }
 
+
 void
 VisuGUI::
 OnEraseAll()
@@ -2083,9 +2145,39 @@ createActions()
                 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
                 this, SLOT(OnChangeLines()));
 
-  createAction( VISU_EDIT_PRS, tr("MEN_EDIT_PRS"), QIconSet(),
+
+  createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIconSet(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditScalarMap()));
+
+  createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
-                this, SLOT(OnEditPrs()));
+                this, SLOT(OnEditDeformedShape()));
+
+  createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIconSet(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditCutPlanes()));
+
+  createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIconSet(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditCutLines()));
+
+  createAction( VISU_EDIT_ISOSURFACE, tr("MEN_EDIT_PRS"), QIconSet(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditIsoSurfaces()));
+
+  createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIconSet(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditVectors()));
+
+  createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIconSet(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditStreamLines()));
+
+  createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIconSet(),
+                tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+                this, SLOT(OnEditPlot3D()));
+
 
   createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(),
                 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
@@ -2234,7 +2326,14 @@ createPopupMenus()
   mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
 
   // edit
-  mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_ISOSURFACE ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
+  mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
   mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
 
   // rename
@@ -2414,8 +2513,22 @@ createPopupMenus()
   mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
   mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
 
-  aRule = "selcount=1 and $type in {" + aPrsAll + "}";
-  mgr->setRule( action( VISU_EDIT_PRS ), aRule, true );
+  mgr->setRule( action( VISU_EDIT_SCALARMAP ), 
+               "selcount=1 and type='VISU::TSCALARMAP'", true );
+  mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ), 
+               "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
+  mgr->setRule( action( VISU_EDIT_CUTPLANES ), 
+               "selcount=1 and type='VISU::TCUTPLANES'", true );
+  mgr->setRule( action( VISU_EDIT_CUTLINES ), 
+               "selcount=1 and type='VISU::TCUTLINES'", true );
+  mgr->setRule( action( VISU_EDIT_ISOSURFACE ), 
+               "selcount=1 and type='VISU::TISOSURFACE'", true );
+  mgr->setRule( action( VISU_EDIT_VECTORS ), 
+               "selcount=1 and type='VISU::TVECTORS'", true );
+  mgr->setRule( action( VISU_EDIT_STREAMLINES ), 
+               "selcount=1 and type='VISU::TSTREAMLINES'", true );
+  mgr->setRule( action( VISU_EDIT_PLOT3D ), 
+               "selcount=1 and type='VISU::TPLOT3D'", true );
 
   aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
   mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
index 3735c34057ee7c2044424de27100b58729c4d5fc..adef19954444de15e23e157886a71857040febf9 100644 (file)
@@ -76,7 +76,14 @@ protected slots:
   void OnCreateManyMesh();
   void OnCreatePlot2dView();
 
-  void OnEditPrs();
+  void OnEditScalarMap();
+  void OnEditDeformedShape();
+  void OnEditCutPlanes();
+  void OnEditCutLines();
+  void OnEditIsoSurfaces();
+  void OnEditVectors();
+  void OnEditStreamLines();
+  void OnEditPlot3D();
 
   void OnDisplayPrs();
   void OnDisplayOnlyPrs();
index c78ac716ba8d44765fd754f50a011548fc75f55b..0a795733c1da8441bf53c0234c8af0c9e4735ff2 100644 (file)
 #define VISU_OPACITY                4060
 #define VISU_LINE_WIDTH             4061
 
+#define VISU_EDIT_SCALARMAP         40620
+#define VISU_EDIT_DEFORMEDSHAPE     40621
+#define VISU_EDIT_CUTPLANES         40622
+#define VISU_EDIT_CUTLINES          40623
+#define VISU_EDIT_ISOSURFACE        40624
+#define VISU_EDIT_VECTORS           40625
+#define VISU_EDIT_STREAMLINES       40626
+#define VISU_EDIT_PLOT3D            40627
+
 #define VISU_EDIT_PRS               4062
 #define VISU_CREATE_TABLE           4063
 #define VISU_SWEEP                  4064
index a4143f84156588bec886b1f211d15cdf655fb881..837ba8afa79c8ed87f67f738bb821f179ec6effd 100644 (file)
@@ -62,48 +62,14 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const
 
 QString VisuGUI_Selection::type( const int ind ) const
 {
-  QString aTypeStr;
+  QString aResStr;
   VISU::Storable::TRestoringMap aMap;
-  CORBA::Object_var anObject = GetSelectedObj( study(), entry( ind ), &aMap );  
-
-  VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
-
-  if ( !CORBA::is_nil( aVisuObj ) ){
-    VISU::VISUType aType = aVisuObj->GetType();
-    switch (aType) {
-      ENUM2STRING( aTypeStr, VISU::TVISUGEN )
-      ENUM2STRING( aTypeStr, VISU::TRESULT )
-      ENUM2STRING( aTypeStr, VISU::TTABLE )
-      ENUM2STRING( aTypeStr, VISU::TCURVE )
-      ENUM2STRING( aTypeStr, VISU::TCONTAINER )
-      ENUM2STRING( aTypeStr, VISU::TMESH )
-      ENUM2STRING( aTypeStr, VISU::TSCALARMAP )
-      ENUM2STRING( aTypeStr, VISU::TISOSURFACE )
-      ENUM2STRING( aTypeStr, VISU::TDEFORMEDSHAPE )
-      ENUM2STRING( aTypeStr, VISU::TCUTPLANES )
-      ENUM2STRING( aTypeStr, VISU::TCUTLINES )
-      ENUM2STRING( aTypeStr, VISU::TVECTORS )
-      ENUM2STRING( aTypeStr, VISU::TSTREAMLINES )
-      ENUM2STRING( aTypeStr, VISU::TPLOT3D )
-      ENUM2STRING( aTypeStr, VISU::TANIMATION )
-    }
-  }
-  else{
-    bool isExist;
-    VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue( aMap, "myType", &isExist).toInt();
-    if( isExist ){
-      switch (aType) {
-       ENUM2STRING( aTypeStr, VISU::TENTITY )
-       ENUM2STRING( aTypeStr, VISU::TFAMILY )
-       ENUM2STRING( aTypeStr, VISU::TGROUP )
-       ENUM2STRING( aTypeStr, VISU::TVIEW3D )
-       ENUM2STRING( aTypeStr, VISU::TFIELD )
-       ENUM2STRING( aTypeStr, VISU::TTIMESTAMP )
-      }
-    }
-  }
-
-  return aTypeStr;
+  GetSelectedObj( study(), entry( ind ), &aMap );  
+  bool isExist;
+  const QString& aVal = VISU::Storable::FindValue(aMap,"myComment",&isExist);
+  if ( isExist )
+    aResStr = "VISU::T" + aVal;
+  return aResStr;
 }
 
 QString VisuGUI_Selection::nbComponents( const int ind ) const
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);