Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISUGUI / VisuGUI_Tools.h
index 4e8a5630eda6f4fa13e619ef27d0943db23344b0..3f36c793a6b84df9a6df761feca81280e182f9cc 100644 (file)
 
 #include "VISUConfig.hh"
 
+#include "SalomeApp_Module.h"
+#include "SalomeApp_Application.h"
+
 #include "SALOMEDSClient_Study.hxx"
 
 #include "SALOMEconfig.h"
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(VISU_Gen)
 #include CORBA_SERVER_HEADER(MED_Gen)
 
 class SUIT_Desktop;
@@ -44,9 +45,10 @@ class SUIT_ViewWindow;
 class VISU_Actor;
 class SVTK_ViewWindow;
 class SPlot2d_Viewer;
+class SPlot2d_Curve;
+class Plot2d_ViewFrame;
 class CAM_Module;
-class SalomeApp_Module;
-class SalomeApp_SelectionMgr;
+class LightApp_SelectionMgr;
 class SalomeApp_Study;
 
 namespace VISU {
@@ -61,31 +63,34 @@ namespace VISU {
   SUIT_Desktop*                        GetDesktop(const CAM_Module* theModule);
   SalomeApp_Study*                     GetAppStudy(const CAM_Module* theModule);
   _PTR(Study)                          GetCStudy(const SalomeApp_Study* theStudy);
-  SALOMEDS::StudyManager_var           GetStudyManager();
 
   bool                                 IsStudyLocked( _PTR(Study) theStudy );
   bool                                 CheckLock( _PTR(Study) theStudy );
 
+  inline void                          UpdateObjBrowser(SalomeApp_Module* theModule,
+                                                       bool updateDataModel = true);
+
   VISU_Gen_i*                          GetVisuGen(const CAM_Module* theModule);
   SALOME_MED::MED_Gen_var              GetMEDEngine();
 
-  VISU::Storable::TRestoringMap        getMapOfValue(SALOMEDS::SObject_var theSObject);
   VISU::Storable::TRestoringMap        getMapOfValue(_PTR(SObject) theSObject);
-  QString                              getValue(SALOMEDS::SObject_var theSObject, QString theKey);
   QString                              getValue(_PTR(SObject) theSObject, QString theKey);
 
   // Selection
-  SalomeApp_SelectionMgr*              GetSelectionMgr(const SalomeApp_Module* theModule);
+  LightApp_SelectionMgr*               GetSelectionMgr(const SalomeApp_Module* theModule);
   CORBA::Object_var                    GetSelectedObj(const SalomeApp_Study* theStudy,
                                                      const QString& theEntry,
                                                      VISU::Storable::TRestoringMap* theMap = NULL);
   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,
+  void                                 Add(LightApp_SelectionMgr* theSelectionMgr,
                                           const Handle(SALOME_InteractiveObject)& theIO);
-  void                                 Remove(SalomeApp_SelectionMgr* theSelectionMgr,
+  void                                 Remove(LightApp_SelectionMgr* theSelectionMgr,
                                              const Handle(SALOME_InteractiveObject)& theIO);
 
   bool                                 IsRemovableSelected(const SalomeApp_Module* theModule);
@@ -95,8 +100,8 @@ namespace VISU {
                                                CORBA::Object_ptr theObject,
                                                bool theUpdate = true);
   void                                 DeleteSObject(SalomeApp_Module* theModule,
-                                                    SALOMEDS::Study_ptr theStudy,
-                                                    SALOMEDS::SObject_ptr theSObject);
+                                                    _PTR(Study)       theStudy,
+                                                    _PTR(SObject)     theSObject);
   void                                 DeletePrs3d(SalomeApp_Module* theModule,
                                                   VISU::Prs3d_i* thePrs,
                                                   const Handle(SALOME_InteractiveObject)& theIO);
@@ -107,12 +112,14 @@ namespace VISU {
   void ChangeRepresentation (const SalomeApp_Module* theModule,
                             VISU::PresentationType  theType);
 
+  void SetShading ( const SalomeApp_Module* theModule, bool theOn = true );
+
   // SObject type
   bool                                 CheckTimeStamp(const SalomeApp_Module* theModule,
-                                                     SALOMEDS::SObject_var& theSObject,
+                                                     _PTR(SObject)&          theSObject,
                                                      Handle(SALOME_InteractiveObject)* theIO = NULL);
   VISU::Result_i*                      CheckResult(const SalomeApp_Module* theModule,
-                                                  SALOMEDS::SObject_var theSource,
+                                                  _PTR(SObject) theSource,
                                                   VISU::Result_var& theResult);
   inline bool                          IsSObjectTable(_PTR(SObject) theSObject);
 
@@ -132,6 +139,14 @@ namespace VISU {
                                                    VISU::Prs3d_i* thePrs,
                                                    bool theDispOnly = false);
 
+  /*!
+   * \brief Repaint all SVTK view windows, where the given object is displayed.
+   * \param theModule  - is used to access application.
+   * \param theIObject - is supposed to be selected (is highlighted in this method).
+   */
+  void                                 RepaintViewWindows(const SalomeApp_Module* theModule,
+                                                         const Handle(SALOME_InteractiveObject)& theIObject);
+
   VISU_Actor*                          FindActor(SVTK_ViewWindow* theViewWindow,
                                                 const char* theEntry);
   VISU_Actor*                          FindActor(SVTK_ViewWindow* theViewWindow,
@@ -139,6 +154,17 @@ namespace VISU {
   void                                 RecreateActor(const SalomeApp_Module* theModule,
                                                     VISU::Prs3d_i* thePrs);
 
+  /*!
+   * \brief Advanced FitAll, sets view projection in accordance with current view contents
+   *
+   * If common bounding box of all actors in \a theViewWindow has
+   * at least one small side, then corresponding projection will be set
+   * (Top, Left or Front), else 3D projection will be used.
+   *
+   * \param theViewWindow - the view to perform FitAll in.
+   */
+  void                                 SetFitAll(SVTK_ViewWindow* theViewWindow);
+
   // Plot2d View
   SPlot2d_Viewer*                      GetPlot2dViewer(const SalomeApp_Module* theModule,
                                                       const bool theCreate = false);
@@ -154,6 +180,12 @@ namespace VISU {
   void                                 CreatePlot( SalomeApp_Module* theModule,
                                                   _PTR(SObject) theSobj );
 
+  void                                 UpdateCurve( VISU::Curve_i*,
+                                                   Plot2d_ViewFrame* frame,
+                                                   SPlot2d_Curve*,
+                                                   int theDisplaying );
+  //parameter frame may be 0, in this case there is only update without display/erase 
+
   // Others
   void CreateMesh (const SalomeApp_Module* theModule,
                   const Handle(SALOME_InteractiveObject)& theIO);
@@ -161,7 +193,7 @@ namespace VISU {
   std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
                                            const Handle(SALOME_InteractiveObject)& theIO);
   std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
-                                           SALOMEDS::SObject_ptr theObject);
+                                           _PTR(SObject) theObject);
 }
 
 bool VISU::IsSObjectTable( _PTR(SObject) theSObject )
@@ -176,4 +208,11 @@ bool VISU::IsSObjectTable( _PTR(SObject) theSObject )
   return false;
 }
 
+void VISU::UpdateObjBrowser(SalomeApp_Module* theModule,
+                           bool updateDataModel)
+{
+  theModule->updateObjBrowser(updateDataModel);
+  theModule->getApp()->updateActions();
+}
+
 #endif