Salome HOME
Persistent problem of NewGeom in the Full SALOME application
[modules/shaper.git] / src / NewGeom / NewGeom_SalomeViewer.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3
4 #ifndef NewGeom_SalomeViewer_H
5 #define NewGeom_SalomeViewer_H
6
7 #include "NewGeom.h"
8
9 #include <ModuleBase_IViewer.h>
10 #include <ModuleBase_IViewWindow.h>
11
12 #include <V3d_View.hxx>
13
14 class SUIT_ViewWindow;
15 class QMouseEvent;
16 class QKeyEvent;
17
18 class NewGeom_OCCSelector;
19 class OCCViewer_Viewer;
20 class SUIT_ViewManager;
21
22
23 class NewGeom_SalomeView: public ModuleBase_IViewWindow
24 {
25 public:
26   NewGeom_SalomeView(OCCViewer_Viewer* theViewer) { myViewer = theViewer; }
27
28   virtual Handle(V3d_View) v3dView() const;
29
30   void setViewer(OCCViewer_Viewer* theViewer) { myViewer = theViewer; }
31   OCCViewer_Viewer* viewer() const { return myViewer; }
32
33 private:
34   OCCViewer_Viewer* myViewer;
35 };
36
37
38 class NewGeom_SalomeViewer : public ModuleBase_IViewer
39 {
40 Q_OBJECT
41  public:
42   NewGeom_SalomeViewer(QObject* theParent);
43
44   ~NewGeom_SalomeViewer();
45
46   //! Returns AIS_InteractiveContext from current OCCViewer
47   virtual Handle(AIS_InteractiveContext) AISContext() const;
48
49   //! Retrurns V3d_Vioewer from current viewer
50   virtual Handle(V3d_Viewer) v3dViewer() const;
51
52   //! Returns Vsd_View object from currently active view window
53   virtual Handle(V3d_View) activeView() const;
54
55   //! Enable or disable selection in the viewer
56   virtual void enableSelection(bool isEnabled);
57
58   //! Returns true if selection is enabled
59   virtual bool isSelectionEnabled() const;
60
61   //! Enable or disable multiselection in the viewer
62   virtual void enableMultiselection(bool isEnable);
63
64   //! Returns true if multiselection is enabled
65   virtual bool isMultiSelectionEnabled() const;
66
67   //! Perfroms the fit all for the active view
68   virtual void fitAll();
69
70   //! Sets the view projection
71   /// \param theX the X projection value
72   /// \param theY the Y projection value
73   /// \param theZ the Z projection value
74   virtual void setViewProjection(double theX, double theY, double theZ);
75
76   void setSelector(NewGeom_OCCSelector* theSel);
77
78   /// Add selection filter to the viewer
79   virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
80
81   /// Remove selection filter from the viewer
82   virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
83
84   /// Remove all selection filters from the viewer
85   virtual void clearSelectionFilters();
86
87   NewGeom_OCCSelector* selector() const
88   {
89     return mySelector;
90   }
91
92  private slots:
93   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
94   void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
95   void onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*);
96   void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
97   void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
98   void onKeyRelease(SUIT_ViewWindow*, QKeyEvent*);
99
100   void onTryCloseView(SUIT_ViewWindow*);
101   void onDeleteView(SUIT_ViewWindow*);
102   void onViewCreated(SUIT_ViewWindow*);
103   void onActivated(SUIT_ViewWindow*);
104
105   void onSelectionChanged();
106
107  private:
108   NewGeom_OCCSelector* mySelector;
109   NewGeom_SalomeView* myView;
110   bool myIsSelectionChanged;
111 };
112
113
114 #endif