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