1 // OCCDemoView.h : interface of the COCCDemoView class
2 //
3 /////////////////////////////////////////////////////////////////////////////
4 
5 #if !defined(AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)
6 #define AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_
7 
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
11 
12 enum View3D_CurrentAction {
13   CurAction3d_Nothing,
14   CurAction3d_DynamicZooming,
15   CurAction3d_WindowZooming,
16   CurAction3d_DynamicPanning,
17   CurAction3d_GlobalPanning,
18   CurAction3d_DynamicRotation
19 };
20 
21 class AIS_RubberBand;
22 
23 class COCCDemoView : public CView
24 {
25 protected: // create from serialization only
26 	COCCDemoView();
27 	DECLARE_DYNCREATE(COCCDemoView)
28 
29 // Attributes
30 public:
31   COCCDemoDoc* GetDocument();
FitAll()32   void FitAll()
33   {
34     myView->FitAll();
35     myView->ZFitAll();
36   };
37   void GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const;
38   void SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ);
39   void GetViewEye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
40   void SetViewEye (const Standard_Real X,const Standard_Real Y,const Standard_Real Z);
41   Standard_Real GetViewScale();
42   void SetViewScale(const Standard_Real Coef);
43   void Translate (const Standard_Real theX, const Standard_Real theY);
44 
45 
46 // Operations
47 public:
48   void InitButtons();
49   void Reset();
50 
51 // Overrides
52 	// ClassWizard generated virtual function overrides
53 	//{{AFX_VIRTUAL(COCCDemoView)
54 	public:
55 	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
56 	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
57 	virtual void OnInitialUpdate();
58 	protected:
59 	//}}AFX_VIRTUAL
60 
61 // Implementation
62 public:
63 	virtual ~COCCDemoView();
64 #ifdef _DEBUG
65 	virtual void AssertValid() const;
66 	virtual void Dump(CDumpContext& dc) const;
67 #endif
68 
69 protected:
70 
71 // Generated message map functions
72 protected:
73 	//{{AFX_MSG(COCCDemoView)
74 	afx_msg void OnBUTTONAxo();
75 	afx_msg void OnBUTTONBack();
76 	afx_msg void OnBUTTONBottom();
77 	afx_msg void OnBUTTONFront();
78 	afx_msg void OnBUTTONHlrOn();
79 	afx_msg void OnBUTTONLeft();
80 	afx_msg void OnBUTTONPan();
81 	afx_msg void OnBUTTONPanGlo();
82 	afx_msg void OnBUTTONReset();
83 	afx_msg void OnBUTTONRight();
84 	afx_msg void OnBUTTONRot();
85 	afx_msg void OnBUTTONTop();
86 	afx_msg void OnBUTTONZoomAll();
87 	afx_msg void OnSize(UINT nType, int cx, int cy);
88 	afx_msg void OnBUTTONZoomProg();
89 	afx_msg void OnBUTTONZoomWin();
90 	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
91 	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
92 	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
93 	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
94 	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
95 	afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
96 	afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
97 	afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
98 	afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
99 	afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
100 	afx_msg void OnBUTTONWire();
101 	afx_msg void OnBUTTONShade();
102 	afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
103 	afx_msg void OnUpdateBUTTONShade(CCmdUI* pCmdUI);
104 	afx_msg void OnUpdateBUTTONWire(CCmdUI* pCmdUI);
105 	//}}AFX_MSG
106 	DECLARE_MESSAGE_MAP()
107 
108 private:
109   void RedrawVisMode();
110 
111 private:
112   enum VisMode { VIS_WIREFRAME, VIS_SHADE, VIS_HLR };
113   Handle(V3d_View)     myView;
114   Handle(Graphic3d_GraphicDriver) myGraphicDriver;
115   View3D_CurrentAction myCurrentMode;
116   VisMode              myVisMode;
117   Standard_Integer     myXmin;
118   Standard_Integer     myYmin;
119   Standard_Integer     myXmax;
120   Standard_Integer     myYmax;
121   Standard_Real        myCurZoom;
122 
123 private:
124   Handle(AIS_RubberBand) myRect; //!< Rubber rectangle for selection
125   virtual void DrawRectangle (const Standard_Integer  MinX  ,
126                               const Standard_Integer  MinY  ,
127                               const Standard_Integer  MaxX  ,
128                               const Standard_Integer  MaxY  ,
129                               const Standard_Boolean  Draw  ,
130                               Aspect_TypeOfLine theLineType = Aspect_TOL_SOLID);
131 
132 };
133 
134 #ifndef _DEBUG  // debug version in OCCDemoView.cpp
GetDocument()135 inline COCCDemoDoc* COCCDemoView::GetDocument()
136    { return (COCCDemoDoc*)m_pDocument; }
137 #endif
138 
139 /////////////////////////////////////////////////////////////////////////////
140 
141 //{{AFX_INSERT_LOCATION}}
142 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
143 
144 #endif // !defined(AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)
145