Salome HOME
- plot curves
[modules/visu.git] / src / VISUGUI / VisuGUI_Tools.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : VisuGUI_Tools.h
25 //  Author : Sergey Anikin 
26 //  Module : VISU
27
28 #ifndef VisuGUI_Tools_HeaderFile
29 #define VisuGUI_Tools_HeaderFile
30
31 #include "SALOME_InteractiveObject.hxx"
32
33 #include "VISUConfig.hh"
34
35 #include "SALOMEDSClient_Study.hxx"
36
37 #include "SALOMEconfig.h"
38 #include CORBA_SERVER_HEADER(SALOMEDS)
39 #include CORBA_SERVER_HEADER(VISU_Gen)
40 #include CORBA_SERVER_HEADER(MED_Gen)
41
42 class SUIT_Desktop;
43 class VISU_Actor;
44 class SVTK_ViewWindow;
45 class SPlot2d_Viewer;
46 class CAM_Module;
47 class SalomeApp_Module;
48 class SalomeApp_SelectionMgr;
49 class SalomeApp_Study;
50
51 namespace VISU{
52   class Prs3d_i;
53   class Result_i;
54   class Table_i;
55   class Curve_i;
56   class Container_i;
57
58   typedef std::vector<SVTK_ViewWindow*> TViewWindows;
59
60   SUIT_Desktop*                        GetDesktop(const CAM_Module* theModule);
61   SalomeApp_SelectionMgr*              GetSelectionMgr(const SalomeApp_Module* theModule);
62   SalomeApp_Study*                     GetAppStudy(const CAM_Module* theModule);
63   _PTR(Study)                          GetCStudy(const SalomeApp_Study* theStudy);
64   bool                                 IsStudyLocked( _PTR(Study) theStudy );
65   bool                                 CheckLock( _PTR(Study) theStudy );
66   VISU::Storable::TRestoringMap        getMapOfValue(SALOMEDS::SObject_var theSObject);
67   VISU::Storable::TRestoringMap        getMapOfValue(_PTR(SObject) theSObject);
68   QString                              getValue(SALOMEDS::SObject_var theSObject, QString theKey);
69   QString                              getValue(_PTR(SObject) theSObject, QString theKey);
70   SVTK_ViewWindow*                     GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate = false );
71   SVTK_ViewWindow*                     GetViewWindow();
72   VISU_Actor*                          PublishInView(const SalomeApp_Module* theModule,
73                                                      VISU::Prs3d_i* thePrs);
74   VISU_Actor*                          UpdateViewer(const SalomeApp_Module* theModule,
75                                                     VISU::Prs3d_i* thePrs, 
76                                                     bool theDispOnly = false);
77
78   VISU_Actor*                          FindActor(SVTK_ViewWindow* theViewWindow,
79                                                  const char* theEntry);
80   VISU_Actor*                          FindActor(SVTK_ViewWindow* theViewWindow,
81                                                  VISU::Prs3d_i* thePrs);
82   void                                 RecreateActor(const SalomeApp_Module* theModule,
83                                                      VISU::Prs3d_i* thePrs);
84
85   void                                 Add(SalomeApp_SelectionMgr* theSelectionMgr,
86                                            const Handle(SALOME_InteractiveObject)& theIO);
87   void                                 Remove(SalomeApp_SelectionMgr* theSelectionMgr,
88                                               const Handle(SALOME_InteractiveObject)& theIO);
89
90   SALOMEDS::StudyManager_var           GetStudyManager();
91   VISU_Gen_i*                          GetVisuGen(const CAM_Module* theModule);
92   SALOME_MED::MED_Gen_var              GetMEDEngine();
93   CORBA::Object_var                    GetSelectedObj(const SalomeApp_Study* theStudy,
94                                                       const QString& theEntry, 
95                                                       VISU::Storable::TRestoringMap* theMap = NULL);
96   CORBA::Object_var                    GetSelectedObj(const SalomeApp_Module* theModule,
97                                                       Handle(SALOME_InteractiveObject)* theIO = NULL, 
98                                                       VISU::Storable::TRestoringMap* theMap = NULL);
99   bool                                 CheckTimeStamp(const SalomeApp_Module* theModule,
100                                                       SALOMEDS::SObject_var& theSObject,
101                                                       Handle(SALOME_InteractiveObject)* theIO = NULL);
102   inline bool                          IsSObjectTable(_PTR(SObject) theSObject);
103   VISU::Result_i*                      CheckResult(const SalomeApp_Module* theModule,
104                                                    SALOMEDS::SObject_var theSource, 
105                                                    VISU::Result_var& theResult);
106   TViewWindows                         GetViews(const SalomeApp_Module* theModule);
107   void                                 DeletePrs3d(SalomeApp_Module* theModule,
108                                                    VISU::Prs3d_i* thePrs,
109                                                    const Handle(SALOME_InteractiveObject)& theIO);
110   void                                 ErasePrs3d(SalomeApp_Module* theModule,
111                                                   VISU::Prs3d_i* thePrs);
112
113   SPlot2d_Viewer*                      GetPlot2dViewer(const SalomeApp_Module* theModule, const bool theCreate = false);
114   void                                 PlotTable( const SalomeApp_Module* theModule, 
115                                                   VISU::Table_i* table, 
116                                                   int theDisplaying );
117   void                                 PlotCurve( const SalomeApp_Module* theModule, 
118                                                   VISU::Curve_i* curve, 
119                                                   int theDisplaying );
120   void                                 PlotContainer( const SalomeApp_Module* theModule, 
121                                                       VISU::Container_i* container, 
122                                                       int theDisplaying );
123   void                                 CreatePlot( SalomeApp_Module* theModule,
124                                                    _PTR(SObject) theSobj );
125 }
126
127 bool VISU::IsSObjectTable( _PTR(SObject) theSObject )
128 {
129   if( theSObject ) {
130     _PTR(GenericAttribute) anAttr;
131     if(theSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ))
132       return true;
133     if(theSObject->FindAttribute( anAttr, "AttributeTableOfReal" ))
134       return true;
135   }  
136   return false;
137 }
138
139 #endif