Salome HOME
IPAL9285,9292,9314
[modules/visu.git] / src / VISUGUI / VisuGUI.h
index 8af43519994a61cc36668b2fa4c8c1643179f7fd..10a62f2f037c73da6dddd98b64e0c1b42a283d6b 100644 (file)
-//  File      : VisuGUI.h
-//  Created   : Wed Aug 01 10:23:06 2001
-//  Author    : Laurent CORNABE & Hubert ROLLAND 
-//  Project   : SALOME
-//  Module    : VISUGUI
-//  Copyright : PRINCIPIA
+//  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
+//
+//
+//
+//  File   : VisuGUI.h
+//  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 <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkRenderWindowInteractor.h>
-#include <vtkWindowToImageFilter.h>
-#include <vtkTIFFWriter.h>
-#include <vtkActor.h>
-#include <vtkActor2D.h>
-#include <vtkActorCollection.h>
-#include <vtkActor2DCollection.h>
+#include "SalomeApp_Module.h"
 
-static QString filters[] = { "DAT Files (*.dat)",
-                       "Pressures Files (*.pre)",
-                       "Displacements Files (*.dis)",
-                       "Scalars Files (*.sca)",
-                       "Vectors Files (*.vec)",
-                       "Data Files (*.dat )",
-                       "Vtk Files (*.vtk )",
-                       "Med Files (*.med)",
-                       "Results Files (*.res )",
-                       "Print Files (*.tif)",
-                       "Plot Files (*.plt)",
-                       "Test Files (*.tst)" };
+#include "SALOME_InteractiveObject.hxx"
 
-typedef enum {SOLVER,DAT_FILE,VTK_FILE,RES_FILE,MED_FILE,SMESH_FILE,VISU_FILE,SCALAR_FILE,ERROR} result ;
+#include "VISUConfig.hh"
 
-enum RepresentType { POINTS, WIREFRAME, SURFACE, SHRINK };
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(VISU_Gen)
+#include CORBA_SERVER_HEADER(MED_Gen)
 
+class SUIT_Desktop;
 
+namespace VISU {
+  class Prs3d_i;
+}
 
-// ======================================================================
-//                             CLASS VIUSGUI
-// ======================================================================
-// 
-class VisuGUI : public QObject
+class VisuGUI: public SalomeApp_Module
 {
-  Q_OBJECT
-
-public :
-VisuGUI();       
-~VisuGUI();      
-
-// Methods PUBLIC for Visualization
-// 
- static SALOMEDS::Study_var GetCurrentStudy() { return myStudy; }
- static QAD_Study* GetGUICurrentStudy() { return myActiveStudy; }
- static VTKViewer_ViewFrame* GetVtkViewFrame();
- static SALOMEDS::StudyBuilder_var GetStudyBuilder() { return myStudyBuilder;}
- static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
-
- static vtkRenderer* GetRenderer(QAD_Study* theStudy);
-
-
-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 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    ClearViewer(QAD_Desktop* parent, vtkRenderer *ren, int TypeOfActor);
-static void    ShowTrihedron(bool Show);
-static void    ChangeViewer(QAD_Desktop* parent, vtkRenderer *ren, bool ScalarBar, int Type);
-
-static void    NewColor(VISU_Actor *Actor);
-static void    NewOutlineColor(VISU_Actor *Actor);
-static void    NewOpacity(VISU_Actor *Actor);
-static void    NewLinewidth(VISU_Actor *Actor);
-
-static void    ChangeScalarBar();
-static void    SetSweepingPreferences();
-static  VISU_Actor *ReferenceActor(QAD_Desktop* parent);
-
-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 );
-
-void    PrintRW(QString prFile, bool toPrinter);
-
-static         QString getVisuInputDir();
-static QString getVisuOutputDir();
-
-static VISU_Actor      *ActorSelected(QAD_Desktop* parent, bool InViewer, int *Mode);
-static VISU_Actor      *GetActorObjBrowser(SALOMEDS::SObject_var objVisu, vtkRenderer *ren);
-static VISU_Actor      *GetActor(QAD_Desktop* parent, Handle_SALOME_InteractiveObject IO, vtkRenderer *ren);
-
- static QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
+  Q_OBJECT;
+public:
 
+  VisuGUI();
+  virtual ~VisuGUI();
 
-VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
-bool IsDisplayed(VISU::Prs3d_i* thePrs);
-void ErasePrs(VISU::Prs3d_i* thePrs);
+  virtual void initialize( CAM_Application* );
+  virtual void windows( QMap<int, int>& ) const;
+  virtual void viewManagers( QStringList& ) const;
 
-VISU_Actor* GetActor(VISU::Prs3d_i* thePrs);
-static VISU::Prs3d_i* GetSelectedPrs();
-void RecreateActor(VISU::Prs3d_i* thePrs);
-static void CreateActor(VISU::Prs3d_i* thePrs);
+  virtual QString engineIOR() const;
 
-void VisuGUI::ChangeRepresentation(RepresentType theType);
-void DeletePresentation(VISU::Prs3d_i* thePrs);
+  virtual void  studyActivated();
 
-
-void   SetState(int aState );
-void   ResetState();
-void   EmitSignalDeactivateDialog();
-void   EmitSignalCloseAllDialogs();
-QDialog*       GetActiveDialogBox();
-void   SetActiveDialogBox(QDialog* aDlg);
-QAD_Study*     GetActiveStudy();
-QAD_Desktop*   GetDesktop();
-
-// ----------------------------------------
-// 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);
-
-Standard_EXPORT static bool APIreaderVTK (QString FileMesh, QString FileResultat);
-
-Standard_EXPORT static bool getObjectRef(QAD_Desktop* parent, SALOMEDS::SObject_ptr obj, 
-                                        _CORBA_ObjRef_OUT_arg< SALOMEDS::_objref_SObject, SALOMEDS::SObject_Helper > objres,
-                                        const char* Type);   
+  virtual void  contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle );
 
 public slots:
- void ImportTablesFromFile();
- void ImportFromFile();
- void ExportToFile();
- void CreateMesh();
- void CreateScalarMap();
- void CreateDeformedShape();
- void CreateVectors();
- void CreateIsoSurfaces();
- void CreateCutPlanes();
- void CreateStreamLines();
-
- void DisplayPrs();
- void DisplayOnlyPrs();
- void ErasePrs();
- void EditPrs();
- void EditScalarBar();
-
- void MakeWireframe();
- void MakeSurface();
- void MakePoints();
- void MakeShrink();
-
- void ChageColor();
- void ChangeOutlineColor();
- void ChangeOpacity();
- void ChangeLines();
-
- void ShowTable();
- 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();
+  virtual bool deactivateModule( SUIT_Study* );
+  virtual bool activateModule( SUIT_Study* );
+
+protected slots:
+  void OnImportFromFile();
+  void OnExploreMEDFile();
+  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 OnEditPrs();
+  //void OnDeletePrs();
+
+  void OnDisplayPrs();
+  void OnDisplayOnlyPrs();
+  void OnErasePrs();
+  void OnEraseAll();
+
+  void OnMakeSurfaceframe();
+  void OnMakeInsideframe();
+  void OnMakeWireframe();
+  void OnMakeSurface();
+  void OnMakePoints();
+  void OnMakeShrink();
+
+  void OnChangeColor();
+  void OnChangeWireframeColor();
+  void OnChangeOpacity();
+  void OnChangeLines();
+
+  void OnShowTable();
+  void OnCreateTable();
+  //void OnDeleteObject();
+  void OnDeleteObjects();
+  void OnPlotData();
+  void OnCurveProperties();
+  void OnClearContainer();
+  void OnEditContainer();
+
+  void OnMergeScalarBars();
+  void OnFreeScalarBars();
+
+  void OnSaveViewParams();
+  void OnRestoreViewParams();
+  //void OnDeleteViewParams();
+
+  void OnRename();
+  void OnClippingPlanes();
+  void OnSweep();
+  void OnTimeAnimation();
+  void OnShowAnimation();
+
+  void OnCopyPresentation();
+
+  void OnSelectionInfo();
+
+  void OnTranslatePrs();
+  void OnArrangeActors();
+
+  void OnScaling();
+  void OnCubeAxes();
 
 protected:
-  
- // Methods PROTECTED
- // 
-
-
- // Fields PROTECTED
- //
-
-private :
-  static VISU::VISU_Gen_var myComponent;
-  static SALOMEDS::Study_var myStudy;
-  static SALOMEDS::StudyBuilder_var myStudyBuilder;
-  static QAD_Desktop* myDesktop;
-  static QAD_Study*  myActiveStudy;
-       QDialog*                        myActiveDialogBox;
-       int                             myState ;
-       int                             myStudyId;
+  virtual SalomeApp_Selection* createSelection() const;
 
-signals:
-       void SignalDeactivateActiveDialog();
-       void SignalCloseAllDialogs();
+private:
+  void createActions();
+  void createMenus();
+  void createToolBars();
+  void createPopupMenus();
 };
 
 #endif