0024001: Stereographic rendering support
[occt.git] / samples / mfc / standard / Common / OCC_3dView.h
1 // OCC_3dView.h: interface for the OCC_3dView class.
2 //
3 //////////////////////////////////////////////////////////////////////
4
5 #if !defined(AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_)
6 #define AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_
7
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
11
12 #include "OCC_BaseView.h"
13 #include "OCC_3dDoc.h"
14 #include "OCC_StereoConfigDlg.h"
15 #include <Standard_Macro.hxx>
16
17 enum CurAction3d { 
18   CurAction3d_Nothing,
19   CurAction3d_DynamicZooming,
20   CurAction3d_WindowZooming,
21   CurAction3d_DynamicPanning,
22   CurAction3d_GlobalPanning,
23   CurAction3d_DynamicRotation
24 };
25
26 class AFX_EXT_CLASS OCC_3dView : public OCC_BaseView  
27 {
28         DECLARE_DYNCREATE(OCC_3dView)
29 public:
30         OCC_3dView();
31         virtual ~OCC_3dView();
32
33         OCC_3dDoc* GetDocument();
34         void FitAll() {   if ( !myView.IsNull() ) myView->FitAll();  myView->ZFitAll(); };
35         void Redraw() {   if ( !myView.IsNull() ) myView->Redraw(); };
36
37         void SetZoom ( const Quantity_Factor& Coef  ) {   myView->SetZoom ( Coef  );  };
38
39   Handle_V3d_View& GetView() { return myView; }
40 // Overrides
41         // ClassWizard generated virtual function overrides
42         //{{AFX_VIRTUAL(OCC_3dView)
43 public:
44         virtual void OnDraw(CDC* pDC);  // overridden to draw this view
45         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
46         virtual void OnInitialUpdate();
47         //}}AFX_VIRTUAL
48
49 // Generated message map functions
50 protected:
51         //{{AFX_MSG(OCC_3dView)
52         afx_msg void OnBUTTONAxo();
53         afx_msg void OnBUTTONBack();
54         afx_msg void OnBUTTONBottom();
55         afx_msg void OnBUTTONFront();
56         afx_msg void OnBUTTONHlrOff();
57         afx_msg void OnBUTTONHlrOn();
58         afx_msg void OnBUTTONLeft();
59         afx_msg void OnBUTTONPan();
60         afx_msg void OnBUTTONPanGlo();
61         afx_msg void OnBUTTONReset();
62         afx_msg void OnBUTTONRight();
63         afx_msg void OnBUTTONRot();
64         afx_msg void OnBUTTONTop();
65         afx_msg void OnBUTTONZoomAll();
66     afx_msg void OnFileExportImage();
67         afx_msg void OnSize(UINT nType, int cx, int cy);
68         afx_msg void OnBUTTONZoomProg();
69         afx_msg void OnBUTTONZoomWin();
70         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
71         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
72         afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
73         afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
74         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
75         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
76         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
77         afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
78         afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
79         afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
80         afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
81         afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
82         afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
83         afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
84         afx_msg void OnModifyChangeBackground();
85   afx_msg void OnStereoConfigButton();
86   afx_msg void OnUpdateStereoConfigButton (CCmdUI* theCmdUI);
87         //}}AFX_MSG
88         DECLARE_MESSAGE_MAP()
89
90 #ifdef _DEBUG
91         virtual void AssertValid() const;
92         virtual void Dump(CDumpContext& dc) const;
93 #endif
94
95 protected:
96
97   Handle_V3d_View  myView;
98   CurAction3d      myCurrentMode;
99   Standard_Integer myXmin;
100   Standard_Integer myYmin;
101   Standard_Integer myXmax;
102   Standard_Integer myYmax;
103   Quantity_Factor  myCurZoom;
104   Standard_Integer myWidth;
105   Standard_Integer myHeight;
106   Standard_Boolean myHlrModeIsOn;
107
108         enum LineStyle { Solid, Dot, ShortDash, LongDash, Default };
109         CPen*  m_Pen;
110
111     virtual void DrawRectangle (const Standard_Integer  MinX  ,
112                                                 const Standard_Integer  MinY  ,
113                                 const Standard_Integer  MaxX  ,
114                                                 const Standard_Integer  MaxY  ,
115                                                     const Standard_Boolean  Draw  ,
116                                 const LineStyle aLineStyle = Default  );
117
118 private:
119
120   //! Persistent non blocking stereo configuration dialog
121   OCC_StereoConfigDlg* m_pStereoDlg;
122 };
123
124 #ifndef _DEBUG  // debug version in OCC_3dView.cpp
125 inline OCC_3dDoc* OCC_3dView::GetDocument()
126    { return (OCC_3dDoc*)m_pDocument; }
127 #endif
128
129 #endif // !defined(AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_)