1 // OCC_BaseView.h: interface for the OCC_BaseView class.
3 //////////////////////////////////////////////////////////////////////
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_
10 #endif // _MSC_VER > 1000
14 #include "OCC_BaseDoc.h"
15 #include "AIS_ViewController.hxx"
20 CurAction3d_DynamicZooming,
21 CurAction3d_WindowZooming,
22 CurAction3d_DynamicPanning,
23 CurAction3d_GlobalPanning,
24 CurAction3d_DynamicRotation
27 class Standard_EXPORT OCC_BaseView : public CView, public AIS_ViewController
33 virtual ~OCC_BaseView();
36 const Handle(V3d_View)& GetView() const { return myView; }
38 void FitAll() { if ( !myView.IsNull() ) myView->FitAll(); myView->ZFitAll(); };
39 void Redraw() { if ( !myView.IsNull() ) myView->Redraw(); };
41 void SetZoom ( const Standard_Real& Coef ) { myView->SetZoom ( Coef ); };
43 //! Return the document.
44 OCC_BaseDoc* GetDocument();
46 //! Request view redrawing.
49 //! Flush events and redraw view.
54 //! Handle view redraw.
55 virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
56 const Handle(V3d_View)& theView) Standard_OVERRIDE;
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;
62 //! Return interactive context.
63 virtual const Handle(AIS_InteractiveContext)& GetAISContext() const;
67 //! Setup mouse gestures.
68 void defineMouseGestures();
70 //! Get current action.
71 CurAction3d getCurrentAction() const { return myCurrentMode; }
73 //! Set current action.
74 void setCurrentAction (CurAction3d theAction)
76 myCurrentMode = theAction;
77 defineMouseGestures();
82 virtual BOOL PreCreateWindow (CREATESTRUCT& cs) Standard_OVERRIDE;
83 virtual void PostNcDestroy() Standard_OVERRIDE;
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
95 CurAction3d myCurrentMode;
97 // message map functions
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);
115 #endif // !defined(AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_)