Tue, 07/09/2002 - 03:44
Hi:
In this sampleHLR, it create a View3d in the dialog. the partial code is as following:
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
((CSampleHLRApp*)AfxGetApp())->GetGraphicDevice();
myActiveViewer = new V3d_Viewer(theGraphicDevice,(short *) "Visu3D");
myActiveViewer->SetDefaultLights();
myActiveViewer->SetLightOn();
myActiveView = myActiveViewer->CreateView();
Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,
GetDlgItem(IDC_BoxView)->GetSafeHwnd(),
Quantity_NOC_GRAY);
aWNTWindow->SetDoubleBuffer(Standard_False);
if (m_DegeneratedModeOn) myActiveView->SetDegenerateModeOn();
myActiveView->SetWindow(aWNTWindow);
myInteractiveContext = new AIS_InteractiveContext(myActiveViewer);
I try to replace it to view2d as following code:
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
((CSampleHLRApp*)AfxGetApp())->GetGraphicDevice();
Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,
GetDlgItem(IDC_BoxView)->GetSafeHwnd(),
Quantity_NOC_GRAY);
aWNTWindow->SetDoubleBuffer(Standard_False);
myActive2dViewer = new V2d_Viewer(theGraphicDevice,(short *) "Visu2D");
myActiveViewer->SetCircularGridValues(0,0,10,8,0);
myActiveViewer->SetRectangularGridValues(0,0,10,10,0);
Then, I stick over getting V2d_View and setting window in V2d_Viewer. I looked all around. It seems there is no relationship between V2d_View with WNT_Window. Is it possible to create V2d_View or V2d_Viewer in the dialog? Thanks a lot.
Sincerely
shawn
Tue, 07/09/2002 - 08:26
Hi Shawn,
on a first look, why do you use a "Graphic3d_WNTGraphicDevice" for 2D?
In the OCC samples for 2D they use a "WNT_GraphicDevice".
Perhaps this helps - apart from that - since you can do V3d_views (and viewers) in a dialog it should also works for 2D.
Best regards,
Patrik Müller
Wed, 07/10/2002 - 16:56
Hi:
I have tried to use
myActive2dViewer->SetCircularGridValues(0,0,10,8,0);
myActive2dViewer->SetRectangularGridValues(0,0,10,10,0);
myActive2dViewer->ActivateGrid(Aspect_GT_Rectangular,
Aspect_GDM_Points);
Handle(WNT_WDriver) aDriver= new WNT_WDriver(aWNTWindow);
myActive2dView = new V2d_View(aDriver, myActive2dViewer,0,0,50);
myInteractiveContext2D= new ISession2D_InteractiveContext(myActive2dViewer);
Those codes are fine to set 2d View. but, I have another problem. How could I can keep the area of 2d View to be more dark than the outer of 2d View? That's to set the background color in 2d View like SampleHRL. I try several ways that change whole area in the dialog except for controls. Thanks a lot.
Sincerely
shawn
Wed, 07/10/2002 - 17:09
Hi Shawn,
try this:
aWNTWindow->SetBackground(Quantity_NOC_Black);
or another color value.
Best regards,
Patrik Müller
Thu, 07/11/2002 - 02:59
Hi:
I have already tried it. It doesn't work. It causes the background of whole dialog to become Black. thanks a lot.
Sincerely
shawn