0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[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 CViewer3dView : public CView
37 {
38 protected: // create from serialization only
39         CViewer3dView();
40         DECLARE_DYNCREATE(CViewer3dView)
41
42 public:
43   CViewer3dDoc* GetDocument();
44   void Redraw() {   myView->Redraw(); };
45   void InitButtons();
46   void Reset();
47   void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const;
48   void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
49   void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
50   void SetViewEye (const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
51   Quantity_Factor GetViewScale();
52   void SetViewScale (const Quantity_Factor Coef);
53   void FitAll() {   myView->FitAll();  myView->ZFitAll();  };
54
55
56 // Overrides
57         // ClassWizard generated virtual function overrides
58         //{{AFX_VIRTUAL(CViewer3dView)
59         public:
60         virtual void OnDraw(CDC* pDC);  // overridden to draw this view
61         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
62         virtual void OnInitialUpdate();
63         //}}AFX_VIRTUAL
64
65 // Implementation
66 public:
67         virtual ~CViewer3dView();
68 #ifdef _DEBUG
69         virtual void AssertValid() const;
70         virtual void Dump(CDumpContext& dc) const;
71 #endif
72
73   int scaleX;
74   int scaleY;
75   int scaleZ;
76
77 protected:
78
79 // Generated message map functions
80 protected:
81         //{{AFX_MSG(CViewer3dView)
82         afx_msg void OnBUTTONAxo();
83         afx_msg void OnBUTTONBack();
84         afx_msg void OnBUTTONBottom();
85         afx_msg void OnBUTTONFront();
86         afx_msg void OnBUTTONHlrOff();
87         afx_msg void OnBUTTONHlrOn();
88         afx_msg void OnBUTTONLeft();
89         afx_msg void OnBUTTONPan();
90         afx_msg void OnBUTTONPanGlo();
91         afx_msg void OnBUTTONReset();
92         afx_msg void OnBUTTONRight();
93         afx_msg void OnBUTTONRot();
94         afx_msg void OnBUTTONTop();
95         afx_msg void OnBUTTONZoomAll();
96         afx_msg void OnSize(UINT nType, int cx, int cy);
97         afx_msg void OnBUTTONZoomProg();
98         afx_msg void OnBUTTONZoomWin();
99         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
100   afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
101         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
102         afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
103         afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
104         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
105         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
106         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
107     afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
108         afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
109         afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
110         afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
111         afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
112         afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
113         afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
114         afx_msg void OnModifyChangeBackground();
115         afx_msg void OnDirectionalLight();
116         afx_msg void OnSpotLight();
117         afx_msg void OnPositionalLight();
118         afx_msg void OnAmbientLight();
119         afx_msg void OnZcueing();
120         afx_msg void OnScale();
121         afx_msg void OnZclipping();
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   Standard_Integer               myWidth;
141   Standard_Integer               myHeight;
142
143   Standard_Integer               NbActiveLights;
144   Standard_Boolean               myHlrModeIsOn;
145   Quantity_Factor                myCurZoom;
146   Handle(V3d_AmbientLight)       myCurrent_AmbientLight;
147   Handle(V3d_SpotLight)          myCurrent_SpotLight;
148   Handle(V3d_PositionalLight)    myCurrent_PositionalLight;
149   Handle(V3d_DirectionalLight)   myCurrent_DirectionalLight;
150   Handle(Graphic3d_ClipPlane)    myClippingPlane;
151   Handle(AIS_Shape)              myShape;
152
153 private:
154         enum LineStyle { Solid, Dot, ShortDash, LongDash, Default };
155         CPen*  m_Pen;
156     virtual void DrawRectangle (const Standard_Integer  MinX  ,
157                                                 const Standard_Integer  MinY  ,
158                                 const Standard_Integer  MaxX  ,
159                                                 const Standard_Integer  MaxY  ,
160                                                     const Standard_Boolean  Draw  ,
161                                 const LineStyle aLineStyle = Default  );
162         UINT myAxisKey;
163         UINT myScaleDirection;
164         void RedrawVisMode();
165
166 };
167
168 #ifndef _DEBUG  // debug version in Viewer3dView.cpp
169 inline CViewer3dDoc* CViewer3dView::GetDocument()
170    { return (CViewer3dDoc*)m_pDocument; }
171 #endif
172
173 /////////////////////////////////////////////////////////////////////////////
174
175 //{{AFX_INSERT_LOCATION}}
176 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
177
178 #endif // !defined(AFX_VIEWERVIEW_H__4EF39FBC_4EBB_11D1_8D67_0800369C8A03__INCLUDED_)