Version: 6.3.1

src/VISUGUI/VisuGUI_Tools.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  VISU VISUGUI : GUI of VISU component
00024 //  File   : VisuGUI_Tools.h
00025 //  Author : Sergey Anikin
00026 //  Module : VISU
00027 //
00028 #ifndef VisuGUI_Tools_HeaderFile
00029 #define VisuGUI_Tools_HeaderFile
00030 
00031 #include "SALOME_InteractiveObject.hxx"
00032 
00033 #include "VISUConfig.hh"
00034 #include "VISU_ColoredPrs3d_i.hh"
00035 
00036 #include "SALOMEDSClient_Study.hxx"
00037 
00038 #include "SALOMEconfig.h"
00039 #include CORBA_SERVER_HEADER(MED_Gen)
00040 
00041 class QWidget;
00042 class QDialog;
00043 class QSpinBox;
00044 class QDoubleSpinBox;
00045 
00046 class SUIT_Desktop;
00047 class SUIT_ViewWindow;
00048 class VISU_Actor;
00049 class SVTK_ViewWindow;
00050 class SPlot2d_Viewer;
00051 class SPlot2d_Curve;
00052 class Plot2d_ViewFrame;
00053 class CAM_Module;
00054 class LightApp_SelectionMgr;
00055 class SalomeApp_DoubleSpinBox;
00056 class SalomeApp_IntSpinBox;
00057 class SalomeApp_Module;
00058 class SalomeApp_Study;
00059 class VisuGUI;
00060 
00061 #include <vector>
00062 #include <utility>
00063 #include "VISU_Mesh_i.hh"
00064 
00065 namespace VISU 
00066 {
00067   class Base_i;
00068   class Prs3d_i;
00069   class Result_i;
00070   class Table_i;
00071   class Curve_i;
00072   class Container_i;
00073 
00074   typedef std::vector<SVTK_ViewWindow*> TViewWindows;
00075 
00076   //----------------------------------------------------------------------------
00077   SUIT_Desktop*                        GetDesktop(const CAM_Module* theModule);
00078   SalomeApp_Study*                     GetAppStudy(const CAM_Module* theModule);
00079   _PTR(Study)                          GetCStudy(const SalomeApp_Study* theStudy);
00080 
00081   bool                                 IsStudyLocked( _PTR(Study) theStudy );
00082   bool                                 CheckLock( _PTR(Study) theStudy,
00083                                                   QWidget* theWidget );
00084 
00085   //----------------------------------------------------------------------------
00086   int                                  runAndWait( QDialog* dlg, const bool modal );
00087 
00088   void                                 UpdateObjBrowser(SalomeApp_Module* theModule,
00089                                                         bool theIsUpdateDataModel = true,
00090                                                         _PTR(SObject) theSObject = _PTR(SObject)());
00091 
00092   //----------------------------------------------------------------------------
00093   VISU_Gen_i*                          GetVisuGen(const CAM_Module* theModule);
00094   SALOME_MED::MED_Gen_var              GetMEDEngine();
00095 
00096   // Selection
00097   LightApp_SelectionMgr*               GetSelectionMgr(const SalomeApp_Module* theModule);
00098 
00099   //----------------------------------------------------------------------------
00100   struct TObjectInfo
00101   {
00102     Base_i* myBase;
00103     _PTR(SObject) mySObject;
00104     TObjectInfo():
00105       myBase(NULL)
00106     {}
00107   };
00108 
00109   struct TSelectionItem
00110   {
00111     TObjectInfo myObjectInfo;
00112     Handle(SALOME_InteractiveObject) myIO;
00113   };
00114 
00115   typedef std::vector<TSelectionItem>  TSelectionInfo;
00116 
00117   TSelectionInfo                       GetSelectedObjects(const SalomeApp_Module* theModule);
00118 
00119   TObjectInfo                          GetObjectByEntry(const SalomeApp_Study* theStudy,
00120                                                         const std::string& theEntry);
00121   
00122   VISU::Prs3d_i*                       GetPrs3dToModify(const SalomeApp_Module* theModule,
00123                                                         Base_i* theBase);
00124 
00125   VISU::Prs3d_i*                       GetPrs3dFromBase(Base_i* theBase);
00126 
00127   bool                                 GetPrs3dSelectionInfo( const SalomeApp_Module* theModule,
00128                                                               VISU::Prs3d_i*& thePrs3d,
00129                                                               SVTK_ViewWindow*& theViewWindow,
00130                                                               VISU_Actor*& thenActor );
00131 
00132   //----------------------------------------------------------------------------
00133   void                                 Add(LightApp_SelectionMgr* theSelectionMgr,
00134                                            const Handle(SALOME_InteractiveObject)& theIO);
00135   void                                 Remove(LightApp_SelectionMgr* theSelectionMgr,
00136                                               const Handle(SALOME_InteractiveObject)& theIO);
00137 
00138   bool                                 IsRemovable        (const std::string theEntry,
00139                                                            const SalomeApp_Module* theModule);
00140   bool                                 IsRemovableSelected(const SalomeApp_Module* theModule);
00141 
00142   void                                 DeleteSObject(VisuGUI* theModule,
00143                                                      _PTR(Study)       theStudy,
00144                                                      _PTR(SObject)     theSObject);
00145   void                                 DeletePrs3d(VisuGUI* theModule,
00146                                                    VISU::Prs3d_i* thePrs);
00147 
00148   // Presentation management
00149   void ChangeRepresentation (const SalomeApp_Module* theModule,
00150                              VISU::PresentationType  theType);
00151 
00152 
00153   void ChangeQuadratic2DRepresentation (const SalomeApp_Module* theModule,
00154                                         VISU::Quadratic2DPresentationType  theType);
00155   
00156 
00157 
00158   void SetShading ( const SalomeApp_Module* theModule, bool theOn = true );
00159 
00160   // SObject type
00161   bool                                 CheckTimeStamp(const SalomeApp_Module* theModule,
00162                                                       _PTR(SObject)&          theSObject,
00163                                                       Handle(SALOME_InteractiveObject)& theIO,
00164                                                       ColoredPrs3d_i::EPublishInStudyMode& thePublishInStudyMode);
00165   VISU::Result_i*                      CheckResult(const SalomeApp_Module* theModule,
00166                                                    _PTR(SObject) theSource,
00167                                                    VISU::Result_var& theResult);
00168   bool                                 IsSObjectTable(_PTR(SObject) theSObject);
00169 
00172   VISU_Actor*                          PublishMeshInView(const SalomeApp_Module* theModule,
00173                                                          VISU::Prs3d_i* thePrs,
00174                                                          SVTK_ViewWindow* theViewWindow);
00175 
00181   void                                 RepaintViewWindows(const SalomeApp_Module* theModule,
00182                                                           const Handle(SALOME_InteractiveObject)& theIObject);
00183 
00184   VISU_Actor*                          FindActor(const SalomeApp_Study* theStudy,
00185                                                  SVTK_ViewWindow* theViewWindow,
00186                                                  const QString& theEntry);
00187   VISU_ActorBase*                      FindActorBase(const SalomeApp_Study* theStudy,
00188                                                      SVTK_ViewWindow* theViewWindow,
00189                                                      const QString& theEntry);
00190   void                                 RecreateActor(const SalomeApp_Module* theModule,
00191                                                      VISU::Prs3d_i* thePrs);
00192 
00193   bool                                 ComputeVisiblePropBounds(SVTK_ViewWindow* theViewWindow,
00194                                                                 vtkFloatingPointType allBounds[6], 
00195                                                                 const char* theActorClassName = "VISU_Actor");
00196 
00206   void                                 SetFitAll(SVTK_ViewWindow* theViewWindow);
00207 
00208   // Plot2d View
00209   SPlot2d_Viewer*                      GetPlot2dViewer(const SalomeApp_Module* theModule,
00210                                                        const bool theCreate = false);
00211   void                                 PlotTable( const SalomeApp_Module* theModule,
00212                                                   VISU::Table_i* table,
00213                                                   int theDisplaying );
00214   void                                 PlotCurve( const SalomeApp_Module* theModule,
00215                                                   VISU::Curve_i* curve,
00216                                                   int theDisplaying );
00217   void                                 PlotRemoveCurve(const SalomeApp_Module* theModule,
00218                                                        VISU::Curve_i* curve);
00219   void                                 PlotContainer( const SalomeApp_Module* theModule,
00220                                                       VISU::Container_i* container,
00221                                                       int theDisplaying );
00222   void                                 CreatePlot( SalomeApp_Module* theModule,
00223                                                    _PTR(SObject) theSobj );
00224 
00228   VISU::Mesh_i* CreateMesh(VisuGUI* theModule,
00229                            const Handle(SALOME_InteractiveObject)& theIO,
00230                            SVTK_ViewWindow* theViewWindow);
00231   
00232   // Others
00233   std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
00234                                             const Handle(SALOME_InteractiveObject)& theIO,
00235                                             bool theGP = false);
00236   std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
00237                                             _PTR(SObject) theObject,
00238                                             bool theGP = false);
00239   
00240   int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow);
00241   void AddScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
00242                             VISU::Prs3d_i* thePrs3d, int pos);
00243   void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
00244                                VISU::Prs3d_i* thePrs3d);
00245 
00246 #define CLIP_PLANES_FOLDER "Clipping Planes"
00247 
00248   bool getClippingPlanesFolder(_PTR(Study) theStudy, _PTR(SObject)& theSObject);
00249 
00250   void initSpinBox( SalomeApp_IntSpinBox*, const int, const int, const int );
00251   void initSpinBox( SalomeApp_DoubleSpinBox*, const double&, const double&, const double&, const char* );
00252 }
00253 
00254 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS