0032709: Samples, MFC - remove samples Viewer2d, Viewer3d, Ocaf, Triangulation, Anima...
[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 #include <Graphic3d_GraphicDriver.hxx>
15
16 #include <Graphic3d_ClipPlane.hxx>
17
18 #if _MSC_VER >= 1000
19 #pragma once
20 #endif // _MSC_VER >= 1000
21 enum View3D_CurrentAction { 
22   CurAction3d_Nothing,
23   CurAction3d_DynamicZooming,
24   CurAction3d_WindowZooming,
25   CurAction3d_DynamicPanning,
26   CurAction3d_GlobalPanning,
27   CurAction3d_DynamicRotation,
28   CurAction3d_BeginSpotLight,
29   CurAction3d_TargetSpotLight,
30   CurAction3d_EndSpotLight,
31   CurAction3d_BeginPositionalLight,
32   CurAction3d_BeginDirectionalLight,
33   CurAction3d_EndDirectionalLight
34 };
35
36 class AIS_RubberBand;
37
38 class CViewer3dView : public CView
39 {
40 protected: // create from serialization only
41         CViewer3dView();
42         DECLARE_DYNCREATE(CViewer3dView)
43
44 public:
45   CViewer3dDoc* GetDocument();
46   void Redraw() {   myView->Redraw(); };
47   void InitButtons();
48   void Reset();
49   void GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const;
50   void SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ);
51   void GetViewEye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
52   void SetViewEye (const Standard_Real X,const Standard_Real Y,const Standard_Real Z);
53   Standard_Real GetViewScale();
54   void SetViewScale (const Standard_Real Coef);
55   void FitAll() {   myView->FitAll();  myView->ZFitAll();  };
56
57
58 // Overrides
59         // ClassWizard generated virtual function overrides
60         //{{AFX_VIRTUAL(CViewer3dView)
61         public:
62         virtual void OnDraw(CDC* pDC);  // overridden to draw this view
63         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
64         virtual void OnInitialUpdate();
65         //}}AFX_VIRTUAL
66
67 // Implementation
68 public:
69         virtual ~CViewer3dView();
70 #ifdef _DEBUG
71         virtual void AssertValid() const;
72         virtual void Dump(CDumpContext& dc) const;
73 #endif
74
75   int scaleX;
76   int scaleY;
77   int scaleZ;
78
79 protected:
80
81 // Generated message map functions
82 protected:
83         //{{AFX_MSG(CViewer3dView)
84         afx_msg void OnBUTTONAxo();
85         afx_msg void OnBUTTONBack();
86         afx_msg void OnBUTTONBottom();
87         afx_msg void OnBUTTONFront();
88         afx_msg void OnBUTTONHlrOff();
89         afx_msg void OnBUTTONHlrOn();
90         afx_msg void OnBUTTONLeft();
91         afx_msg void OnBUTTONPan();
92         afx_msg void OnBUTTONPanGlo();
93         afx_msg void OnBUTTONReset();
94         afx_msg void OnBUTTONRight();
95         afx_msg void OnBUTTONRot();
96         afx_msg void OnBUTTONTop();
97         afx_msg void OnBUTTONZoomAll();
98         afx_msg void OnSize(UINT nType, int cx, int cy);
99         afx_msg void OnBUTTONZoomProg();
100         afx_msg void OnBUTTONZoomWin();
101         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
102   afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
103         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
104         afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
105         afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
106         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
107         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
108         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
109     afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
110         afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
111         afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
112         afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
113         afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
114         afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
115         afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
116         afx_msg void OnModifyChangeBackground();
117         afx_msg void OnDirectionalLight();
118         afx_msg void OnSpotLight();
119         afx_msg void OnPositionalLight();
120         afx_msg void OnAmbientLight();
121         afx_msg void OnScale();
122         afx_msg void OnShadingmodel();
123         afx_msg void OnAntialiasingonoff();
124         afx_msg void OnClearLights();
125         afx_msg void OnModelclipping();
126         afx_msg void OnOptionsTrihedronStaticTrihedron();
127         //}}AFX_MSG
128         DECLARE_MESSAGE_MAP()
129 private:
130         enum VisMode { VIS_WIREFRAME, VIS_SHADE, VIS_HLR };
131         VisMode                        myVisMode;
132         
133   Handle(V3d_View)                myView;
134   Handle(Graphic3d_GraphicDriver) myGraphicDriver;
135   View3D_CurrentAction           myCurrentMode;
136   Standard_Integer               myXmin;
137   Standard_Integer               myYmin;
138   Standard_Integer               myXmax;
139   Standard_Integer               myYmax;
140
141   Standard_Integer               NbActiveLights;
142   Standard_Boolean               myHlrModeIsOn;
143   Standard_Real                  myCurZoom;
144   Handle(V3d_AmbientLight)       myCurrent_AmbientLight;
145   Handle(V3d_SpotLight)          myCurrent_SpotLight;
146   Handle(V3d_PositionalLight)    myCurrent_PositionalLight;
147   Handle(V3d_DirectionalLight)   myCurrent_DirectionalLight;
148   Handle(Graphic3d_ClipPlane)    myClippingPlane;
149   Handle(AIS_Shape)              myShape;
150   Handle(AIS_RubberBand)         myRect; //!< Rubber rectangle for selection
151
152 private:
153
154         void DrawRectangle (Standard_Integer theMinX, Standard_Integer theMinY, Standard_Integer theMaxX, Standard_Integer theMaxY,
155                         Standard_Boolean theToDraw, Aspect_TypeOfLine theLineType = Aspect_TOL_SOLID);
156
157         UINT myAxisKey;
158         UINT myScaleDirection;
159         void RedrawVisMode();
160
161 };
162
163 #ifndef _DEBUG  // debug version in Viewer3dView.cpp
164 inline CViewer3dDoc* CViewer3dView::GetDocument()
165    { return (CViewer3dDoc*)m_pDocument; }
166 #endif
167
168 /////////////////////////////////////////////////////////////////////////////
169
170 //{{AFX_INSERT_LOCATION}}
171 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
172
173 #endif // !defined(AFX_VIEWERVIEW_H__4EF39FBC_4EBB_11D1_8D67_0800369C8A03__INCLUDED_)