0024270: Port viewer3d mfc sample to new clipping
[occt.git] / samples / mfc / standard / 04_Viewer3d / src / Viewer3dView.h
1 // Viewer3dView.h : interface of the CViewer3dView class
2 //
3 /////////////////////////////////////////////////////////////////////////////
4
5 #if !defined(AFX_VIEWERVIEW_H__4EF39FBC_4EBB_11D1_8D67_0800369C8A03__INCLUDED_)
6 #define AFX_VIEWERVIEW_H__4EF39FBC_4EBB_11D1_8D67_0800369C8A03__INCLUDED_
7
8 #include <Viewer3dDoc.h>
9
10 #include <V3d_DirectionalLight.hxx>
11 #include <V3d_PositionalLight.hxx>
12 #include <V3d_AmbientLight.hxx>
13 #include <V3d_SpotLight.hxx>
14
15 #include <Graphic3d_ClipPlane.hxx>
16
17 #if _MSC_VER >= 1000
18 #pragma once
19 #endif // _MSC_VER >= 1000
20 enum View3D_CurrentAction { 
21   CurAction3d_Nothing,
22   CurAction3d_DynamicZooming,
23   CurAction3d_WindowZooming,
24   CurAction3d_DynamicPanning,
25   CurAction3d_GlobalPanning,
26   CurAction3d_DynamicRotation,
27   CurAction3d_BeginSpotLight,
28   CurAction3d_TargetSpotLight,
29   CurAction3d_EndSpotLight,
30   CurAction3d_BeginPositionalLight,
31   CurAction3d_BeginDirectionalLight,
32   CurAction3d_EndDirectionalLight
33 };
34
35 class CViewer3dView : public CView
36 {
37 protected: // create from serialization only
38         CViewer3dView();
39         DECLARE_DYNCREATE(CViewer3dView)
40
41 public:
42         CViewer3dDoc* GetDocument();
43         void Redraw() {   myView->Redraw(); };
44         void InitButtons();
45         void Reset();
46         void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
47         void CViewer3dView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc);
48         void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
49         void SetViewEye(const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
50         Quantity_Factor GetViewScale();
51         void SetViewScale(const Quantity_Factor Coef);
52         void FitAll() {   myView->FitAll();  myView->ZFitAll();  };
53
54
55 // Overrides
56         // ClassWizard generated virtual function overrides
57         //{{AFX_VIRTUAL(CViewer3dView)
58         public:
59         virtual void OnDraw(CDC* pDC);  // overridden to draw this view
60         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
61         virtual void OnInitialUpdate();
62         //}}AFX_VIRTUAL
63
64 // Implementation
65 public:
66         virtual ~CViewer3dView();
67 #ifdef _DEBUG
68         virtual void AssertValid() const;
69         virtual void Dump(CDumpContext& dc) const;
70 #endif
71
72   int scaleX;
73   int scaleY;
74   int scaleZ;
75
76 protected:
77
78 // Generated message map functions
79 protected:
80         //{{AFX_MSG(CViewer3dView)
81         afx_msg void OnBUTTONAxo();
82         afx_msg void OnBUTTONBack();
83         afx_msg void OnBUTTONBottom();
84         afx_msg void OnBUTTONFront();
85         afx_msg void OnBUTTONHlrOff();
86         afx_msg void OnBUTTONHlrOn();
87         afx_msg void OnBUTTONLeft();
88         afx_msg void OnBUTTONPan();
89         afx_msg void OnBUTTONPanGlo();
90         afx_msg void OnBUTTONReset();
91         afx_msg void OnBUTTONRight();
92         afx_msg void OnBUTTONRot();
93         afx_msg void OnBUTTONTop();
94         afx_msg void OnBUTTONZoomAll();
95         afx_msg void OnSize(UINT nType, int cx, int cy);
96         afx_msg void OnBUTTONZoomProg();
97         afx_msg void OnBUTTONZoomWin();
98         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
99   afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
100         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
101         afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
102         afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
103         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
104         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
105         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
106     afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
107         afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
108         afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
109         afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
110         afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
111         afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
112         afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
113         afx_msg void OnModifyChangeBackground();
114         afx_msg void OnDirectionalLight();
115         afx_msg void OnSpotLight();
116         afx_msg void OnPositionalLight();
117         afx_msg void OnAmbientLight();
118         afx_msg void OnZcueing();
119         afx_msg void OnScale();
120         afx_msg void OnZclipping();
121         afx_msg void OnShadingmodel();
122         afx_msg void OnAntialiasingonoff();
123         afx_msg void OnClearLights();
124         afx_msg void OnModelclipping();
125         afx_msg void OnOptionsTrihedronStaticTrihedron();
126         //}}AFX_MSG
127         DECLARE_MESSAGE_MAP()
128 private:
129         enum VisMode { VIS_WIREFRAME, VIS_SHADE, VIS_HLR };
130         VisMode                        myVisMode;
131         
132   Handle_V3d_View                myView;
133   Handle_Graphic3d_GraphicDriver myGraphicDriver;
134   View3D_CurrentAction           myCurrentMode;
135   Standard_Integer               myXmin;
136   Standard_Integer               myYmin;
137   Standard_Integer               myXmax;
138   Standard_Integer               myYmax;
139   Standard_Integer               myWidth;
140   Standard_Integer               myHeight;
141
142   Standard_Integer               NbActiveLights;
143   Standard_Boolean               myHlrModeIsOn;
144   Quantity_Factor                myCurZoom;
145   Handle(V3d_AmbientLight)       myCurrent_AmbientLight;
146   Handle(V3d_SpotLight)          myCurrent_SpotLight;
147   Handle(V3d_PositionalLight)    myCurrent_PositionalLight;
148   Handle(V3d_DirectionalLight)   myCurrent_DirectionalLight;
149   Handle(Graphic3d_ClipPlane)    myClippingPlane;
150   Handle(AIS_Shape)              myShape;
151
152 private:
153         enum LineStyle { Solid, Dot, ShortDash, LongDash, Default };
154         CPen*  m_Pen;
155     virtual void DrawRectangle (const Standard_Integer  MinX  ,
156                                                 const Standard_Integer  MinY  ,
157                                 const Standard_Integer  MaxX  ,
158                                                 const Standard_Integer  MaxY  ,
159                                                     const Standard_Boolean  Draw  ,
160                                 const LineStyle aLineStyle = Default  );
161         UINT myAxisKey;
162         UINT myScaleDirection;
163         void RedrawVisMode();
164
165 };
166
167 #ifndef _DEBUG  // debug version in Viewer3dView.cpp
168 inline CViewer3dDoc* CViewer3dView::GetDocument()
169    { return (CViewer3dDoc*)m_pDocument; }
170 #endif
171
172 /////////////////////////////////////////////////////////////////////////////
173
174 //{{AFX_INSERT_LOCATION}}
175 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
176
177 #endif // !defined(AFX_VIEWERVIEW_H__4EF39FBC_4EBB_11D1_8D67_0800369C8A03__INCLUDED_)