Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISUGUI / VisuGUI.h
index ad52d84ff17eacbe2e8988b8cce73d29720b52ba..cec1e4c2ef98d53d1e59067e99b7e29ce265b8c4 100644 (file)
 //  VISU VISUGUI : GUI of VISU component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : VisuGUI.h
-//  Author : Laurent CORNABE & Hubert ROLLAND 
+//  Author : Laurent CORNABE & Hubert ROLLAND
 //  Module : VISU
 //  $Header$
 
 #ifndef VisuGUI_HeaderFile
 #define VisuGUI_HeaderFile
 
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(VISU_Gen)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-#include "QAD_Desktop.h"
-#include "VISU_Actor.h"
-#include "VISU_PrsObject_i.hh"
-#include "VISU_Table_i.hh"
-#include "VISU_ViewManager_i.hh"
-
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SalomeApp_Module.h"
 
-class vtkRenderer;
+#include <map>
+#include <set>
 
-enum RepresentType { POINTS, WIREFRAME, SURFACE, SHRINK };
+class SUIT_ViewManager;
+class SVTK_ViewWindow;
+class Prs3d_i;
 
+namespace VISU{
+typedef std::pair<Prs3d_i*,int> TPrs3dToInd; // prs pointer and default index of scalar bar placement
+typedef std::set<TPrs3dToInd> TSetPrs3d;
+typedef std::map<SVTK_ViewWindow*,TSetPrs3d> TViewToPrs3d;
+}
 
-
-// ======================================================================
-//                             CLASS VIUSGUI
-// ======================================================================
-// 
-class VisuGUI : public QObject{
+class VisuGUI: public SalomeApp_Module
+{
   Q_OBJECT;
- public:
-  VisuGUI();     
-  ~VisuGUI();    
-
-  static VISU::VISU_Gen_i* GetVisuGen();
-
-  static QAD_Desktop* GetDesktop();
-  static QAD_Study* GetActiveStudy();
-  static vtkRenderer* GetRenderer();
-  static VTKViewer_ViewFrame* GetVtkViewFrame();
-  static SALOMEDS::Study_var GetStudyDocument();
-  static SALOMEDS::StudyBuilder_var NewBuilder();
-  static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
-
-  static  VisuGUI* GetOrCreateVisuGUI(QAD_Desktop* desktop);
-  static  VisuGUI* GetVisuGUI() ;
-
-  static VISU::Result_i*  CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult);
-
-  bool CreateScalarMap(SALOMEDS::SObject_var theField);
-  static VISU::ScalarMap_i* CreateScalarMapPrs(SALOMEDS::SObject_var theField, 
-                                              const char* theMeshName, VISU::Entity theEntity, 
-                                              const char* theFieldName, double theTimeId);
-  bool CreateDeformedShape(SALOMEDS::SObject_var theField);
-  static VISU::DeformedShape_i* CreateDeformedShapePrs(SALOMEDS::SObject_var theField, 
-                                                      const char* theMeshName, VISU::Entity theEntity, 
-                                                      const char* theFieldName, double theTimeId);
-  bool CreateVectors(SALOMEDS::SObject_var theField);
-  static VISU::Vectors_i* CreateVectorsPrs(SALOMEDS::SObject_var theField, 
-                                          const char* theMeshName, VISU::Entity theEntity, 
-                                          const char* theFieldName, double theTimeId);
-  bool CreateIsoSurfaces(SALOMEDS::SObject_var theField);
-  static VISU::IsoSurfaces_i* CreateIsoSurfacesPrs(SALOMEDS::SObject_var theField, 
-                                                  const char* theMeshName, VISU::Entity theEntity, 
-                                                  const char* theFieldName, double theTimeId);
-  bool CreateCutPlanes(SALOMEDS::SObject_var theField);
-  static VISU::CutPlanes_i* CreateCutPlanesPrs(SALOMEDS::SObject_var theField, 
-                                              const char* theMeshName, VISU::Entity theEntity, 
-                                              const char* theFieldName, double theTimeId);
-  bool CreateCutLines(SALOMEDS::SObject_var theField);
-  static VISU::CutLines_i* CreateCutLinesPrs(SALOMEDS::SObject_var theField, 
-                                            const char* theMeshName, VISU::Entity theEntity, 
-                                            const char* theFieldName, double theTimeId);
-  bool CreateStreamLines(SALOMEDS::SObject_var theField);
-  static VISU::StreamLines_i* CreateStreamLinesPrs(SALOMEDS::SObject_var theField, 
-                                                  const char* theMeshName, VISU::Entity theEntity, 
-                                                  const char* theFieldName, double theTimeId);
-  bool TestObjectBrowser(SALOMEDS::SObject_var& objVisu);
-  
-  static void ShowTrihedron(bool Show);
-  static void ChangeViewer(int theType);
-            
-  static void NewColor(VISU_Actor *Actor);
-  static void NewOutlineColor(VISUMesh_Actor *Actor);
-  static void NewOpacity(VISU_Actor *Actor);
-  static void NewLinewidth(VISU_Actor *Actor);
-            
-  static void ChangeScalarBar();
-  static void SetSweepingPreferences();
-            
-  static void  PlotTable( VISU::Table_i* table, int theDisplaying );
-  static void  PlotCurve( VISU::Curve_i* curve, int theDisplaying );
-  static void  PlotContainer( VISU::Container_i* container, int theDisplaying );
-  
-  static QString getVisuInputDir();
-  static QString getVisuOutputDir();
-  
-  static QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
-  static int checkHomoSelection();
-  
-  VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
-  bool IsDisplayed(VISU::Prs3d_i* thePrs);
-  void ErasePrs(VISU::Prs3d_i* thePrs);
-  
-  static VISU::Prs3d_i* GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO = NULL);
-  void RecreateActor(VISU::Prs3d_i* thePrs);
-  static void CreateActor(VISU::Prs3d_i* thePrs);
-  static VISU_Actor *GetActor(int* theSelectionType = NULL);
-  static VISU_Actor* GetActor(VISU::Prs3d_i* thePrs, VTKViewer_ViewFrame* theViewFrame = NULL);
-  
-  void VisuGUI::ChangeRepresentation(RepresentType theType);
-  void DeletePresentation(VISU::Prs3d_i* thePrs);
-  
-  void         SetState(int aState );
-  void         ResetState();
-  void         EmitSignalDeactivateDialog();
-  void         EmitSignalCloseAllDialogs();
-  QDialog*     GetActiveDialogBox();
-  void         SetActiveDialogBox(QDialog* aDlg);
-  
-// ----------------------------------------
-// All method of standard EXPORT
-// ----------------------------------------
-  Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
-  Standard_EXPORT static bool setSettings(QAD_Desktop* parent);
-  Standard_EXPORT static void DefinePopup(QString & theContext,
-                                         QString & theParent, 
-                                         QString & theObject ) ;
-  Standard_EXPORT static bool CustomPopup(QAD_Desktop* parent,
-                                         QPopupMenu* popup,
-                                         const QString & theContext,
-                                         const QString & theParent,
-                                         const QString & theObject);
-  Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
-  Standard_EXPORT static bool OnMousePress(QMouseEvent* pe ,
-                                          QAD_Desktop* parent, 
-                                          QAD_StudyFrame* studyFrame);
-  Standard_EXPORT static bool OnMouseMove(QMouseEvent* pe ,
-                                         QAD_Desktop* parent, 
-                                         QAD_StudyFrame* studyFrame);
-  Standard_EXPORT static bool OnKeyPress(QKeyEvent* pe,
-                                        QAD_Desktop* parent,
-                                        QAD_StudyFrame* studyFrame);
-  public slots:
-  void ImportTablesFromFile();
-  void ImportFromFile();
-  void ExportToFile();
-  void CreateMesh();
-  void CreateScalarMap();
-  void CreateDeformedShape();
-  void CreateVectors();
-  void CreateIsoSurfaces();
-  void CreateCutPlanes();
-  void CreateCutLines();
-  void CreateStreamLines();
-  void CreateManyMesh();
-  
-  void DisplayPrs();
-  void DisplayOnlyPrs();
-  void ErasePrs();
-  void EditPrs();
-  void EditScalarBar();
-  void DisplayManyPrs();
-  void EraseManyPrs();
-  
-  void MakeWireframe();
-  void MakeSurface();
-  void MakePoints();
-  void MakeShrink();
-  
-  void ChageColor();
-  void ChangeOutlineColor();
-  void ChangeOpacity();
-  void ChangeLines();
-  
-  void ShowTable();
-  void CreateTable();
-  void PlotData();
-  void CurveProperties();
-  void ClearContainer();
-  
-  void SaveViewParams();
-  void RestoreViewParams();
-  
-  void DeletePrs();
-  void Rename();
-  void Sweep();
-  void TimeAnimation();
-  
-  void ImportMedField();
-  //void ImportMedMesh();
-  
-  void DeleteViewParams();
-  void CopyPresentation();
-
-  void InfoOnPoint();
-  void InfoOnCell();
-  void SelectPoint();
-  void SelectCell();
 
-private :
-  QDialog* myActiveDialogBox;
-  int myState ;
-  
-signals:
-  void SignalDeactivateActiveDialog();
-  void SignalCloseAllDialogs();
+public:
+
+  VisuGUI();
+  virtual ~VisuGUI();
+
+  virtual LightApp_Displayer*    displayer();
+  virtual void initialize( CAM_Application* );
+  virtual void windows( QMap<int, int>& ) const;
+  virtual void viewManagers( QStringList& ) const;
+
+  virtual QString engineIOR() const;
+
+  virtual void  studyActivated();
+
+  virtual void  contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle );
+
+  virtual void createPreferences();
+  virtual void preferencesChanged( const QString&, const QString& );
+
+  virtual
+  SUIT_ViewManager*
+  getViewManager(const QString& theType, 
+                const bool theIsCreate);
+
+  VISU::TViewToPrs3d getScalarBarsMap();
+  VISU::TViewToPrs3d myScalarBarsMap;
+  
+public slots:
+  virtual bool deactivateModule( SUIT_Study* );
+  virtual bool activateModule( SUIT_Study* );
+
+protected slots:
+  void OnImportFromFile();
+  void OnImportTableFromFile();
+  void OnExportTableToFile();
+  void OnImportMedField();
+
+  void OnCreateMesh();
+  void OnCreateScalarMap();
+  void OnCreateDeformedShape();
+  void OnCreateVectors();
+  void OnCreateIsoSurfaces();
+  void OnCreateCutPlanes();
+  void OnCreateCutLines();
+  void OnCreateStreamLines();
+  void OnCreatePlot3D();
+  void OnCreateManyMesh();
+  void OnCreatePlot2dView();
+  void OnCreateScalarMapOnDeformedShape();
+
+  void OnEditScalarMap();
+  void OnEditDeformedShape();
+  void OnEditCutPlanes();
+  void OnEditCutLines();
+  void OnEditIsoSurfaces();
+  void OnEditVectors();
+  void OnEditStreamLines();
+  void OnEditPlot3D();
+  void OnEditScalarMapOnDeformedShape();
+
+  virtual void OnDisplayPrs();
+  virtual void OnDisplayOnlyPrs();
+  virtual void OnErasePrs();
+  virtual void OnEraseAll();
+
+  void OnMakeSurfaceframe();
+  void OnMakeInsideframe();
+  void OnMakeWireframe();
+  void OnMakeSurface();
+  void OnMakePoints();
+  void OnMakeShrink();
+
+  void OnSetShadingOn();
+  void OnSetShadingOff();
+
+  void OnChangeColor();
+  void OnChangeWireframeColor();
+  void OnChangeOpacity();
+  void OnChangeLines();
+
+  void OnShowTable();
+  void OnCreateTable();
+  void OnDeleteObjects();
+  void OnPlotData();
+  void OnCurveProperties();
+  void OnClearContainer();
+  void OnEditContainer();
+
+  void OnMergeScalarBars();
+  void OnFreeScalarBars();
+
+  virtual void OnSaveViewParams();
+  virtual void OnRestoreViewParams();
+
+  void OnRename();
+  void OnClippingPlanes();
+  void OnSweep();
+  void OnTimeAnimation();
+  void OnShowAnimation();
+
+  void OnCopyPresentation();
+
+  void OnSelectionInfo();
+
+  void OnTranslatePrs();
+  void OnArrangeActors();
+
+protected:
+  virtual LightApp_Selection* createSelection() const;
+
+private:
+  void createActions();
+  void createMenus();
+  void createToolBars();
+  void createPopupMenus();
+
+private:
+  LightApp_Displayer*  myDisplayer;
 };
 
 #endif