|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//Polygon.h
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
#include "CommonDefines.h"
|
|
|
|
|
|
|
|
|
|
|
|
class CGDFPolygon
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
CGDFPolygon();
|
|
|
|
|
|
~CGDFPolygon();
|
|
|
|
|
|
|
|
|
|
|
|
//Attributes
|
|
|
|
|
|
private:
|
|
|
|
|
|
CArray<CPoint2D,CPoint2D> m_pointarray;
|
|
|
|
|
|
int m_iType;//0--internal 1--external
|
|
|
|
|
|
CRect8 m_rect;
|
|
|
|
|
|
|
|
|
|
|
|
CString m_strTypeName;
|
|
|
|
|
|
|
|
|
|
|
|
CArray<POINT,POINT> m_drawarray;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>m_pointarray<61>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
GDFLOGPEN m_logpen;
|
|
|
|
|
|
|
|
|
|
|
|
BOOL m_bClose;
|
|
|
|
|
|
|
|
|
|
|
|
POINT m_oldpoint;
|
|
|
|
|
|
POINT m_originpoint;
|
|
|
|
|
|
int m_iSelectedIndex;
|
|
|
|
|
|
|
|
|
|
|
|
BOOL m_bIsEditing;
|
|
|
|
|
|
|
|
|
|
|
|
//Operations
|
|
|
|
|
|
public:
|
|
|
|
|
|
void SetPointArray(CPoint2D* p,int count);
|
|
|
|
|
|
int GetPointCount();
|
|
|
|
|
|
CPoint2D* GetPointArray();
|
|
|
|
|
|
void SetPoint(int index,CPoint2D p);
|
|
|
|
|
|
int GetType();
|
|
|
|
|
|
void SetType(int iType);
|
|
|
|
|
|
CRect8 GetRect();
|
|
|
|
|
|
void AddPoint(CPoint2D point);
|
|
|
|
|
|
void AddPoint(CPoint2D* point,int count);
|
|
|
|
|
|
int PointInRegion(CPoint2D point);
|
|
|
|
|
|
void Clear();
|
|
|
|
|
|
int GetDirection();//1--˳ʱ<CBB3><CAB1> -1--<2D><>ʱ<EFBFBD><CAB1> 0--<2D><EFBFBD><DEB7>ж<EFBFBD>
|
|
|
|
|
|
void ReversePointArray();
|
|
|
|
|
|
void Copy(CGDFPolygon* pPolygon);
|
|
|
|
|
|
void Normalize(CTypedPtrArray<CPtrArray,CGDFPolygon*>& polygonarray);
|
|
|
|
|
|
void NormalizeBorder();
|
|
|
|
|
|
double CalculateArea();
|
|
|
|
|
|
|
|
|
|
|
|
CString GetTypeName();
|
|
|
|
|
|
void SetTypeName(LPCTSTR strTypeName);
|
|
|
|
|
|
|
|
|
|
|
|
BOOL ReadFromFile(CString strFileName);
|
|
|
|
|
|
BOOL SaveToFile(CString strFileName);
|
|
|
|
|
|
BOOL ReadFromFile(CStdioFile& file);
|
|
|
|
|
|
BOOL SaveToFile(CStdioFile& file);
|
|
|
|
|
|
|
|
|
|
|
|
POINT* GetDrawArray();
|
|
|
|
|
|
void SetDrawArray(POINT* point,int count);
|
|
|
|
|
|
int GetDrawPointCount();
|
|
|
|
|
|
//mouse message
|
|
|
|
|
|
BOOL OnLButtonDown(CView* pView,CDC* pDC,UINT nFlags,CPoint p,double dZoomFactor);
|
|
|
|
|
|
BOOL OnLButtonUp(CView* pView,CDC* pDC,UINT nFlags,CPoint p,double dZoomFactor);
|
|
|
|
|
|
BOOL OnMouseMove(CView* pView,CDC* pDC,UINT nFlags,CPoint p,double dZoomFactor);
|
|
|
|
|
|
BOOL OnLButtonDblClick(CView* pView,CDC* pDC,UINT nFlags,CPoint p,double dZoomFactor);
|
|
|
|
|
|
BOOL OnRButtonDown(CView* pView,CDC* pDC,UINT nFlags,CPoint p,double dZoomFactor);
|
|
|
|
|
|
|
|
|
|
|
|
void GetLogPen(GDFLOGPEN* logpen);
|
|
|
|
|
|
void SetLogPen(GDFLOGPEN* logpen);
|
|
|
|
|
|
|
|
|
|
|
|
void DrawSelectedMark(CDC* pDC,CView* pView,double dZoomFactor);
|
|
|
|
|
|
void Draw(CDC* pDC,CView* pView,double dZoomFactor);
|
|
|
|
|
|
|
|
|
|
|
|
void SetClose(BOOL bValue);
|
|
|
|
|
|
BOOL GetClose();
|
|
|
|
|
|
|
|
|
|
|
|
void SetEditing(BOOL bValue);
|
|
|
|
|
|
BOOL GetEditing();
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateRect();
|
|
|
|
|
|
|
|
|
|
|
|
double GetArea();
|
|
|
|
|
|
};
|