1 // OCC_2dDoc.cpp: implementation of the OCC_2dDoc class.
3 //////////////////////////////////////////////////////////////////////
10 #include "OCC_2dView.h"
12 IMPLEMENT_DYNCREATE(OCC_2dDoc, CDocument)
14 //////////////////////////////////////////////////////////////////////
15 // Construction/Destruction
16 //////////////////////////////////////////////////////////////////////
18 OCC_2dDoc::OCC_2dDoc() : OCC_BaseDoc()
20 // Get the Graphic Driver from the application
21 Handle(Graphic3d_GraphicDriver) aGraphicDriver =
22 ((OCC_App*)AfxGetApp())->GetGraphicDriver();
25 TCollection_ExtendedString aName ("Viewer 2D");
26 TCollection_AsciiString aDomain ("My Domain");
28 myViewer = new V3d_Viewer (aGraphicDriver,
32 myViewer->SetDefaultLights();
33 myViewer->SetLightOn();
34 myViewer->SetDefaultViewProj (V3d_Zpos);
36 // set default values for grids
37 myViewer->SetCircularGridValues (0, 0, 10, 8, 0);
38 myViewer->SetRectangularGridValues (0, 0, 10, 10, 0);
40 myAISContext = new AIS_InteractiveContext (myViewer);
45 OCC_2dDoc::~OCC_2dDoc()
49 void OCC_2dDoc::FitAll2DViews(Standard_Boolean theUpdateViewer)
56 POSITION aPosition = GetFirstViewPosition();
57 while (aPosition != (POSITION)NULL)
59 OCC_2dView* aCurrentView = (OCC_2dView*)GetNextView (aPosition);
60 ASSERT_VALID (aCurrentView);
61 aCurrentView->GetV2dView()->FitAll();
65 void OCC_2dDoc::MoveEvent(const Standard_Integer theMouseX,
66 const Standard_Integer theMouseY,
67 const Handle(V3d_View)& theView)
69 myAISContext->MoveTo (theMouseX, theMouseY, theView);
72 void OCC_2dDoc::ShiftMoveEvent(const Standard_Integer theMouseX,
73 const Standard_Integer theMouseY,
74 const Handle(V3d_View)& theView)
76 myAISContext->MoveTo (theMouseX, theMouseY, theView);