1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 #ifndef NewGeom_SalomeViewer_H
5 #define NewGeom_SalomeViewer_H
9 #include <ModuleBase_IViewer.h>
10 #include <ModuleBase_IViewWindow.h>
12 #include <V3d_View.hxx>
14 class SUIT_ViewWindow;
18 class NewGeom_OCCSelector;
19 class OCCViewer_Viewer;
20 class SUIT_ViewManager;
24 * A class for providing access of NewGeom functionality to
25 * SALOME view window functionality
27 class NewGeom_SalomeView: public ModuleBase_IViewWindow
31 /// \param theViewer a reference to a viewer
32 NewGeom_SalomeView(OCCViewer_Viewer* theViewer);
34 virtual Handle(V3d_View) v3dView() const;
36 /// Returns the view window view port
37 virtual QWidget* viewPort() const;
39 /// Set the current viewer
40 /// \param theViewer a viewer instance
41 void setViewer(OCCViewer_Viewer* theViewer) { myViewer = theViewer; }
43 /// Returns current viewer
44 OCCViewer_Viewer* viewer() const { return myViewer; }
46 /// Sets the current view
47 void setCurrentView(SUIT_ViewWindow* theView) { myCurrentView = theView; }
50 /// A reference to a viewer
51 OCCViewer_Viewer* myViewer;
52 SUIT_ViewWindow* myCurrentView;
58 * A class for providing access of NewGeom functionality to
59 * SALOME viewer functionality
61 class NewGeom_SalomeViewer : public ModuleBase_IViewer
66 /// \param theParent a parent object
67 NewGeom_SalomeViewer(QObject* theParent);
69 ~NewGeom_SalomeViewer();
71 //! Returns AIS_InteractiveContext from current OCCViewer
72 virtual Handle(AIS_InteractiveContext) AISContext() const;
74 //! Retrurns V3d_Vioewer from current viewer
75 virtual Handle(V3d_Viewer) v3dViewer() const;
77 //! Returns Vsd_View object from currently active view window
78 virtual Handle(V3d_View) activeView() const;
80 //! Enable or disable selection in the viewer
81 virtual void enableSelection(bool isEnabled);
83 //! Returns true if selection is enabled
84 virtual bool isSelectionEnabled() const;
86 //! Enable or disable multiselection in the viewer
87 virtual void enableMultiselection(bool isEnable);
89 //! Returns true if multiselection is enabled
90 virtual bool isMultiSelectionEnabled() const;
92 //! Perfroms the fit all for the active view
93 virtual void fitAll();
95 //! Sets the view projection
96 /// \param theX the X projection value
97 /// \param theY the Y projection value
98 /// \param theZ the Z projection value
99 virtual void setViewProjection(double theX, double theY, double theZ);
102 /// \param theSel a selector instance
103 void setSelector(NewGeom_OCCSelector* theSel);
105 /// Add selection filter to the viewer
106 virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
108 /// Remove selection filter from the viewer
109 virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
111 /// Remove all selection filters from the viewer
112 virtual void clearSelectionFilters();
114 /// Returns current selector
115 NewGeom_OCCSelector* selector() const
120 /// Update current viewer
121 virtual void update();
123 /// Method returns True if the viewer can process editing objects
124 /// by mouse drugging. If this is impossible thet it has to return False.
125 virtual bool canDragByMouse() const;
128 void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
129 void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
130 void onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*);
131 void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
132 void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
133 void onKeyRelease(SUIT_ViewWindow*, QKeyEvent*);
135 void onTryCloseView(SUIT_ViewWindow*);
136 void onDeleteView(SUIT_ViewWindow*);
137 void onViewCreated(SUIT_ViewWindow*);
138 void onActivated(SUIT_ViewWindow*);
140 void onSelectionChanged();
143 NewGeom_OCCSelector* mySelector;
144 NewGeom_SalomeView* myView;
145 bool myIsSelectionChanged;