PolygonClipView.h
上传用户:shwyly
上传日期:2007-11-25
资源大小:47k
文件大小:2k
- // PolygonClipView.h : interface of the CPolygonClipView class
- //
- /////////////////////////////////////////////////////////////////////////////
- #if !defined(AFX_POLYGONCLIPVIEW_H__476467E3_C815_43CA_AF50_10AD5255877C__INCLUDED_)
- #define AFX_POLYGONCLIPVIEW_H__476467E3_C815_43CA_AF50_10AD5255877C__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #define EdgeNum 6
- #define MAX 2*EdgeNum
- typedef struct{
- float x,y;
- }Vertex;
- typedef Vertex Edge[2];
- typedef Vertex VertexArray[MAX];
- class CPolygonClipView : public CView
- {
- protected: // create from serialization only
- CPolygonClipView();
- DECLARE_DYNCREATE(CPolygonClipView)
- // Attributes
- public:
- CPolygonClipDoc* GetDocument();
- CRect screen;
- Edge clipBoundary;
- int *outLength;//= new int outlength;
- int inLength;
- VertexArray inVertexArray,outVertexArray;
- // CPoint startpoint,lastendpoint;
- int count;
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CPolygonClipView)
- public:
- virtual void OnDraw(CDC* pDC); // overridden to draw this view
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- protected:
- //}}AFX_VIRTUAL
- // Implementation
- public:
- void SHPolygonClip(int inLength,VertexArray inVertexArray,int *outLength,VertexArray outVertexArray,Edge clipBoundary);
- void Output(Vertex *newVertex,int *outLength,VertexArray outVertexArray);
- bool Inside(Vertex* testVertex, Edge clipBoundary);
- void Intersect(Vertex *s,Vertex *p,Edge clipBoundary,Vertex *I);
- virtual ~CPolygonClipView();
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- protected:
- // Generated message map functions
- protected:
- //{{AFX_MSG(CPolygonClipView)
- afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- #ifndef _DEBUG // debug version in PolygonClipView.cpp
- inline CPolygonClipDoc* CPolygonClipView::GetDocument()
- { return (CPolygonClipDoc*)m_pDocument; }
- #endif
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_POLYGONCLIPVIEW_H__476467E3_C815_43CA_AF50_10AD5255877C__INCLUDED_)