Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom into Dev_0.7.1
[modules/shaper.git] / src / NewGeom / NewGeom_SalomeViewer.h
index 8217e0146fb647b63b27f12a0ad024adefd2504f..0377ce7e06d17ed86a351dc1cd22a6b271d40b8e 100644 (file)
@@ -1,3 +1,4 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
 
 #ifndef NewGeom_SalomeViewer_H
@@ -5,20 +6,55 @@
 
 #include "NewGeom.h"
 
-#include <XGUI_SalomeViewer.h>
+#include <ModuleBase_IViewer.h>
+#include <ModuleBase_IViewWindow.h>
+
+#include <V3d_View.hxx>
 
 class SUIT_ViewWindow;
 class QMouseEvent;
 class QKeyEvent;
 
 class NewGeom_OCCSelector;
-
-class NewGeom_SalomeViewer: public XGUI_SalomeViewer
+class OCCViewer_Viewer;
+class SUIT_ViewManager;
+
+/**
+* A class for providing access of NewGeom functionality to 
+* SALOME view window functionality
+*/
+class NewGeom_SalomeView: public ModuleBase_IViewWindow
 {
-  Q_OBJECT
 public:
+  /// Constructor
+  /// \param theViewer a reference to a viewer
+  NewGeom_SalomeView(OCCViewer_Viewer* theViewer) { myViewer = theViewer; }
+
+  virtual Handle(V3d_View) v3dView() const;
+
+  void setViewer(OCCViewer_Viewer* theViewer) { myViewer = theViewer; }
+  OCCViewer_Viewer* viewer() const { return myViewer; }
+
+private:
+  /// A reference to a viewer
+  OCCViewer_Viewer* myViewer;
+};
+
+
+/**
+* A class for providing access of NewGeom functionality to 
+* SALOME viewer functionality
+*/
+class NewGeom_SalomeViewer : public ModuleBase_IViewer
+{
+Q_OBJECT
+ public:
+   /// Constructor
+   /// \param theParent a parent object
   NewGeom_SalomeViewer(QObject* theParent);
 
+  ~NewGeom_SalomeViewer();
+
   //! Returns AIS_InteractiveContext from current OCCViewer
   virtual Handle(AIS_InteractiveContext) AISContext() const;
 
@@ -43,11 +79,33 @@ public:
   //! Perfroms the fit all for the active view
   virtual void fitAll();
 
+  //! Sets the view projection
+  /// \param theX the X projection value
+  /// \param theY the Y projection value
+  /// \param theZ the Z projection value
+  virtual void setViewProjection(double theX, double theY, double theZ);
+
   void setSelector(NewGeom_OCCSelector* theSel);
 
-  NewGeom_OCCSelector* selector() const { return mySelector; }
+  /// Add selection filter to the viewer
+  virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
+
+  /// Remove selection filter from the viewer
+  virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
+
+  /// Remove all selection filters from the viewer
+  virtual void clearSelectionFilters();
+
+  NewGeom_OCCSelector* selector() const
+  {
+    return mySelector;
+  }
+
+  /// Update current viewer
+  virtual void update();
 
-private slots:
+
+ private slots:
   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
   void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
   void onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*);
@@ -55,10 +113,18 @@ private slots:
   void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
   void onKeyRelease(SUIT_ViewWindow*, QKeyEvent*);
 
+  void onTryCloseView(SUIT_ViewWindow*);
+  void onDeleteView(SUIT_ViewWindow*);
+  void onViewCreated(SUIT_ViewWindow*);
+  void onActivated(SUIT_ViewWindow*);
 
-private:
-  NewGeom_OCCSelector* mySelector;
+  void onSelectionChanged();
 
+ private:
+  NewGeom_OCCSelector* mySelector;
+  NewGeom_SalomeView* myView;
+  bool myIsSelectionChanged;
 };
 
+
 #endif