⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convexhullview.h

📁 Gramham法求解凸包。从最基本数据结构定义开始实现
💻 H
字号:
// ConvexHullView.h : interface of the CConvexHullView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_CONVEXHULLVIEW_H__A2E10657_FEEE_40CA_AC49_0682A4CDB0B4__INCLUDED_)
#define AFX_CONVEXHULLVIEW_H__A2E10657_FEEE_40CA_AC49_0682A4CDB0B4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "dse_convex_hull.hpp"
class CConvexHullDoc;
//##ModelId=443378C802A1
class CConvexHullView : public CView
{
    enum{ ID_TIMER_DEMO = 1 };

protected: // create from serialization only
	//##ModelId=443378C802AC
	CConvexHullView();
	DECLARE_DYNCREATE(CConvexHullView)

// Attributes
public:
	//##ModelId=443378C90023
    typedef enum
    {
        CLIENT_STATUS_NONE,
        CLIENT_STATUS_PUT_POINT,
        CLIENT_STATUS_DELETE_POINT,
        CLIENT_STATUS_ERASE_POINTS,
        CLIENT_STATUS_DEMO,

    }ClientStatus;


private:
	//##ModelId=443378C802B6
    CDC     m_BufferDC;
	//##ModelId=443378C802BB
    CBitmap m_BufferBitmap;
	//##ModelId=443378C802C0
    CBitmap *m_pBufferOldBitmap;
	//##ModelId=443378C802C9
    BOOL    m_BufferDCReady;

	//##ModelId=443378C802CA
    double m_AxisXOffset;
	//##ModelId=443378C802D3
    double m_AxisYOffset;
	//##ModelId=443378C802D4
    double m_ZoomRatio;
	//##ModelId=443378C802DE
    CFont  m_ScaleFont;
	//##ModelId=443378C802E2
    BOOL   m_IsDragging;
	//##ModelId=443378C802F2
    BOOL   m_IsDemoPaused;
	//##ModelId=443378C802FC
    CPoint m_LastMousePoint;



	//##ModelId=443378C80307
    ClientStatus m_ClientStatus;

// Operations
public:
	//##ModelId=443378C8030B
    CConvexHullDoc* GetDocument();

	//##ModelId=443378C8030C
    BOOL IsClientStatus_None() { return m_ClientStatus == CLIENT_STATUS_NONE; }
	//##ModelId=443378C80310
    BOOL IsClientStatus_PutPoint() { return m_ClientStatus == CLIENT_STATUS_PUT_POINT; }
	//##ModelId=443378C80311
    BOOL IsClientStatus_DeletePoint() { return m_ClientStatus == CLIENT_STATUS_DELETE_POINT; }
	//##ModelId=443378C80312
    BOOL IsClientStatus_ErasePoints() { return m_ClientStatus == CLIENT_STATUS_ERASE_POINTS; }
	//##ModelId=443378C80313
    BOOL IsClientStatus_Demo() { return m_ClientStatus == CLIENT_STATUS_DEMO; }
	//##ModelId=443378C80314
    BOOL IsDemoPaused() { return m_IsDemoPaused; }

	//##ModelId=443378C80315
    VOID SetClientStatus(ClientStatus st);
	//##ModelId=443378C8031B
    VOID PauseDemo(BOOL bPause = TRUE);
	//##ModelId=443378C8031D
    VOID ZoomOut(double ratio = 1.05);
	//##ModelId=443378C80325
    VOID ZoomIn(double ratio = 1.05);
	//##ModelId=443378C8032E
    VOID ZoomAdjust();

	//##ModelId=443378C8032F
    VOID AddPointByMouse(CPoint &point);
	//##ModelId=443378C80331
    VOID ErasePointsByMouse(CPoint &p, int radius, BOOL once);
	//##ModelId=443378C8033B
    VOID AddRandomPoints(int n);
	//##ModelId=443378C80342
    VOID ClientPointToAxisPoint(dse::point2d &p, CRect &clientRect, dse::point2d &out);
	//##ModelId=443378C8034D
    VOID AxisPointToClientPoint(dse::point2d &p, CRect &clientRect, dse::point2d &out);

	//##ModelId=443378C80357
    void DrawView(CDC* pDC, CRect &r);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CConvexHullView)
	public:
	//##ModelId=443378C8036A
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	//##ModelId=443378C8036D
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	//##ModelId=443378C80376
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	//##ModelId=443378C8038B
	virtual void OnInitialUpdate();
	protected:
	//##ModelId=443378C80393
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	//##ModelId=443378C8039C
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	//##ModelId=443378C803A6
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	//##ModelId=443378C803B0
	virtual ~CConvexHullView();
#ifdef _DEBUG
	//##ModelId=443378C803B2
	virtual void AssertValid() const;
	//##ModelId=443378C803BB
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CConvexHullView)
	//##ModelId=443378C803C4
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	//##ModelId=443378C803C8
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	//##ModelId=443378C803D1
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	//##ModelId=443378C803DB
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	//##ModelId=443378C803E4
	afx_msg void OnTimer(UINT nIDEvent);
	//##ModelId=443378C90004
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	//##ModelId=443378C90008
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	//##ModelId=443378C90011
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//##ModelId=443378C9001C
	afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in ConvexHullView.cpp
inline CConvexHullDoc* CConvexHullView::GetDocument()
   { return (CConvexHullDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CONVEXHULLVIEW_H__A2E10657_FEEE_40CA_AC49_0682A4CDB0B4__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -