//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //PointSegment.h #pragma once #include "CommonDefines.h" class CBezierStyleDrawPointSegment {//一段Bezier曲线 public: CBezierStyleDrawPointSegment(POINT* point=NULL,int count=0,FACIESSEGMENTDIRECTION direction=segmentforward,BOOL bSmoothConnection=FALSE); ~CBezierStyleDrawPointSegment(); int m_count; POINT* m_point; //m_index0m_index1表示为反向 FACIESSEGMENTDIRECTION m_direction; BOOL m_bSmoothConnection;//与下一段的接合处是否平滑 int m_iType; void SetParameter(POINT* point=NULL,int count=0,FACIESSEGMENTDIRECTION direction=segmentforward,BOOL bSmoothConnection=FALSE); void SetSmoothConnection(BOOL bValue); BOOL GetSmoothConnection(); BOOL GetPoint(int index,POINT& point); BOOL GetPoint(int index,POINT& p0,POINT& p1,POINT& p2);//针对Bezier曲线 BOOL GetPoint(int index,POINT& p0,POINT& p1,POINT& p2,POINT& p3);//针对Bezier曲线 void Reverse(); }; class CBezierStyleDrawPointSegmentArray { public: CBezierStyleDrawPointSegmentArray(); ~CBezierStyleDrawPointSegmentArray(); BOOL m_bClose; int m_iPointCount; CArray m_segmentarray; public: BOOL GetClose(); void SetClose(BOOL bValue); void AddSegment(POINT* point,int count,FACIESSEGMENTDIRECTION direction,BOOL bSmoothConnection=FALSE); void AddSegment(CBezierStyleDrawPointSegment& segment); void AddSegment(CBezierStyleDrawPointSegmentArray& segmentarray); void InsertSegment(int index,POINT* point,int count,FACIESSEGMENTDIRECTION direction,BOOL bSmoothConnection=FALSE); void DeleteSegment(int index); void SetSegment(int index,POINT* point,int count,FACIESSEGMENTDIRECTION direction,BOOL bSmoothConnection=FALSE); int GetSegmentCount(); CBezierStyleDrawPointSegment* GetSegmentArray(); CBezierStyleDrawPointSegment* GetSegment(int index); BOOL GetPoint(int index,POINT& point); BOOL GetPoint(int index,POINT& p0,POINT& p1,POINT& p2); BOOL GetPoint(int index,POINT& p0,POINT& p1,POINT& p2,POINT& p3); BOOL GetPoint(double dIndex,POINT& point); BOOL GetCutPoint(double index,POINT* point); BOOL GetCutPoint(double dHeadIndex,POINT* headcutpoint,double dEndIndex,POINT* endcutpoint,FACIESSEGMENTDIRECTION direction); void Clear(); int GetPointCount(); void operator=(CBezierStyleDrawPointSegmentArray& segmentarray); void GetPointArray(CArray& pointarray); void SetSize(int iValue); void Reverse(); }; class CBezierStyleMapPointSegment {//一段Bezier曲线 public: CBezierStyleMapPointSegment(CPoint2D* point=NULL,int count=0,FACIESSEGMENTDIRECTION direction=segmentforward,BOOL bSmoothConnection=FALSE); ~CBezierStyleMapPointSegment(); int m_count; CPoint2D* m_point; FACIESSEGMENTDIRECTION m_direction; int m_index1; BOOL m_bSmoothConnection; int m_iType; void SetParameter(CPoint2D* point=NULL,int count=0,FACIESSEGMENTDIRECTION direction=segmentforward,BOOL bSmoothConnection=FALSE); void SetSmoothConnection(BOOL bValue); BOOL GetSmoothConnection(); BOOL GetPoint(int index,CPoint2D& point); BOOL GetPoint(int index,CPoint2D& p0,CPoint2D& p1,CPoint2D& p2); BOOL GetPoint(int index,CPoint2D& p0,CPoint2D& p1,CPoint2D& p2,CPoint2D& p3); void Reverse(); }; class CBezierStyleMapPointSegmentArray { public: CBezierStyleMapPointSegmentArray(); ~CBezierStyleMapPointSegmentArray(); BOOL m_bClose; int m_iPointCount; CArray m_segmentarray; public: BOOL GetClose(); void SetClose(BOOL bValue); void AddSegment(CPoint2D* point,int count,FACIESSEGMENTDIRECTION direction,BOOL bSmoothConnection=FALSE); void AddSegment(CBezierStyleMapPointSegment& segment); void AddSegment(CBezierStyleMapPointSegmentArray& segmentarray); void InsertSegment(int index,CPoint2D* point,int count,FACIESSEGMENTDIRECTION direction,BOOL bSmoothConnection=FALSE); void DeleteSegment(int index); void SetSegment(int index,CPoint2D* point,int count,FACIESSEGMENTDIRECTION direction,BOOL bSmoothConnection=FALSE); int GetSegmentCount(); CBezierStyleMapPointSegment* GetSegmentArray(); CBezierStyleMapPointSegment* GetSegment(int index); BOOL GetPoint(int index,CPoint2D& point); BOOL GetPoint(int index,CPoint2D& p0,CPoint2D& p1,CPoint2D& p2);//针对Bezier曲线 BOOL GetPoint(int index,CPoint2D& p0,CPoint2D& p1,CPoint2D& p2,CPoint2D& p3);//针对Bezier曲线 BOOL GetPoint(double dIndex,CPoint2D& point); BOOL GetCutPoint(double index,CPoint2D* point); BOOL GetCutPoint(double dHeadIndex,CPoint2D* headcutpoint,double dEndIndex,CPoint2D* endcutpoint,FACIESSEGMENTDIRECTION direction); void Clear(); int GetPointCount(); void operator=(CBezierStyleMapPointSegmentArray& segmentarray); void GetPointArray(CArray& pointarray); void GetPointArray(CArray& pointarray,double dZoomFactor); void SetSize(int iValue); void Reverse(); };