From 4716247158067af48d9f35f5943318b2357ba846 Mon Sep 17 00:00:00 2001 From: aba Date: Thu, 9 Oct 2014 15:40:14 +0400 Subject: [PATCH] 0025284: Problems with standard MFC samples - OCAF sample Save Document option: corrected conversion from LPCTSTR to Standard_CString - HLR sample: corrected mouse move event handling for HLR 2D view; Corrected CSelectionDialog view displaying and updating - Geometry sample: CGeometryDoc correction to avoid code duplication - OCC_3dBaseDoc: corrected DragEvent() handler for proper emulation of rectangle selection. - Viewer3d sample: moved resource files (resource.h; resource.hm; AISToolbar.bmp) from /src to /res Code style changes Fixed "About" dialog error in release. Corrected dimension dialogs Workaround for dimensions sample: AIS_LocalContext::SelectedShape() doesn't take into account TopoDS shape local transformation, and operates with selected interactive transformation. --- .../standard/01_Geometry/src/GeometryDoc.cpp | 98 ++- .../standard/01_Geometry/src/GeometryDoc.h | 40 +- .../standard/01_Geometry/src/GeometryView.cpp | 410 ----------- .../standard/01_Geometry/src/GeometryView.h | 34 - .../04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj | 16 +- .../adm/win/vc10/Viewer3d.vcxproj.filters | 8 +- .../04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj | 16 +- .../adm/win/vc11/Viewer3d.vcxproj.filters | 8 +- .../04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj | 16 +- .../adm/win/vc12/Viewer3d.vcxproj.filters | 8 +- .../04_Viewer3d/adm/win/vc8/Viewer3d.vcproj | 6 +- .../04_Viewer3d/adm/win/vc9/Viewer3d.vcproj | 16 +- .../04_Viewer3d/{src => res}/AISToolbar.bmp | Bin .../mfc/standard/04_Viewer3d/res/Viewer3d.rc | 269 ++++--- .../mfc/standard/04_Viewer3d/res/resource.h | 29 +- .../04_Viewer3d/{src => res}/resource.hm | 0 .../standard/04_Viewer3d/src/OffsetDlg.cpp | 2 +- .../mfc/standard/04_Viewer3d/src/ScaleDlg.h | 2 +- .../04_Viewer3d/src/ShadingModelDlg.h | 2 +- samples/mfc/standard/04_Viewer3d/src/StdAfx.h | 2 +- .../standard/04_Viewer3d/src/TrihedronDlg.h | 2 +- .../mfc/standard/04_Viewer3d/src/Viewer3d.rc | 606 ---------------- .../standard/04_Viewer3d/src/Viewer3dDoc.cpp | 685 +++++++++--------- .../standard/04_Viewer3d/src/Viewer3dDoc.h | 221 +++--- .../standard/04_Viewer3d/src/Viewer3dView.cpp | 3 +- .../mfc/standard/04_Viewer3d/src/resource.h | 108 --- .../05_ImportExport/src/ImportExportDoc.cpp | 21 +- .../05_ImportExport/src/ImportExportDoc.h | 5 +- samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp | 55 +- samples/mfc/standard/08_HLR/res/HLR.rc | 2 +- samples/mfc/standard/08_HLR/res/resource.h | 2 +- samples/mfc/standard/08_HLR/src/HLRDoc.cpp | 1 + samples/mfc/standard/08_HLR/src/HLRView2D.cpp | 82 ++- samples/mfc/standard/08_HLR/src/HLRView2D.h | 15 +- .../standard/08_HLR/src/SelectionDialog.cpp | 17 +- .../Common/AngleParamsVerticesPage.cpp | 7 +- samples/mfc/standard/Common/DimensionDlg.cpp | 9 + samples/mfc/standard/Common/DimensionDlg.h | 7 + .../standard/Common/LengthParamsEdgePage.cpp | 21 +- .../standard/Common/LengthParamsEdgesPage.cpp | 14 +- .../Common/LengthParamsVerticesPage.cpp | 2 +- samples/mfc/standard/Common/OCC_2dDoc.h | 17 +- samples/mfc/standard/Common/OCC_3dBaseDoc.cpp | 58 +- samples/mfc/standard/Common/OCC_3dBaseDoc.h | 9 +- samples/mfc/standard/Common/OCC_3dDoc.cpp | 45 +- samples/mfc/standard/Common/OCC_3dDoc.h | 41 +- samples/mfc/standard/Common/OCC_3dView.cpp | 7 +- samples/mfc/standard/Common/OCC_App.cpp | 5 +- .../mfc/standard/Common/ParamsFacesPage.cpp | 14 +- .../mfc/standard/Common/RadiusParamsPage.cpp | 7 +- .../mfc/standard/Common/res/OCC_Resource.rc | 2 +- 51 files changed, 1093 insertions(+), 1979 deletions(-) rename samples/mfc/standard/04_Viewer3d/{src => res}/AISToolbar.bmp (100%) mode change 100755 => 100644 rename samples/mfc/standard/04_Viewer3d/{src => res}/resource.hm (100%) mode change 100755 => 100644 delete mode 100755 samples/mfc/standard/04_Viewer3d/src/Viewer3d.rc delete mode 100755 samples/mfc/standard/04_Viewer3d/src/resource.h diff --git a/samples/mfc/standard/01_Geometry/src/GeometryDoc.cpp b/samples/mfc/standard/01_Geometry/src/GeometryDoc.cpp index 125ed6c1fc..e7d60851c3 100755 --- a/samples/mfc/standard/01_Geometry/src/GeometryDoc.cpp +++ b/samples/mfc/standard/01_Geometry/src/GeometryDoc.cpp @@ -29,9 +29,9 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CGeometryDoc -IMPLEMENT_DYNCREATE(CGeometryDoc, CDocument) +IMPLEMENT_DYNCREATE(CGeometryDoc, OCC_3dBaseDoc) -BEGIN_MESSAGE_MAP(CGeometryDoc, CDocument) +BEGIN_MESSAGE_MAP(CGeometryDoc, OCC_3dBaseDoc) //{{AFX_MSG_MAP(CGeometryDoc) ON_COMMAND(ID_WINDOW_NEW2D, OnWindowNew2d) ON_COMMAND(ID_BUTTON_Test_1, OnBUTTONTest1) @@ -143,28 +143,21 @@ END_MESSAGE_MAP() // CGeometryDoc construction/destruction CGeometryDoc::CGeometryDoc() +: OCC_3dBaseDoc() { FitMode = false; AfxInitRichEdit(); - // TODO: add one-time construction code here - Handle(Graphic3d_GraphicDriver) aGraphicDriver = - ((CGeometryApp*)AfxGetApp())->GetGraphicDriver(); - - TCollection_ExtendedString a3DName("Visu3D"); - myViewer = new V3d_Viewer(aGraphicDriver,a3DName.ToExtString()); - myViewer->SetDefaultLights(); - myViewer->SetLightOn(); - - myAISContext =new AIS_InteractiveContext(myViewer); myAISContext->DefaultDrawer()->UIsoAspect()->SetNumber(11); myAISContext->DefaultDrawer()->VIsoAspect()->SetNumber(11); + Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((OCC_App*)AfxGetApp())->GetGraphicDriver(); TCollection_ExtendedString a2DName("Visu2D"); myViewer2D = new V3d_Viewer(aGraphicDriver,a2DName.ToExtString()); myViewer2D->SetCircularGridValues(0,0,1,8,0); myViewer2D->SetRectangularGridValues(0,0,1,1,0); - //set view projection + + // Set view projection myViewer2D->SetDefaultViewProj(V3d_Zpos); myAISContext2D = new AIS_InteractiveContext(myViewer2D); myCResultDialog.Create(CResultDialog::IDD,NULL); @@ -200,9 +193,7 @@ BOOL CGeometryDoc::OnNewDocument() return TRUE; } - - -void CGeometryDoc::OnWindowNew2d() +void CGeometryDoc::OnWindowNew2d() { ((CGeometryApp*)AfxGetApp())->CreateView2D(this); } @@ -330,6 +321,48 @@ void CGeometryDoc::Popup2D(const Standard_Integer x, AfxGetMainWnd()); } + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void CGeometryDoc::Popup (const Standard_Integer theMouseX, + const Standard_Integer theMouseY, + const Handle(V3d_View)& theView) +{ + Standard_Integer PopupMenuNumber=0; + GetAISContext()->InitCurrent(); + if (GetAISContext()->MoreCurrent()) + { + PopupMenuNumber=1; + } + + CMenu menu; + VERIFY(menu.LoadMenu(IDR_Popup3D)); + CMenu* pPopup = menu.GetSubMenu(PopupMenuNumber); + ASSERT(pPopup != NULL); + + POINT winCoord = { theMouseX , theMouseY }; + Handle(WNT_Window) aWNTWindow = Handle(WNT_Window)::DownCast(theView->Window()); + ClientToScreen ( (HWND)(aWNTWindow->HWindow()), &winCoord ); + + pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON , + winCoord.x, winCoord.y , + AfxGetMainWnd()); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void CGeometryDoc::InputEvent (const Standard_Integer /*theMouseX*/, + const Standard_Integer /*theMouseY*/, + const Handle(V3d_View)& /*theView*/) +{ + myAISContext->Select(); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- void CGeometryDoc::Put2DOnTop(bool isMax) { POSITION position = GetFirstViewPosition(); @@ -354,6 +387,9 @@ void CGeometryDoc::Put2DOnTop(bool isMax) } } +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- void CGeometryDoc::Minimize2D() { POSITION position = GetFirstViewPosition(); @@ -371,6 +407,9 @@ void CGeometryDoc::Minimize2D() } } +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- void CGeometryDoc::Fit2DViews() { POSITION position = GetFirstViewPosition(); @@ -385,6 +424,10 @@ void CGeometryDoc::Fit2DViews() } } } + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- void CGeometryDoc::Put3DOnTop(bool isMax) { POSITION position = GetFirstViewPosition(); @@ -409,6 +452,9 @@ void CGeometryDoc::Put3DOnTop(bool isMax) } } +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- void CGeometryDoc::Minimize3D() { POSITION position = GetFirstViewPosition(); @@ -426,6 +472,9 @@ void CGeometryDoc::Minimize3D() } } +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- void CGeometryDoc::Fit3DViews(Quantity_Coefficient Coef) { POSITION position = GetFirstViewPosition(); @@ -441,6 +490,9 @@ void CGeometryDoc::Fit3DViews(Quantity_Coefficient Coef) } } +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- void CGeometryDoc::Set3DViewsZoom(const Quantity_Factor& Coef) { POSITION position = GetFirstViewPosition(); @@ -456,6 +508,9 @@ void CGeometryDoc::Set3DViewsZoom(const Quantity_Factor& Coef) } } +//----------------------------------------------------------------------------------------- +// Buttons event handlers +//----------------------------------------------------------------------------------------- void CGeometryDoc::OnBUTTONTest1() { Current = 1; GeomSources::gpTest1(this); } @@ -1013,15 +1068,6 @@ void CGeometryDoc::OnCloseDocument() CDocument::OnCloseDocument(); } -void CGeometryDoc::Fit() -{ - CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; - CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); - OCC_3dView *pView = (OCC_3dView *) pChild->GetActiveView(); - pView->FitAll(); -} - - void CGeometryDoc::OnCreateSol() { // TODO: Add your command handler code here @@ -1368,7 +1414,7 @@ void CGeometryDoc::simplify(const TopoDS_Shape& aShape) if(aPoints1(i).X() > aPntMax.X()) { aIndex = i; - aPntMax = aPoints1(aIndex); + aPntMax = aPoints1(aIndex); } } diff --git a/samples/mfc/standard/01_Geometry/src/GeometryDoc.h b/samples/mfc/standard/01_Geometry/src/GeometryDoc.h index 7ab5419b78..6128ff911a 100755 --- a/samples/mfc/standard/01_Geometry/src/GeometryDoc.h +++ b/samples/mfc/standard/01_Geometry/src/GeometryDoc.h @@ -9,12 +9,12 @@ #pragma once #endif // _MSC_VER >= 1000 -#include "OCC_BaseDoc.h" +#include "OCC_3dBaseDoc.h" #include "ResultDialog.h" class Handle_AIS_Point; -class CGeometryDoc : public OCC_BaseDoc +class CGeometryDoc : public OCC_3dBaseDoc { public: void Put2DOnTop(bool isMax = true); @@ -25,32 +25,41 @@ public: void simplify(const TopoDS_Shape& aShape); - static void Fit(); + //-------------------- 2D -------------------// - // 2D void DragEvent2D (const Standard_Integer x , const Standard_Integer y , const Standard_Integer TheState, const Handle_V3d_View& aView ); void InputEvent2D (const Standard_Integer x , const Standard_Integer y , - const Handle_V3d_View& aView ); + const Handle_V3d_View& aView ); void MoveEvent2D (const Standard_Integer x , const Standard_Integer y , - const Handle_V3d_View& aView ); + const Handle_V3d_View& aView ); void ShiftMoveEvent2D (const Standard_Integer x , const Standard_Integer y , - const Handle_V3d_View& aView ); + const Handle_V3d_View& aView ); void ShiftDragEvent2D (const Standard_Integer x , const Standard_Integer y , const Standard_Integer TheState, - const Handle_V3d_View& aView ); + const Handle_V3d_View& aView ); void ShiftInputEvent2D (const Standard_Integer x , const Standard_Integer y , - const Handle_V3d_View& aView ); + const Handle_V3d_View& aView ); void Popup2D (const Standard_Integer x , const Standard_Integer y , - const Handle_V3d_View& aView ); + const Handle_V3d_View& aView ); + + //-------------------- 3D -------------------// + + virtual void Popup (const Standard_Integer theMouseX, + const Standard_Integer theMouseY, + const Handle(V3d_View)& theView); + + virtual void InputEvent (const Standard_Integer theMouseX, + const Standard_Integer theMouseY, + const Handle(V3d_View)& theView); Handle_AIS_InteractiveObject drawSurface (const Handle_Geom_Surface& theSurface, @@ -211,10 +220,6 @@ protected: //}}AFX_MSG DECLARE_MESSAGE_MAP() -private: - Handle_V3d_Viewer myViewer2D; - Handle_AIS_InteractiveContext myAISContext2D; - public: int Current; void Minimize3D(); @@ -223,9 +228,14 @@ public: Handle_AIS_InteractiveContext& GetISessionContext() { return myAISContext2D; }; BOOL FitMode; -public : +public: CResultDialog myCResultDialog; +private: + Handle_V3d_Viewer myViewer2D; + Handle_AIS_InteractiveContext myAISContext2D; + + }; ///////////////////////////////////////////////////////////////////////////// diff --git a/samples/mfc/standard/01_Geometry/src/GeometryView.cpp b/samples/mfc/standard/01_Geometry/src/GeometryView.cpp index 2ca07f7008..bbb4a29612 100755 --- a/samples/mfc/standard/01_Geometry/src/GeometryView.cpp +++ b/samples/mfc/standard/01_Geometry/src/GeometryView.cpp @@ -23,21 +23,6 @@ IMPLEMENT_DYNCREATE(CGeometryView, OCC_3dView) BEGIN_MESSAGE_MAP(CGeometryView, OCC_3dView) //{{AFX_MSG_MAP(CGeometryView) ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage) - ON_WM_SIZE() - ON_WM_LBUTTONDOWN() - ON_WM_LBUTTONUP() - ON_WM_MBUTTONDOWN() - ON_WM_MBUTTONUP() - ON_WM_MOUSEMOVE() - ON_WM_RBUTTONDOWN() - ON_WM_RBUTTONUP() - ON_UPDATE_COMMAND_UI(ID_BUTTONHlrOff, OnUpdateBUTTONHlrOff) - ON_UPDATE_COMMAND_UI(ID_BUTTONHlrOn, OnUpdateBUTTONHlrOn) - ON_UPDATE_COMMAND_UI(ID_BUTTONPanGlo, OnUpdateBUTTONPanGlo) - ON_UPDATE_COMMAND_UI(ID_BUTTONPan, OnUpdateBUTTONPan) - ON_UPDATE_COMMAND_UI(ID_BUTTONZoomProg, OnUpdateBUTTONZoomProg) - ON_UPDATE_COMMAND_UI(ID_BUTTONZoomWin, OnUpdateBUTTONZoomWin) - ON_UPDATE_COMMAND_UI(ID_BUTTONRot, OnUpdateBUTTONRot) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -76,402 +61,7 @@ CGeometryDoc* CGeometryView::GetDocument() // non-debug version is inline ///////////////////////////////////////////////////////////////////////////// // CGeometryView message handlers - void CGeometryView::OnFileExportImage() { GetDocument()->ExportView (myView); } - -void CGeometryView::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) -{ - if (!myView.IsNull()) - myView->MustBeResized(); -} - -void CGeometryView::OnLButtonDown(UINT nFlags, CPoint point) -{ - // save the current mouse coordinate in min - myXmin=point.x; myYmin=point.y; - myXmax=point.x; myYmax=point.y; - - if ( nFlags & MK_CONTROL ) - { - // Button MB1 down Control :start zomming - // SetCursor(AfxGetApp()->LoadStandardCursor()); - } - else // if ( Ctrl ) - { - switch (myCurrentMode) - { - case CurAction3d_Nothing : // start a drag - if (nFlags & MK_SHIFT) - ShiftDragEvent(myXmax,myYmax,-1); - else - DragEvent(myXmax,myYmax,-1); - break; - break; - case CurAction3d_DynamicZooming : // noting - // SetCursor(AfxGetApp()->LoadStandardCursor()); - break; - case CurAction3d_WindowZooming : - break; - case CurAction3d_DynamicPanning :// noting - // SetCursor(AfxGetApp()->LoadStandardCursor()); - break; - case CurAction3d_GlobalPanning :// noting - // SetCursor(AfxGetApp()->LoadStandardCursor()); - break; - case CurAction3d_DynamicRotation : - // SetCursor(AfxGetApp()->LoadStandardCursor()); - if (myHlrModeIsOn) - { - myView->SetComputedMode (Standard_False); - } - myView->StartRotation (point.x, point.y); - break; - default : - Standard_Failure::Raise(" incompatible Current Mode "); - break; - } - } -} - -void CGeometryView::OnLButtonUp(UINT nFlags, CPoint point) -{ - if ( nFlags & MK_CONTROL ) - { - return; - } - else // if ( Ctrl ) - { - switch (myCurrentMode) - { - case CurAction3d_Nothing : - if (point.x == myXmin && point.y == myYmin) - { // no offset between down and up --> selectEvent - myXmax=point.x; - myYmax=point.y; - if (nFlags & MK_SHIFT ) - ShiftInputEvent(point.x,point.y); - else - InputEvent (point.x,point.y); - } else - { - myXmax=point.x; myYmax=point.y; - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); - if (nFlags & MK_SHIFT) - ShiftDragEvent(point.x,point.y,1); - else - DragEvent(point.x,point.y,1); - } - break; - case CurAction3d_DynamicZooming : - // SetCursor(AfxGetApp()->LoadStandardCursor()); - myCurrentMode = CurAction3d_Nothing; - break; - case CurAction3d_WindowZooming : - myXmax=point.x; myYmax=point.y; - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False,LongDash); - if ((abs(myXmin-myXmax)>ValZWMin) || (abs(myYmin-myYmax)>ValZWMin)) - // Test if the zoom window is greater than a minimale window. - { - // Do the zoom window between Pmin and Pmax - myView->WindowFitAll(myXmin,myYmin,myXmax,myYmax); - } - myCurrentMode = CurAction3d_Nothing; - break; - case CurAction3d_DynamicPanning : - myCurrentMode = CurAction3d_Nothing; - break; - case CurAction3d_GlobalPanning : - myView->Place(point.x,point.y,myCurZoom); - myCurrentMode = CurAction3d_Nothing; - break; - case CurAction3d_DynamicRotation : - myCurrentMode = CurAction3d_Nothing; - break; - default : - Standard_Failure::Raise(" incompatible Current Mode "); - break; - } //switch (myCurrentMode) - } // else // if ( Ctrl ) -} - -void CGeometryView::OnMButtonDown(UINT nFlags, CPoint /*point*/) -{ - if ( nFlags & MK_CONTROL ) - { - // Button MB2 down Control : panning init - // SetCursor(AfxGetApp()->LoadStandardCursor()); - } -} - -void CGeometryView::OnMButtonUp(UINT nFlags, CPoint /*point*/) -{ - if ( nFlags & MK_CONTROL ) - { - // Button MB2 down Control : panning init - // SetCursor(AfxGetApp()->LoadStandardCursor()); - } -} - -void CGeometryView::OnRButtonDown(UINT nFlags, CPoint point) -{ - if ( nFlags & MK_CONTROL ) - { - // SetCursor(AfxGetApp()->LoadStandardCursor()); - if (myHlrModeIsOn) - { - myView->SetComputedMode (Standard_False); - } - myView->StartRotation (point.x, point.y); - } - else // if ( Ctrl ) - { - Popup (point.x, point.y); - } -} - -void CGeometryView::OnRButtonUp(UINT /*nFlags*/, CPoint /*point*/) -{ - SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); - myView->SetComputedMode (myHlrModeIsOn); - SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); -} - -void CGeometryView::OnMouseMove(UINT nFlags, CPoint point) -{ - // ============================ LEFT BUTTON ======================= - if ( nFlags & MK_LBUTTON) - { - if ( nFlags & MK_CONTROL ) - { - // move with MB1 and Control : on the dynamic zooming - // Do the zoom in function of mouse's coordinates - myView->Zoom(myXmax,myYmax,point.x,point.y); - // save the current mouse coordinate in min - myXmax = point.x; - myYmax = point.y; - } - else // if ( Ctrl ) - { - switch (myCurrentMode) - { - case CurAction3d_Nothing : - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); - myXmax = point.x; - myYmax = point.y; - if (nFlags & MK_SHIFT) - ShiftDragEvent(myXmax,myYmax,0); - else - DragEvent(myXmax,myYmax,0); - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True); - break; - case CurAction3d_DynamicZooming : - myView->Zoom(myXmax,myYmax,point.x,point.y); - // save the current mouse coordinate in min \n"; - myXmax=point.x; myYmax=point.y; - break; - case CurAction3d_WindowZooming : - myXmax = point.x; myYmax = point.y; - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False,LongDash); - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True,LongDash); - break; - case CurAction3d_DynamicPanning : - myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning - myXmax = point.x; myYmax = point.y; - break; - case CurAction3d_GlobalPanning : // nothing - break; - case CurAction3d_DynamicRotation : - myView->Rotation(point.x,point.y); - myView->Redraw(); - break; - default : - Standard_Failure::Raise(" incompatible Current Mode "); - break; - }// switch (myCurrentMode) - }// if ( nFlags & MK_CONTROL ) else - } else // if ( nFlags & MK_LBUTTON) - // ============================ MIDDLE BUTTON ======================= - if ( nFlags & MK_MBUTTON) - { - if ( nFlags & MK_CONTROL ) - { - myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning - myXmax = point.x; myYmax = point.y; - - } - } else // if ( nFlags & MK_MBUTTON) - // ============================ RIGHT BUTTON ======================= - if ( nFlags & MK_RBUTTON) - { - if ( nFlags & MK_CONTROL ) - { - myView->Rotation(point.x,point.y); - } - }else //if ( nFlags & MK_RBUTTON) - // ============================ NO BUTTON ======================= - { // No buttons - myXmax = point.x; myYmax = point.y; - if (nFlags & MK_SHIFT) - ShiftMoveEvent(point.x,point.y); - else - MoveEvent(point.x,point.y); - } -} - -void CGeometryView::OnUpdateBUTTONHlrOff (CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck (!myHlrModeIsOn); - pCmdUI->Enable (myHlrModeIsOn); -} - -void CGeometryView::OnUpdateBUTTONHlrOn (CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck (myHlrModeIsOn); - pCmdUI->Enable (!myHlrModeIsOn); -} - -void CGeometryView::OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck (myCurrentMode == CurAction3d_GlobalPanning); - pCmdUI->Enable (myCurrentMode != CurAction3d_GlobalPanning); - -} - -void CGeometryView::OnUpdateBUTTONPan(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicPanning); - pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicPanning ); -} - -void CGeometryView::OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicZooming ); - pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicZooming); -} - -void CGeometryView::OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck (myCurrentMode == CurAction3d_WindowZooming); - pCmdUI->Enable (myCurrentMode != CurAction3d_WindowZooming); -} - -void CGeometryView::OnUpdateBUTTONRot(CCmdUI* pCmdUI) -{ - pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicRotation); - pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicRotation); -} - -//========================================================================================== -//========================================================================================== -//========================================================================================== - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CGeometryView::DragEvent(const Standard_Integer x , - const Standard_Integer y , - const Standard_Integer TheState ) -{ - - // TheState == -1 button down - // TheState == 0 move - // TheState == 1 button up - - static Standard_Integer theButtonDownX=0; - static Standard_Integer theButtonDownY=0; - - if (TheState == -1) - { - theButtonDownX=x; - theButtonDownY=y; - } - - if (TheState == 0) - GetDocument()->GetAISContext()->Select(theButtonDownX,theButtonDownY,x,y,myView); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CGeometryView::InputEvent(const Standard_Integer /*x*/, - const Standard_Integer /*y*/) -{ - GetDocument()->GetAISContext()->Select(); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CGeometryView::MoveEvent(const Standard_Integer x, - const Standard_Integer y) -{ - GetDocument()->GetAISContext()->MoveTo(x,y,myView); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CGeometryView::ShiftMoveEvent(const Standard_Integer x , - const Standard_Integer y ) -{ - GetDocument()->GetAISContext()->MoveTo(x,y,myView); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CGeometryView::ShiftDragEvent(const Standard_Integer x , - const Standard_Integer y , - const Standard_Integer TheState ) -{ - static Standard_Integer theButtonDownX=0; - static Standard_Integer theButtonDownY=0; - - if (TheState == -1) - { - theButtonDownX=x; - theButtonDownY=y; - } - - if (TheState == 0) - GetDocument()->GetAISContext()->ShiftSelect(theButtonDownX,theButtonDownY,x,y,myView); -} - - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CGeometryView::ShiftInputEvent(const Standard_Integer /*x*/, - const Standard_Integer /*y*/) -{ - GetDocument()->GetAISContext()->ShiftSelect(); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CGeometryView::Popup(const Standard_Integer x, - const Standard_Integer y ) -{ - Standard_Integer PopupMenuNumber=0; - GetDocument()->GetAISContext()->InitCurrent(); - if (GetDocument()->GetAISContext()->MoreCurrent()) - PopupMenuNumber=1; - - CMenu menu; - VERIFY(menu.LoadMenu(IDR_Popup3D)); - CMenu* pPopup = menu.GetSubMenu(PopupMenuNumber); - ASSERT(pPopup != NULL); - - POINT winCoord = { x , y }; - Handle(WNT_Window) aWNTWindow= - Handle(WNT_Window)::DownCast(myView->Window()); - ClientToScreen ( &winCoord); - pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON , winCoord.x, winCoord.y , - AfxGetMainWnd()); -} - - diff --git a/samples/mfc/standard/01_Geometry/src/GeometryView.h b/samples/mfc/standard/01_Geometry/src/GeometryView.h index fad98464ea..c3b25297d7 100755 --- a/samples/mfc/standard/01_Geometry/src/GeometryView.h +++ b/samples/mfc/standard/01_Geometry/src/GeometryView.h @@ -51,42 +51,8 @@ public: protected: //{{AFX_MSG(CGeometryView) afx_msg void OnFileExportImage(); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg void OnLButtonUp(UINT nFlags, CPoint point); - afx_msg void OnMButtonDown(UINT nFlags, CPoint point); - afx_msg void OnMButtonUp(UINT nFlags, CPoint point); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnRButtonDown(UINT nFlags, CPoint point); - afx_msg void OnRButtonUp(UINT nFlags, CPoint point); - afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI); //}}AFX_MSG DECLARE_MESSAGE_MAP() - -private: - void DragEvent (const Standard_Integer x , - const Standard_Integer y , - const Standard_Integer TheState); - void InputEvent (const Standard_Integer x , - const Standard_Integer y ); - void MoveEvent (const Standard_Integer x , - const Standard_Integer y ); - void ShiftMoveEvent (const Standard_Integer x , - const Standard_Integer y ); - void ShiftDragEvent (const Standard_Integer x , - const Standard_Integer y , - const Standard_Integer TheState); - void ShiftInputEvent(const Standard_Integer x , - const Standard_Integer y ); - void Popup (const Standard_Integer x , - const Standard_Integer y ); - }; #ifndef _DEBUG // debug version in GeometryView.cpp diff --git a/samples/mfc/standard/04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj b/samples/mfc/standard/04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj index 4920197d5f..ffd3e3358f 100644 --- a/samples/mfc/standard/04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj +++ b/samples/mfc/standard/04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj @@ -477,15 +477,15 @@ - + %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) @@ -495,7 +495,7 @@ - + @@ -509,9 +509,9 @@ - + - + diff --git a/samples/mfc/standard/04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj.filters b/samples/mfc/standard/04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj.filters index c75f9d4ead..5174902abb 100644 --- a/samples/mfc/standard/04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj.filters +++ b/samples/mfc/standard/04_Viewer3d/adm/win/vc10/Viewer3d.vcxproj.filters @@ -68,7 +68,7 @@ - + Source Files @@ -91,7 +91,7 @@ Header Files - + Header Files @@ -129,13 +129,13 @@ - + Header Files Resource Files - + Resource Files diff --git a/samples/mfc/standard/04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj b/samples/mfc/standard/04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj index 9b7d9049ec..074eb081be 100644 --- a/samples/mfc/standard/04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj +++ b/samples/mfc/standard/04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj @@ -481,15 +481,15 @@ - + %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) @@ -499,7 +499,7 @@ - + @@ -513,9 +513,9 @@ - + - + diff --git a/samples/mfc/standard/04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj.filters b/samples/mfc/standard/04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj.filters index c75f9d4ead..5174902abb 100644 --- a/samples/mfc/standard/04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj.filters +++ b/samples/mfc/standard/04_Viewer3d/adm/win/vc11/Viewer3d.vcxproj.filters @@ -68,7 +68,7 @@ - + Source Files @@ -91,7 +91,7 @@ Header Files - + Header Files @@ -129,13 +129,13 @@ - + Header Files Resource Files - + Resource Files diff --git a/samples/mfc/standard/04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj b/samples/mfc/standard/04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj index 8d2203de99..a23197dbd9 100644 --- a/samples/mfc/standard/04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj +++ b/samples/mfc/standard/04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj @@ -481,15 +481,15 @@ - + %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - src;%(AdditionalIncludeDirectories) + res;%(AdditionalIncludeDirectories) @@ -499,7 +499,7 @@ - + @@ -513,9 +513,9 @@ - + - + diff --git a/samples/mfc/standard/04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj.filters b/samples/mfc/standard/04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj.filters index c75f9d4ead..5174902abb 100644 --- a/samples/mfc/standard/04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj.filters +++ b/samples/mfc/standard/04_Viewer3d/adm/win/vc12/Viewer3d.vcxproj.filters @@ -68,7 +68,7 @@ - + Source Files @@ -91,7 +91,7 @@ Header Files - + Header Files @@ -129,13 +129,13 @@ - + Header Files Resource Files - + Resource Files diff --git a/samples/mfc/standard/04_Viewer3d/adm/win/vc8/Viewer3d.vcproj b/samples/mfc/standard/04_Viewer3d/adm/win/vc8/Viewer3d.vcproj index 8d9435d746..41840ffbe8 100644 --- a/samples/mfc/standard/04_Viewer3d/adm/win/vc8/Viewer3d.vcproj +++ b/samples/mfc/standard/04_Viewer3d/adm/win/vc8/Viewer3d.vcproj @@ -729,7 +729,7 @@ @@ -1083,11 +1083,11 @@ > = 1000 -#include "resource.h" +#include "..\res\resource.h" ///////////////////////////////////////////////////////////////////////////// // CShadingModelDlg dialog diff --git a/samples/mfc/standard/04_Viewer3d/src/StdAfx.h b/samples/mfc/standard/04_Viewer3d/src/StdAfx.h index dbe7b83d23..b15dda5622 100755 --- a/samples/mfc/standard/04_Viewer3d/src/StdAfx.h +++ b/samples/mfc/standard/04_Viewer3d/src/StdAfx.h @@ -67,7 +67,7 @@ #include "State.h" -#include +#include <..\res\resource.h> //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/samples/mfc/standard/04_Viewer3d/src/TrihedronDlg.h b/samples/mfc/standard/04_Viewer3d/src/TrihedronDlg.h index 32492e8d42..6f76a04eec 100755 --- a/samples/mfc/standard/04_Viewer3d/src/TrihedronDlg.h +++ b/samples/mfc/standard/04_Viewer3d/src/TrihedronDlg.h @@ -13,7 +13,7 @@ #include #include -#include "resource.h" +#include "..\res\resource.h" ///////////////////////////////////////////////////////////////////////////// // CTrihedronDlg dialog diff --git a/samples/mfc/standard/04_Viewer3d/src/Viewer3d.rc b/samples/mfc/standard/04_Viewer3d/src/Viewer3d.rc deleted file mode 100755 index 01e4c83385..0000000000 --- a/samples/mfc/standard/04_Viewer3d/src/Viewer3d.rc +++ /dev/null @@ -1,606 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -// Generated Help ID header file -#define APSTUDIO_HIDDEN_SYMBOLS -#include "resource.hm" -#undef APSTUDIO_HIDDEN_SYMBOLS - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" -#include "..\..\Common\res\OCC_Resource.h" -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Russian resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -#ifdef _WIN32 -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_SETOFFSETS DIALOGEX 442, 45, 187, 60 -STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_TOOLWINDOW -CAPTION "Set offsets" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - CONTROL "Slider2",IDC_SLIDER_OFFSETFACTOR,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,39,14,100,15 - LTEXT "Factor:",IDC_STATIC,13,17,23,15 - LTEXT "Units:",IDC_STATIC,13,35,19,8 - CONTROL "Slider3",IDC_SLIDER_OFFSETUNITS,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,39,32,100,15 - GROUPBOX "Offset parameters",IDC_STATIC,7,6,173,47 - EDITTEXT IDC_EDIT_OFFSETFACTOR,148,14,22,14,ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_EDIT_OFFSETUNITS,148,32,22,14,ES_AUTOHSCROLL | ES_NUMBER -END - -IDD_TRIHEDRON DIALOG 0, 0, 138, 95 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Triedron settings" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,21,75,50,14 - PUSHBUTTON "Cancel",IDCANCEL,73,75,50,14 - COMBOBOX IDC_COMBOTRIHEDRPOS,38,8,92,60,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBOTRIHEDRCOLOR,38,29,92,78,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDITTRIHEDRSCALE,38,51,33,12,ES_CENTER | ES_AUTOHSCROLL - LTEXT "Color:",IDC_STATIC,8,31,20,8 - LTEXT "Position:",IDC_STATIC,8,10,28,8 - LTEXT "Scale:",IDC_STATIC,8,53,24,10 - CONTROL "Spin1",IDC_SPINTRIHEDRSCALE,"msctls_updown32",UDS_AUTOBUDDY | UDS_ARROWKEYS,70,51,11,12 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_SETOFFSETS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 180 - TOPMARGIN, 6 - BOTTOMMARGIN, 53 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Russian resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ZCLIPPING DIALOG 0, 0, 180, 95 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "ZClipping" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,13,68,50,14 - PUSHBUTTON "Cancel",IDCANCEL,70,68,50,14 - CONTROL "Slider1",IDC_SLIDER_ZCLIPPINGDEPTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,6,97,15 - LTEXT "Depth:",IDC_STATIC,13,9,22,8 - GROUPBOX "",IDC_STATIC,7,0,166,44 - EDITTEXT IDC_EDIT_ZCLIPPINGDEPTH,131,7,34,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Slider2",IDC_SLIDER_ZCLIPPINGWIDTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,25,97,15 - LTEXT "Width:",IDC_STATIC,13,28,22,8 - EDITTEXT IDC_EDIT_ZCLIPPINGWIDTH,131,26,34,14,ES_AUTOHSCROLL | ES_NUMBER - COMBOBOX IDC_COMBO_ZCLIPPINGTYPE,39,47,80,55,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Type:",IDC_STATIC,13,49,19,8 - GROUPBOX "",IDC_STATIC,7,59,166,29 -END - -IDD_ZCUEING DIALOG 0, 0, 180, 95 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "ZCueing" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,13,68,50,14 - PUSHBUTTON "Cancel",IDCANCEL,70,68,50,14 - CONTROL "Slider1",IDC_SLIDER_ZCUEINGDEPTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,6,97,15 - LTEXT "Depth:",-1,13,9,22,8 - GROUPBOX "",-1,7,0,166,44 - EDITTEXT IDC_EDIT_ZCUEINGDEPTH,131,7,34,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Slider2",IDC_SLIDER_ZCUEINGWIDTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,25,97,15 - LTEXT "Width:",-1,13,28,22,8 - EDITTEXT IDC_EDIT_ZCUEINGWIDTH,131,26,34,14,ES_AUTOHSCROLL | ES_NUMBER - GROUPBOX "",-1,7,59,166,29 - CONTROL "Cueing ON/OFF",IDC_CHECK_CUEINGONOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,49,67,10 -END - -IDD_SHADINGMODEL DIALOG 0, 0, 60, 86 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "ShadingModel" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "COLOR",IDC_SHADINGMODEL_COLOR,7,7,46,16 - PUSHBUTTON "FLAT",IDC_SHADINGMODEL_FLAT,7,25,46,15 - PUSHBUTTON "GOURAUD",IDC_SHADINGMODEL_GOURAUD,7,43,46,16 - PUSHBUTTON "PHONG",IDC_SHADINGMODEL_PHONG,7,62,46,16 -END - -IDD_MODELCLIPPING DIALOG 0, 0, 180, 74 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Model clipping" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,13,47,50,14 - PUSHBUTTON "Cancel",IDCANCEL,70,47,50,14 - CONTROL "Slider1",IDC_SLIDER_MODELCLIPPING_Z,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,21,6,97,15 - LTEXT "Z:",-1,12,10,8,8 - GROUPBOX "",-1,7,0,166,25 - EDITTEXT IDC_EDIT_MODELCLIPPING_Z,118,7,34,14,ES_AUTOHSCROLL | ES_NUMBER - GROUPBOX "",-1,7,38,166,29 - CONTROL "Model clipping ON/OFF",IDC_CHECK_MODELCLIPPINGONOFF, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,28,91,10 -END - -IDD_RADIUS DIALOGEX 0, 0, 151, 82 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Radius" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,7,61,50,14 - PUSHBUTTON "Cancel",IDCANCEL,94,61,50,14 - CONTROL "Spin1",IDC_SPIN_RADIUS,"msctls_updown32",UDS_ARROWKEYS,98,43,11,14 - EDITTEXT IDC_EDIT_RADIUS,48,42,45,13,ES_AUTOHSCROLL | NOT WS_TABSTOP - CTEXT "Radius Fillet",IDC_RadiusFillet,33,20,94,18,0,WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE,HIDC_RadiusFillet -END - -IDD_ISOS DIALOG 0, 0, 161, 66 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Isos" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,7,44,50,14 - PUSHBUTTON "Cancel",IDCANCEL,104,44,50,14 - LTEXT "U Isos Number",IDC_ISOU,31,13,48,8 - LTEXT "V Isos Number",IDC_ISOV,31,28,47,8 - EDITTEXT IDC_EDIT_ISOU,93,7,40,14,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_ISOV,93,24,40,12,ES_AUTOHSCROLL -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "#include ""..\\..\\Common\\res\\OCC_Resource.h""\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDR_MAINFRAME BITMAP "..//res//Toolbar.bmp" -IDR_TB_AIS BITMAP "..//res//AIS_TB.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Toolbar -// - -IDR_MAINFRAME TOOLBAR 20, 20 -BEGIN - BUTTON ID_FILE_NEW - SEPARATOR - BUTTON ID_CIRCLE - BUTTON ID_LINE - BUTTON ID_BOX - BUTTON ID_Cylinder - BUTTON ID_SPHERE - SEPARATOR - BUTTON ID_OVERLAPPED_BOX - BUTTON ID_OVERLAPPED_CYLINDER - BUTTON ID_OVERLAPPED_SPHERE - BUTTON ID_POLYGON_OFFSETS - SEPARATOR - BUTTON ID_ERASEALL - SEPARATOR - BUTTON ID_SPOT_LIGHT - BUTTON ID_POSITIONAL_LIGHT - BUTTON ID_DIRECTIONAL_LIGHT - BUTTON ID_AMBIENT_LIGHT - BUTTON ID_CLEAR_LIGHTS - SEPARATOR - BUTTON ID_ZCLIPPING - BUTTON ID_ZCUEING - BUTTON ID_SCALE - SEPARATOR - BUTTON ID_NBISOS - BUTTON ID_SHADINGMODEL - BUTTON ID_ANTIALIASINGONOFF - SEPARATOR - BUTTON ID_MODELCLIPPING - SEPARATOR - BUTTON ID_VERTICES - BUTTON ID_EDGES - BUTTON ID_FACES - BUTTON ID_NEUTRAL - SEPARATOR - BUTTON ID_FILLET3D - SEPARATOR - BUTTON ID_TEXTURE_ON - BUTTON ID_BUTTONStart - BUTTON ID_BUTTONPrev - BUTTON ID_BUTTONRepeat - BUTTON ID_BUTTONNext - BUTTON ID_BUTTONEnd - SEPARATOR - BUTTON ID_DUMP_VIEW - SEPARATOR - BUTTON ID_APP_ABOUT -END - -IDR_TB_AIS TOOLBAR 20, 20 -BEGIN - BUTTON ID_OBJECT_WIREFRAME - BUTTON ID_OBJECT_SHADING - BUTTON ID_OBJECT_COLORED_MESH - SEPARATOR - BUTTON ID_OBJECT_COLOR - BUTTON ID_OBJECT_MATERIAL - BUTTON ID_OBJECT_TRANSPARENCY - SEPARATOR - BUTTON ID_OBJECT_ERASE - BUTTON ID_OBJECT_DISPLAYALL - SEPARATOR - BUTTON ID_OBJECT_REMOVE - BUTTON ID_OBJECT_DIM -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINFRAME MENU -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&New\tCtrl+N", ID_FILE_NEW - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_APP_EXIT - END - POPUP "&View" - BEGIN - MENUITEM "&Toolbar", ID_VIEW_TOOLBAR - MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - END - POPUP "&Help" - BEGIN - MENUITEM "&About Viewer3d...", ID_APP_ABOUT - END -END - -IDR_3DTYPE MENU -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&New\tCtrl+N", ID_FILE_NEW - MENUITEM "&Close", ID_FILE_CLOSE - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_APP_EXIT - END - POPUP "&View" - BEGIN - MENUITEM "&Toolbar", ID_VIEW_TOOLBAR - MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - END - POPUP "&Options" - BEGIN - POPUP "&Trihedron" - BEGIN - MENUITEM "&Static Trihedron...", ID_OPTIONS_TRIHEDRON_STATIC_TRIHEDRON - MENUITEM "&Dynamic Trihedron", ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON - END - END - POPUP "&Window" - BEGIN - MENUITEM "&New Window", ID_WINDOW_NEW - MENUITEM "&Cascade", ID_WINDOW_CASCADE - MENUITEM "&Tile", ID_WINDOW_TILE_HORZ - MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE - END - POPUP "&Help" - BEGIN - MENUITEM "&About Viewer3d...", ID_APP_ABOUT - END -END - -IDR_Popup3D MENU -BEGIN - POPUP "BackGround" - BEGIN - MENUITEM "Background Color...", ID_Modify_ChangeBackground - END - POPUP "Object(s)" - BEGIN - MENUITEM "Erase", ID_OBJECT_ERASE - MENUITEM "Shading", ID_OBJECT_SHADING - MENUITEM "Wireframe", ID_OBJECT_WIREFRAME - MENUITEM "Color...", ID_OBJECT_COLOR - MENUITEM "Material...", ID_OBJECT_MATERIAL - POPUP "Material" - BEGIN - MENUITEM "Aluminium", ID_OBJECT_MATERIAL_ALUMINIUM - MENUITEM "Brass", ID_OBJECT_MATERIAL_BRASS - MENUITEM "Bronze", ID_OBJECT_MATERIAL_BRONZE - MENUITEM "Chrome", ID_OBJECT_MATERIAL_CHROME - MENUITEM "Copper", ID_OBJECT_MATERIAL_COPPER - MENUITEM "Gold", ID_OBJECT_MATERIAL_GOLD - MENUITEM "Jade", ID_OBJECT_MATERIAL_JADE - MENUITEM "Metalized", ID_OBJECT_MATERIAL_METALIZED - MENUITEM "Neon GNC", ID_OBJECT_MATERIAL_NEON_GNC - MENUITEM "Neon PHC", ID_OBJECT_MATERIAL_NEON_PHC - MENUITEM "Obsidian", ID_OBJECT_MATERIAL_OBSIDIAN - MENUITEM "Pewter", ID_OBJECT_MATERIAL_PEWTER - MENUITEM "Plaster", ID_OBJECT_MATERIAL_PLASTER - MENUITEM "Plastic", ID_OBJECT_MATERIAL_PLASTIC - MENUITEM "Satin", ID_OBJECT_MATERIAL_SATIN - MENUITEM "Shiny plastic", ID_OBJECT_MATERIAL_SHINY_PLASTIC - MENUITEM "Silver", ID_OBJECT_MATERIAL_SILVER - MENUITEM "Steel", ID_OBJECT_MATERIAL_STEEL - MENUITEM "Stone", ID_OBJECT_MATERIAL_STONE - MENUITEM SEPARATOR - MENUITEM "Default", ID_OBJECT_MATERIAL_DEFAULT - END - MENUITEM "Transparency...", ID_OBJECT_TRANSPARENCY - END - POPUP "User cylinder" - BEGIN - MENUITEM "Change face color", ID_USERCYLINDER_CHANGEFACECOLOR - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "Viewer MFC Application" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "Viewer" - VALUE "LegalCopyright", "Copyright (C) 1997" - VALUE "OriginalFilename", "Viewer.EXE" - VALUE "ProductName", "SampleViewer3d Application" - VALUE "ProductVersion", "1, 0, 0, 1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDR_MAINFRAME "Viewer3d" - IDR_3DTYPE "\nViewer3d\n\n\n\n.Document\n Document" -END - -STRINGTABLE -BEGIN - ID_BOX "Create and display a box\nBox" - ID_Cylinder "Create and display a cylinder\nCylinder" - ID_SPHERE "Create and display a sphere\nSphere" - ID_ERASEALL "Remove all\nRemove all" - ID_AMBIENT_LIGHT "Create an ambient light source\nAmbient light" - ID_DIRECTIONAL_LIGHT "Create an directional light source\nDirectional light" - ID_POSITIONAL_LIGHT "Create an positional light source\nPositional light" - ID_SPOT_LIGHT "Create an spot light source\nSpot light" - ID_LIGHTOFF "Delete lights\nDelete lights" - ID_ZCLIPPING "ZClipping\nZClipping" - ID_ZCUEING "ZCueing\nZCueing" - ID_SHADINGMODEL "Define shading model\nShadingModel" - ID_ANTIALIASINGONOFF "Antialiasing ON/OFF\nAntialiasing" -END - -STRINGTABLE -BEGIN - ID_CLEAR_LIGHTS "Clear all the light sources\nClear lights" - ID_MODELCLIPPING "ModelClipping\nModelClipping" - ID_OVERLAPPED_BOX "Create and display two overlapped boxes\nOverlapped boxes" - ID_BUTTON819 "Create and display two overlapped spheres\nOverlapped spheres" - ID_OVERLAPPED_SPHERE "Create and display two overlapped spheres\nOverlapped spheres" - ID_BUTTON821 "Create and display two overlapped boxes\nOverlapped boxes" - ID_OVERLAPPED_CYLINDER "Create and display two overlapped cylinders\nOverlapped cylinders" - ID_POLYGON_OFFSETS "Set/unset offsets\nSet/unset offsets" - ID_OBJECT_COLORED_MESH "Puts cylinder in colored mesh\nColored mesh" - ID_SCALE "Scale\nScale" -END - -STRINGTABLE -BEGIN - ID_CIRCLE "Clear all the light sources\nClear lights" - ID_LINE "Create and display a line with standard tools\nLine" - ID_VERTICES "Set the selection mode to vertices\nVertices" - ID_EDGES "Set the selection mode to edges\nEdges" - ID_FACES "Set the selection modes to faces\nFaces" - ID_NEUTRAL "Neutral point for selection\nNeutral point" - ID_FILLET3D "Make a fillet between faces\nFillet" - ID_NBISOS "Set global isos number\nIsos" - ID_BUTTONStart "Press to go to the first sample\nFirst sample (Home)" - ID_BUTTONPrev "Press to go to the previous sample\nPrevious sample (PgUp)" - ID_BUTTONRepeat "Press to repeat the current sample\nRepeat sample (Space)" - ID_BUTTONNext "Press to go to the next sample\nNext sample (PgDn)" - ID_BUTTONEnd "Press to go to the last sample\nLast sample (End)" -END - -STRINGTABLE -BEGIN - ID_DUMP_VIEW "Save current frame into an image file\nExport view (F12)" - ID_TEXTURE_ON "Run texture example\nRun texture example" -END - -STRINGTABLE -BEGIN - ID_OBJECT_DIMENSIONS "Add dimensions" - ID_LOCALCONTEXT_ADDDIMENSION "Add new dimension for selected objetcs" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_SCALE DIALOG 0, 0, 186, 103 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Heterogeneous Scale" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,13,78,50,14 - PUSHBUTTON "Cancel",IDCANCEL,70,78,50,14 - GROUPBOX "",IDC_STATIC,7,69,166,29 - GROUPBOX "",IDC_STATIC,7,0,166,65 - CONTROL "Slider1",IDC_SLIDER_SCALEX,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,6,97,15 - LTEXT "X:",IDC_STATIC,13,9,8,8 - EDITTEXT IDC_EDIT_SCALEX,131,7,34,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Slider2",IDC_SLIDER_SCALEY,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,25,97,15 - LTEXT "Y:",IDC_STATIC,13,28,8,8 - EDITTEXT IDC_EDIT_SCALEY,131,26,34,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Slider2",IDC_SLIDER_SCALEZ,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,45,97,15 - LTEXT "Z:",IDC_STATIC,13,48,8,8 - EDITTEXT IDC_EDIT_SCALEZ,131,46,34,14,ES_AUTOHSCROLL | ES_NUMBER -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_SCALE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 96 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif -#include "afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp b/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp index 52698d2529..3974ab181c 100755 --- a/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp +++ b/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp @@ -20,57 +20,57 @@ IMPLEMENT_DYNCREATE(CViewer3dDoc, CDocument) -BEGIN_MESSAGE_MAP(CViewer3dDoc, OCC_3dBaseDoc) - //{{AFX_MSG_MAP(CViewer3dDoc) - ON_COMMAND(ID_BOX, OnBox) - ON_COMMAND(ID_Cylinder, OnCylinder) - ON_COMMAND(ID_SPHERE, OnSphere) - ON_COMMAND(ID_ERASEALL, OnRemoveAll) - ON_COMMAND(ID_NBISOS, OnNbisos) - ON_COMMAND(ID_FACES, OnFaces) - ON_COMMAND(ID_EDGES, OnEdges) - ON_COMMAND(ID_VERTICES, OnVertices) - ON_COMMAND(ID_NEUTRAL, OnNeutral) - ON_COMMAND(ID_USERCYLINDER_CHANGEFACECOLOR, OnUsercylinderChangefacecolor) - ON_COMMAND(ID_FILLET3D, OnFillet3d) - ON_COMMAND(ID_CIRCLE, OnCircle) - ON_COMMAND(ID_LINE, OnLine) - ON_COMMAND(ID_OVERLAPPED_BOX, OnOverlappedBox) - ON_COMMAND(ID_OVERLAPPED_CYLINDER, OnOverlappedCylinder) - ON_COMMAND(ID_OVERLAPPED_SPHERE, OnOverlappedSphere) - ON_COMMAND(ID_POLYGON_OFFSETS, OnPolygonOffsets) - ON_UPDATE_COMMAND_UI(ID_POLYGON_OFFSETS, OnUpdatePolygonOffsets) - ON_UPDATE_COMMAND_UI(ID_Cylinder, OnUpdateCylinder) - ON_UPDATE_COMMAND_UI(ID_SPHERE, OnUpdateSphere) - ON_UPDATE_COMMAND_UI(ID_BOX, OnUpdateBox) - ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_CYLINDER, OnUpdateOverlappedCylinder) - ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_SPHERE, OnUpdateOverlappedSphere) - ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_BOX, OnUpdateOverlappedBox) - ON_COMMAND(ID_OBJECT_REMOVE, OnObjectRemove) - ON_COMMAND(ID_OBJECT_ERASE, OnObjectErase) - ON_COMMAND(ID_OBJECT_DISPLAYALL, OnObjectDisplayall) - ON_COMMAND(ID_OBJECT_COLORED_MESH, OnObjectColoredMesh) - ON_UPDATE_COMMAND_UI(ID_OBJECT_COLORED_MESH, OnUpdateObjectColoredMesh) - ON_UPDATE_COMMAND_UI(ID_OBJECT_SHADING, OnUpdateObjectShading) - ON_UPDATE_COMMAND_UI(ID_OBJECT_WIREFRAME, OnUpdateObjectWireframe) - ON_COMMAND(ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON, OnOptionsTrihedronDynamicTrihedron) - ON_UPDATE_COMMAND_UI(ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON, OnUpdateOptionsTrihedronDynamicTrihedron) - ON_UPDATE_COMMAND_UI(ID_OPTIONS_TRIHEDRON_STATIC_TRIHEDRON, OnUpdateOptionsTrihedronStaticTrihedron) - ON_COMMAND(ID_OBJECT_MATERIAL, OnObjectMaterial) - ON_COMMAND(ID_TEXTURE_ON, OnTextureOn) - ON_COMMAND(ID_BUTTONNext, OnBUTTONNext) - ON_COMMAND(ID_BUTTONStart, OnBUTTONStart) - ON_COMMAND(ID_BUTTONRepeat, OnBUTTONRepeat) - ON_COMMAND(ID_BUTTONPrev, OnBUTTONPrev) - ON_COMMAND(ID_BUTTONEnd, OnBUTTONEnd) - ON_UPDATE_COMMAND_UI(ID_BUTTONNext, OnUpdateBUTTONNext) - ON_UPDATE_COMMAND_UI(ID_BUTTONPrev, OnUpdateBUTTONPrev) - ON_UPDATE_COMMAND_UI(ID_BUTTONStart, OnUpdateBUTTONStart) - ON_UPDATE_COMMAND_UI(ID_BUTTONRepeat, OnUpdateBUTTONRepeat) - ON_UPDATE_COMMAND_UI(ID_BUTTONEnd, OnUpdateBUTTONEnd) - ON_COMMAND(ID_FILE_NEW, OnFileNew) - ON_COMMAND(ID_DUMP_VIEW, OnDumpView) - //}}AFX_MSG_MAP +BEGIN_MESSAGE_MAP(CViewer3dDoc, OCC_3dDoc) + //{{AFX_MSG_MAP(CViewer3dDoc) + ON_COMMAND(ID_BOX, OnBox) + ON_COMMAND(ID_Cylinder, OnCylinder) + ON_COMMAND(ID_SPHERE, OnSphere) + ON_COMMAND(ID_ERASEALL, OnRemoveAll) + ON_COMMAND(ID_NBISOS, OnNbisos) + ON_COMMAND(ID_FACES, OnFaces) + ON_COMMAND(ID_EDGES, OnEdges) + ON_COMMAND(ID_VERTICES, OnVertices) + ON_COMMAND(ID_NEUTRAL, OnNeutral) + ON_COMMAND(ID_USERCYLINDER_CHANGEFACECOLOR, OnUsercylinderChangefacecolor) + ON_COMMAND(ID_FILLET3D, OnFillet3d) + ON_COMMAND(ID_CIRCLE, OnCircle) + ON_COMMAND(ID_LINE, OnLine) + ON_COMMAND(ID_OVERLAPPED_BOX, OnOverlappedBox) + ON_COMMAND(ID_OVERLAPPED_CYLINDER, OnOverlappedCylinder) + ON_COMMAND(ID_OVERLAPPED_SPHERE, OnOverlappedSphere) + ON_COMMAND(ID_POLYGON_OFFSETS, OnPolygonOffsets) + ON_UPDATE_COMMAND_UI(ID_POLYGON_OFFSETS, OnUpdatePolygonOffsets) + ON_UPDATE_COMMAND_UI(ID_Cylinder, OnUpdateCylinder) + ON_UPDATE_COMMAND_UI(ID_SPHERE, OnUpdateSphere) + ON_UPDATE_COMMAND_UI(ID_BOX, OnUpdateBox) + ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_CYLINDER, OnUpdateOverlappedCylinder) + ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_SPHERE, OnUpdateOverlappedSphere) + ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_BOX, OnUpdateOverlappedBox) + ON_COMMAND(ID_OBJECT_REMOVE, OnObjectRemove) + ON_COMMAND(ID_OBJECT_ERASE, OnObjectErase) + ON_COMMAND(ID_OBJECT_DISPLAYALL, OnObjectDisplayall) + ON_COMMAND(ID_OBJECT_COLORED_MESH, OnObjectColoredMesh) + ON_UPDATE_COMMAND_UI(ID_OBJECT_COLORED_MESH, OnUpdateObjectColoredMesh) + ON_UPDATE_COMMAND_UI(ID_OBJECT_SHADING, OnUpdateObjectShading) + ON_UPDATE_COMMAND_UI(ID_OBJECT_WIREFRAME, OnUpdateObjectWireframe) + ON_COMMAND(ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON, OnOptionsTrihedronDynamicTrihedron) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON, OnUpdateOptionsTrihedronDynamicTrihedron) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_TRIHEDRON_STATIC_TRIHEDRON, OnUpdateOptionsTrihedronStaticTrihedron) + ON_COMMAND(ID_OBJECT_MATERIAL, OnObjectMaterial) + ON_COMMAND(ID_TEXTURE_ON, OnTextureOn) + ON_COMMAND(ID_BUTTONNext, OnBUTTONNext) + ON_COMMAND(ID_BUTTONStart, OnBUTTONStart) + ON_COMMAND(ID_BUTTONRepeat, OnBUTTONRepeat) + ON_COMMAND(ID_BUTTONPrev, OnBUTTONPrev) + ON_COMMAND(ID_BUTTONEnd, OnBUTTONEnd) + ON_UPDATE_COMMAND_UI(ID_BUTTONNext, OnUpdateBUTTONNext) + ON_UPDATE_COMMAND_UI(ID_BUTTONPrev, OnUpdateBUTTONPrev) + ON_UPDATE_COMMAND_UI(ID_BUTTONStart, OnUpdateBUTTONStart) + ON_UPDATE_COMMAND_UI(ID_BUTTONRepeat, OnUpdateBUTTONRepeat) + ON_UPDATE_COMMAND_UI(ID_BUTTONEnd, OnUpdateBUTTONEnd) + ON_COMMAND(ID_FILE_NEW, OnFileNew) + ON_COMMAND(ID_DUMP_VIEW, OnDumpView) + //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -79,34 +79,34 @@ END_MESSAGE_MAP() CViewer3dDoc::CViewer3dDoc() :OCC_3dDoc() { - myCylinder.Nullify(); - mySphere.Nullify(); - myBox.Nullify(); - myOverlappedCylinder.Nullify(); - myOverlappedSphere.Nullify(); - myOverlappedBox.Nullify(); - myOffsetDlg = NULL; - myStaticTrihedronAxisIsDisplayed = FALSE; - myState = -1; + myCylinder.Nullify(); + mySphere.Nullify(); + myBox.Nullify(); + myOverlappedCylinder.Nullify(); + myOverlappedSphere.Nullify(); + myOverlappedBox.Nullify(); + myOffsetDlg = NULL; + myStaticTrihedronAxisIsDisplayed = FALSE; + myState = -1; - isTextureSampleStarted = FALSE; + isTextureSampleStarted = FALSE; - myPresentation = OCCDemo_Presentation::Current; - myPresentation->SetDocument(this); + myPresentation = OCCDemo_Presentation::Current; + myPresentation->SetDocument(this); - myAISContext->DefaultDrawer()->ShadingAspect()->SetColor(Quantity_NOC_CHARTREUSE1); - myAISContext->DefaultDrawer()->ShadingAspect()->SetMaterial(Graphic3d_NOM_SILVER); + myAISContext->DefaultDrawer()->ShadingAspect()->SetColor(Quantity_NOC_CHARTREUSE1); + myAISContext->DefaultDrawer()->ShadingAspect()->SetMaterial(Graphic3d_NOM_SILVER); - strcpy_s(myDataDir, "Data"); - strcpy_s(myLastPath, "."); + strcpy_s(myDataDir, "Data"); + strcpy_s(myLastPath, "."); - /* - Handle(AIS_Trihedron) myTrihedron; - Handle(Geom_Axis2Placement) myTrihedronAxis=new Geom_Axis2Placement(gp::XOY()); - myTrihedron=new AIS_Trihedron(myTrihedronAxis); - myAISContext->Display(myTrihedron); - */ + /* + Handle(AIS_Trihedron) myTrihedron; + Handle(Geom_Axis2Placement) myTrihedronAxis=new Geom_Axis2Placement(gp::XOY()); + myTrihedron=new AIS_Trihedron(myTrihedronAxis); + myAISContext->Display(myTrihedron); + */ } CViewer3dDoc::~CViewer3dDoc() @@ -119,12 +119,12 @@ CViewer3dDoc::~CViewer3dDoc() #ifdef _DEBUG void CViewer3dDoc::AssertValid() const { - CDocument::AssertValid(); + CDocument::AssertValid(); } void CViewer3dDoc::Dump(CDumpContext& dc) const { - CDocument::Dump(dc); + CDocument::Dump(dc); } #endif //_DEBUG @@ -133,9 +133,9 @@ void CViewer3dDoc::Dump(CDumpContext& dc) const void CViewer3dDoc::UpdateResultMessageDlg (CString theTitle, const TCollection_AsciiString& theMessage) { - CString aText (theMessage.ToCString()); - myCResultDialog.SetText (aText); - myCResultDialog.SetTitle(theTitle); + CString aText (theMessage.ToCString()); + myCResultDialog.SetText (aText); + myCResultDialog.SetTitle(theTitle); } void CViewer3dDoc::UpdateResultMessageDlg(CString theTitle, CString theMessage) @@ -144,366 +144,347 @@ void CViewer3dDoc::UpdateResultMessageDlg(CString theTitle, CString theMessage) myCResultDialog.SetTitle(theTitle); } -void CViewer3dDoc::OnBox() +void CViewer3dDoc::OnBox() { - if(myBox.IsNull()){ - BRepPrimAPI_MakeBox B(gp_Pnt(0,-400,-100), 200.,150.,100.); + if(myBox.IsNull()) + { + BRepPrimAPI_MakeBox B(gp_Pnt(0,-400,-100), 200.,150.,100.); - myBox = new AIS_Shape(B.Shape()); + myBox = new AIS_Shape(B.Shape()); - myAISContext->SetMaterial(myBox,Graphic3d_NOM_PEWTER); - myAISContext->SetDisplayMode(myBox,1); + myAISContext->SetMaterial(myBox,Graphic3d_NOM_PEWTER); + myAISContext->SetDisplayMode(myBox,1); - myAISContext->Display(myBox); - TCollection_AsciiString Message("\ + myAISContext->Display(myBox); + TCollection_AsciiString Message("\ BRepPrimAPI_MakeBox Box1(gp_Pnt(0,-400,-100), 200.,150.,100.);\n\ - "); - - UpdateResultMessageDlg("Create Box",Message); + "); - } + UpdateResultMessageDlg("Create Box",Message); + } } -void CViewer3dDoc::OnCylinder() +void CViewer3dDoc::OnCylinder() { - if(myCylinder.IsNull()) { - gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100)))); - - //BRepPrimAPI_MakeCylinder C(CylAx2, 80.,200.); - - myCylinder = new User_Cylinder(CylAx2, 80.,200.); - -// myCylinder = new AIS_Shape(C.Shape()); -/* - myCylinder->SetTransparency(0.5); + if(myCylinder.IsNull()) + { + gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100)))); + myCylinder = new User_Cylinder(CylAx2, 80.,200.); - myAISContext->SetColor(myCylinder,Quantity_NOC_WHITE); - myAISContext->SetMaterial(myCylinder,Graphic3d_NOM_SHINY_PLASTIC); -*/ - myAISContext->SetDisplayMode(myCylinder,1); + myAISContext->SetDisplayMode(myCylinder,1); - myAISContext->Display(myCylinder); + myAISContext->Display(myCylinder); - TCollection_AsciiString Message("\ + TCollection_AsciiString Message("\ gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100))));\n\ C = new User_Cylinder(CylAx2, 80.,200.);;\n\ - "); - - UpdateResultMessageDlg("Create Cylinder",Message); + "); - } + UpdateResultMessageDlg("Create Cylinder",Message); + } } -void CViewer3dDoc::OnSphere() +void CViewer3dDoc::OnSphere() { - if(mySphere.IsNull()){ - BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.); + if(mySphere.IsNull()) + { + BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.); + + mySphere = new AIS_Shape(S.Shape()); - mySphere = new AIS_Shape(S.Shape()); - - myAISContext->SetMaterial(mySphere,Graphic3d_NOM_BRONZE); - myAISContext->SetDisplayMode(mySphere,1); + myAISContext->SetMaterial(mySphere,Graphic3d_NOM_BRONZE); + myAISContext->SetDisplayMode(mySphere,1); - myAISContext->Display(mySphere); - TCollection_AsciiString Message("\ + myAISContext->Display(mySphere); + TCollection_AsciiString Message("\ BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.);\n\ - "); - UpdateResultMessageDlg("Create Sphere",Message); - } + "); + UpdateResultMessageDlg("Create Sphere",Message); + } } -void CViewer3dDoc::OnRemoveAll() +void CViewer3dDoc::OnRemoveAll() { - AIS_ListOfInteractive aListOfObjects; - myAISContext->ObjectsInside(aListOfObjects,AIS_KOI_Shape); + AIS_ListOfInteractive aListOfObjects; + myAISContext->ObjectsInside(aListOfObjects,AIS_KOI_Shape); - AIS_ListIteratorOfListOfInteractive aListIterator; - for(aListIterator.Initialize(aListOfObjects);aListIterator.More();aListIterator.Next()){ - myAISContext->Remove(aListIterator.Value()); - } + AIS_ListIteratorOfListOfInteractive aListIterator; + for(aListIterator.Initialize(aListOfObjects);aListIterator.More();aListIterator.Next()){ + myAISContext->Remove(aListIterator.Value()); + } - myAISContext->Remove(myCylinder); + myAISContext->Remove(myCylinder); - myCylinder.Nullify(); - mySphere.Nullify(); - myBox.Nullify(); - myOverlappedCylinder.Nullify(); - myOverlappedSphere.Nullify(); - myOverlappedBox.Nullify(); - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - myOffsetDlg->UpdateValues(); + myCylinder.Nullify(); + mySphere.Nullify(); + myBox.Nullify(); + myOverlappedCylinder.Nullify(); + myOverlappedSphere.Nullify(); + myOverlappedBox.Nullify(); + if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) + myOffsetDlg->UpdateValues(); } void CViewer3dDoc::OnOverlappedBox() { - OnBox(); - if(myOverlappedBox.IsNull()){ - BRepPrimAPI_MakeBox B(gp_Pnt(0,-400,-100), 200.,150.,100.); + OnBox(); + if(myOverlappedBox.IsNull()){ + BRepPrimAPI_MakeBox B(gp_Pnt(0,-400,-100), 200.,150.,100.); - BRepBuilderAPI_NurbsConvert aNurbsConvert(B.Shape()); - TopoDS_Shape aBoxShape2 = aNurbsConvert.Shape(); + BRepBuilderAPI_NurbsConvert aNurbsConvert(B.Shape()); + TopoDS_Shape aBoxShape2 = aNurbsConvert.Shape(); - myOverlappedBox = new AIS_Shape(aBoxShape2); + myOverlappedBox = new AIS_Shape(aBoxShape2); - myAISContext->SetMaterial(myOverlappedBox,Graphic3d_NOM_GOLD); - myAISContext->SetDisplayMode(myOverlappedBox,1); + myAISContext->SetMaterial(myOverlappedBox,Graphic3d_NOM_GOLD); + myAISContext->SetDisplayMode(myOverlappedBox,1); - myAISContext->Display(myOverlappedBox); - TCollection_AsciiString Message("\ + myAISContext->Display(myOverlappedBox); + TCollection_AsciiString Message("\ BRepPrimAPI_MakeBox Box1(gp_Pnt(0,-400,-100), 200.,150.,100.);\n\ \n\ BRepPrimAPI_MakeBox Box2(gp_Pnt(0,-400,-100), 200.,150.,100.);\n\ BRepBuilderAPI_NurbsConvert aNurbsConvert(Box2.Shape());\n\ - "); - UpdateResultMessageDlg("Create overlapped boxes",Message); - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - myOffsetDlg->UpdateValues(); - - - } + "); + UpdateResultMessageDlg("Create overlapped boxes",Message); + if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) + myOffsetDlg->UpdateValues(); + } } -void CViewer3dDoc::OnOverlappedCylinder() +void CViewer3dDoc::OnOverlappedCylinder() { - OnCylinder(); + OnCylinder(); - if(myOverlappedCylinder.IsNull()){ - gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100)))); - BRepPrimAPI_MakeCylinder C(CylAx2, 80.,200.); + if(myOverlappedCylinder.IsNull()){ + gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100)))); + BRepPrimAPI_MakeCylinder C(CylAx2, 80.,200.); - BRepBuilderAPI_NurbsConvert aNurbsConvert(C.Shape()); - TopoDS_Shape aCylShape2 = aNurbsConvert.Shape(); + BRepBuilderAPI_NurbsConvert aNurbsConvert(C.Shape()); + TopoDS_Shape aCylShape2 = aNurbsConvert.Shape(); - myOverlappedCylinder = new AIS_Shape(aCylShape2); + myOverlappedCylinder = new AIS_Shape(aCylShape2); - - myAISContext->SetMaterial(myOverlappedCylinder,Graphic3d_NOM_GOLD); - myAISContext->SetDisplayMode(myOverlappedCylinder,1); - myAISContext->Display(myOverlappedCylinder); + myAISContext->SetMaterial(myOverlappedCylinder,Graphic3d_NOM_GOLD); + myAISContext->SetDisplayMode(myOverlappedCylinder,1); - TCollection_AsciiString Message("\ + myAISContext->Display(myOverlappedCylinder); + + TCollection_AsciiString Message("\ gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100))));\n\ Cylinder1 = new User_Cylinder(CylAx2, 80.,200.);\n\ \n\ BRepPrimAPI_MakeCylinder Cylinder2(CylAx2, 80.,200.);\n\ BRepBuilderAPI_NurbsConvert aNurbsConvert(Cylinder2.Shape());\n\ - "); - UpdateResultMessageDlg("Create overlapped cylinders",Message); - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - myOffsetDlg->UpdateValues(); - - } + "); + UpdateResultMessageDlg("Create overlapped cylinders",Message); + if (myOffsetDlg && myOffsetDlg->IsWindowVisible()) + { + myOffsetDlg->UpdateValues(); + } + } } -void CViewer3dDoc::OnOverlappedSphere() +void CViewer3dDoc::OnOverlappedSphere() { - OnSphere(); - if(myOverlappedSphere.IsNull()){ - BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.); + OnSphere(); + if(myOverlappedSphere.IsNull()){ + BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.); - BRepBuilderAPI_NurbsConvert aNurbsConvert(S.Shape()); - TopoDS_Shape aSphereShape2 = aNurbsConvert.Shape(); + BRepBuilderAPI_NurbsConvert aNurbsConvert(S.Shape()); + TopoDS_Shape aSphereShape2 = aNurbsConvert.Shape(); - myOverlappedSphere = new AIS_Shape(aSphereShape2); + myOverlappedSphere = new AIS_Shape(aSphereShape2); - myAISContext->SetMaterial(myOverlappedSphere,Graphic3d_NOM_GOLD); + myAISContext->SetMaterial(myOverlappedSphere,Graphic3d_NOM_GOLD); - myAISContext->SetDisplayMode(myOverlappedSphere,1); + myAISContext->SetDisplayMode(myOverlappedSphere,1); - myAISContext->Display(myOverlappedSphere); + myAISContext->Display(myOverlappedSphere); - TCollection_AsciiString Message("\ + TCollection_AsciiString Message("\ BRepPrimAPI_MakeSphere Sphere1(gp_Pnt(0,300,0), 100.);\n\ \n\ BRepPrimAPI_MakeSphere Sphere2(gp_Pnt(0,300,0), 100.);\n\ BRepBuilderAPI_NurbsConvert aNurbsConvert(Sphere2.Shape());\n\ - "); - UpdateResultMessageDlg("Create overlapped spheres",Message); - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - myOffsetDlg->UpdateValues(); - - } + "); + UpdateResultMessageDlg("Create overlapped spheres",Message); + if (myOffsetDlg && myOffsetDlg->IsWindowVisible()) + { + myOffsetDlg->UpdateValues(); + } + } } -void CViewer3dDoc::OnPolygonOffsets() +void CViewer3dDoc::OnPolygonOffsets() { - - myOffsetDlg = new COffsetDlg(this); - myOffsetDlg->Create(COffsetDlg::IDD,NULL); - myAISContext->UpdateCurrentViewer(); - + myOffsetDlg = new COffsetDlg(this); + myOffsetDlg->Create(COffsetDlg::IDD,NULL); + myAISContext->UpdateCurrentViewer(); } void CViewer3dDoc::OnUpdatePolygonOffsets(CCmdUI* pCmdUI) { - Standard_Integer aOffsetMode; - Standard_ShortReal aFactor; - Standard_ShortReal aCylUnits = 0; - Standard_ShortReal aSphereUnits = 0; - Standard_ShortReal aBoxUnits = 0; - - BOOL IsOverlappedCylinderDisplayed = myAISContext->IsDisplayed(myOverlappedCylinder); - BOOL IsOverlappedSphereDisplayed = myAISContext->IsDisplayed(myOverlappedSphere); - BOOL IsOverlappedBoxDisplayed = myAISContext->IsDisplayed(myOverlappedBox); - BOOL IsAnyOverlappedObjectDisplayed = - IsOverlappedCylinderDisplayed || IsOverlappedSphereDisplayed || IsOverlappedBoxDisplayed; - - if(!myOverlappedCylinder.IsNull() && IsOverlappedCylinderDisplayed){ - myOverlappedCylinder->PolygonOffsets(aOffsetMode,aFactor,aCylUnits); - } - - if(!myOverlappedSphere.IsNull() && IsOverlappedSphereDisplayed){ - myOverlappedSphere->PolygonOffsets(aOffsetMode,aFactor,aSphereUnits); - } - - if(!myOverlappedBox.IsNull() && IsOverlappedBoxDisplayed){ - myOverlappedBox->PolygonOffsets(aOffsetMode,aFactor,aBoxUnits); - } - - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - pCmdUI->SetCheck(TRUE); - else - pCmdUI->SetCheck(FALSE); - if (IsAnyOverlappedObjectDisplayed) - if(myOffsetDlg) - pCmdUI->Enable(!myOffsetDlg->IsWindowVisible()); - else - pCmdUI->Enable(TRUE); - else - pCmdUI->Enable(FALSE); - - + Standard_Integer aOffsetMode; + Standard_ShortReal aFactor; + Standard_ShortReal aCylUnits = 0; + Standard_ShortReal aSphereUnits = 0; + Standard_ShortReal aBoxUnits = 0; + + BOOL IsOverlappedCylinderDisplayed = myAISContext->IsDisplayed(myOverlappedCylinder); + BOOL IsOverlappedSphereDisplayed = myAISContext->IsDisplayed(myOverlappedSphere); + BOOL IsOverlappedBoxDisplayed = myAISContext->IsDisplayed(myOverlappedBox); + BOOL IsAnyOverlappedObjectDisplayed = + IsOverlappedCylinderDisplayed || IsOverlappedSphereDisplayed || IsOverlappedBoxDisplayed; + + if(!myOverlappedCylinder.IsNull() && IsOverlappedCylinderDisplayed){ + myOverlappedCylinder->PolygonOffsets(aOffsetMode,aFactor,aCylUnits); + } + + if(!myOverlappedSphere.IsNull() && IsOverlappedSphereDisplayed){ + myOverlappedSphere->PolygonOffsets(aOffsetMode,aFactor,aSphereUnits); + } + + if(!myOverlappedBox.IsNull() && IsOverlappedBoxDisplayed){ + myOverlappedBox->PolygonOffsets(aOffsetMode,aFactor,aBoxUnits); + } + + if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) + pCmdUI->SetCheck(TRUE); + else + pCmdUI->SetCheck(FALSE); + if (IsAnyOverlappedObjectDisplayed) + if(myOffsetDlg) + pCmdUI->Enable(!myOffsetDlg->IsWindowVisible()); + else + pCmdUI->Enable(TRUE); + else + pCmdUI->Enable(FALSE); } -void CViewer3dDoc::OnUpdateCylinder(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateCylinder(CCmdUI* pCmdUI) { - pCmdUI->Enable(myCylinder.IsNull()); - + pCmdUI->Enable(myCylinder.IsNull()); } -void CViewer3dDoc::OnUpdateSphere(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateSphere(CCmdUI* pCmdUI) { - pCmdUI->Enable(mySphere.IsNull()); - + pCmdUI->Enable(mySphere.IsNull()); } -void CViewer3dDoc::OnUpdateBox(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateBox(CCmdUI* pCmdUI) { - pCmdUI->Enable(myBox.IsNull()); - + pCmdUI->Enable(myBox.IsNull()); } -void CViewer3dDoc::OnUpdateOverlappedCylinder(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateOverlappedCylinder(CCmdUI* pCmdUI) { - pCmdUI->Enable (myOverlappedCylinder.IsNull() - || myCylinder.IsNull()); - + pCmdUI->Enable (myOverlappedCylinder.IsNull() + || myCylinder.IsNull()); + } -void CViewer3dDoc::OnUpdateOverlappedSphere(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateOverlappedSphere(CCmdUI* pCmdUI) { - pCmdUI->Enable (myOverlappedSphere.IsNull() - || mySphere.IsNull()); + pCmdUI->Enable (myOverlappedSphere.IsNull() + || mySphere.IsNull()); } -void CViewer3dDoc::OnUpdateOverlappedBox(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateOverlappedBox(CCmdUI* pCmdUI) { - pCmdUI->Enable (myOverlappedBox.IsNull() - || myBox.IsNull()); + pCmdUI->Enable (myOverlappedBox.IsNull() + || myBox.IsNull()); } -void CViewer3dDoc::OnObjectRemove() - +void CViewer3dDoc::OnObjectRemove() { + if(myAISContext->IsCurrent(myBox)) + myBox.Nullify(); - if(myAISContext->IsCurrent(myBox)) - myBox.Nullify(); - - if(myAISContext->IsCurrent(myCylinder)) - myCylinder.Nullify(); + if(myAISContext->IsCurrent(myCylinder)) + myCylinder.Nullify(); - if(myAISContext->IsCurrent(mySphere)) - mySphere.Nullify(); + if(myAISContext->IsCurrent(mySphere)) + mySphere.Nullify(); - if(myAISContext->IsCurrent(myOverlappedBox)) - myOverlappedBox.Nullify(); + if(myAISContext->IsCurrent(myOverlappedBox)) + myOverlappedBox.Nullify(); - if(myAISContext->IsCurrent(myOverlappedCylinder)) - myOverlappedCylinder.Nullify(); + if(myAISContext->IsCurrent(myOverlappedCylinder)) + myOverlappedCylinder.Nullify(); - if(myAISContext->IsCurrent(myOverlappedSphere)) - myOverlappedSphere.Nullify(); + if(myAISContext->IsCurrent(myOverlappedSphere)) + myOverlappedSphere.Nullify(); - - for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->InitCurrent()) - myAISContext->Remove(myAISContext->Current(),Standard_True); - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - myOffsetDlg->UpdateValues(); + for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->InitCurrent()) + myAISContext->Remove(myAISContext->Current(),Standard_True); + if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) + myOffsetDlg->UpdateValues(); } -void CViewer3dDoc::OnObjectErase() +void CViewer3dDoc::OnObjectErase() { - OCC_3dBaseDoc::OnObjectErase(); - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - myOffsetDlg->UpdateValues(); + OCC_3dBaseDoc::OnObjectErase(); + if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) + myOffsetDlg->UpdateValues(); } -void CViewer3dDoc::OnObjectDisplayall() +void CViewer3dDoc::OnObjectDisplayall() { - OCC_3dBaseDoc::OnObjectDisplayall(); - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - myOffsetDlg->UpdateValues(); + OCC_3dBaseDoc::OnObjectDisplayall(); + if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) + myOffsetDlg->UpdateValues(); } Handle_User_Cylinder CViewer3dDoc::GetCylinder() { - return myCylinder; + return myCylinder; } Handle_AIS_Shape CViewer3dDoc::GetSphere() { - return mySphere; + return mySphere; } Handle_AIS_Shape CViewer3dDoc::GetBox() { - return myBox; + return myBox; } Handle_AIS_Shape CViewer3dDoc::GetOverlappedCylinder() { - return myOverlappedCylinder; + return myOverlappedCylinder; } Handle_AIS_Shape CViewer3dDoc::GetOverlappedSphere() { - return myOverlappedSphere; + return myOverlappedSphere; } Handle_AIS_Shape CViewer3dDoc::GetOverlappedBox() { - return myOverlappedBox; + return myOverlappedBox; } -void CViewer3dDoc::DragEvent(const Standard_Integer x , - const Standard_Integer y , - const Standard_Integer TheState , - const Handle(V3d_View)& aView ) +void CViewer3dDoc::DragEvent (const Standard_Integer theX, + const Standard_Integer theY, + const Standard_Integer theState, + const Handle(V3d_View)& theView) { - OCC_3dBaseDoc::DragEvent(x,y, TheState,aView); - if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) - myOffsetDlg->UpdateValues(); + OCC_3dBaseDoc::DragEvent (theX, theY, theState, theView); + if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) + myOffsetDlg->UpdateValues(); } //----------------------------------------------------------------------------------------- @@ -592,12 +573,12 @@ void CViewer3dDoc::InputEvent(const Standard_Integer /*x*/, //----------------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------------- -void CViewer3dDoc::ShiftDragEvent(const Standard_Integer x , - const Standard_Integer y , - const Standard_Integer TheState , - const Handle(V3d_View)& aView ) +void CViewer3dDoc::ShiftDragEvent (const Standard_Integer theX, + const Standard_Integer theY, + const Standard_Integer theState, + const Handle(V3d_View)& theView) { - OCC_3dBaseDoc::ShiftDragEvent(x,y,TheState,aView); + OCC_3dBaseDoc::ShiftDragEvent(theX, theY, theState, theView); if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) myOffsetDlg->UpdateValues(); } @@ -606,17 +587,16 @@ void CViewer3dDoc::ShiftDragEvent(const Standard_Integer x , //----------------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------------- - -void CViewer3dDoc::ShiftInputEvent(const Standard_Integer x , - const Standard_Integer y , - const Handle(V3d_View)& aView ) +void CViewer3dDoc::ShiftInputEvent (const Standard_Integer theX, + const Standard_Integer theY, + const Handle(V3d_View)& theView) { - OCC_3dBaseDoc::ShiftInputEvent(x,y,aView); + OCC_3dBaseDoc::ShiftInputEvent (theX, theY, theView); if(myOffsetDlg && myOffsetDlg->IsWindowVisible()) myOffsetDlg->UpdateValues(); } -void CViewer3dDoc::OnObjectColoredMesh() +void CViewer3dDoc::OnObjectColoredMesh() { for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent()) if (myAISContext->Current()->IsKind(STANDARD_TYPE(User_Cylinder))) @@ -627,70 +607,69 @@ void CViewer3dDoc::OnObjectColoredMesh() } } -void CViewer3dDoc::OnUpdateObjectColoredMesh(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateObjectColoredMesh(CCmdUI* pCmdUI) { bool CylinderIsCurrentAndDisplayed = false; for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) - if(myAISContext->Current()->IsKind(STANDARD_TYPE(User_Cylinder))) - CylinderIsCurrentAndDisplayed=true; - pCmdUI->Enable (CylinderIsCurrentAndDisplayed); + if(myAISContext->Current()->IsKind(STANDARD_TYPE(User_Cylinder))) + CylinderIsCurrentAndDisplayed=true; + pCmdUI->Enable (CylinderIsCurrentAndDisplayed); } -void CViewer3dDoc::OnUpdateObjectWireframe(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateObjectWireframe(CCmdUI* pCmdUI) { bool OneOrMoreInShadingOrColoredMesh = false; for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) if (myAISContext->IsDisplayed(myAISContext->Current(),1) || myAISContext->IsDisplayed(myAISContext->Current(),6)) - OneOrMoreInShadingOrColoredMesh=true; - pCmdUI->Enable (OneOrMoreInShadingOrColoredMesh); + OneOrMoreInShadingOrColoredMesh=true; + pCmdUI->Enable (OneOrMoreInShadingOrColoredMesh); } -void CViewer3dDoc::OnUpdateObjectShading(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateObjectShading(CCmdUI* pCmdUI) { bool OneOrMoreInWireframeOrColoredMesh = false; for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) if (myAISContext->IsDisplayed(myAISContext->Current(),0) || myAISContext->IsDisplayed(myAISContext->Current(),6)) - OneOrMoreInWireframeOrColoredMesh=true; - pCmdUI->Enable (OneOrMoreInWireframeOrColoredMesh); + OneOrMoreInWireframeOrColoredMesh=true; + pCmdUI->Enable (OneOrMoreInWireframeOrColoredMesh); } - -void CViewer3dDoc::OnOptionsTrihedronDynamicTrihedron() +void CViewer3dDoc::OnOptionsTrihedronDynamicTrihedron() { - if (myAISContext -> IsDisplayed(myTrihedron)) - { - myAISContext->Remove(myTrihedron); - } - else - { - Handle(Geom_Axis2Placement) myTrihedronAxis=new Geom_Axis2Placement(gp::XOY()); - myTrihedron=new AIS_Trihedron(myTrihedronAxis); - myAISContext->SetTrihedronSize(200, Standard_True); - myAISContext->Display(myTrihedron); - } + if (myAISContext -> IsDisplayed(myTrihedron)) + { + myAISContext->Remove(myTrihedron); + } + else + { + Handle(Geom_Axis2Placement) myTrihedronAxis=new Geom_Axis2Placement(gp::XOY()); + myTrihedron=new AIS_Trihedron(myTrihedronAxis); + myAISContext->SetTrihedronSize(200, Standard_True); + myAISContext->Display(myTrihedron); + } } -void CViewer3dDoc::OnUpdateOptionsTrihedronDynamicTrihedron(CCmdUI* pCmdUI) +void CViewer3dDoc::OnUpdateOptionsTrihedronDynamicTrihedron(CCmdUI* pCmdUI) { - if (myAISContext->IsDisplayed(myTrihedron)) - pCmdUI->SetCheck(1); - else - pCmdUI->SetCheck(0); + if (myAISContext->IsDisplayed(myTrihedron)) + pCmdUI->SetCheck(1); + else + pCmdUI->SetCheck(0); } void CViewer3dDoc::SetMyStaticTrihedronAxisIsDisplayed(BOOL IsDisplayed) { - myStaticTrihedronAxisIsDisplayed = IsDisplayed; + myStaticTrihedronAxisIsDisplayed = IsDisplayed; } void CViewer3dDoc::OnUpdateOptionsTrihedronStaticTrihedron(CCmdUI* pCmdUI) { - if (myStaticTrihedronAxisIsDisplayed) - pCmdUI->SetCheck(1); - else - pCmdUI->SetCheck(0); - + if (myStaticTrihedronAxisIsDisplayed) + pCmdUI->SetCheck(1); + else + pCmdUI->SetCheck(0); + } void CViewer3dDoc::Popup (const Standard_Integer x, @@ -791,22 +770,19 @@ void CViewer3dDoc::OnFillet3d() myAISContext->InitSelected(); if (myAISContext->MoreSelected()) { - Handle(AIS_Shape) S = Handle(AIS_Shape)::DownCast (myAISContext->SelectedInteractive()); - - if (S.IsNull()) + const Handle(AIS_Shape)& aSelInteractive = Handle(AIS_Shape)::DownCast (myAISContext->SelectedInteractive()); + if (aSelInteractive.IsNull()) { AfxMessageBox (L"It is necessary to activate the edges selection mode\n" L"and select edges on an object before \nrunning this function"); return; } - TopoDS_Shape Sh=S->Shape(); - - BRepFilletAPI_MakeFillet aFillet(Sh); + BRepFilletAPI_MakeFillet aFillet (aSelInteractive->Shape()); for (myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected()) { - TopoDS_Shape aSelShape = myAISContext->SelectedShape(); + const TopoDS_Shape& aSelShape = myAISContext->SelectedShape(); if (aSelShape.ShapeType() != TopAbs_EDGE) { AfxMessageBox (L"It is necessary to activate the edges selection mode\n" @@ -815,13 +791,16 @@ void CViewer3dDoc::OnFillet3d() } } - BoxRadius dlg(NULL,10.); - if (dlg.DoModal() == IDOK) + BoxRadius aDialog (NULL,10.); + if (aDialog.DoModal() == IDOK) { for (myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected()) { - TopoDS_Edge anEdge = TopoDS::Edge(myAISContext->SelectedShape()); - aFillet.Add(dlg.m_radius,anEdge); + // Selected shape has its own location, and sub-shapes in the solid shape for fillet building + // don't have own locations. Fillet builder needs to know that input edge is just the same one as + // some sub-shape in our target solid shape, so no location is to be in input edge for fillet builder. + TopoDS_Shape aSelShape = myAISContext->SelectedShape().Located (TopLoc_Location()); + aFillet.Add (aDialog.m_radius, TopoDS::Edge (aSelShape) ); } } else @@ -840,8 +819,8 @@ void CViewer3dDoc::OnFillet3d() return; } - S ->Set (aNewShape); - myAISContext->Redisplay (S); + aSelInteractive ->Set (aNewShape); + myAISContext->Redisplay (aSelInteractive); } myCResultDialog.SetTitle("Make a fillet"); diff --git a/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.h b/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.h index 76ad0e31c2..af369bbbe9 100755 --- a/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.h +++ b/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.h @@ -25,127 +25,130 @@ class OCCDemo_Presentation; class CViewer3dDoc : public OCC_3dDoc { - DECLARE_DYNCREATE(CViewer3dDoc) + DECLARE_DYNCREATE(CViewer3dDoc) + protected: // create from serialization only - CViewer3dDoc(); - void InitViewButtons(); - void DoSample(); + CViewer3dDoc(); + void InitViewButtons(); + void DoSample(); public: - void SetMyStaticTrihedronAxisIsDisplayed(BOOL IsDisplayed); - Handle_AIS_Shape GetBox(); - Handle_AIS_Shape GetSphere(); - Handle_User_Cylinder GetCylinder(); - Handle_AIS_Shape GetOverlappedBox(); - Handle_AIS_Shape GetOverlappedSphere(); - Handle_AIS_Shape GetOverlappedCylinder(); - void Start(); - Standard_CString GetDataDir() {return myDataDir;} - static void Fit(); - - virtual ~CViewer3dDoc(); - void UpdateResultMessageDlg (CString theTitle, const TCollection_AsciiString& theMessage); + void SetMyStaticTrihedronAxisIsDisplayed(BOOL IsDisplayed); + Handle_AIS_Shape GetBox(); + Handle_AIS_Shape GetSphere(); + Handle_User_Cylinder GetCylinder(); + Handle_AIS_Shape GetOverlappedBox(); + Handle_AIS_Shape GetOverlappedSphere(); + Handle_AIS_Shape GetOverlappedCylinder(); + void Start(); + Standard_CString GetDataDir() {return myDataDir;} + static void Fit(); + + virtual ~CViewer3dDoc(); + void UpdateResultMessageDlg (CString theTitle, const TCollection_AsciiString& theMessage); void UpdateResultMessageDlg (CString theTitle, CString theMessage); - virtual BOOL OnNewDocument(); - virtual void Popup (const Standard_Integer x , - const Standard_Integer y , - const Handle(V3d_View)& aView ); - - virtual void DragEvent (const Standard_Integer x , - const Standard_Integer y , - const Standard_Integer TheState, - const Handle(V3d_View)& aView ); - virtual void InputEvent (const Standard_Integer x , - const Standard_Integer y , - const Handle(V3d_View)& aView ); - virtual void ShiftDragEvent (const Standard_Integer x , - const Standard_Integer y , - const Standard_Integer TheState, - const Handle(V3d_View)& aView ); - virtual void ShiftInputEvent(const Standard_Integer x , - const Standard_Integer y , - const Handle(V3d_View)& aView ); - + virtual BOOL OnNewDocument(); + virtual void Popup (const Standard_Integer x, + const Standard_Integer y, + const Handle(V3d_View)& aView); + + virtual void DragEvent (const Standard_Integer x, + const Standard_Integer y, + const Standard_Integer TheState, + const Handle(V3d_View)& aView); + + virtual void InputEvent (const Standard_Integer x, + const Standard_Integer y, + const Handle(V3d_View)& aView); + + virtual void ShiftDragEvent (const Standard_Integer x, + const Standard_Integer y, + const Standard_Integer TheState, + const Handle(V3d_View)& aView); + + virtual void ShiftInputEvent (const Standard_Integer x, + const Standard_Integer y, + const Handle(V3d_View)& aView); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif -// Generated message map functions + // Generated message map functions protected: - BOOL myStaticTrihedronAxisIsDisplayed; - //{{AFX_MSG(CViewer3dDoc) - afx_msg void OnBox(); - afx_msg void OnCylinder(); - afx_msg void OnSphere(); - afx_msg void OnRemoveAll(); - afx_msg void OnNbisos(); - afx_msg void OnFaces(); - afx_msg void OnEdges(); - afx_msg void OnVertices(); - afx_msg void OnNeutral(); - afx_msg void OnUsercylinderChangefacecolor(); - afx_msg void OnFillet3d(); - afx_msg void OnCircle(); - afx_msg void OnLine(); - afx_msg void OnOverlappedBox(); - afx_msg void OnOverlappedCylinder(); - afx_msg void OnOverlappedSphere(); - afx_msg void OnPolygonOffsets(); - afx_msg void OnUpdatePolygonOffsets(CCmdUI* pCmdUI); - afx_msg void OnUpdateCylinder(CCmdUI* pCmdUI); - afx_msg void OnUpdateSphere(CCmdUI* pCmdUI); - afx_msg void OnUpdateBox(CCmdUI* pCmdUI); - afx_msg void OnUpdateOverlappedCylinder(CCmdUI* pCmdUI); - afx_msg void OnUpdateOverlappedSphere(CCmdUI* pCmdUI); - afx_msg void OnUpdateOverlappedBox(CCmdUI* pCmdUI); - afx_msg void OnObjectRemove(); - afx_msg void OnObjectErase(); - afx_msg void OnObjectDisplayall(); - afx_msg void OnObjectColoredMesh(); - afx_msg void OnUpdateObjectColoredMesh(CCmdUI* pCmdUI); - afx_msg void OnUpdateObjectShading(CCmdUI* pCmdUI); - afx_msg void OnUpdateObjectWireframe(CCmdUI* pCmdUI); - afx_msg void OnOptionsTrihedronDynamicTrihedron(); - afx_msg void OnUpdateOptionsTrihedronDynamicTrihedron(CCmdUI* pCmdUI); - afx_msg void OnUpdateOptionsTrihedronStaticTrihedron(CCmdUI* pCmdUI); - afx_msg void OnTextureOn(); - afx_msg void OnBUTTONNext(); - afx_msg void OnBUTTONStart(); - afx_msg void OnBUTTONRepeat(); - afx_msg void OnBUTTONPrev(); - afx_msg void OnBUTTONEnd(); - afx_msg void OnUpdateBUTTONNext(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONPrev(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONStart(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONRepeat(CCmdUI* pCmdUI); - afx_msg void OnUpdateBUTTONEnd(CCmdUI* pCmdUI); - afx_msg void OnFileNew(); - afx_msg void OnBUTTONShowResult(); - afx_msg void OnDumpView(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - -//Attributes + BOOL myStaticTrihedronAxisIsDisplayed; + //{{AFX_MSG(CViewer3dDoc) + afx_msg void OnBox(); + afx_msg void OnCylinder(); + afx_msg void OnSphere(); + afx_msg void OnRemoveAll(); + afx_msg void OnNbisos(); + afx_msg void OnFaces(); + afx_msg void OnEdges(); + afx_msg void OnVertices(); + afx_msg void OnNeutral(); + afx_msg void OnUsercylinderChangefacecolor(); + afx_msg void OnFillet3d(); + afx_msg void OnCircle(); + afx_msg void OnLine(); + afx_msg void OnOverlappedBox(); + afx_msg void OnOverlappedCylinder(); + afx_msg void OnOverlappedSphere(); + afx_msg void OnPolygonOffsets(); + afx_msg void OnUpdatePolygonOffsets(CCmdUI* pCmdUI); + afx_msg void OnUpdateCylinder(CCmdUI* pCmdUI); + afx_msg void OnUpdateSphere(CCmdUI* pCmdUI); + afx_msg void OnUpdateBox(CCmdUI* pCmdUI); + afx_msg void OnUpdateOverlappedCylinder(CCmdUI* pCmdUI); + afx_msg void OnUpdateOverlappedSphere(CCmdUI* pCmdUI); + afx_msg void OnUpdateOverlappedBox(CCmdUI* pCmdUI); + afx_msg void OnObjectRemove(); + afx_msg void OnObjectErase(); + afx_msg void OnObjectDisplayall(); + afx_msg void OnObjectColoredMesh(); + afx_msg void OnUpdateObjectColoredMesh(CCmdUI* pCmdUI); + afx_msg void OnUpdateObjectShading(CCmdUI* pCmdUI); + afx_msg void OnUpdateObjectWireframe(CCmdUI* pCmdUI); + afx_msg void OnOptionsTrihedronDynamicTrihedron(); + afx_msg void OnUpdateOptionsTrihedronDynamicTrihedron(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsTrihedronStaticTrihedron(CCmdUI* pCmdUI); + afx_msg void OnTextureOn(); + afx_msg void OnBUTTONNext(); + afx_msg void OnBUTTONStart(); + afx_msg void OnBUTTONRepeat(); + afx_msg void OnBUTTONPrev(); + afx_msg void OnBUTTONEnd(); + afx_msg void OnUpdateBUTTONNext(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONPrev(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONStart(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONRepeat(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONEnd(CCmdUI* pCmdUI); + afx_msg void OnFileNew(); + afx_msg void OnBUTTONShowResult(); + afx_msg void OnDumpView(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + + //Attributes protected: - int myState; + int myState; private: - COffsetDlg* myOffsetDlg; - - Handle_User_Cylinder myCylinder; - Handle_AIS_Shape mySphere; - Handle_AIS_Shape myBox; - Handle_AIS_Shape myOverlappedCylinder; - Handle_AIS_Shape myOverlappedSphere; - Handle_AIS_Shape myOverlappedBox; - Handle_AIS_Trihedron myTrihedron; - - OCCDemo_Presentation *myPresentation; - char myDataDir[5]; // for "Data\0" - char myLastPath[MAX_PATH]; // directory of lastly saved file in DumpView() - bool isTextureSampleStarted; + COffsetDlg* myOffsetDlg; + + Handle_User_Cylinder myCylinder; + Handle_AIS_Shape mySphere; + Handle_AIS_Shape myBox; + Handle_AIS_Shape myOverlappedCylinder; + Handle_AIS_Shape myOverlappedSphere; + Handle_AIS_Shape myOverlappedBox; + Handle_AIS_Trihedron myTrihedron; + + OCCDemo_Presentation *myPresentation; + char myDataDir[5]; // for "Data\0" + char myLastPath[MAX_PATH]; // directory of lastly saved file in DumpView() + bool isTextureSampleStarted; }; ///////////////////////////////////////////////////////////////////////////// diff --git a/samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp b/samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp index 548862ec2f..1a019cf29f 100755 --- a/samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp +++ b/samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp @@ -655,8 +655,9 @@ void CViewer3dView::OnMouseMove(UINT nFlags, CPoint point) switch (myCurrentMode) { case CurAction3d_Nothing : - myXmax = point.x; myYmax = point.y; + DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); + myXmax = point.x; myYmax = point.y; if (nFlags & MK_SHIFT) GetDocument()->ShiftDragEvent(myXmax,myYmax,0,myView); else diff --git a/samples/mfc/standard/04_Viewer3d/src/resource.h b/samples/mfc/standard/04_Viewer3d/src/resource.h deleted file mode 100755 index fac2093ddb..0000000000 --- a/samples/mfc/standard/04_Viewer3d/src/resource.h +++ /dev/null @@ -1,108 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Viewer3d.rc -// -#define IDD_SHADINGMODEL 131 -#define IDD_SETOFFSETS 134 -#define IDD_SCALE 139 -#define IDD_RADIUS 144 -#define IDD_ZCLIPPING 152 -#define IDD_ZCUEING 153 -#define IDD_TRIHEDRON 542 -#define ID_BOX 802 -#define ID_Cylinder 803 -#define ID_SPHERE 804 -#define ID_ERASEALL 805 -#define ID_AMBIENT_LIGHT 806 -#define ID_DIRECTIONAL_LIGHT 807 -#define ID_POSITIONAL_LIGHT 808 -#define ID_SPOT_LIGHT 809 -#define ID_LIGHTOFF 810 -#define ID_USERCYLINDER_CHANGEFACECOLOR 810 -#define ID_ZCLIPPING 812 -#define ID_ZCUEING 813 -#define ID_SHADINGMODEL 814 -#define ID_ANTIALIASINGONOFF 815 -#define ID_CLEAR_LIGHTS 816 -#define ID_MODELCLIPPING 817 -#define ID_OVERLAPPED_BOX 818 -#define ID_BUTTON819 819 -#define ID_OVERLAPPED_SPHERE 820 -#define ID_BUTTON821 821 -#define ID_OVERLAPPED_CYLINDER 822 -#define ID_POLYGON_OFFSETS 823 -#define ID_OBJECT_COLORED_MESH 827 -#define ID_OPTIONS_TRIHEDRON_STATIC_TRIHEDRON 829 -#define ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON 830 -#define ID_SCALE 831 -#define ID_CIRCLE 833 -#define ID_LINE 834 -#define ID_VERTICES 837 -#define ID_EDGES 838 -#define ID_FACES 839 -#define ID_NEUTRAL 840 -#define ID_FILLET3D 841 -#define ID_NBISOS 842 -#define ID_BUTTONStart 843 -#define ID_BUTTONPrev 844 -#define ID_BUTTONRepeat 845 -#define ID_BUTTONNext 846 -#define ID_BUTTONEnd 847 -#define ID_DUMP_VIEW 848 -#define ID_TEXTURE_ON 849 -#define IDC_SPIN_RADIUS 1000 -#define IDC_EDIT_RADIUS 1001 -#define IDC_SHADINGMODEL_COLOR 1002 -#define IDC_EDIT_ISOU 1002 -#define IDC_SHADINGMODEL_MULTICOLOR 1003 -#define IDC_SLIDER_MODELCLIPPING_Z 1003 -#define IDC_SHADINGMODEL_FLAT 1004 -#define IDC_ISOU 1004 -#define IDC_SHADINGMODEL_HIDDEN 1005 -#define IDC_EDIT_MODELCLIPPING_Z 1005 -#define IDC_ISOV 1005 -#define IDC_SHADINGMODEL_GOURAUD 1006 -#define IDC_EDIT_ISOV 1006 -#define IDC_SHADINGMODEL_PHONG 1007 -#define IDC_CHECK_MODELCLIPPINGONOFF 1008 -#define IDC_SLIDER_OFFSETFACTOR 1010 -#define IDC_SLIDER_OFFSETUNITS 1011 -#define IDC_EDIT_OFFSETFACTOR 1012 -#define IDC_EDIT_OFFSETUNITS 1013 -#define IDC_COMBO_OFFSETTYPE 1023 -#define IDC_SLIDER_SCALEX 1028 -#define IDC_SLIDER_SCALEY 1029 -#define IDC_EDIT_SCALEX 1030 -#define IDC_EDIT_SCALEY 1031 -#define IDC_RadiusFillet 1031 -#define IDC_SLIDER_SCALEZ 1032 -#define IDC_EDIT_SCALEZ 1033 -#define IDD_RESULTMESSAGEDLG 1500 -#define IDD_MODELCLIPPING 1501 -#define IDD_ISOS 1502 -#define IDC_COMBO_ZCLIPPINGTYPE 1650 -#define IDC_CHECK_CUEINGONOFF 1651 -#define IDC_EDITTRIHEDRSCALE 1686 -#define IDC_SPINTRIHEDRSCALE 1737 -#define IDC_COMBOTRIHEDRPOS 1739 -#define IDC_COMBOTRIHEDRCOLOR 1740 -#define IDC_SLIDER_ZCLIPPINGDEPTH 2004 -#define IDC_SLIDER_ZCLIPPINGWIDTH 2005 -#define IDC_EDIT_ZCLIPPINGDEPTH 2006 -#define IDC_EDIT_ZCLIPPINGWIDTH 2007 -#define IDC_SLIDER_ZCUEINGDEPTH 2009 -#define IDC_SLIDER_ZCUEINGWIDTH 2010 -#define IDC_EDIT_ZCUEINGDEPTH 2011 -#define IDC_EDIT_ZCUEINGWIDTH 2012 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 140 -#define _APS_NEXT_COMMAND_VALUE 850 -#define _APS_NEXT_CONTROL_VALUE 1032 -#define _APS_NEXT_SYMED_VALUE 104 -#endif -#endif diff --git a/samples/mfc/standard/05_ImportExport/src/ImportExportDoc.cpp b/samples/mfc/standard/05_ImportExport/src/ImportExportDoc.cpp index 7f50af3e68..e19a1fdb72 100755 --- a/samples/mfc/standard/05_ImportExport/src/ImportExportDoc.cpp +++ b/samples/mfc/standard/05_ImportExport/src/ImportExportDoc.cpp @@ -22,9 +22,9 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CImportExportDoc -IMPLEMENT_DYNCREATE(CImportExportDoc, CDocument) +IMPLEMENT_DYNCREATE(CImportExportDoc, OCC_3dDoc) -BEGIN_MESSAGE_MAP(CImportExportDoc, OCC_3dBaseDoc) +BEGIN_MESSAGE_MAP(CImportExportDoc, OCC_3dDoc) //{{AFX_MSG_MAP(CImportExportDoc) ON_COMMAND(ID_FILE_IMPORT_BREP, OnFileImportBrep) ON_COMMAND(ID_FILE_IMPORT_CSFDB, OnFileImportCSFDB) @@ -48,23 +48,8 @@ END_MESSAGE_MAP() // CImportExportDoc construction/destruction CImportExportDoc::CImportExportDoc() +: OCC_3dDoc (false) { - /* - Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice = - ((CImportExportApp*)AfxGetApp())->GetGraphicDevice(); - - TCollection_ExtendedString a3DName("Visu3D"); - myViewer = new V3d_Viewer(theGraphicDevice,a3DName.ToExtString(),"", 1000.0, - V3d_XposYnegZpos, Quantity_NOC_GRAY30, - V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT, - Standard_True, Standard_False); - - myViewer->SetDefaultLights(); - myViewer->SetLightOn(); - - myAISContext =new AIS_InteractiveContext(myViewer); - - */ /* // TRIHEDRON Handle(AIS_Trihedron) aTrihedron; diff --git a/samples/mfc/standard/05_ImportExport/src/ImportExportDoc.h b/samples/mfc/standard/05_ImportExport/src/ImportExportDoc.h index 151e9f94c4..a2d9850234 100755 --- a/samples/mfc/standard/05_ImportExport/src/ImportExportDoc.h +++ b/samples/mfc/standard/05_ImportExport/src/ImportExportDoc.h @@ -10,9 +10,10 @@ #endif // _MSC_VER >= 1000 #include -#include +#include -class CImportExportDoc : public OCC_3dBaseDoc{ +class CImportExportDoc : public OCC_3dDoc +{ DECLARE_DYNCREATE(CImportExportDoc) public: CImportExportDoc(); diff --git a/samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp b/samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp index fe9f254c88..c9096d0595 100755 --- a/samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp +++ b/samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp @@ -1100,40 +1100,39 @@ m_App->SaveAs(myOcafDoc,(TCollection_ExtendedString) TPath); \n\ myCResultDialog.SetText(text); } -BOOL COcafDoc::OnOpenDocument(LPCTSTR lpszPathName) +BOOL COcafDoc::OnOpenDocument(LPCTSTR lpszPathName) { - if (!CDocument::OnOpenDocument(lpszPathName)) - return FALSE; - - Handle(TOcaf_Application) m_App= ((COcafApp*)AfxGetApp())->GetApp(); + if (!CDocument::OnOpenDocument(lpszPathName)) + { + return FALSE; + } - CWaitCursor aWaitCursor; - PathName=lpszPathName; + Handle(TOcaf_Application) m_App= ((COcafApp*)AfxGetApp())->GetApp(); - Standard_CString SPath = (Standard_CString) lpszPathName; - TCollection_ExtendedString TPath(SPath); - PathName=lpszPathName; + CWaitCursor aWaitCursor; + PathName = lpszPathName; - // open the document in the current application + const wchar_t* aPathName = lpszPathName; + TCollection_ExtendedString anOccPathName ((Standard_ExtString)aPathName); + + // Open the document in the current application //PCDM_ReaderStatus RS = m_App->Open(TPath,myOcafDoc); - m_App->Open(TPath,myOcafDoc); + m_App->Open(anOccPathName, myOcafDoc); //CDF_RetrievableStatus RS = m_App->Open(TPath,myOcafDoc); - //connect the document CAF (myDoc) with the AISContext (myAISContext) - //TPrsStd_AISViewer::Has(myOcafDoc->Main()); - TPrsStd_AISViewer::New(myOcafDoc->Main(),myViewer); - myOcafDoc->SetUndoLimit(10); + // Connect the document CAF (myDoc) with the AISContext (myAISContext) + TPrsStd_AISViewer::New (myOcafDoc->Main(), myViewer); + myOcafDoc->SetUndoLimit (10); - Handle(AIS_InteractiveContext) CTX; - TPrsStd_AISViewer::Find(myOcafDoc->Main(),CTX); - CTX->SetDisplayMode(AIS_Shaded); + Handle(AIS_InteractiveContext) aContext; + TPrsStd_AISViewer::Find (myOcafDoc->Main(), aContext); + aContext->SetDisplayMode (AIS_Shaded); + myAISContext = aContext; - myAISContext = CTX; + // Display the presentations (which was not stored in the document) + DisplayPrs(); - // Display the presentations (which was not stored in the document) - DisplayPrs(); - - TCollection_AsciiString Message = TCollection_AsciiString("\ + TCollection_AsciiString Message = TCollection_AsciiString("\ // Retrieve a document \n\ \n\ Handle(TOcaf_Application) m_App= ((COcafApp*)AfxGetApp())->GetApp(); \n\ @@ -1149,11 +1148,11 @@ myOcafDoc->SetUndoLimit(10); \n\ \n\ \n"); - myCResultDialog.SetTitle("Open a document"); - CString text(Message.ToCString()); - myCResultDialog.SetText(text); + myCResultDialog.SetTitle ("Open a document"); + CString text (Message.ToCString()); + myCResultDialog.SetText (text); - return TRUE; + return TRUE; } diff --git a/samples/mfc/standard/08_HLR/res/HLR.rc b/samples/mfc/standard/08_HLR/res/HLR.rc index 21e4c41afb..619fb55c4c 100755 --- a/samples/mfc/standard/08_HLR/res/HLR.rc +++ b/samples/mfc/standard/08_HLR/res/HLR.rc @@ -250,7 +250,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION CAPTION "Choose Shapes and Projector" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN - CONTROL "2",IDC_DUMMYBUTTON,"Button",BS_OWNERDRAW | WS_DISABLED | WS_TABSTOP,110,60,100,80,WS_EX_TRANSPARENT + CONTROL "2",IDC_HlrDlgView,"Button",BS_OWNERDRAW | WS_DISABLED | WS_TABSTOP,110,60,100,80,WS_EX_TRANSPARENT CONTROL "Default",IDC_DisplayDefault,"Button",BS_AUTORADIOBUTTON | WS_GROUP,17,0,70,10 CONTROL "sharp Edges",IDC_VsharpEdges,"Button",BS_AUTORADIOBUTTON,20,20,70,10 CONTROL "smooth Edges",IDC_VsmoothEdges,"Button",BS_AUTORADIOBUTTON,20,30,70,10 diff --git a/samples/mfc/standard/08_HLR/res/resource.h b/samples/mfc/standard/08_HLR/res/resource.h index 1dc47a380d..ed2c12f15b 100755 --- a/samples/mfc/standard/08_HLR/res/resource.h +++ b/samples/mfc/standard/08_HLR/res/resource.h @@ -104,7 +104,7 @@ #define ID_Update2D 1522 #define IDC_HlrModeIsOn 1523 #define IDC_TopView 1529 -#define IDC_DUMMYBUTTON 1530 +#define IDC_HlrDlgView 1530 #define IDC_BottomView 1531 #define IDC_LeftView 1532 #define IDC_RightView 1533 diff --git a/samples/mfc/standard/08_HLR/src/HLRDoc.cpp b/samples/mfc/standard/08_HLR/src/HLRDoc.cpp index 59d83d60a4..eaddf0aea8 100755 --- a/samples/mfc/standard/08_HLR/src/HLRDoc.cpp +++ b/samples/mfc/standard/08_HLR/src/HLRDoc.cpp @@ -165,6 +165,7 @@ void CHLRDoc::OnBUTTONHLRDialog() myCSelectionDialogIsCreated = true; } myCSelectionDialog->ShowWindow(SW_RESTORE); + myCSelectionDialog->UpdateWindow(); } void CHLRDoc::OnFileImportBrep() diff --git a/samples/mfc/standard/08_HLR/src/HLRView2D.cpp b/samples/mfc/standard/08_HLR/src/HLRView2D.cpp index aaa4864aa3..d7c8476740 100755 --- a/samples/mfc/standard/08_HLR/src/HLRView2D.cpp +++ b/samples/mfc/standard/08_HLR/src/HLRView2D.cpp @@ -32,8 +32,7 @@ IMPLEMENT_DYNCREATE(CHLRView2D, OCC_2dView) BEGIN_MESSAGE_MAP(CHLRView2D, OCC_2dView) //{{AFX_MSG_MAP(CHLRView2D) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! + ON_WM_MOUSEMOVE() //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -119,7 +118,6 @@ void CHLRView2D::MultiDragEvent2D(const Standard_Integer /*x*/, { } - //----------------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------------- @@ -128,6 +126,84 @@ void CHLRView2D::MultiInputEvent2D(const Standard_Integer /*x*/, { } +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void CHLRView2D::OnMouseMove(UINT nFlags, CPoint point) +{ + if ( (nFlags & MK_LBUTTON) &! (nFlags & MK_RBUTTON) ) // Left + Right is specific + { + if ( nFlags & CASCADESHORTCUTKEY ) + { + // move with MB1 and CASCADESHORTCUTKEY : on the dynamic zooming + // Do the zoom in function of mouse's coordinates + myV2dView->Zoom(myXmax,myYmax,point.x,point.y); + myXmax = point.x; + myYmax = point.y; + } + else // if ( CASCADESHORTCUTKEY ) + { + switch (myCurrentMode) + { + case CurAction2d_Nothing : + myXmax = point.x; + myYmax = point.y; + DragEvent2D(myXmax,myYmax,0); + break; + case CurAction2d_DynamicZooming : + myV2dView->Zoom(myXmax,myYmax,point.x,point.y); + myXmax=point.x; + myYmax=point.y; + break; + case CurAction2d_WindowZooming : + myXmax = point.x; + myYmax = point.y; + break; + case CurAction2d_DynamicPanning : + myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning + myXmax = point.x; + myYmax = point.y; + break; + case CurAction2d_GlobalPanning : + break; + default : + Standard_Failure::Raise(" incompatible Current Mode "); + break; + } + } + } else if ( nFlags & MK_MBUTTON) + { + if ( nFlags & CASCADESHORTCUTKEY ) + { + myV2dView->Pan (point.x-myXmax,myYmax-point.y); + myXmax = point.x; + myYmax = point.y; + } + } else if ( (nFlags & MK_RBUTTON) &! (nFlags & MK_LBUTTON) ) + { + } + else if ( (nFlags & MK_RBUTTON) && (nFlags & MK_LBUTTON) ) + { + if ( nFlags & CASCADESHORTCUTKEY ) + { + myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning + myXmax = point.x; myYmax = point.y; + } + } + else + { // No buttons + myXmax = point.x; + myYmax = point.y; + if (nFlags & MULTISELECTIONKEY) + { + MultiMoveEvent2D(point.x,point.y); + } + else + { + MoveEvent2D(point.x,point.y); + } + } +} #ifdef _DEBUG void CHLRView2D::AssertValid() const diff --git a/samples/mfc/standard/08_HLR/src/HLRView2D.h b/samples/mfc/standard/08_HLR/src/HLRView2D.h index e3c03ebb66..19a7b294ed 100755 --- a/samples/mfc/standard/08_HLR/src/HLRView2D.h +++ b/samples/mfc/standard/08_HLR/src/HLRView2D.h @@ -21,6 +21,10 @@ protected: // create from serialization only CHLRView2D(); DECLARE_DYNCREATE(CHLRView2D) + // Override MouseMove event to exclude rectangle selection emulation as + // no selection is supported in DragEvent2D for this view. + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + DECLARE_MESSAGE_MAP() // Overrides // ClassWizard generated virtual function overrides @@ -51,17 +55,6 @@ public: virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(CHLRView2D) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - }; ///////////////////////////////////////////////////////////////////////////// diff --git a/samples/mfc/standard/08_HLR/src/SelectionDialog.cpp b/samples/mfc/standard/08_HLR/src/SelectionDialog.cpp index 27ece995ae..9c3d477d21 100644 --- a/samples/mfc/standard/08_HLR/src/SelectionDialog.cpp +++ b/samples/mfc/standard/08_HLR/src/SelectionDialog.cpp @@ -104,10 +104,10 @@ BOOL CSelectionDialog::OnInitDialog() // get the View Window position to managed mouse move CRect BoxRect,ViewRect; GetWindowRect (BoxRect); - CWnd * TheViewerWindow = GetDlgItem (IDC_DUMMYBUTTON); + CWnd * TheViewerWindow = GetDlgItem (IDC_HlrDlgView); TheViewerWindow->GetWindowRect (ViewRect); myPosMinX = ViewRect.TopLeft().x - BoxRect.TopLeft().x; - myPosMaxX = ViewRect.Width()+myPosMinX; + myPosMaxX = ViewRect.Width() + myPosMinX; myPosMinY = ViewRect.TopLeft().y - BoxRect.TopLeft().y; myPosMaxY = myPosMinY + ViewRect.Height(); @@ -121,10 +121,12 @@ BOOL CSelectionDialog::OnInitDialog() void CSelectionDialog::OnDisplay (bool isFit) { - GetDlgItem(IDC_DUMMYBUTTON)->SetRedraw (true); + // GetDlgItem(IDC_HlrDlgView)->SetRedraw() wrapping of this method makes view blinking, + // but displaying of big models may be faster. + //GetDlgItem(IDC_HlrDlgView)->SetRedraw(true); if (!myIsDisplayed) { - Handle(Graphic3d_GraphicDriver) aGraphicDriver = + Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((CHLRApp*)AfxGetApp())->GetGraphicDriver(); myActiveViewer = new V3d_Viewer (aGraphicDriver, (short *) "Visu3D"); @@ -132,7 +134,7 @@ void CSelectionDialog::OnDisplay (bool isFit) myActiveViewer->SetLightOn(); myActiveView = myActiveViewer->CreateView(); - Handle(WNT_Window) aWNTWindow = new WNT_Window (GetDlgItem (IDC_DUMMYBUTTON)->GetSafeHwnd(), + Handle(WNT_Window) aWNTWindow = new WNT_Window (GetDlgItem (IDC_HlrDlgView)->GetSafeHwnd(), Quantity_NOC_GRAY); myActiveView->SetComputedMode (m_HlrModeIsOn); myActiveView->SetWindow(aWNTWindow); @@ -144,6 +146,7 @@ void CSelectionDialog::OnDisplay (bool isFit) myTrihedron = new AIS_Trihedron (aTrihedronAxis); myInteractiveContext->Display (myTrihedron); + myIsDisplayed = Standard_True; } if(isFit) { @@ -152,8 +155,7 @@ void CSelectionDialog::OnDisplay (bool isFit) } myActiveView->Redraw(); - myIsDisplayed = Standard_True; - GetDlgItem (IDC_DUMMYBUTTON)->SetRedraw (false); + //GetDlgItem (IDC_HlrDlgView)->SetRedraw (false); } @@ -551,6 +553,5 @@ void CSelectionDialog::OnOK() void CSelectionDialog::OnPaint() { - CPaintDC dc(this); // device context for painting OnDisplay(false); } diff --git a/samples/mfc/standard/Common/AngleParamsVerticesPage.cpp b/samples/mfc/standard/Common/AngleParamsVerticesPage.cpp index 9767f58b5c..321506f529 100644 --- a/samples/mfc/standard/Common/AngleParamsVerticesPage.cpp +++ b/samples/mfc/standard/Common/AngleParamsVerticesPage.cpp @@ -142,15 +142,16 @@ void CAngleParamsVerticesPage::OnBnClickedVertex3Btn() anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); anAspect->SetCommonColor (aDimDlg->GetDimensionColor()); - anAngleDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); + anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (aDimDlg->IsUnitsDisplayed()) { anAngleDim->SetDisplayUnits (aDimDlg->GetUnits()); if ((anAngleDim->GetDisplayUnits().IsEqual (TCollection_AsciiString ("deg")))) { - anAngleDim->DimensionAspect()->MakeUnitsDisplayed (Standard_False); + // No units - for degree is special symbol that is enabled by default + anAspect->MakeUnitsDisplayed (Standard_False); } - else + else // radians - no special symbol { anAngleDim->SetDisplaySpecialSymbol (AIS_DSS_No); } diff --git a/samples/mfc/standard/Common/DimensionDlg.cpp b/samples/mfc/standard/Common/DimensionDlg.cpp index 748a478f5a..317132c234 100644 --- a/samples/mfc/standard/Common/DimensionDlg.cpp +++ b/samples/mfc/standard/Common/DimensionDlg.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include BEGIN_MESSAGE_MAP(CDimensionDlg, CDialog) @@ -762,3 +763,11 @@ void CDimensionDlg::OnClose() } CDialog::OnClose(); } + +TopoDS_Shape CDimensionDlg::SelectedShape() +{ + Handle(Standard_Transient) aSelection = AIS_Selection::CurrentSelection()->Value(); + Handle(SelectMgr_EntityOwner) anOwner = *((Handle(SelectMgr_EntityOwner)*)&aSelection); + Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast(anOwner); + return aBrepOwner->Shape().Located (aBrepOwner->Location() * aBrepOwner->Shape().Location()); +} diff --git a/samples/mfc/standard/Common/DimensionDlg.h b/samples/mfc/standard/Common/DimensionDlg.h index 2e01419a73..c948ae4228 100755 --- a/samples/mfc/standard/Common/DimensionDlg.h +++ b/samples/mfc/standard/Common/DimensionDlg.h @@ -37,6 +37,13 @@ public: const TCollection_AsciiString GetUnits() const; const Quantity_Color GetDimensionColor() const; +public: + + // Workaround: AIS_LocalContext::SelectedShape() doesn't take into account local location of selected TopoDS shape, + // and operates with selected interactive object transformation only. + static TopoDS_Shape SelectedShape(); + +public: // Dialog Data enum { IDD = IDD_Dimension }; // Initialization of dialog diff --git a/samples/mfc/standard/Common/LengthParamsEdgePage.cpp b/samples/mfc/standard/Common/LengthParamsEdgePage.cpp index a29426c93d..41ff0b1bb4 100644 --- a/samples/mfc/standard/Common/LengthParamsEdgePage.cpp +++ b/samples/mfc/standard/Common/LengthParamsEdgePage.cpp @@ -60,6 +60,7 @@ CButton* CLengthParamsEdgePage::GetButton() return (CButton*)GetDlgItem (IDC_ChooseEdgeBtn); } +#include //======================================================================= //function : OnBnClickedChooseEdgeBtn //purpose : @@ -75,28 +76,32 @@ void CLengthParamsEdgePage::OnBnClickedChooseEdgeBtn() return; } - TopoDS_Edge anEdge = TopoDS::Edge(myAISContext->LocalContext()->SelectedShape()); + // Workaround for AIS_LocalContext::SelectedShape() + //TopoDS_Shape aSelShape = myAISContext->LocalContext()->SelectedShape(); + TopoDS_Shape aSelShape = CDimensionDlg::SelectedShape(); + const TopoDS_Edge& anEdge = TopoDS::Edge (aSelShape); + myAISContext->LocalContext()->ClearSelected(); TopoDS_Vertex aFirstVertex, aSecondVertex; - TopExp::Vertices (anEdge, aFirstVertex, aSecondVertex); + TopExp::Vertices (TopoDS::Edge (anEdge), aFirstVertex, aSecondVertex); - gp_Pnt aP1=BRep_Tool::Pnt (aFirstVertex); - gp_Pnt aP2=BRep_Tool::Pnt (aSecondVertex); - gp_Pnt aP3(aP2.X()+10, aP2.Y()+10, aP2.Z()+10); + gp_Pnt aP1 = BRep_Tool::Pnt (aFirstVertex); + gp_Pnt aP2 = BRep_Tool::Pnt (aSecondVertex); + gp_Pnt aP3 (aP2.X() + 10, aP2.Y() + 10, aP2.Z() + 10); GC_MakePlane aMkPlane (aP1,aP2,aP3); - Handle(Geom_Plane) aPlane = aMkPlane.Value (); + Handle(Geom_Plane) aPlane = aMkPlane.Value(); CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner()); - Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (anEdge, aPlane->Pln()); + Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (TopoDS::Edge (anEdge), aPlane->Pln()); Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect(); anAspect->MakeArrows3d (Standard_False); anAspect->MakeText3d (aDimDlg->GetTextType()); anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); anAspect->SetCommonColor (aDimDlg->GetDimensionColor()); - aLenDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); + anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (aDimDlg->IsUnitsDisplayed()) { aLenDim->SetDisplayUnits (aDimDlg->GetUnits()); diff --git a/samples/mfc/standard/Common/LengthParamsEdgesPage.cpp b/samples/mfc/standard/Common/LengthParamsEdgesPage.cpp index 6865b042cf..430e9fa9bf 100644 --- a/samples/mfc/standard/Common/LengthParamsEdgesPage.cpp +++ b/samples/mfc/standard/Common/LengthParamsEdgesPage.cpp @@ -78,7 +78,10 @@ void CLengthParamsEdgesPage::OnBnClickedEdge1Btn() return; } - myFirstEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape()); + // Workaround for AIS_LocalContext::SelectedShape() + myFirstEdge = TopoDS::Edge (CDimensionDlg::SelectedShape()); + //myFirstEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape()); + myAISContext->LocalContext()->ClearSelected(); } @@ -97,7 +100,10 @@ void CLengthParamsEdgesPage::OnBnClickedEdge2Btn() return; } - mySecondEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape()); + // Workaround for AIS_LocalContext::SelectedShape() + mySecondEdge = TopoDS::Edge (CDimensionDlg::SelectedShape()); + //mySecondEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape()); + myAISContext->LocalContext()->ClearSelected(); // Build plane through three points @@ -122,6 +128,7 @@ void CLengthParamsEdgesPage::OnBnClickedEdge2Btn() anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); anAspect->SetCommonColor (aDimDlg->GetDimensionColor()); + anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (myIsAngleDimension) { // Build an angle dimension between two non-parallel edges @@ -148,10 +155,9 @@ void CLengthParamsEdgesPage::OnBnClickedEdge2Btn() { Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (myFirstEdge, mySecondEdge, aPlane->Pln()); aLenDim->SetDimensionAspect (anAspect); - aLenDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); + aLenDim->SetFlyout (aDimDlg->GetFlyout()); if (aDimDlg->IsUnitsDisplayed()) { - aLenDim->SetFlyout (aDimDlg->GetFlyout()); aLenDim->SetDisplayUnits (aDimDlg->GetUnits()); } diff --git a/samples/mfc/standard/Common/LengthParamsVerticesPage.cpp b/samples/mfc/standard/Common/LengthParamsVerticesPage.cpp index 2cea959a70..4aeae3b23d 100644 --- a/samples/mfc/standard/Common/LengthParamsVerticesPage.cpp +++ b/samples/mfc/standard/Common/LengthParamsVerticesPage.cpp @@ -117,7 +117,7 @@ void CLengthParamsVerticesPage::OnBnClickedVertex2Btn() anAspect->MakeText3d (aDimDlg->GetTextType()); anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); - aLenDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); + anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (aDimDlg->IsUnitsDisplayed()) { aLenDim->SetDisplayUnits (aDimDlg->GetUnits ()); diff --git a/samples/mfc/standard/Common/OCC_2dDoc.h b/samples/mfc/standard/Common/OCC_2dDoc.h index eff94246d6..a788792a71 100755 --- a/samples/mfc/standard/Common/OCC_2dDoc.h +++ b/samples/mfc/standard/Common/OCC_2dDoc.h @@ -13,7 +13,9 @@ #include "ResultDialog.h" #include -class AFX_EXT_CLASS OCC_2dDoc : public OCC_BaseDoc +// Mouse and clipboard event tracker for OCC_2dView +// NO 3D operation are supported (like rotation) +class AFX_EXT_CLASS OCC_2dDoc : public OCC_BaseDoc { DECLARE_DYNCREATE(OCC_2dDoc) @@ -22,19 +24,24 @@ public: OCC_2dDoc(); ~OCC_2dDoc(); -// Operations -public: - - Handle_V3d_Viewer GetViewer2D () { return myViewer; }; +public: // New operations void FitAll2DViews(Standard_Boolean theUpdateViewer = Standard_False); +public: // getters + + Handle_V3d_Viewer GetViewer2D () { return myViewer; }; + Handle(AIS_InteractiveContext)& GetInteractiveContext() { return myAISContext; }; +public: // Operations to override + + // Mouse move event tracking for 2D view : no rotation is supported in 2D view. virtual void MoveEvent(const Standard_Integer theMouseX, const Standard_Integer theMouseY, const Handle(V3d_View)& theView); + // Shift move event tracking for 2D view : no rotation is supported in 2D view. virtual void ShiftMoveEvent(const Standard_Integer theMouseX, const Standard_Integer theMouseY, const Handle(V3d_View)& theViewView); diff --git a/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp b/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp index 9a2c8ad620..407ac62537 100755 --- a/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp +++ b/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp @@ -38,8 +38,6 @@ BEGIN_MESSAGE_MAP(OCC_3dBaseDoc, OCC_BaseDoc) ON_UPDATE_COMMAND_UI(ID_OBJECT_DISPLAYALL, OnUpdateObjectDisplayall) ON_COMMAND(ID_OBJECT_REMOVE, OnObjectRemove) ON_UPDATE_COMMAND_UI(ID_OBJECT_REMOVE, OnUpdateObjectRemove) - ON_COMMAND(ID_OBJECT_DIM, OnObjectAddDimensions) - ON_UPDATE_COMMAND_UI(ID_OBJECT_DIM, OnUpdateObjectAddDimensions) //}}AFX_MSG_MAP ON_COMMAND_EX_RANGE(ID_OBJECT_MATERIAL_BRASS,ID_OBJECT_MATERIAL_DEFAULT, OnObjectMaterialRange) @@ -52,20 +50,16 @@ END_MESSAGE_MAP() ////////////////////////////////////////////////////////////////////// OCC_3dBaseDoc::OCC_3dBaseDoc() -:myPopupMenuNumber(0), - myDimensionDlg() +:myPopupMenuNumber(0) { AfxInitRichEdit(); - Handle(Graphic3d_GraphicDriver) aGraphicDriver = - ((OCC_App*)AfxGetApp())->GetGraphicDriver(); + Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((OCC_App*)AfxGetApp())->GetGraphicDriver(); myViewer = new V3d_Viewer (aGraphicDriver, Standard_ExtString("Visu3D") ); myViewer->SetDefaultLights(); myViewer->SetLightOn(); myAISContext = new AIS_InteractiveContext (myViewer); - myDimensionDlg.SetContext (myAISContext); - myDimensionDlg.Create(CDimensionDlg::IDD, NULL); } OCC_3dBaseDoc::~OCC_3dBaseDoc() @@ -87,20 +81,27 @@ void OCC_3dBaseDoc::DragEvent (const Standard_Integer theMouseX, static Standard_Integer aStartDragX = 0; static Standard_Integer aStartDragY = 0; - if (theState == -1) + switch (theState) { - // button down - aStartDragX = theMouseX; - aStartDragY = theMouseY; - } - - if (theState == 1) - { - // button up - myAISContext->Select (aStartDragX, aStartDragY, - theMouseX, theMouseY, - theView); - } + case -1: + { + aStartDragX = theMouseX; + aStartDragY = theMouseY; + break; + } + case 0: + { + myAISContext->UpdateCurrentViewer(); + break; + } + case 1: + { + myAISContext->Select (aStartDragX, aStartDragY, + theMouseX, theMouseY, + theView); + break; + } + }; } //----------------------------------------------------------------------------------------- @@ -423,18 +424,3 @@ void OCC_3dBaseDoc::SetMaterial(Graphic3d_NameOfMaterial Material) myAISContext->SetMaterial (myAISContext->Current(), (Graphic3d_NameOfMaterial)(Material)); } - -void OCC_3dBaseDoc::OnObjectAddDimensions() -{ - //Add dimentions dialog is opened here - myDimensionDlg.ShowWindow(SW_SHOW); - myDimensionDlg.UpdateStandardMode (); -} - -void OCC_3dBaseDoc::OnUpdateObjectAddDimensions(CCmdUI* /*pCmdUI*/) -{ - // Check if local context is opened - //pCmdUI->Enable (myAISContext->HasOpenedContext()); -} - - diff --git a/samples/mfc/standard/Common/OCC_3dBaseDoc.h b/samples/mfc/standard/Common/OCC_3dBaseDoc.h index cd93b28a85..e590141a2e 100755 --- a/samples/mfc/standard/Common/OCC_3dBaseDoc.h +++ b/samples/mfc/standard/Common/OCC_3dBaseDoc.h @@ -15,9 +15,6 @@ class AFX_EXT_CLASS OCC_3dBaseDoc : public OCC_BaseDoc { -protected: - CDimensionDlg myDimensionDlg; - int myPopupMenuNumber; public: OCC_3dBaseDoc(); @@ -83,11 +80,13 @@ protected: afx_msg void OnUpdateObjectDisplayall(CCmdUI* pCmdUI); afx_msg void OnObjectRemove(); afx_msg void OnUpdateObjectRemove(CCmdUI* pCmdUI); - afx_msg void OnObjectAddDimensions(); - afx_msg void OnUpdateObjectAddDimensions(CCmdUI* pCmdUI); //}}AFX_MSG DECLARE_MESSAGE_MAP() + +protected: + + int myPopupMenuNumber; }; #endif // !defined(AFX_OCC_3dBaseDoc_H__02CE7BD9_39BE_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/samples/mfc/standard/Common/OCC_3dDoc.cpp b/samples/mfc/standard/Common/OCC_3dDoc.cpp index 1a2f4d42c9..b93b36862d 100755 --- a/samples/mfc/standard/Common/OCC_3dDoc.cpp +++ b/samples/mfc/standard/Common/OCC_3dDoc.cpp @@ -5,27 +5,36 @@ #include #include "OCC_3dDoc.h" +BEGIN_MESSAGE_MAP(OCC_3dDoc, OCC_3dBaseDoc) + ON_COMMAND(ID_OBJECT_DIM, OnObjectAddDimensions) +END_MESSAGE_MAP() + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// -OCC_3dDoc::OCC_3dDoc() +OCC_3dDoc::OCC_3dDoc (bool theIsResultDialog) +: myDimensionDlg() { + if (theIsResultDialog) + { + myCResultDialog.Create(CResultDialog::IDD,NULL); + + RECT dlgrect; + myCResultDialog.GetWindowRect(&dlgrect); + LONG width = dlgrect.right-dlgrect.left; + LONG height = dlgrect.bottom-dlgrect.top; + + RECT MainWndRect; + AfxGetApp()->m_pMainWnd->GetWindowRect(&MainWndRect); + LONG left = MainWndRect.left+3; + LONG top = MainWndRect.top + 112; - myCResultDialog.Create(CResultDialog::IDD,NULL); - - RECT dlgrect; - myCResultDialog.GetWindowRect(&dlgrect); - LONG width = dlgrect.right-dlgrect.left; - LONG height = dlgrect.bottom-dlgrect.top; - - RECT MainWndRect; - AfxGetApp()->m_pMainWnd->GetWindowRect(&MainWndRect); - LONG left = MainWndRect.left+3; - LONG top = MainWndRect.top + 112; - - myCResultDialog.MoveWindow(left,top,width,height); + myCResultDialog.MoveWindow(left,top,width,height); + } + myDimensionDlg.SetContext (myAISContext); + myDimensionDlg.Create(CDimensionDlg::IDD, NULL); } OCC_3dDoc::~OCC_3dDoc() @@ -36,7 +45,6 @@ OCC_3dDoc::~OCC_3dDoc() void OCC_3dDoc::PocessTextInDialog (CString theTitle, CString theMessage) { -// aMessage+= "-------------------------------- END ----------------------------------------\n"; myCResultDialog.SetTitle (theTitle); myCResultDialog.SetText (theMessage); SetTitle (theTitle); @@ -73,3 +81,10 @@ void OCC_3dDoc::SetDialogTitle(TCollection_AsciiString theTitle) { myCResultDialog.SetTitle(theTitle.ToCString()); } + +void OCC_3dDoc::OnObjectAddDimensions() +{ + //Add dimentions dialog is opened here + myDimensionDlg.ShowWindow(SW_SHOW); + myDimensionDlg.UpdateStandardMode (); +} diff --git a/samples/mfc/standard/Common/OCC_3dDoc.h b/samples/mfc/standard/Common/OCC_3dDoc.h index 84c6c52f22..2c29340afd 100755 --- a/samples/mfc/standard/Common/OCC_3dDoc.h +++ b/samples/mfc/standard/Common/OCC_3dDoc.h @@ -13,26 +13,39 @@ #include "ResultDialog.h" #include -class AFX_EXT_CLASS OCC_3dDoc : public OCC_3dBaseDoc +// Event tracker for 3D views with support of advanced message dialog operations +// and dimensions dialog +class AFX_EXT_CLASS OCC_3dDoc : public OCC_3dBaseDoc { public: - void SetDialogTitle(TCollection_AsciiString theTitle); - CString GetDialogText(); - OCC_3dDoc(); - virtual ~OCC_3dDoc(); - void PocessTextInDialog (CString theTitle, CString theMessage); - void PocessTextInDialog (CString theTitle, const TCollection_AsciiString& theMessage) - { - CString aMessage (theMessage.ToCString()); - PocessTextInDialog (theTitle, aMessage); - } - void ClearDialog(); - void AddTextInDialog(TCollection_AsciiString& aMessage); + OCC_3dDoc (bool theIsResultDialog = true); + virtual ~OCC_3dDoc(); +public: // Dialog operations + + void SetDialogTitle(TCollection_AsciiString theTitle); + CString GetDialogText(); + + void PocessTextInDialog (CString theTitle, CString theMessage); + void PocessTextInDialog (CString theTitle, const TCollection_AsciiString& theMessage) + { + CString aMessage (theMessage.ToCString()); + PocessTextInDialog (theTitle, aMessage); + } + + void ClearDialog(); + void AddTextInDialog(TCollection_AsciiString& aMessage); protected: - CResultDialog myCResultDialog; + + afx_msg void OnObjectAddDimensions(); + DECLARE_MESSAGE_MAP() + +protected: + + CResultDialog myCResultDialog; + CDimensionDlg myDimensionDlg; }; #endif // !defined(AFX_OCC_3DDOC_H__1F4065AD_39C4_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/samples/mfc/standard/Common/OCC_3dView.cpp b/samples/mfc/standard/Common/OCC_3dView.cpp index 101de8c2d1..a8e1093bfc 100755 --- a/samples/mfc/standard/Common/OCC_3dView.cpp +++ b/samples/mfc/standard/Common/OCC_3dView.cpp @@ -345,7 +345,6 @@ void OCC_3dView::OnLButtonUp(UINT nFlags, CPoint point) } break; case CurAction3d_DynamicZooming : - // SetCursor(AfxGetApp()->LoadStandardCursor()); myCurrentMode = CurAction3d_Nothing; break; case CurAction3d_WindowZooming : @@ -445,9 +444,11 @@ void OCC_3dView::OnMouseMove(UINT nFlags, CPoint point) switch (myCurrentMode) { case CurAction3d_Nothing : - myXmax = point.x; myYmax = point.y; DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); - if (nFlags & MK_SHIFT) + myXmax = point.x; + myYmax = point.y; + + if (nFlags & MK_SHIFT) GetDocument()->ShiftDragEvent(myXmax,myYmax,0,myView); else GetDocument()->DragEvent(myXmax,myYmax,0,myView); diff --git a/samples/mfc/standard/Common/OCC_App.cpp b/samples/mfc/standard/Common/OCC_App.cpp index 1728d3bd93..dd0360f2fa 100644 --- a/samples/mfc/standard/Common/OCC_App.cpp +++ b/samples/mfc/standard/Common/OCC_App.cpp @@ -136,7 +136,7 @@ BOOL CAboutDlgStd::OnInitDialog(){ CWnd* aReadmeEdit = GetDlgItem(IDC_README); CFile aFile; - CString aHelpFilePath = CString (((OCC_App*)AfxGetApp())->GetInitDataDir()) + "\\README.txt"; + CString aHelpFilePath = CString (((OCC_App*)AfxGetApp())->GetInitDataDir()) + L"\\README.txt"; if(aFile.Open (aHelpFilePath, CFile::modeRead)) { aReadmeEdit->ShowWindow(TRUE); @@ -145,9 +145,8 @@ BOOL CAboutDlgStd::OnInitDialog(){ aFile.Read(buffer,aFileLength); ReadmeText = buffer; delete[] buffer; - ReadmeText.SetAt (aFileLength, '\0'); ReadmeText.Replace (L"\n", L"\r\n"); - UpdateData(FALSE); + UpdateData (FALSE); } else { diff --git a/samples/mfc/standard/Common/ParamsFacesPage.cpp b/samples/mfc/standard/Common/ParamsFacesPage.cpp index c22e582218..d934801620 100644 --- a/samples/mfc/standard/Common/ParamsFacesPage.cpp +++ b/samples/mfc/standard/Common/ParamsFacesPage.cpp @@ -51,7 +51,10 @@ void CParamsFacesPage::OnBnClickedFacesbtn1() return; } - myFirstFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape()); + // Workaround for AIS_LocalContext::SelectedShape() + myFirstFace = TopoDS::Face (CDimensionDlg::SelectedShape()); + //myFirstFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape()); + myAISContext->LocalContext()->ClearSelected(); } @@ -66,7 +69,9 @@ void CParamsFacesPage::OnBnClickedFacesbtn2() return; } - mySecondFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape()); + // Workaround for AIS_LocalContext::SelectedShape() + mySecondFace = TopoDS::Face (CDimensionDlg::SelectedShape()); + //mySecondFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape()); myAISContext->LocalContext()->ClearSelected(); CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner()); @@ -79,12 +84,13 @@ void CParamsFacesPage::OnBnClickedFacesbtn2() anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); anAspect->SetCommonColor (aDimDlg->GetDimensionColor()); + anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (myIsAngleDimension) { // Build an angle dimension between two non-parallel edges Handle(AIS_AngleDimension) anAngleDim = new AIS_AngleDimension (myFirstFace, mySecondFace); anAngleDim->SetDimensionAspect (anAspect); - anAngleDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); + if (aDimDlg->IsUnitsDisplayed()) { anAngleDim->SetDisplayUnits (aDimDlg->GetUnits ()); @@ -105,7 +111,7 @@ void CParamsFacesPage::OnBnClickedFacesbtn2() { Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (myFirstFace, mySecondFace); aLenDim->SetDimensionAspect (anAspect); - aLenDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); + if (aLenDim->DimensionAspect()->IsUnitsDisplayed()) { aLenDim->SetFlyout (aDimDlg->GetFlyout()); diff --git a/samples/mfc/standard/Common/RadiusParamsPage.cpp b/samples/mfc/standard/Common/RadiusParamsPage.cpp index d8b03f1c93..002d23fd6b 100644 --- a/samples/mfc/standard/Common/RadiusParamsPage.cpp +++ b/samples/mfc/standard/Common/RadiusParamsPage.cpp @@ -69,7 +69,10 @@ void CRadiusParamsPage::OnBnClickedObjectBtn() Standard_Boolean isAttachPoint = Standard_False; Standard_Real aFirstPar = 0, aLastPar = 0; - TopoDS_Shape aSelShape = myAISContext->LocalContext()->SelectedShape(); + // Workaround for AIS_LocalContext::SelectedShape() + TopoDS_Shape aSelShape = CDimensionDlg::SelectedShape(); + //TopoDS_Shape aSelShape = myAISContext->LocalContext()->SelectedShape(); + if (aSelShape.ShapeType() != TopAbs_EDGE && aSelShape.ShapeType() != TopAbs_FACE && aSelShape.ShapeType() != TopAbs_WIRE) @@ -113,7 +116,7 @@ void CRadiusParamsPage::OnBnClickedObjectBtn() anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); anAspect->SetCommonColor (aDimDlg->GetDimensionColor()); - aDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); + anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (aDimDlg->IsUnitsDisplayed()) { aDim->SetDisplayUnits (aDimDlg->GetUnits()); diff --git a/samples/mfc/standard/Common/res/OCC_Resource.rc b/samples/mfc/standard/Common/res/OCC_Resource.rc index 7a61b517b3..3667b0a6b7 100755 --- a/samples/mfc/standard/Common/res/OCC_Resource.rc +++ b/samples/mfc/standard/Common/res/OCC_Resource.rc @@ -683,7 +683,7 @@ END STRINGTABLE BEGIN ID_OBJECT_DIMENSIONS "Add dimensions" - ID_LOCALCONTEXT_ADDDIMENSION "Add new dimension for selected objetcs" + ID_LOCALCONTEXT_ADDDIMENSION "Add new dimension for selected objects" END STRINGTABLE -- 2.20.1