/////////////////////////////////////////////////////////////////////////////
// CNSGView
-IMPLEMENT_DYNCREATE(CGeometryView2D, CView)
+IMPLEMENT_DYNCREATE(CGeometryView2D, OCC_2dView)
BEGIN_MESSAGE_MAP(CGeometryView2D, OCC_2dView)
//{{AFX_MSG_MAP(CGeometryView2D)
- ON_WM_LBUTTONDOWN()
- ON_WM_LBUTTONUP()
- ON_WM_MBUTTONDOWN()
- ON_WM_MBUTTONUP()
- ON_WM_RBUTTONDOWN()
- ON_WM_RBUTTONUP()
- ON_WM_MOUSEMOVE()
- ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
{
}
-// CNSGView drawing
-
-void CGeometryView2D::OnDraw(CDC* /*pDC*/)
+const Handle(AIS_InteractiveContext)& CGeometryView2D::GetAISContext() const
{
- CGeometryDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- if (!myV2dView.IsNull())
- myV2dView->Update();
+ return ((CGeometryDoc*)m_pDocument)->GetISessionContext();
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CNSGView message handlers
-
-
//=================================================================
-
-void CGeometryView2D::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 CurAction2d_Nothing : // start a drag
- GetDocument()->DragEvent2D(point.x,point.y,-1,myV2dView);
- break;
- case CurAction2d_DynamicZooming : // noting
- break;
- case CurAction2d_WindowZooming :
- break;
- case CurAction2d_DynamicPanning :// noting
- break;
- case CurAction2d_GlobalPanning :// noting
- break;
- default :
- throw Standard_Failure(" incompatible Current Mode ");
- break;
- }
- }
-}
-
-void CGeometryView2D::OnLButtonUp(UINT nFlags, CPoint point)
-{
- // TODO: Add your message handler code here and/or call default
- if ( nFlags & MK_CONTROL )
- {
- return;
- }
- else // if ( Ctrl )
- {
- const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetISessionContext();
- switch (myCurrentMode)
- {
- case CurAction2d_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 )
- GetDocument()->ShiftInputEvent2D(point.x,point.y,myV2dView);
- else
- GetDocument()->InputEvent2D (point.x,point.y,myV2dView);
- } else
- {
- drawRectangle (myXmin,myYmin,myXmax,myYmax,aContext,Standard_False);
- myXmax=point.x;
- myYmax=point.y;
- if (nFlags & MK_SHIFT)
- GetDocument()->ShiftDragEvent2D(point.x,point.y,1,myV2dView);
- else
- GetDocument()->DragEvent2D(point.x,point.y,1,myV2dView);
- }
- break;
- case CurAction2d_DynamicZooming :
- // SetCursor(AfxGetApp()->LoadStandardCursor());
- myCurrentMode = CurAction2d_Nothing;
- break;
- case CurAction2d_WindowZooming :
- myXmax=point.x; myYmax=point.y;
- drawRectangle (myXmin,myYmin,myXmax,myYmax,aContext,Standard_False);
- 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
- myV2dView->WindowFit(myXmin,myYmin,myXmax,myYmax);
- }
- myCurrentMode = CurAction2d_Nothing;
- break;
- case CurAction2d_DynamicPanning :
- myCurrentMode = CurAction2d_Nothing;
- break;
- case CurAction2d_GlobalPanning :
- myV2dView->Place(point.x,point.y,myCurZoom);
- myCurrentMode = CurAction2d_Nothing;
- break;
- default :
- throw Standard_Failure(" incompatible Current Mode ");
- break;
- } //switch (myCurrentMode)
- } // else // if ( Ctrl )
-
-}
-
-void CGeometryView2D::OnMButtonDown(UINT nFlags, CPoint /*point*/)
-{
- if ( nFlags & MK_CONTROL )
- {
- // Button MB2 down Control : panning init
- // SetCursor(AfxGetApp()->LoadStandardCursor());
- }
-}
-
-void CGeometryView2D::OnMButtonUp(UINT nFlags, CPoint /*point*/)
-{
- if ( nFlags & MK_CONTROL )
- {
- // Button MB2 up Control : panning stop
- // SetCursor(AfxGetApp()->LoadStandardCursor());
- }
-}
-
-void CGeometryView2D::OnRButtonDown(UINT nFlags, CPoint point)
-{
- // TODO: Add your message handler code here and/or call default
- if ( nFlags & MK_CONTROL )
- {
- // SetCursor(AfxGetApp()->LoadStandardCursor());
- }
- else // if ( Ctrl )
- {
- GetDocument()->Popup2D(point.x,point.y,myV2dView);
- }
-}
-
-void CGeometryView2D::OnRButtonUp(UINT /*nFlags*/, CPoint point)
-{
- OCC_2dView::Popup2D(point.x,point.y);
-}
-
-void CGeometryView2D::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
- myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
- // save the current mouse coordinate in min
- myXmax = point.x;
- myYmax = point.y;
- }
- else // if ( Ctrl )
- {
- const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetISessionContext();
- switch (myCurrentMode)
- {
- case CurAction2d_Nothing :
- myXmax = point.x;
- myYmax = point.y;
- GetDocument()->DragEvent2D(myXmax,myYmax,0,myV2dView);
- drawRectangle (myXmin,myYmin,myXmax,myYmax, aContext);
- break;
- case CurAction2d_DynamicZooming :
- myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
- // save the current mouse coordinate in min \n";
- myXmax=point.x; myYmax=point.y;
- break;
- case CurAction2d_WindowZooming :
- myXmax = point.x; myYmax = point.y;
- drawRectangle (myXmin,myYmin,myXmax,myYmax, aContext);
- 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 : // nothing
- break;
- default :
- throw Standard_Failure(" 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 )
- {
- myV2dView->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)
- {
- }else //if ( nFlags & MK_RBUTTON)
- // ============================ NO BUTTON =======================
- { // No buttons
- myXmax = point.x; myYmax = point.y;
- if (nFlags & MK_SHIFT)
- GetDocument()->ShiftMoveEvent2D(point.x,point.y,myV2dView);
- else
- GetDocument()->MoveEvent2D(point.x,point.y,myV2dView);
- }
-}
-
-void CGeometryView2D::OnSize(UINT nType, int cx, int cy)
-{
- OCC_2dView::OnSize (nType, cx, cy);
- if (!myV2dView.IsNull())
- {
- myV2dView->MustBeResized(); // added sro
- }
-}
-
void CGeometryView2D::OnInitialUpdate()
{
- Handle(WNT_Window) aWNTWindow;
- aWNTWindow = new WNT_Window(GetSafeHwnd());
-
- myV2dView = GetDocument()->GetViewer2D()->CreateView();
- myV2dView->SetWindow(aWNTWindow);
- myV2dView->SetBackgroundColor(Quantity_NOC_BLACK);
-
- // initialyse the grids dialogs
- TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
- TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
- TheRectangularGridDialog.SetViewer (GetDocument()->GetViewer2D());
- TheCircularGridDialog.SetViewer (GetDocument()->GetViewer2D());
-
- Standard_Integer w=100 , h=100 ; /* Debug Matrox */
- aWNTWindow->Size (w,h) ; /* Keeps me unsatisfied (rlb)..... */
- /* Resize is not supposed to be done on */
- /* Matrox */
- /* I suspect another problem elsewhere */
- ::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
+ OCC_2dView::OnInitialUpdate();
+ myView->SetBackgroundColor (Quantity_NOC_BLACK);
}
// Overrides
// ClassWizard generated virtual function overrides
public:
- virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual void OnInitialUpdate(); // called first time after construct
// Implementation
virtual void Dump(CDumpContext& dc) const;
#endif
+ //! Return interactive context for 2d presentations.
+ virtual const Handle(AIS_InteractiveContext)& GetAISContext() const Standard_OVERRIDE;
+
// Generated message map functions
protected:
//{{AFX_MSG(CGeometryView2D)
- 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 OnRButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
if(pCurrentView->IsKindOf(RUNTIME_CLASS(OCC_2dView)) )
{
ASSERT_VALID(pCurrentView);
- ((OCC_2dView*)pCurrentView)->GetV2dView()->FitAll();
+ ((OCC_2dView*)pCurrentView)->FitAll();
}
}
}
#include "resource2d\RectangularGrid.h"
#include "resource2d\CircularGrid.h"
-#define ValZWMin 1
-
#ifdef _DEBUG
//#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-// the key for multi selection :
-#define MULTISELECTIONKEY MK_SHIFT
-
-// the key for shortcut ( use to activate dynamic rotation, panning )
-#define CASCADESHORTCUTKEY MK_CONTROL
-
-// define in witch case you want to display the popup
-#define POPUPONBUTTONDOWN
-
/////////////////////////////////////////////////////////////////////////////
// CHLRView2D
BEGIN_MESSAGE_MAP(CHLRView2D, OCC_2dView)
//{{AFX_MSG_MAP(CHLRView2D)
- ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CHLRView2D::CHLRView2D()
{
+ /// TODO
+ /// Override MouseMove event to exclude rectangle selection emulation as
+ /// no selection is supported in DragEvent2D for this view.
}
CHLRView2D::~CHLRView2D()
{
}
-CHLRDoc* CHLRView2D::GetDocument() // non-debug version is inline
-{
- //ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(OCC_2dDoc)));
- return (CHLRDoc*)m_pDocument;
-}
-
-
-void CHLRView2D::OnInitialUpdate()
-{
- Handle(WNT_Window) aWNTWindow;
- aWNTWindow = new WNT_Window(GetSafeHwnd(),Quantity_NOC_GRAY);
- myV2dView = GetDocument()->GetViewer2D()->CreateView();
- myV2dView->SetWindow(aWNTWindow);
-
- // initialyse the grids dialogs
- TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
- TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
- TheRectangularGridDialog.SetViewer (GetDocument()->GetViewer2D());
- TheCircularGridDialog.SetViewer (GetDocument()->GetViewer2D());
-
- Standard_Integer w=100 , h=100 ; /* Debug Matrox */
- aWNTWindow->Size (w,h) ; /* Keeps me unsatisfied (rlb)..... */
- /* Resize is not supposed to be done on */
- /* Matrox */
- /* I suspect another problem elsewhere */
- ::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void CHLRView2D::DragEvent2D(const Standard_Integer /*x*/,
- const Standard_Integer /*y*/,
- const Standard_Integer /*TheState*/)
-{
-}
-
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void CHLRView2D::InputEvent2D(const Standard_Integer /*x*/,
- const Standard_Integer /*y*/)
-{
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void CHLRView2D::MoveEvent2D(const Standard_Integer /*x*/,
- const Standard_Integer /*y*/)
+const Handle(AIS_InteractiveContext)& CHLRView2D::GetAISContext() const
{
+ return ((CHLRDoc*)m_pDocument)->GetInteractiveContext2D();
}
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void CHLRView2D::MultiMoveEvent2D(const Standard_Integer /*x*/,
- const Standard_Integer /*y*/)
-{
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void CHLRView2D::MultiDragEvent2D(const Standard_Integer /*x*/,
- const Standard_Integer /*y*/,
- const Standard_Integer /*TheState*/)
-{
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void CHLRView2D::MultiInputEvent2D(const Standard_Integer /*x*/,
- const Standard_Integer /*y*/)
-{
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void CHLRView2D::OnMouseMove(UINT nFlags, CPoint point)
+CHLRDoc* CHLRView2D::GetDocument() // non-debug version is inline
{
- 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 :
- throw Standard_Failure(" 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);
- }
- }
+ //ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(OCC_2dDoc)));
+ return (CHLRDoc*)m_pDocument;
}
#ifdef _DEBUG
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
- //{{AFX_VIRTUAL(CHLRView2D)
-protected:
- virtual void OnInitialUpdate(); // called first time after construct
- //}}AFX_VIRTUAL
+ //! Return interactive context for HLR presentations.
+ virtual const Handle(AIS_InteractiveContext)& GetAISContext() const Standard_OVERRIDE;
// Implementation
public:
virtual ~CHLRView2D();
CHLRDoc* GetDocument();
- virtual void DragEvent2D (const Standard_Integer x,
- const Standard_Integer y,
- const Standard_Integer TheState);
- virtual void InputEvent2D (const Standard_Integer x,
- const Standard_Integer y);
- virtual void MoveEvent2D (const Standard_Integer x,
- const Standard_Integer y );
- virtual void MultiMoveEvent2D (const Standard_Integer x,
- const Standard_Integer y );
- virtual void MultiDragEvent2D (const Standard_Integer x,
- const Standard_Integer y ,
- const Standard_Integer TheState);
- virtual void MultiInputEvent2D (const Standard_Integer x,
- const Standard_Integer y );
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
OCC_2dDoc::OCC_2dDoc() : OCC_BaseDoc()
{
// Get the Graphic Driver from the application
- Handle(Graphic3d_GraphicDriver) aGraphicDriver =
- ((OCC_App*)AfxGetApp())->GetGraphicDriver();
+ Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((OCC_App*)AfxGetApp())->GetGraphicDriver();
// create the Viewer
myViewer = new V3d_Viewer (aGraphicDriver);
{
OCC_2dView* aCurrentView = (OCC_2dView*)GetNextView (aPosition);
ASSERT_VALID (aCurrentView);
- aCurrentView->GetV2dView()->FitAll();
+ aCurrentView->GetView()->FitAll();
}
}
-void OCC_2dDoc::MoveEvent(const Standard_Integer theMouseX,
- const Standard_Integer theMouseY,
- const Handle(V3d_View)& theView)
+void OCC_2dDoc::Popup (const Standard_Integer theMouseX,
+ const Standard_Integer theMouseY,
+ const Handle(V3d_View)& theView)
{
- myAISContext->MoveTo (theMouseX, theMouseY, theView, Standard_True);
-}
+ // load the 'normal' popup
+ CMenu aMenu;
+ VERIFY(aMenu.LoadMenu(IDR_Popup2D));
+ // activate the sub menu '0'
+ CMenu* aPopup = aMenu.GetSubMenu(0);
+ ASSERT(aPopup != NULL);
-void OCC_2dDoc::ShiftMoveEvent(const Standard_Integer theMouseX,
- const Standard_Integer theMouseY,
- const Handle(V3d_View)& theView)
-{
- myAISContext->MoveTo (theMouseX, theMouseY, theView, Standard_True);
+ // display the popup
+ POINT aWinCoord = { theMouseX, theMouseY };
+ ClientToScreen ((HWND )theView->Window()->NativeHandle(), &aWinCoord);
+ aPopup->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, aWinCoord.x, aWinCoord.y, AfxGetMainWnd());
}
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);
+ virtual void Popup (const Standard_Integer theMouseX,
+ const Standard_Integer theMouseY,
+ const Handle(V3d_View)& theView) Standard_OVERRIDE;
};
#endif // !defined(AFX_OCC_2dDOC_H__2E048CC7_38F9_11D7_8611_0060B0EE281E__INCLUDED_)
#include "Quantity_Color.hxx"
#include "Quantity_NameOfColor.hxx"
-#define ValZWMin 1
-
-// the key for multi selection :
-#define MULTISELECTIONKEY MK_SHIFT
-
-// the key for shortcut ( use to activate dynamic rotation, panning )
-#define CASCADESHORTCUTKEY MK_CONTROL
-
-// define in witch case you want to display the popup
-#define POPUPONBUTTONDOWN
-
/////////////////////////////////////////////////////////////////////////////
// OCC_2dView
-IMPLEMENT_DYNCREATE(OCC_2dView, CView)
+IMPLEMENT_DYNCREATE(OCC_2dView, OCC_BaseView)
-BEGIN_MESSAGE_MAP(OCC_2dView, CView)
+BEGIN_MESSAGE_MAP(OCC_2dView, OCC_BaseView)
//{{AFX_MSG_MAP(OCC_2dView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
- ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage)
- ON_COMMAND(ID_BUTTON2DGridRectLines, OnBUTTONGridRectLines)
- ON_COMMAND(ID_BUTTON2DGridRectPoints, OnBUTTONGridRectPoints)
- ON_COMMAND(ID_BUTTON2DGridCircLines, OnBUTTONGridCircLines)
- ON_COMMAND(ID_BUTTON2DGridCircPoints, OnBUTTONGridCircPoints)
- ON_COMMAND(ID_BUTTON2DGridValues, OnBUTTONGridValues)
- ON_UPDATE_COMMAND_UI(ID_BUTTON2DGridValues, OnUpdateBUTTONGridValues)
- ON_COMMAND(ID_BUTTON2DGridCancel, OnBUTTONGridCancel)
- ON_UPDATE_COMMAND_UI(ID_BUTTON2DGridCancel, OnUpdateBUTTONGridCancel)
- ON_WM_LBUTTONDOWN()
- ON_WM_LBUTTONUP()
- ON_WM_MBUTTONDOWN()
- ON_WM_MBUTTONUP()
- ON_WM_RBUTTONDOWN()
- ON_WM_RBUTTONUP()
- ON_WM_MOUSEMOVE()
- ON_WM_SIZE()
- ON_COMMAND(ID_BUTTON2DFitAll, OnBUTTONFitAll)
- ON_COMMAND(ID_BUTTON2DGlobPanning, OnBUTTONGlobPanning)
- ON_COMMAND(ID_BUTTON2DPanning, OnBUTTONPanning)
- ON_COMMAND(ID_BUTTON2DZoomProg, OnBUTTONZoomProg)
- ON_COMMAND(ID_BUTTON2DZoomWin, OnBUTTONZoomWin)
- ON_UPDATE_COMMAND_UI(ID_BUTTON2DGlobPanning, OnUpdateBUTTON2DGlobPanning)
- ON_UPDATE_COMMAND_UI(ID_BUTTON2DPanning, OnUpdateBUTTON2DPanning)
- ON_UPDATE_COMMAND_UI(ID_BUTTON2DZoomProg, OnUpdateBUTTON2DZoomProg)
- ON_UPDATE_COMMAND_UI(ID_BUTTON2DZoomWin, OnUpdateBUTTON2DZoomWin)
- ON_COMMAND(ID_Modify_ChangeBackground ,OnChangeBackground)
+ ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage)
+ ON_COMMAND(ID_BUTTON2DGridRectLines, OnBUTTONGridRectLines)
+ ON_COMMAND(ID_BUTTON2DGridRectPoints, OnBUTTONGridRectPoints)
+ ON_COMMAND(ID_BUTTON2DGridCircLines, OnBUTTONGridCircLines)
+ ON_COMMAND(ID_BUTTON2DGridCircPoints, OnBUTTONGridCircPoints)
+ ON_COMMAND(ID_BUTTON2DGridValues, OnBUTTONGridValues)
+ ON_UPDATE_COMMAND_UI(ID_BUTTON2DGridValues, OnUpdateBUTTONGridValues)
+ ON_COMMAND(ID_BUTTON2DGridCancel, OnBUTTONGridCancel)
+ ON_UPDATE_COMMAND_UI(ID_BUTTON2DGridCancel, OnUpdateBUTTONGridCancel)
+ ON_WM_SIZE()
+ ON_COMMAND(ID_BUTTON2DFitAll, OnBUTTONFitAll)
+ ON_COMMAND(ID_BUTTON2DGlobPanning, OnBUTTONGlobPanning)
+ ON_COMMAND(ID_BUTTON2DPanning, OnBUTTONPanning)
+ ON_COMMAND(ID_BUTTON2DZoomProg, OnBUTTONZoomProg)
+ ON_COMMAND(ID_BUTTON2DZoomWin, OnBUTTONZoomWin)
+ ON_UPDATE_COMMAND_UI(ID_BUTTON2DGlobPanning, OnUpdateBUTTON2DGlobPanning)
+ ON_UPDATE_COMMAND_UI(ID_BUTTON2DPanning, OnUpdateBUTTON2DPanning)
+ ON_UPDATE_COMMAND_UI(ID_BUTTON2DZoomProg, OnUpdateBUTTON2DZoomProg)
+ ON_UPDATE_COMMAND_UI(ID_BUTTON2DZoomWin, OnUpdateBUTTON2DZoomWin)
+ ON_COMMAND(ID_Modify_ChangeBackground ,OnChangeBackground)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// OCC_2dView construction/destruction
OCC_2dView::OCC_2dView()
-: myCurrentMode (CurAction2d_Nothing)
{
+ myToAllowRotation = false;
+ myDefaultGestures.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_SelectRectangle);
+ myMouseGestureMap = myDefaultGestures;
}
OCC_2dView::~OCC_2dView()
{
- myV2dView->Remove();
-}
-
-BOOL OCC_2dView::PreCreateWindow(CREATESTRUCT& cs)
-{
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- cs.lpszClass = ::AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC, ::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
- return CView::PreCreateWindow(cs);
+ //
}
/////////////////////////////////////////////////////////////////////////////
// OCC_2dView drawing
-void OCC_2dView::OnDraw(CDC* /*pDC*/)
-{
- if (!myV2dView.IsNull())
- myV2dView->Update();
-}
-
void OCC_2dView::OnInitialUpdate()
{
- CView::OnInitialUpdate();
+ OCC_BaseView::OnInitialUpdate();
- Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd(),Quantity_NOC_MATRAGRAY);
- myV2dView =((OCC_2dDoc*)GetDocument())->GetViewer2D()->CreateView();
- myV2dView->SetWindow(aWNTWindow);
// initialize the grids dialogs
TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
- TheRectangularGridDialog.SetViewer (((OCC_2dDoc*)GetDocument())->GetViewer2D());
- TheCircularGridDialog.SetViewer (((OCC_2dDoc*)GetDocument())->GetViewer2D());
-
- Standard_Integer w=100 , h=100 ; /* Debug Matrox */
- aWNTWindow->Size (w,h) ; /* Keeps me unsatisfied (rlb)..... */
- /* Resize is not supposed to be done on */
- /* Matrox */
- /* I suspect another problem elsewhere */
- ::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
-
+ TheRectangularGridDialog.SetViewer (myView->Viewer());
+ TheCircularGridDialog.SetViewer (myView->Viewer());
}
void OCC_2dView::OnFileExportImage()
{
- GetDocument()->ExportView (myV2dView);
+ GetDocument()->ExportView (myView);
}
/////////////////////////////////////////////////////////////////////////////
#endif //_DEBUG
void OCC_2dView::OnBUTTONGridRectLines()
{
- Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
+ Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2);
aViewer->SetGridEcho(aGridAspect);
Standard_Integer aWidth=0, aHeight=0, anOffset=0;
- myV2dView->Window()->Size(aWidth,aHeight);
+ myView->Window()->Size(aWidth,aHeight);
aViewer->SetRectangularGridGraphicValues(aWidth,aHeight,anOffset);
aViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines);
FitAll();
void OCC_2dView::OnBUTTONGridRectPoints()
{
- Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
+ Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2);
aViewer->SetGridEcho(aGridAspect);
Standard_Integer aWidth=0, aHeight=0, anOffset=0;
- myV2dView->Window()->Size(aWidth,aHeight);
+ myView->Window()->Size(aWidth,aHeight);
aViewer->SetRectangularGridGraphicValues(aWidth,aHeight,anOffset);
aViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Points);
FitAll();
void OCC_2dView::OnBUTTONGridCircLines()
{
- Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
+ Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2);
aViewer->SetGridEcho(aGridAspect);
Standard_Integer aWidth=0, aHeight=0, anOffset=0;
- myV2dView->Window()->Size(aWidth,aHeight);
+ myView->Window()->Size(aWidth,aHeight);
aViewer->SetCircularGridGraphicValues(aWidth>aHeight?aWidth:aHeight,anOffset);
aViewer->ActivateGrid(Aspect_GT_Circular, Aspect_GDM_Lines);
FitAll();
void OCC_2dView::OnBUTTONGridCircPoints()
{
- Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
+ Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2);
aViewer->SetGridEcho(aGridAspect);
Standard_Integer aWidth=0, aHeight=0, anOffset=0;
- myV2dView->Window()->Size(aWidth,aHeight);
+ myView->Window()->Size(aWidth,aHeight);
aViewer->SetCircularGridGraphicValues(aWidth>aHeight?aWidth:aHeight,anOffset);
aViewer->ActivateGrid(Aspect_GT_Circular, Aspect_GDM_Points);
FitAll();
void OCC_2dView::OnBUTTONGridValues()
{
- Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
+ Handle(V3d_Viewer) aViewer = myView->Viewer();
Aspect_GridType TheGridtype = aViewer->GridType();
switch( TheGridtype )
}
void OCC_2dView::OnUpdateBUTTONGridValues(CCmdUI* pCmdUI)
{
- Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
+ Handle(V3d_Viewer) aViewer = myView->Viewer();
pCmdUI-> Enable( aViewer->IsActive() );
}
void OCC_2dView::OnBUTTONGridCancel()
{
- Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
+ Handle(V3d_Viewer) aViewer = myView->Viewer();
aViewer->DeactivateGrid();
TheRectangularGridDialog.ShowWindow(SW_HIDE);
TheCircularGridDialog.ShowWindow(SW_HIDE);
}
void OCC_2dView::OnUpdateBUTTONGridCancel(CCmdUI* pCmdUI)
{
- Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
+ Handle(V3d_Viewer) aViewer = myView->Viewer();
pCmdUI-> Enable( aViewer->IsActive() );
}
-void OCC_2dView::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 & CASCADESHORTCUTKEY )
- {
- // Button MB1 down Control :start zomming
- //
- }
- else // if ( MULTISELECTIONKEY )
- {
- switch (myCurrentMode)
- {
- case CurAction2d_Nothing : // start a drag
- DragEvent2D(point.x,point.y,-1);
- break;
- case CurAction2d_DynamicZooming : // nothing
- break;
- case CurAction2d_WindowZooming : // nothing
- break;
- case CurAction2d_DynamicPanning :// nothing
- break;
- case CurAction2d_GlobalPanning :// nothing
- break;
- default :
- throw Standard_Failure(" incompatible Current Mode ");
- break;
- }
- }
-}
-
-
-void OCC_2dView::OnLButtonUp(UINT nFlags, CPoint point)
-{
- // TODO: Add your message handler code here and/or call default
- if ( nFlags & CASCADESHORTCUTKEY )
- {
- return;
- }
- else // if ( Ctrl )
- {
- const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetAISContext();
- switch (myCurrentMode)
- {
- case CurAction2d_Nothing :
- if (point.x == myXmin && point.y == myYmin)
- { // no offset between down and up --> selectEvent
- myXmax=point.x;
- myYmax=point.y;
- if (nFlags & MULTISELECTIONKEY )
- MultiInputEvent2D(point.x,point.y);
- else
- InputEvent2D (point.x,point.y);
- } else
- {
- drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext, Standard_False);
- myXmax=point.x;
- myYmax=point.y;
- if (nFlags & MULTISELECTIONKEY)
- MultiDragEvent2D(point.x,point.y,1);
- else
- DragEvent2D(point.x,point.y,1);
- }
- break;
- case CurAction2d_DynamicZooming :
- //
- myCurrentMode = CurAction2d_Nothing;
- break;
- case CurAction2d_WindowZooming :
- myXmax=point.x; myYmax=point.y;
- drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext, Standard_False);
- 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
- myV2dView->WindowFit(myXmin,myYmin,myXmax,myYmax);
- }
- myCurrentMode = CurAction2d_Nothing;
- break;
- case CurAction2d_DynamicPanning :
- myCurrentMode = CurAction2d_Nothing;
- break;
- case CurAction2d_GlobalPanning :
- myV2dView->Place(point.x,point.y,myCurZoom);
- myCurrentMode = CurAction2d_Nothing;
- break;
- default :
- throw Standard_Failure(" incompatible Current Mode ");
- break;
- } //switch (myCurrentMode)
- } // else // if ( CASCADESHORTCUTKEY )
-}
-
-void OCC_2dView::OnMButtonDown(UINT nFlags, CPoint /*point*/)
-{
- if ( nFlags & CASCADESHORTCUTKEY )
- {
- // Button MB2 down + CASCADESHORTCUTKEY : panning init
- //
- }
-}
-
-void OCC_2dView::OnMButtonUp(UINT nFlags, CPoint /*point*/)
-{
- if ( nFlags & CASCADESHORTCUTKEY )
- {
- // Button MB2 up + CASCADESHORTCUTKEY : panning stop
- }
-}
-
-void OCC_2dView::OnRButtonDown(UINT nFlags, CPoint point)
-{
-#ifdef POPUPONBUTTONDOWN
- if ( !(nFlags & CASCADESHORTCUTKEY) )
- Popup2D(point.x,point.y);
-#endif
-}
-
-void OCC_2dView::OnRButtonUp(UINT
-#ifndef POPUPONBUTTONDOWN
- nFlags
-#endif
- , CPoint
-#ifndef POPUPONBUTTONDOWN
- point
-#endif
- )
-{
-#ifndef POPUPONBUTTONDOWN
- if ( !(nFlags & CASCADESHORTCUTKEY) )
- Popup2D(point.x,point.y);
-#endif
-}
-
-void OCC_2dView::OnMouseMove(UINT nFlags, CPoint point)
-{
- // ============================ LEFT BUTTON =======================
- 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);
- // save the current mouse coordinate in min
- myXmax = point.x;
- myYmax = point.y;
- }
- else // if ( CASCADESHORTCUTKEY )
- {
- const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetAISContext();
- switch (myCurrentMode)
- {
- case CurAction2d_Nothing :
- myXmax = point.x; myYmax = point.y;
- DragEvent2D(myXmax,myYmax,0);
- drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext);
- break;
- case CurAction2d_DynamicZooming :
- myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
- // save the current mouse coordinate in min \n";
- myXmax=point.x; myYmax=point.y;
- break;
- case CurAction2d_WindowZooming :
- myXmax = point.x;
- myYmax = point.y;
- drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext);
- 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 : // nothing
- break;
- default :
- throw Standard_Failure(" incompatible Current Mode ");
- break;
- }// switch (myCurrentMode)
- }// if ( nFlags & CASCADESHORTCUTKEY ) else
- } else // if ( nFlags & MK_LBUTTON)
- // ============================ MIDDLE BUTTON =======================
- if ( nFlags & MK_MBUTTON)
- {
- if ( nFlags & CASCADESHORTCUTKEY )
- {
- myV2dView->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) &! (nFlags & MK_LBUTTON) ) // Left + Right is specific
- {
- }else //if ( nFlags & MK_RBUTTON)
- if ( (nFlags & MK_RBUTTON) && (nFlags & MK_LBUTTON) )
- {
- // in case of Left + Right : same as Middle
- if ( nFlags & CASCADESHORTCUTKEY )
- {
- myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
- myXmax = point.x; myYmax = point.y;
- }
- }else //if ( nFlags & MK_RBUTTON)&& (nFlags & MK_LBUTTON)
- // ============================ NO BUTTON =======================
- { // No buttons
- myXmax = point.x; myYmax = point.y;
- if (nFlags & MULTISELECTIONKEY)
- MultiMoveEvent2D(point.x,point.y);
- else
- MoveEvent2D(point.x,point.y);
- }
-}
-
-
void OCC_2dView::OnSize(UINT nType, int cx, int cy)
{
OCC_BaseView::OnSize (nType, cx, cy);
// Take care : This fonction is call before OnInitialUpdate
- if (!myV2dView.IsNull())
- myV2dView->MustBeResized();
+ if (!myView.IsNull())
+ myView->MustBeResized();
}
void OCC_2dView::OnBUTTONFitAll()
{
- myV2dView->FitAll();
+ myView->FitAll();
}
void OCC_2dView::OnBUTTONGlobPanning()
{
//save the current zoom value
- myCurZoom = myV2dView->Scale();
+ myCurZoom = myView->Scale();
// Do a Global Zoom
- myV2dView->FitAll();
+ myView->FitAll();
// Set the mode
- myCurrentMode = CurAction2d_GlobalPanning;
+ setCurrentAction (CurAction3d_GlobalPanning);
}
void OCC_2dView::OnBUTTONPanning()
{
- myCurrentMode = CurAction2d_DynamicPanning;
+ setCurrentAction (CurAction3d_DynamicPanning);
}
void OCC_2dView::OnBUTTONZoomProg()
{
- myCurrentMode = CurAction2d_DynamicZooming;
+ setCurrentAction (CurAction3d_DynamicZooming);
}
void OCC_2dView::OnBUTTONZoomWin()
{
- myCurrentMode = CurAction2d_WindowZooming;
+ setCurrentAction (CurAction3d_WindowZooming);
}
void OCC_2dView::OnChangeBackground()
{
Standard_Real R1, G1, B1;
- Handle(Aspect_Window) aWindow = myV2dView->Window();
+ Handle(Aspect_Window) aWindow = myView->Window();
Aspect_Background ABack = aWindow->Background();
Quantity_Color aColor = ABack.Color();
aColor.Values(R1,G1,B1,Quantity_TOC_RGB);
G1 = GetGValue(m_clr)/255.;
B1 = GetBValue(m_clr)/255.;
aColor.SetValues(R1,G1,B1,Quantity_TOC_RGB);
- myV2dView->SetBackgroundColor(aColor);
- myV2dView->Update();
+ myView->SetBackgroundColor(aColor);
+ myView->Update();
}
}
void OCC_2dView::OnUpdateBUTTON2DGlobPanning(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction2d_GlobalPanning);
- pCmdUI->Enable (myCurrentMode != CurAction2d_GlobalPanning);
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_GlobalPanning);
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_GlobalPanning);
}
void OCC_2dView::OnUpdateBUTTON2DPanning(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction2d_DynamicPanning);
- pCmdUI->Enable (myCurrentMode != CurAction2d_DynamicPanning);
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicPanning);
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicPanning);
}
void OCC_2dView::OnUpdateBUTTON2DZoomProg(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction2d_DynamicZooming);
- pCmdUI->Enable (myCurrentMode != CurAction2d_DynamicZooming);
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicZooming);
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicZooming);
}
void OCC_2dView::OnUpdateBUTTON2DZoomWin(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction2d_WindowZooming);
- pCmdUI->Enable (myCurrentMode != CurAction2d_WindowZooming);
-}
-
-// =====================================================================
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void OCC_2dView::DragEvent2D(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)
- {
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->MoveTo (x, y, myV2dView, Standard_False);
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->Select (theButtonDownX, theButtonDownY, x, y, myV2dView, Standard_True);
- }
-
- if (TheState == 1)
- {
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->Select(true);
- }
-}
-
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void OCC_2dView::InputEvent2D(const Standard_Integer /*x*/,
- const Standard_Integer /*y*/)
-{
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->Select(true);
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void OCC_2dView::MoveEvent2D(const Standard_Integer x,
- const Standard_Integer y)
-{
- if(myV2dView->Viewer()->Grid()->IsActive())
- {
- Standard_Real aGridX=0,aGridY=0,aGridZ=0;
- myV2dView->ConvertToGrid(x,y,aGridX,aGridY,aGridZ);
- //View is not updated automatically in ConvertToGrid
- myV2dView->Update();
- }
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->MoveTo (x, y, myV2dView, Standard_True);
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void OCC_2dView::MultiMoveEvent2D(const Standard_Integer x,
- const Standard_Integer y)
-{
-// MultiMoveEvent2D means we move the mouse in a multi selection mode
-((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->MoveTo (x, y, myV2dView, Standard_True);
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void OCC_2dView::MultiDragEvent2D(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)
- {
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->MoveTo (x, y, myV2dView, Standard_False);
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->ShiftSelect (theButtonDownX, theButtonDownY, x, y, myV2dView, Standard_True);
- }
-
- if (TheState == 1)
- {
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->ShiftSelect(true);
- }
-}
-
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void OCC_2dView::MultiInputEvent2D(const Standard_Integer /*x*/,
- const Standard_Integer /*y*/)
-{
- ((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->ShiftSelect(true);
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-void OCC_2dView::Popup2D(const Standard_Integer x,
- const Standard_Integer y )
-{
- CMenu menu;
- CMenu* pPopup ;
-
- // load the 'normal' popup
- VERIFY(menu.LoadMenu(IDR_Popup2D));
- // activate the sub menu '0'
- pPopup= menu.GetSubMenu(0);
- ASSERT(pPopup != NULL);
-
- // display the popup
- POINT winCoord = { x , y };
- ClientToScreen ( &winCoord);
- pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON , winCoord.x, winCoord.y , AfxGetMainWnd());
-}
-
-void OCC_2dView::FitAll()
-{
- myV2dView->FitAll();
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_WindowZooming);
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_WindowZooming);
}
#include "Resource2d/RectangularGrid.h"
#include "Resource2d/CircularGrid.h"
-enum CurrentAction2d
-{
- CurAction2d_Nothing,
- CurAction2d_DynamicZooming,
- CurAction2d_WindowZooming,
- CurAction2d_DynamicPanning,
- CurAction2d_GlobalPanning,
-};
-
class Standard_EXPORT OCC_2dView : public OCC_BaseView
{
DECLARE_DYNCREATE(OCC_2dView)
OCC_2dDoc* GetDocument();
- Handle(V3d_View)& GetV2dView() { return myV2dView; }
-
- void FitAll();
-
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(OCC_2dView)
- public:
- virtual void OnDraw(CDC* pDC); // overridden to draw this view
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- protected:
+protected:
virtual void OnInitialUpdate(); // called first time after construct
//}}AFX_VIRTUAL
afx_msg void OnUpdateBUTTONGridValues(CCmdUI* pCmdUI);
afx_msg void OnBUTTONGridCancel();
afx_msg void OnUpdateBUTTONGridCancel(CCmdUI* pCmdUI);
- 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 OnRButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnBUTTONFitAll();
afx_msg void OnBUTTONGlobPanning();
DECLARE_MESSAGE_MAP()
protected:
-
- virtual void DragEvent2D (const Standard_Integer x,
- const Standard_Integer y,
- const Standard_Integer TheState);
-
- virtual void InputEvent2D (const Standard_Integer x,
- const Standard_Integer y);
-
- virtual void MoveEvent2D (const Standard_Integer x,
- const Standard_Integer y);
-
- virtual void MultiMoveEvent2D (const Standard_Integer x,
- const Standard_Integer y);
-
- virtual void MultiDragEvent2D (const Standard_Integer x,
- const Standard_Integer y,
- const Standard_Integer TheState);
-
- virtual void MultiInputEvent2D (const Standard_Integer x,
- const Standard_Integer y);
-
- virtual void Popup2D (const Standard_Integer x,
- const Standard_Integer y);
-
-protected:
-
- Handle(V3d_View) myV2dView;
- CurrentAction2d myCurrentMode;
CRectangularGrid TheRectangularGridDialog;
CCircularGrid TheCircularGridDialog;
};
}
POINT winCoord = { theMouseX , theMouseY };
- Handle(WNT_Window) aWNTWindow=
- Handle(WNT_Window)::DownCast(theView->Window());
- ClientToScreen ( (HWND)(aWNTWindow->HWindow()),&winCoord);
+ ClientToScreen ((HWND )theView->Window()->NativeHandle(), &winCoord);
pPopup->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON,
winCoord.x,
winCoord.y,
virtual void Popup (const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
- const Handle(V3d_View)& theView);
+ const Handle(V3d_View)& theView) Standard_OVERRIDE;
static void Fit();
#include <OpenGl_GraphicDriver.hxx>
-#define ValZWMin 1
+IMPLEMENT_DYNCREATE(OCC_3dView, OCC_BaseView)
-IMPLEMENT_DYNCREATE(OCC_3dView, CView)
-
-BEGIN_MESSAGE_MAP(OCC_3dView, CView)
+BEGIN_MESSAGE_MAP(OCC_3dView, OCC_BaseView)
//{{AFX_MSG_MAP(OCC_3dView)
ON_COMMAND(ID_BUTTONAxo, OnBUTTONAxo)
ON_COMMAND(ID_BUTTONBack, OnBUTTONBack)
ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage)
ON_COMMAND(ID_BUTTONZoomProg, OnBUTTONZoomProg)
ON_COMMAND(ID_BUTTONZoomWin, OnBUTTONZoomWin)
- 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)
// OCC_3dView construction/destruction
OCC_3dView::OCC_3dView()
-: myCurrentMode (CurAction3d_Nothing),
- myWidth (0),
- myHeight (0),
- myHlrModeIsOn (Standard_False)
{
// TODO: add construction code here
}
OCC_3dView::~OCC_3dView()
{
- if (myView.IsNull())
- {
- myView->Remove();
- }
-
delete m_pStereoDlg;
}
-BOOL OCC_3dView::PreCreateWindow(CREATESTRUCT& cs)
-{
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- cs.lpszClass = ::AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC, ::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
- return CView::PreCreateWindow(cs);
-}
-
/////////////////////////////////////////////////////////////////////////////
// OCC_3dView drawing
void OCC_3dView::OnInitialUpdate()
{
- CView::OnInitialUpdate();
-
- myView = GetDocument()->GetViewer()->CreateView();
-
- // store for restore state after rotation (which is in Degenerated mode)
- myHlrModeIsOn = Standard_False;
- myView->SetComputedMode (myHlrModeIsOn);
-
- Handle(OpenGl_GraphicDriver) aDriver =
- Handle(OpenGl_GraphicDriver)::DownCast (((OCC_App*)AfxGetApp())->GetGraphicDriver());
-
- Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd());
-
- myView->SetWindow(aWNTWindow);
- myView->Camera()->SetProjectionType (aDriver->Options().contextStereo
- ? Graphic3d_Camera::Projection_Stereo
- : Graphic3d_Camera::Projection_Orthographic);
-
- if (!aWNTWindow->IsMapped())
- {
- aWNTWindow->Map();
- }
-
- // store the mode ( nothing , dynamic zooming, dynamic ... )
- myCurrentMode = CurAction3d_Nothing;
-
+ OCC_BaseView::OnInitialUpdate();
m_pStereoDlg = new OCC_StereoConfigDlg (this);
m_pStereoDlg->SetView (myView);
m_pStereoDlg->Create (IDD_DIALOG_STEREO, this);
}
-void OCC_3dView::OnDraw(CDC* /*pDC*/)
-{
- CRect aRect;
- GetWindowRect(aRect);
- if(myWidth != aRect.Width() || myHeight != aRect.Height()) {
- myWidth = aRect.Width();
- myHeight = aRect.Height();
- ::PostMessage ( GetSafeHwnd() , WM_SIZE , SW_SHOW , myWidth + myHeight*65536 );
- }
- myView->Redraw();
-}
-
/////////////////////////////////////////////////////////////////////////////
// OCC_3dView diagnostics
GetDocument()->ExportView (myView);
}
-void OCC_3dView::OnSize(UINT nType, int cx, int cy)
-{
- OCC_BaseView::OnSize (nType, cx, cy);
- if (!myView.IsNull())
- myView->MustBeResized();
-}
-
// See the back View
void OCC_3dView::OnBUTTONBack()
{
myView->SetProj(V3d_Ypos);
+ myView->Redraw();
}
// See the front View
void OCC_3dView::OnBUTTONFront()
{
myView->SetProj(V3d_Yneg);
+ myView->Redraw();
}
// See the bottom View
void OCC_3dView::OnBUTTONBottom()
{
myView->SetProj(V3d_Zneg);
+ myView->Redraw();
}
// See the top View
void OCC_3dView::OnBUTTONTop()
{
myView->SetProj(V3d_Zpos);
+ myView->Redraw();
}
// See the left View
void OCC_3dView::OnBUTTONLeft()
{
myView->SetProj(V3d_Xneg);
+ myView->Redraw();
}
// See the right View
void OCC_3dView::OnBUTTONRight()
{
myView->SetProj(V3d_Xpos);
+ myView->Redraw();
}
// See the axonometric View
void OCC_3dView::OnBUTTONAxo()
{
myView->SetProj(V3d_XposYnegZpos);
+ myView->Redraw();
}
void OCC_3dView::OnBUTTONHlrOff()
{
- myHlrModeIsOn = Standard_False;
- myView->SetComputedMode (myHlrModeIsOn);
+ myView->SetComputedMode (Standard_False);
myView->Redraw();
}
void OCC_3dView::OnBUTTONHlrOn()
{
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
- myHlrModeIsOn = Standard_True;
- myView->SetComputedMode (myHlrModeIsOn);
+ myView->SetComputedMode (Standard_True);
myView->Redraw();
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
}
void OCC_3dView::OnBUTTONPan()
{
- myCurrentMode = CurAction3d_DynamicPanning;
+ setCurrentAction (CurAction3d_DynamicPanning);
}
void OCC_3dView::OnBUTTONPanGlo()
// save the current zoom value
myCurZoom = myView->Scale();
// Do a Global Zoom
- //myView->FitAll();
+ myView->FitAll();
// Set the mode
- myCurrentMode = CurAction3d_GlobalPanning;
+ setCurrentAction (CurAction3d_GlobalPanning);
}
void OCC_3dView::OnBUTTONReset()
void OCC_3dView::OnBUTTONRot()
{
- myCurrentMode = CurAction3d_DynamicRotation;
+ setCurrentAction (CurAction3d_DynamicRotation);
}
void OCC_3dView::OnBUTTONZoomAll()
}
void OCC_3dView::OnBUTTONZoomProg()
-{ myCurrentMode = CurAction3d_DynamicZooming; }
-
-void OCC_3dView::OnBUTTONZoomWin()
-{ myCurrentMode = CurAction3d_WindowZooming; }
-
-void OCC_3dView::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)
- GetDocument()->ShiftDragEvent(myXmax,myYmax,-1,myView);
- else
- GetDocument()->DragEvent(myXmax,myYmax,-1,myView);
- break;
- break;
- case CurAction3d_DynamicZooming : // noting
- break;
- case CurAction3d_WindowZooming : // noting
- break;
- case CurAction3d_DynamicPanning :// noting
- break;
- case CurAction3d_GlobalPanning :// noting
- break;
- case CurAction3d_DynamicRotation :
- if (myHlrModeIsOn)
- {
- myView->SetComputedMode (Standard_False);
- }
-
- myView->StartRotation(point.x,point.y);
- break;
- default :
- throw Standard_Failure(" incompatible Current Mode ");
- break;
- }
- }
-}
-
-void OCC_3dView::OnLButtonUp(UINT nFlags, CPoint point)
-{
- if ( nFlags & MK_CONTROL )
- {
- return;
- }
- else // if ( Ctrl )
- {
- const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetAISContext();
- 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 )
- GetDocument()->ShiftInputEvent(point.x,point.y,myView);
- else
- GetDocument()->InputEvent (point.x,point.y,myView);
- } else
- {
- myXmax=point.x; myYmax=point.y;
- drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext, Standard_False);
- if (nFlags & MK_SHIFT)
- GetDocument()->ShiftDragEvent(point.x,point.y,1,myView);
- else
- GetDocument()->DragEvent(point.x,point.y,1,myView);
- }
- break;
- case CurAction3d_DynamicZooming :
- myCurrentMode = CurAction3d_Nothing;
- break;
- case CurAction3d_WindowZooming :
- myXmax=point.x; myYmax=point.y;
- drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext, Standard_False);
- 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;
- if (myHlrModeIsOn)
- {
- CWaitCursor aWaitCursor;
- myView->SetComputedMode (myHlrModeIsOn);
- myView->Redraw();
- }
- else
- {
- myView->SetComputedMode (myHlrModeIsOn);
- }
- break;
- default :
- throw Standard_Failure(" incompatible Current Mode ");
- break;
- } //switch (myCurrentMode)
- } // else // if ( Ctrl )
-}
-
-void OCC_3dView::OnMButtonDown(UINT nFlags, CPoint /*point*/)
-{
- if ( nFlags & MK_CONTROL )
- {
- // Button MB2 down Control : panning init
- // SetCursor(AfxGetApp()->LoadStandardCursor());
- }
-}
-
-void OCC_3dView::OnMButtonUp(UINT nFlags, CPoint /*point*/)
-{
- if ( nFlags & MK_CONTROL )
- {
- // Button MB2 down Control : panning init
- // SetCursor(AfxGetApp()->LoadStandardCursor());
- }
-}
-
-void OCC_3dView::OnRButtonDown(UINT nFlags, CPoint point)
-{
- if ( nFlags & MK_CONTROL )
- {
- if (myHlrModeIsOn)
- {
- myView->SetComputedMode (Standard_False);
- }
- myView->StartRotation(point.x,point.y);
- }
- else // if ( Ctrl )
- {
- GetDocument()->Popup(point.x,point.y,myView);
- }
+ setCurrentAction (CurAction3d_DynamicZooming);
}
-void OCC_3dView::OnRButtonUp(UINT /*nFlags*/, CPoint /*point*/)
-{
- SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
- if (myHlrModeIsOn)
- {
- myView->SetComputedMode (myHlrModeIsOn);
- myView->Redraw();
- }
- SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
-}
-
-void OCC_3dView::OnMouseMove(UINT nFlags, CPoint point)
+void OCC_3dView::OnBUTTONZoomWin()
{
- // ============================ 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 )
- {
- const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetAISContext();
- switch (myCurrentMode)
- {
- case CurAction3d_Nothing :
- myXmax = point.x;
- myYmax = point.y;
-
- if (nFlags & MK_SHIFT)
- GetDocument()->ShiftDragEvent(myXmax,myYmax,0,myView);
- else
- GetDocument()->DragEvent(myXmax,myYmax,0,myView);
-
- drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext);
-
- 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, aContext);
- 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 :
- throw Standard_Failure(" incompatible Current Mode ");
- break;
- }// switch (myCurrentMode)
- }// if ( nFlags & MK_CONTROL ) else
- }
- else 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_RBUTTON)
- {
- if ( nFlags & MK_CONTROL )
- {
- myView->Rotation(point.x,point.y);
- }
- }
- else
- { // No buttons
- myXmax = point.x;
- myYmax = point.y;
- if (nFlags & MK_SHIFT)
- GetDocument()->ShiftMoveEvent(point.x,point.y,myView);
- else
- GetDocument()->MoveEvent(point.x,point.y,myView);
- }
+ setCurrentAction (CurAction3d_WindowZooming);
}
void OCC_3dView::OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (!myHlrModeIsOn);
- pCmdUI->Enable (myHlrModeIsOn);
+ pCmdUI->SetCheck (!myView->ComputedMode());
+ pCmdUI->Enable (myView->ComputedMode());
}
void OCC_3dView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myHlrModeIsOn);
- pCmdUI->Enable (!myHlrModeIsOn);
+ pCmdUI->SetCheck (myView->ComputedMode());
+ pCmdUI->Enable (!myView->ComputedMode());
}
void OCC_3dView::OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction3d_GlobalPanning);
- pCmdUI->Enable (myCurrentMode != CurAction3d_GlobalPanning);
-
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_GlobalPanning);
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_GlobalPanning);
}
void OCC_3dView::OnUpdateBUTTONPan(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicPanning);
- pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicPanning );
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicPanning);
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicPanning );
}
void OCC_3dView::OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicZooming );
- pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicZooming);
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicZooming );
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicZooming);
}
void OCC_3dView::OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction3d_WindowZooming);
- pCmdUI->Enable (myCurrentMode != CurAction3d_WindowZooming);
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_WindowZooming);
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_WindowZooming);
}
void OCC_3dView::OnUpdateBUTTONRot(CCmdUI* pCmdUI)
{
- pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicRotation);
- pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicRotation);
+ pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicRotation);
+ pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicRotation);
}
void OCC_3dView::OnModifyChangeBackground()
#include "OCC_StereoConfigDlg.h"
#include <Standard_Macro.hxx>
-enum CurAction3d {
- CurAction3d_Nothing,
- CurAction3d_DynamicZooming,
- CurAction3d_WindowZooming,
- CurAction3d_DynamicPanning,
- CurAction3d_GlobalPanning,
- CurAction3d_DynamicRotation
-};
-
class Standard_EXPORT OCC_3dView : public OCC_BaseView
{
DECLARE_DYNCREATE(OCC_3dView)
virtual ~OCC_3dView();
OCC_3dDoc* GetDocument();
- void FitAll() { if ( !myView.IsNull() ) myView->FitAll(); myView->ZFitAll(); };
- void Redraw() { if ( !myView.IsNull() ) myView->Redraw(); };
-
- void SetZoom ( const Standard_Real& Coef ) { myView->SetZoom ( Coef ); };
- Handle(V3d_View)& GetView() { return myView; }
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(OCC_3dView)
public:
- virtual void OnDraw(CDC* pDC); // overridden to draw this view
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate();
//}}AFX_VIRTUAL
// Generated message map functions
protected:
//{{AFX_MSG(OCC_3dView)
- afx_msg void OnBUTTONAxo();
- afx_msg void OnBUTTONBack();
- afx_msg void OnBUTTONBottom();
- afx_msg void OnBUTTONFront();
- afx_msg void OnBUTTONHlrOff();
- afx_msg void OnBUTTONHlrOn();
- afx_msg void OnBUTTONLeft();
- afx_msg void OnBUTTONPan();
- afx_msg void OnBUTTONPanGlo();
- afx_msg void OnBUTTONReset();
- afx_msg void OnBUTTONRight();
- afx_msg void OnBUTTONRot();
- afx_msg void OnBUTTONTop();
- afx_msg void OnBUTTONZoomAll();
- afx_msg void OnFileExportImage();
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnBUTTONZoomProg();
- afx_msg void OnBUTTONZoomWin();
- 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 void OnModifyChangeBackground();
+ afx_msg void OnBUTTONAxo();
+ afx_msg void OnBUTTONBack();
+ afx_msg void OnBUTTONBottom();
+ afx_msg void OnBUTTONFront();
+ afx_msg void OnBUTTONHlrOff();
+ afx_msg void OnBUTTONHlrOn();
+ afx_msg void OnBUTTONLeft();
+ afx_msg void OnBUTTONPan();
+ afx_msg void OnBUTTONPanGlo();
+ afx_msg void OnBUTTONReset();
+ afx_msg void OnBUTTONRight();
+ afx_msg void OnBUTTONRot();
+ afx_msg void OnBUTTONTop();
+ afx_msg void OnBUTTONZoomAll();
+ afx_msg void OnFileExportImage();
+ afx_msg void OnBUTTONZoomProg();
+ afx_msg void OnBUTTONZoomWin();
+ 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 void OnModifyChangeBackground();
afx_msg void OnStereoConfigButton();
afx_msg void OnUpdateStereoConfigButton (CCmdUI* theCmdUI);
//}}AFX_MSG
virtual void Dump(CDumpContext& dc) const;
#endif
-protected:
-
- Handle(V3d_View) myView;
- CurAction3d myCurrentMode;
- Standard_Integer myWidth;
- Standard_Integer myHeight;
- Standard_Boolean myHlrModeIsOn;
-
private:
//! Persistent non blocking stereo configuration dialog
// init frame
theTemplate->InitialUpdateFrame(aNewFrame, this);
-
-
-
}
virtual ~OCC_BaseDoc();
- Handle(AIS_InteractiveContext)& GetAISContext() { return myAISContext; }
+ const Handle(AIS_InteractiveContext)& GetAISContext() const { return myAISContext; }
+ const Handle(AIS_InteractiveContext)& GetInteractiveContext() const { return myAISContext; };
- Handle(V3d_Viewer) GetViewer() { return myViewer; }
+ const Handle(V3d_Viewer)& GetViewer() const { return myViewer; }
// Returns string with supported export pixel and vector images formats.
const CString SupportedImageFormats() const;
const Standard_Integer /*theMouseY*/,
const Handle(V3d_View)& /*theView*/) {}
+ //! Callback called by handleMoveTo() on Selection in 3D Viewer.
+ virtual void OnSelectionChanged (const Handle(AIS_InteractiveContext)& ,
+ const Handle(V3d_View)& ) {}
+
void ResetDocumentViews (CDocTemplate* theTemplate);
protected:
#include <stdafx.h>
#include "OCC_BaseView.h"
+BEGIN_MESSAGE_MAP(OCC_BaseView, CView)
+ ON_WM_SIZE()
+ ON_WM_MOUSEMOVE()
+ ON_WM_MOUSEWHEEL()
+ ON_WM_MOUSELEAVE()
+ ON_WM_NCMOUSEMOVE()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_LBUTTONUP()
+ ON_WM_MBUTTONDOWN()
+ ON_WM_MBUTTONUP()
+ ON_WM_RBUTTONDOWN()
+ ON_WM_RBUTTONUP()
+END_MESSAGE_MAP()
+
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
OCC_BaseView::OCC_BaseView()
- : myXmin (0),
- myYmin (0),
- myXmax (0),
- myYmax (0),
- myCurZoom (0.0),
- myRect (new AIS_RubberBand (Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0) )
-{
- myRect->SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
- if (myRect->ZLayer() != Graphic3d_ZLayerId_TopOSD)
- {
- myRect->SetZLayer (Graphic3d_ZLayerId_TopOSD);
- }
-
+: myUpdateRequests (0),
+ myCurZoom (0.0),
+ myCurrentMode (CurAction3d_Nothing)
+{
+ myDefaultGestures = myMouseGestureMap;
}
//=======================================================================
//=======================================================================
OCC_BaseView::~OCC_BaseView()
{
-
+ //
}
//=======================================================================
return (OCC_BaseDoc*)m_pDocument;
}
-//=======================================================================
-//function : drawRectangle
-//purpose :
-//=======================================================================
-void OCC_BaseView::drawRectangle (const Standard_Integer theMinX,
- const Standard_Integer theMinY,
- const Standard_Integer theMaxX,
- const Standard_Integer theMaxY,
- const Handle(AIS_InteractiveContext)& theContext,
- const Standard_Boolean toDraw)
-{
- if (toDraw)
+// =======================================================================
+// function : PostNcDestroy
+// purpose :
+// =======================================================================
+void OCC_BaseView::PostNcDestroy()
+{
+ if (!myView.IsNull())
+ {
+ myView->Remove();
+ myView.Nullify();
+ }
+ CView::PostNcDestroy();
+}
+
+// =======================================================================
+// function : PreCreateWindow
+// purpose :
+// =======================================================================
+BOOL OCC_BaseView::PreCreateWindow (CREATESTRUCT& cs)
+{
+ cs.lpszClass = ::AfxRegisterWndClass (CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC, ::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
+ return CView::PreCreateWindow (cs);
+}
+
+// =======================================================================
+// function : OnInitialUpdate
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnInitialUpdate()
+{
+ myCurrentMode = CurAction3d_Nothing;
+ CView::OnInitialUpdate();
+ if (!myView.IsNull())
{
- CRect aRect;
- GetWindowRect(aRect);
- myRect->SetRectangle (theMinX, aRect.Height() - theMinY, theMaxX, aRect.Height() - theMaxY);
+ return;
+ }
+
+ myView = GetAISContext()->CurrentViewer()->CreateView();
+ myView->SetImmediateUpdate (false);
+ myView->SetComputedMode (Standard_False);
+
+ Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (myView->Viewer()->Driver());
+ myView->Camera()->SetProjectionType (aDriver->Options().contextStereo
+ ? Graphic3d_Camera::Projection_Stereo
+ : Graphic3d_Camera::Projection_Orthographic);
+
+ Handle(WNT_Window) aWNTWindow = new WNT_Window (GetSafeHwnd());
+ myView->SetWindow (aWNTWindow);
+ if (!aWNTWindow->IsMapped()) aWNTWindow->Map();
+
+ myView->Redraw();
+ myView->Invalidate();
+}
+
+// ================================================================
+// Function : GetAISContext
+// Purpose :
+// ================================================================
+const Handle(AIS_InteractiveContext)& OCC_BaseView::GetAISContext() const
+{
+ return ((OCC_BaseDoc*)m_pDocument)->GetInteractiveContext();
+}
- if (!theContext->IsDisplayed (myRect))
+// ================================================================
+// Function : update3dView
+// Purpose :
+// ================================================================
+void OCC_BaseView::update3dView()
+{
+ if (!myView.IsNull())
+ {
+ if (++myUpdateRequests == 1)
+ {
+ Invalidate (FALSE);
+ UpdateWindow();
+ }
+ }
+}
+
+// ================================================================
+// Function : redraw3dView
+// Purpose :
+// ================================================================
+void OCC_BaseView::redraw3dView()
+{
+ if (!myView.IsNull())
+ {
+ FlushViewEvents (GetAISContext(), myView, true);
+ }
+}
+
+// ================================================================
+// Function : handleViewRedraw
+// Purpose :
+// ================================================================
+void OCC_BaseView::handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
+ const Handle(V3d_View)& theView)
+{
+ myUpdateRequests = 0;
+ AIS_ViewController::handleViewRedraw (theCtx, theView);
+}
+
+// ================================================================
+// Function : OnSelectionChanged
+// Purpose :
+// ================================================================
+void OCC_BaseView::OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx,
+ const Handle(V3d_View)& theView)
+{
+ AIS_ViewController::OnSelectionChanged (theCtx, theView);
+ GetDocument()->OnSelectionChanged (theCtx, theView);
+}
+
+// =======================================================================
+// function : OnDraw
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnDraw (CDC* )
+{
+ // always redraw immediate layer (dynamic highlighting) on Paint event,
+ // and redraw entire view content only when it is explicitly invalidated (V3d_View::Invalidate())
+ myView->InvalidateImmediate();
+ FlushViewEvents (GetAISContext(), myView, true);
+}
+
+// =======================================================================
+// function : defineMouseGestures
+// purpose :
+// =======================================================================
+void OCC_BaseView::defineMouseGestures()
+{
+ myMouseGestureMap.Clear();
+ AIS_MouseGesture aRot = AIS_MouseGesture_RotateOrbit;
+ switch (myCurrentMode)
+ {
+ case CurAction3d_Nothing:
+ {
+ myMouseGestureMap = myDefaultGestures;
+ break;
+ }
+ case CurAction3d_DynamicZooming:
{
- theContext->Display (myRect, Standard_False);
+ myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Zoom);
+ break;
}
- else
+ case CurAction3d_GlobalPanning:
{
- theContext->Redisplay (myRect, Standard_False);
+ break;
}
+ case CurAction3d_WindowZooming:
+ {
+ myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_ZoomWindow);
+ break;
+ }
+ case CurAction3d_DynamicPanning:
+ {
+ myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Pan);
+ break;
+ }
+ case CurAction3d_DynamicRotation:
+ {
+ myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, aRot);
+ break;
+ }
+ }
+}
+
+// =======================================================================
+// function : OnMouseMove
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnMouseMove (UINT theFlags, CPoint thePoint)
+{
+ TRACKMOUSEEVENT aMouseEvent; // for WM_MOUSELEAVE
+ aMouseEvent.cbSize = sizeof(aMouseEvent);
+ aMouseEvent.dwFlags = TME_LEAVE;
+ aMouseEvent.hwndTrack = m_hWnd;
+ aMouseEvent.dwHoverTime = HOVER_DEFAULT;
+ if (!::_TrackMouseEvent (&aMouseEvent)) { TRACE("Track ERROR!\n"); }
+
+ const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
+ if (UpdateMousePosition (Graphic3d_Vec2i (thePoint.x, thePoint.y), PressedMouseButtons(), aFlags, false))
+ {
+ update3dView();
+ }
+}
+
+// =======================================================================
+// function : OnLButtonDown
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnLButtonDown (UINT theFlags, CPoint thePoint)
+{
+ const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
+ PressMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_LeftButton, aFlags, false);
+ update3dView();
+}
+
+// =======================================================================
+// function : OnLButtonUp
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnLButtonUp (UINT theFlags, CPoint thePoint)
+{
+ const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
+ ReleaseMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_LeftButton, aFlags, false);
+ if (myCurrentMode == CurAction3d_GlobalPanning)
+ {
+ myView->Place (thePoint.x, thePoint.y, myCurZoom);
+ myView->Invalidate();
}
- else
+ if (myCurrentMode != CurAction3d_Nothing)
{
- theContext->Remove (myRect, Standard_False);
+ setCurrentAction (CurAction3d_Nothing);
}
+ update3dView();
+}
- theContext->CurrentViewer()->RedrawImmediate();
+// =======================================================================
+// function : OnMButtonDown
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnMButtonDown (UINT theFlags, CPoint thePoint)
+{
+ const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
+ PressMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_MiddleButton, aFlags, false);
+ update3dView();
}
+// =======================================================================
+// function : OnMButtonUp
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnMButtonUp (UINT theFlags, CPoint thePoint)
+{
+ const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
+ ReleaseMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_MiddleButton, aFlags, false);
+ update3dView();
+ if (myCurrentMode != CurAction3d_Nothing)
+ {
+ setCurrentAction (CurAction3d_Nothing);
+ }
+}
+
+// =======================================================================
+// function : OnRButtonDown
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnRButtonDown (UINT theFlags, CPoint thePoint)
+{
+ const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
+ PressMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_RightButton, aFlags, false);
+ update3dView();
+ myClickPos.SetValues (thePoint.x, thePoint.y);
+}
+
+// =======================================================================
+// function : OnRButtonUp
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnRButtonUp (UINT theFlags, CPoint thePoint)
+{
+ const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
+ ReleaseMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_RightButton, aFlags, false);
+ update3dView();
+ if (myCurrentMode != CurAction3d_Nothing)
+ {
+ setCurrentAction (CurAction3d_Nothing);
+ }
+ if (aFlags == Aspect_VKeyFlags_NONE
+ && (myClickPos - Graphic3d_Vec2i (thePoint.x, thePoint.y)).cwiseAbs().maxComp() <= 4)
+ {
+ GetDocument()->Popup (thePoint.x, thePoint.y, myView);
+ }
+}
+
+// =======================================================================
+// function : OnMouseWheel
+// purpose :
+// =======================================================================
+BOOL OCC_BaseView::OnMouseWheel (UINT theFlags, short theDelta, CPoint thePoint)
+{
+ const Standard_Real aDeltaF = Standard_Real(theDelta) / Standard_Real(WHEEL_DELTA);
+ CPoint aCursorPnt = thePoint;
+ ScreenToClient (&aCursorPnt);
+ const Graphic3d_Vec2i aPos (aCursorPnt.x, aCursorPnt.y);
+ const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
+ if (UpdateMouseScroll (Aspect_ScrollDelta (aPos, aDeltaF, aFlags)))
+ {
+ update3dView();
+ }
+ return true;
+}
+
+// =======================================================================
+// function : OnSize
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnSize (UINT nType, int cx, int cy)
+{
+ CView::OnSize (nType, cx, cy);
+ if (cx != 0
+ && cy != 0
+ && !myView.IsNull())
+ {
+ myView->Window()->DoResize();
+ myView->MustBeResized();
+ myView->Invalidate();
+ update3dView();
+ }
+}
+
+// =======================================================================
+// function : OnMouseLeave
+// purpose :
+// =======================================================================
+void OCC_BaseView::OnMouseLeave()
+{
+ CPoint aCursorPos;
+ if (GetCursorPos (&aCursorPos))
+ {
+ ReleaseMouseButton (Graphic3d_Vec2i (aCursorPos.x, aCursorPos.y),
+ PressedMouseButtons(),
+ Aspect_VKeyMouse_NONE,
+ false);
+ }
+}
#include <stdafx.h>
#include "OCC_BaseDoc.h"
-#include "AIS_RubberBand.hxx"
+#include "AIS_ViewController.hxx"
-class Standard_EXPORT OCC_BaseView : public CView
+enum CurAction3d
+{
+ CurAction3d_Nothing,
+ CurAction3d_DynamicZooming,
+ CurAction3d_WindowZooming,
+ CurAction3d_DynamicPanning,
+ CurAction3d_GlobalPanning,
+ CurAction3d_DynamicRotation
+};
+
+class Standard_EXPORT OCC_BaseView : public CView, public AIS_ViewController
{
public:
OCC_BaseView();
virtual ~OCC_BaseView();
-
+
+ //! Return the view.
+ const Handle(V3d_View)& GetView() const { return myView; }
+
+ void FitAll() { if ( !myView.IsNull() ) myView->FitAll(); myView->ZFitAll(); };
+ void Redraw() { if ( !myView.IsNull() ) myView->Redraw(); };
+
+ void SetZoom ( const Standard_Real& Coef ) { myView->SetZoom ( Coef ); };
+
+ //! Return the document.
OCC_BaseDoc* GetDocument();
+ //! Request view redrawing.
+ void update3dView();
+
+ //! Flush events and redraw view.
+ void redraw3dView();
+
protected:
-
- virtual void drawRectangle (const Standard_Integer theMinX,
- const Standard_Integer theMinY,
- const Standard_Integer theMaxX,
- const Standard_Integer theMaxY,
- const Handle(AIS_InteractiveContext)& theContext,
- const Standard_Boolean toDraw = Standard_True);
+ //! Handle view redraw.
+ virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
+ const Handle(V3d_View)& theView) Standard_OVERRIDE;
+
+ //! Callback called by handleMoveTo() on Selection in 3D Viewer.
+ virtual void OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx,
+ const Handle(V3d_View)& theView) Standard_OVERRIDE;
+
+ //! Return interactive context.
+ virtual const Handle(AIS_InteractiveContext)& GetAISContext() const;
protected:
- Standard_Real myCurZoom;
- Standard_Integer myXmin;
- Standard_Integer myYmin;
- Standard_Integer myXmax;
- Standard_Integer myYmax;
+ //! Setup mouse gestures.
+ void defineMouseGestures();
- Handle(AIS_RubberBand) myRect; //!< Rubber rectangle for selection
+ //! Get current action.
+ CurAction3d getCurrentAction() const { return myCurrentMode; }
+
+ //! Set current action.
+ void setCurrentAction (CurAction3d theAction)
+ {
+ myCurrentMode = theAction;
+ defineMouseGestures();
+ }
+
+public:
+
+ virtual BOOL PreCreateWindow (CREATESTRUCT& cs) Standard_OVERRIDE;
+ virtual void PostNcDestroy() Standard_OVERRIDE;
+
+protected:
+
+ Handle(V3d_View) myView;
+ AIS_MouseGestureMap myDefaultGestures;
+ Graphic3d_Vec2i myClickPos;
+ Standard_Real myCurZoom;
+ unsigned int myUpdateRequests; //!< counter for unhandled update requests
+
+private:
+
+ CurAction3d myCurrentMode;
+
+// message map functions
+protected:
+ DECLARE_MESSAGE_MAP()
+public:
+ virtual void OnInitialUpdate() Standard_OVERRIDE;
+ virtual void OnDraw (CDC* /*pDC*/) Standard_OVERRIDE;
+ afx_msg void OnSize (UINT nType, int cx, int cy);
+ afx_msg BOOL OnMouseWheel (UINT theFlags, short theDelta, CPoint thePoint);
+ afx_msg void OnMouseMove (UINT theFlags, CPoint thePoint);
+ afx_msg void OnMouseLeave();
+ afx_msg void OnLButtonDown (UINT theFlags, CPoint thePoint);
+ afx_msg void OnLButtonUp (UINT theFlags, CPoint thePoint);
+ afx_msg void OnMButtonDown (UINT theFlags, CPoint thePoint);
+ afx_msg void OnMButtonUp (UINT theFlags, CPoint thePoint);
+ afx_msg void OnRButtonDown (UINT theFlags, CPoint thePoint);
+ afx_msg void OnRButtonUp (UINT theFlags, CPoint thePoint);
};
#endif // !defined(AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_)