Using Vector Engines
Start with the project you created in Using the Camera.
Take the following steps to add support for viewing vector drawing in different vector engines:
1. |
Click the "Resource View" tab of the project workspace. |
2. |
Click to open the "tutorial resources" branch. |
3. |
Click to open the "Menu" branch. |
4. |
Double-click "IDR_MAINFRAME". |
5. |
Create an "Engine" menu item and check the "Pop-up" check box. |
6. |
Create this Menu structure under the Engine Menu item: |
& GDI with ID = ID_ENGINE_GDI
&OpenGL with ID = ID_ENGINE_OPENGL
7. |
Drag the "Engine" menu item so that it appears immediately after the "Edit" menu item. |
8. |
Choose View->Class Wizard... |
9. |
Under the Class Name drop down box, select "CTutorialDoc". |
10. |
Under the Object IDs drop down box, select ID_ENGINE_GDI. |
11. |
Under the Messages drop down box, Select COMMAND. |
12. |
Click the "Add Function" button and then the "OK" button. |
13. |
Select the UPDATE_COMMAND_UI message. |
14. |
Click the "Add Function" button and then the "OK" button. |
15. |
Repeat steps 10 through 14 for the Object ID ID_ENGINE_OPENGL. |
16. |
Click the "Edit Code" button. |
17. |
Add the following code for the six new functions: |
void CTutorialDoc::OnEngineGdi()
{
m_pVectorWindow->SetEngine (VECTOR_ENGINE_GDI);
}
void CTutorialDoc::OnUpdateEngineGdi(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_pVectorWindow->GetEngine () == VECTOR_ENGINE_GDI);
}
void CTutorialDoc::OnEngineOpengl()
{
m_pVectorWindow->SetEngine (VECTOR_ENGINE_OPENGL);
}
void CTutorialDoc::OnUpdateEngineOpengl(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_pVectorWindow->GetEngine () == VECTOR_ENGINE_OPENGL);
}
18. |
Compile and run the demo. |
19. |
From the program menu, browse to the "images" folder of your LEAD installation. Open the image random.dxf and click OK. |
20. |
Select different vector engines and see the effect of how the drawing is painted on the window. |