]>
Commit | Line | Data |
---|---|---|
7fd59977 | 1 | // OCC_BaseView.h: interface for the OCC_BaseView class. |
2 | // | |
3 | ////////////////////////////////////////////////////////////////////// | |
4 | ||
5 | #if !defined(AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_) | |
6 | #define AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_ | |
7 | ||
8 | #if _MSC_VER > 1000 | |
9 | #pragma once | |
10 | #endif // _MSC_VER > 1000 | |
11 | ||
12 | #include <stdafx.h> | |
13 | ||
b12e1c7b | 14 | #include "OCC_BaseDoc.h" |
7ff18fb9 | 15 | #include "AIS_ViewController.hxx" |
b12e1c7b | 16 | |
7ff18fb9 | 17 | enum CurAction3d |
18 | { | |
19 | CurAction3d_Nothing, | |
20 | CurAction3d_DynamicZooming, | |
21 | CurAction3d_WindowZooming, | |
22 | CurAction3d_DynamicPanning, | |
23 | CurAction3d_GlobalPanning, | |
24 | CurAction3d_DynamicRotation | |
25 | }; | |
26 | ||
27 | class Standard_EXPORT OCC_BaseView : public CView, public AIS_ViewController | |
7fd59977 | 28 | { |
b12e1c7b | 29 | |
7fd59977 | 30 | public: |
b12e1c7b | 31 | |
7fd59977 | 32 | OCC_BaseView(); |
33 | virtual ~OCC_BaseView(); | |
7ff18fb9 | 34 | |
35 | //! Return the view. | |
36 | const Handle(V3d_View)& GetView() const { return myView; } | |
37 | ||
38 | void FitAll() { if ( !myView.IsNull() ) myView->FitAll(); myView->ZFitAll(); }; | |
39 | void Redraw() { if ( !myView.IsNull() ) myView->Redraw(); }; | |
40 | ||
41 | void SetZoom ( const Standard_Real& Coef ) { myView->SetZoom ( Coef ); }; | |
42 | ||
43 | //! Return the document. | |
b12e1c7b | 44 | OCC_BaseDoc* GetDocument(); |
45 | ||
7ff18fb9 | 46 | //! Request view redrawing. |
47 | void update3dView(); | |
48 | ||
49 | //! Flush events and redraw view. | |
50 | void redraw3dView(); | |
51 | ||
b12e1c7b | 52 | protected: |
b12e1c7b | 53 | |
7ff18fb9 | 54 | //! Handle view redraw. |
55 | virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx, | |
56 | const Handle(V3d_View)& theView) Standard_OVERRIDE; | |
57 | ||
58 | //! Callback called by handleMoveTo() on Selection in 3D Viewer. | |
59 | virtual void OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx, | |
60 | const Handle(V3d_View)& theView) Standard_OVERRIDE; | |
61 | ||
62 | //! Return interactive context. | |
63 | virtual const Handle(AIS_InteractiveContext)& GetAISContext() const; | |
b12e1c7b | 64 | |
65 | protected: | |
66 | ||
7ff18fb9 | 67 | //! Setup mouse gestures. |
68 | void defineMouseGestures(); | |
7fd59977 | 69 | |
7ff18fb9 | 70 | //! Get current action. |
71 | CurAction3d getCurrentAction() const { return myCurrentMode; } | |
72 | ||
73 | //! Set current action. | |
74 | void setCurrentAction (CurAction3d theAction) | |
75 | { | |
76 | myCurrentMode = theAction; | |
77 | defineMouseGestures(); | |
78 | } | |
79 | ||
80 | public: | |
81 | ||
82 | virtual BOOL PreCreateWindow (CREATESTRUCT& cs) Standard_OVERRIDE; | |
83 | virtual void PostNcDestroy() Standard_OVERRIDE; | |
84 | ||
85 | protected: | |
86 | ||
87 | Handle(V3d_View) myView; | |
88 | AIS_MouseGestureMap myDefaultGestures; | |
89 | Graphic3d_Vec2i myClickPos; | |
90 | Standard_Real myCurZoom; | |
91 | unsigned int myUpdateRequests; //!< counter for unhandled update requests | |
92 | ||
93 | private: | |
94 | ||
95 | CurAction3d myCurrentMode; | |
96 | ||
97 | // message map functions | |
98 | protected: | |
99 | DECLARE_MESSAGE_MAP() | |
100 | public: | |
101 | virtual void OnInitialUpdate() Standard_OVERRIDE; | |
102 | virtual void OnDraw (CDC* /*pDC*/) Standard_OVERRIDE; | |
103 | afx_msg void OnSize (UINT nType, int cx, int cy); | |
104 | afx_msg BOOL OnMouseWheel (UINT theFlags, short theDelta, CPoint thePoint); | |
105 | afx_msg void OnMouseMove (UINT theFlags, CPoint thePoint); | |
106 | afx_msg void OnMouseLeave(); | |
107 | afx_msg void OnLButtonDown (UINT theFlags, CPoint thePoint); | |
108 | afx_msg void OnLButtonUp (UINT theFlags, CPoint thePoint); | |
109 | afx_msg void OnMButtonDown (UINT theFlags, CPoint thePoint); | |
110 | afx_msg void OnMButtonUp (UINT theFlags, CPoint thePoint); | |
111 | afx_msg void OnRButtonDown (UINT theFlags, CPoint thePoint); | |
112 | afx_msg void OnRButtonUp (UINT theFlags, CPoint thePoint); | |
7fd59977 | 113 | }; |
114 | ||
115 | #endif // !defined(AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_) |