1 // OCC_2dViewRDRD.cpp: implementation of the OCC_2dViewRDRD class.
3 //////////////////////////////////////////////////////////////////////
6 #include <res/OCC_Resource.h>
7 #include "OCC_2dViewRD.h"
11 static char THIS_FILE[]=__FILE__;
15 //////////////////////////////////////////////////////////////////////
16 // Construction/Destruction
17 //////////////////////////////////////////////////////////////////////
19 BEGIN_MESSAGE_MAP(OCC_2dViewRD, CView)
20 //{{AFX_MSG_MAP(OCC_2dViewRD)
21 // NOTE - the ClassWizard will add and remove mapping macros here.
22 // DO NOT EDIT what you see in these blocks of generated code!
23 ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage)
24 ON_COMMAND(ID_BUTTON2DGridRectLines, OnBUTTONGridRectLines)
25 ON_COMMAND(ID_BUTTON2DGridRectPoints, OnBUTTONGridRectPoints)
26 ON_COMMAND(ID_BUTTON2DGridCircLines, OnBUTTONGridCircLines)
27 ON_COMMAND(ID_BUTTON2DGridCircPoints, OnBUTTONGridCircPoints)
28 ON_COMMAND(ID_BUTTON2DGridValues, OnBUTTONGridValues)
29 ON_COMMAND(ID_BUTTON2DGridCancel, OnBUTTONGridCancel)
33 void OCC_2dViewRD::OnFileExportImage()
35 OCC_2dViewRD::OnFileExportImage();
36 // Update Get information to update Result dialog
38 UINT anID=ID_FILE_EXPORT_IMAGE;
39 TCollection_AsciiString Message(" \
40 CFileDialog dlg(FALSE,_T(\"*.BMP\"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, \n\
41 _T(\"BMP Files (*.BMP)|*.bmp |GIF Files (*.GIF)|*.gif | XWD Files (*.XWD)|*.xwd||\"), \n\
44 if (dlg.DoModal() == IDOK) \n\
46 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); \n\
47 CString filename = dlg.GetPathName(); \n\
48 Handle(WNT_Window) aWNTWindow= \n\
49 Handle(WNT_Window)::DownCast(myV2dView->Driver()->Window()); \n\
50 CString ext = dlg.GetFileExt(); \n\
51 if (ext == \"bmp\") aWNTWindow->SetOutputFormat ( WNT_TOI_BMP ); \n\
52 if (ext == \"gif\") aWNTWindow->SetOutputFormat ( WNT_TOI_GIF ); \n\
53 if (ext == \"xwd\") aWNTWindow->SetOutputFormat ( WNT_TOI_XWD ); \n\
54 aWNTWindow->Dump ((Standard_CString)(LPCTSTR)filename); \n\
55 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); \n\
58 // Update The Result Dialog
59 GetDocument()->UpdateResultDialog(anID,Message);
63 void OCC_2dViewRD::OnBUTTONGridRectLines()
65 OCC_2dViewRD::OnBUTTONGridRectLines();
66 // Update Get information to update Result dialog
68 UINT anID=ID_BUTTON2DGridRectLines;
69 TCollection_AsciiString Message;
71 Handle(V2d_Viewer) aViewer = myV2dView->Viewer(); \n\
72 aViewer->SetGridColor(Quantity_Color(Quantity_NOC_WHITE), Quantity_Color(Quantity_NOC_WHITE)); \n\
73 aViewer->ActivateGrid(Aspect_GT_Rectangular, \n\
74 Aspect_GDM_Lines); \n\
75 if (TheCircularGridDialog.IsWindowVisible()) \n\
77 TheCircularGridDialog.ShowWindow(SW_HIDE); \n\
78 TheRectangularGridDialog.UpdateValues(); \n\
79 TheRectangularGridDialog.ShowWindow(SW_SHOW); \n\
83 // Update The Result Dialog
84 GetDocument()->UpdateResultDialog(anID,Message);
88 void OCC_2dViewRD::OnBUTTONGridRectPoints()
90 OCC_2dViewRD::OnBUTTONGridRectPoints();
91 // Update Get information to update Result dialog
93 UINT anID=ID_BUTTON2DGridRectPoints;
94 TCollection_AsciiString Message;
96 Handle(V2d_Viewer) aViewer = myV2dView->Viewer(); \n\
97 aViewer->SetGridColor(Quantity_Color(Quantity_NOC_WHITE), Quantity_Color(Quantity_NOC_WHITE)); \n\
98 aViewer->ActivateGrid(Aspect_GT_Rectangular, \n\
99 Aspect_GDM_Points); \n\
100 if (TheCircularGridDialog.IsWindowVisible()) \n\
102 TheCircularGridDialog.ShowWindow(SW_HIDE); \n\
103 TheRectangularGridDialog.UpdateValues(); \n\
104 TheRectangularGridDialog.ShowWindow(SW_SHOW); \n\
107 // Update The Result Dialog
108 GetDocument()->UpdateResultDialog(anID,Message);
113 void OCC_2dViewRD::OnBUTTONGridCircLines()
115 OCC_2dViewRD::OnBUTTONGridCircLines();
116 // Update Get information to update Result dialog
118 UINT anID=ID_BUTTON2DGridCircLines;
119 TCollection_AsciiString Message("\
120 Handle(V2d_Viewer) aViewer = myV2dView->Viewer(); \n\
121 aViewer->SetGridColor(Quantity_Color(Quantity_NOC_WHITE), Quantity_Color(Quantity_NOC_WHITE)); \n\
122 aViewer->ActivateGrid(Aspect_GT_Circular, \n\
123 Aspect_GDM_Lines); \n\
124 if (TheRectangularGridDialog.IsWindowVisible()) \n\
126 TheRectangularGridDialog.ShowWindow(SW_HIDE); \n\
127 TheCircularGridDialog.UpdateValues(); \n\
128 TheCircularGridDialog.ShowWindow(SW_SHOW); \n\
130 // Update The Result Dialog
131 GetDocument()->UpdateResultDialog(anID,Message);
135 void OCC_2dViewRD::OnBUTTONGridCircPoints()
137 OCC_2dViewRD::OnBUTTONGridCircPoints();
138 // Update Get information to update Result dialog
140 UINT anID=ID_BUTTON2DGridCircPoints;
141 TCollection_AsciiString Message("\
142 Handle(V2d_Viewer) aViewer = myV2dView->Viewer(); \n\
143 aViewer->SetGridColor(Quantity_Color(Quantity_NOC_WHITE), Quantity_Color(Quantity_NOC_WHITE)); \n\
144 aViewer->ActivateGrid(Aspect_GT_Circular, \n\
145 Aspect_GDM_Points); \n\
146 if (TheRectangularGridDialog.IsWindowVisible()) \n\
148 TheRectangularGridDialog.ShowWindow(SW_HIDE); \n\
149 TheCircularGridDialog.UpdateValues(); \n\
150 TheCircularGridDialog.ShowWindow(SW_SHOW); \n\
154 // Update The Result Dialog
155 GetDocument()->UpdateResultDialog(anID,Message);
159 void OCC_2dViewRD::OnBUTTONGridValues()
161 OCC_2dViewRD::OnBUTTONGridValues();
162 // Update Get information to update Result dialog
164 UINT anID=ID_BUTTON2DGridValues;
165 TCollection_AsciiString Message("\
166 Handle(V2d_Viewer) aViewer = myV2dView->Viewer(); \n\
167 Aspect_GridType TheGridtype = aViewer->GridType(); \n\
169 switch( TheGridtype ) \n\
171 case Aspect_GT_Rectangular: \n\
172 TheRectangularGridDialog.UpdateValues(); \n\
173 TheRectangularGridDialog.ShowWindow(SW_SHOW); \n\
175 case Aspect_GT_Circular: \n\
176 TheCircularGridDialog.UpdateValues(); \n\
177 TheCircularGridDialog.ShowWindow(SW_SHOW); \n\
180 Standard_Failure::Raise(\"invalid Aspect_GridType\"); \n\
183 // Update The Result Dialog
184 GetDocument()->UpdateResultDialog(anID,Message);
188 void OCC_2dViewRD::OnBUTTONGridCancel()
190 OCC_2dViewRD::OnBUTTONGridCancel();
191 // Update Get information to update Result dialog
193 UINT anID=ID_BUTTON2DGridCancel;
194 TCollection_AsciiString Message("\
195 Handle(V2d_Viewer) aViewer = myV2dView->Viewer(); \n\
196 aViewer->DeactivateGrid(); \n\
197 TheRectangularGridDialog.ShowWindow(SW_HIDE); \n\
198 TheCircularGridDialog.ShowWindow(SW_HIDE); \n\
199 aViewer->Update(); \n\
202 // Update The Result Dialog
203 GetDocument()->UpdateResultDialog(anID,Message);
208 OCC_2dViewRD::OCC_2dViewRD()
213 OCC_2dViewRD::~OCC_2dViewRD()
218 OCC_2dDoc* OCC_2dViewRD::GetDocument()
220 return (OCC_2dDoc*)m_pDocument;