Salome HOME
Copyright update 2020
[modules/med.git] / src / MEDCalc / gui / PresentationController.hxx
index 19384c52f96104c10852da7310325b2f32f07fba..b040335a123c22da375982b565d2b0a9bbb0db6a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016  CEA/DEN, EDF R&D
+// Copyright (C) 2016-2020  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #ifndef PRESENTATION_CONTROLLER_HXX
 #define PRESENTATION_CONTROLLER_HXX
 
-#include <QtGui>
+#include "MEDEventListener_i.hxx"
+
+#include <QObject>
 #include "MEDCALCGUI.hxx"
 
-#include "MEDEventListener_i.hxx"
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(MEDPresentationManager)
 #include CORBA_CLIENT_HEADER(MEDDataManager)
 #include <SALOME_AppStudyEditor.hxx>
 #include "WidgetPresentationParameters.hxx"
 
-typedef struct {
-  enum EventType {
-    EVENT_VIEW_OBJECT_CONTOUR,
-    EVENT_VIEW_OBJECT_DEFLECTION_SHAPE,
-    EVENT_VIEW_OBJECT_POINT_SPRITE,
-    EVENT_VIEW_OBJECT_SCALAR_MAP,
-    EVENT_VIEW_OBJECT_SLICES,
-    EVENT_VIEW_OBJECT_VECTOR_FIELD
-  };
-  int eventtype;
-  XmedDataObject* objectdata;
-  QString objectalias;
-} PresentationEvent;
+#include "PresentationEvent.hxx"
 
 class MEDModule;
+class QDockWidget;
+class MEDWidgetHelper;
+class XmedConsoleDriver;
 
 class MEDCALCGUI_EXPORT PresentationController : public QObject {
   Q_OBJECT
@@ -57,30 +49,67 @@ public:
 
   void createActions();
 
-  MEDCALC::MEDPresentationViewMode getSelectedViewMode();
-  MEDCALC::MEDPresentationColorMap getSelectedColorMap();
+  MEDCALC::ViewModeType getSelectedViewMode() const;
+  MEDCALC::ColorMapType getSelectedColorMap() const;
+  MEDCALC::ScalarBarRangeType getSelectedScalarBarRange() const;
+
+  void showDockWidgets(bool isVisible);
+
+  std::string getPresTypeFromWidgetHelper(int presId) const;
+
+  void setConsoleDriver(XmedConsoleDriver* driver) { _consoleDriver = driver; };
 
 signals:
   void presentationSignal(const PresentationEvent*);
 
 protected slots:
-  void OnVisualizeScalarMap();
-  void OnVisualizeContour();
-  void OnVisualizeVectorField();
-  void OnVisualizeSlices();
-  void OnVisualizeDeflectionShape();
-  void OnVisualizePointSprite();
+  void onVisualizeMeshView();
+  void onVisualizeScalarMap();
+  void onVisualizeContour();
+  void onVisualizeVectorField();
+  void onVisualizeSlices();
+  void onVisualizeDeflectionShape();
+  void onVisualizePointSprite();
+
+  void onDeletePresentation();
+  void onParavisDump();
+
+  void onPresentationSelected(int presId, const QString& presType, const QString& presName);
+
   void processWorkspaceEvent(const MEDCALC::MedEvent*);
+  void processPresentationEvent(const PresentationEvent*);
 
 private:
   void visualize(PresentationEvent::EventType);
-  void updateTreeViewWithNewPresentation(long, long);
+  void updateTreeViewWithNewPresentation(long dataId, long presentationId);
+  void updateTreeViewForPresentationRemoval(long presId);
   std::string _getIconName(const std::string&);
+  MEDWidgetHelper * findOrCreateWidgetHelper(MEDCALC::MEDPresentationManager_ptr presManager,
+                                             int presId, const std::string& type, const std::string& name);
+
+  QString getViewModePython() const;
+  QString getColorMapPython() const;
+  QString getScalarBarRangePython() const;
+  QString getMeshModePython(const int mode) const;
+  QString getSliceOrientationPython(const int orient) const;
+
+  void _dealWithReplaceMode();
 
 private:
   MEDModule* _salomeModule;
+  XmedConsoleDriver* _consoleDriver;   // the same as in WorkspaceController
   SALOME_AppStudyEditor* _studyEditor; // borrowed to MEDModule
+
+  QDockWidget *_dockWidget;
   WidgetPresentationParameters* _widgetPresentationParameters;
+
+  // GUI needs to talk directly to the pres manager to activate a view, get some params, print low level py dump, etc ...:
+  static MEDCALC::MEDPresentationManager_ptr _presManager;
+
+  // Key: presentation ID, value MEDPresentationHelper *
+  std::map<int, MEDWidgetHelper *> _presHelperMap;
+
+  MEDWidgetHelper * _currentWidgetHelper;
 };
 
 #endif /* PRESENTATION_CONTROLLER_HXX */