Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / mfc / standard / 08_HLR / src / HLRView2D.cpp
1 // HLRView.cpp : implementation of the CHLRView2D class
2 //
3
4 #include "stdafx.h"
5
6 #include "HLRView2D.h"
7
8 #include "HLRApp.h"
9 #include "HLRDoc.h"
10 #include "resource2d\RectangularGrid.h"
11 #include "resource2d\CircularGrid.h"
12
13 #define ValZWMin 1
14
15 #ifdef _DEBUG
16 //#define new DEBUG_NEW
17 #undef THIS_FILE
18 static char THIS_FILE[] = __FILE__;
19 #endif
20
21 // the key for multi selection :
22 #define MULTISELECTIONKEY MK_SHIFT
23
24 // the key for shortcut ( use to activate dynamic rotation, panning )
25 #define CASCADESHORTCUTKEY MK_CONTROL
26
27 // define in witch case you want to display the popup
28 #define POPUPONBUTTONDOWN
29
30 /////////////////////////////////////////////////////////////////////////////
31 // CHLRView2D
32
33 IMPLEMENT_DYNCREATE(CHLRView2D, OCC_2dView)
34
35 BEGIN_MESSAGE_MAP(CHLRView2D, OCC_2dView)
36         //{{AFX_MSG_MAP(CHLRView2D)
37                 // NOTE - the ClassWizard will add and remove mapping macros here.
38                 //    DO NOT EDIT what you see in these blocks of generated code!
39         //}}AFX_MSG_MAP
40 END_MESSAGE_MAP()
41
42 /////////////////////////////////////////////////////////////////////////////
43 // CHLRView2D construction/destruction
44
45 CHLRView2D::CHLRView2D()
46 {
47 }
48
49 CHLRView2D::~CHLRView2D()
50 {
51 }
52
53 CHLRDoc* CHLRView2D::GetDocument() // non-debug version is inline
54 {
55         //ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(OCC_2dDoc)));
56         return (CHLRDoc*)m_pDocument;
57 }
58
59
60 void CHLRView2D::OnInitialUpdate()
61 {
62
63         Handle(WNT_Window) aWNTWindow;
64         aWNTWindow = new WNT_Window(((CHLRApp*)AfxGetApp())->GetGraphicDevice(),GetSafeHwnd());   
65 //    aWNTWindow->SetBackground(Quantity_NOC_BLACK);
66
67         Handle(WNT_WDriver)  aDriver= new WNT_WDriver(aWNTWindow);
68         myV2dView = new V2d_View(aDriver, GetDocument()->GetViewer2D(),0,0,50);
69
70     // initialyse the grids dialogs
71     TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
72     TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
73     TheRectangularGridDialog.SetViewer (GetDocument()->GetViewer2D());
74     TheCircularGridDialog.SetViewer (GetDocument()->GetViewer2D());
75
76         Standard_Integer w=100 , h=100 ;   /* Debug Matrox                         */
77         aWNTWindow->Size (w,h) ;           /* Keeps me unsatisfied (rlb).....      */
78                                            /* Resize is not supposed to be done on */
79                                            /* Matrox                               */
80                                            /* I suspect another problem elsewhere  */
81         ::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
82
83 }
84
85 //-----------------------------------------------------------------------------------------
86 //
87 //-----------------------------------------------------------------------------------------
88 void CHLRView2D::DragEvent2D(const Standard_Integer  x        ,
89                                                   const Standard_Integer  y        ,
90                                                   const Standard_Integer  TheState )
91 {
92 }
93
94
95 //-----------------------------------------------------------------------------------------
96 //
97 //-----------------------------------------------------------------------------------------
98 void CHLRView2D::InputEvent2D(const Standard_Integer  x     ,
99                                                    const Standard_Integer  y     ) 
100 {
101 }
102
103 //-----------------------------------------------------------------------------------------
104 //
105 //-----------------------------------------------------------------------------------------
106 void CHLRView2D::MoveEvent2D(const Standard_Integer  x       ,
107                                                   const Standard_Integer  y       ) 
108 {
109 }
110
111 //-----------------------------------------------------------------------------------------
112 //
113 //-----------------------------------------------------------------------------------------
114 void CHLRView2D::MultiMoveEvent2D(const Standard_Integer  x       ,
115                                                            const Standard_Integer  y      ) 
116 {
117 }
118
119 //-----------------------------------------------------------------------------------------
120 //
121 //-----------------------------------------------------------------------------------------
122 void CHLRView2D::MultiDragEvent2D(const Standard_Integer  x        ,
123                                                            const Standard_Integer  y        ,
124                                                            const Standard_Integer  TheState) 
125 {
126 }
127
128
129 //-----------------------------------------------------------------------------------------
130 //
131 //-----------------------------------------------------------------------------------------
132 void CHLRView2D::MultiInputEvent2D(const Standard_Integer  x       ,
133                                                                 const Standard_Integer  y       ) 
134 {
135 }
136
137
138 #ifdef _DEBUG
139 void CHLRView2D::AssertValid() const
140 {
141          OCC_2dView::AssertValid();
142 }
143
144 void CHLRView2D::Dump(CDumpContext& dc) const
145 {
146          OCC_2dView::Dump(dc);
147 }
148
149 #endif