#ifndef __POLYLINE_H_INCLUDED_
#define __POLYLINE_H_INCLUDED_

#include "indix.h"

//该类不要当作polygon使用。
class INDIX_API CPolyline :	public CIndicater
{
public:
	CPolyline(void);
	virtual ~CPolyline(void);
	
	virtual BOOL Serialize(HANDLE device, BOOL bIn ) ;

	virtual void Show(CDelegate* pDelegate,int mode, BOOL bForced);
	virtual void ShowSketch(CDelegate* pDelegate,CSketchMark* pMark, HGPD hGpd, int grabType, GPoint grabPos);
//	virtual void ShowSketch(CDelegate* pDelegate,RvPoint leftTop, RvPoint rightBottom);

	virtual CUCObj* Clone(  CUCObj *twin);

	void             SetVertexArray(RvPoint* pPtsArr, int size);
	const RvPoint* GetVertexArray();
	int              GetVertexCount();

	BOOL  IsPolylineClosed();
	void  SetPolylineClosed(BOOL flag);
	 
	virtual void    Move(double dx, double dy) ;
	virtual void    SetCtrlRect(int left, int top, int right, int bottom) ;
	virtual RvRect  GetCtrlRect();
	virtual void    SetCtrlPos(int x, int y);
	virtual RvPoint GetCtrlPos();

public:
	typedef struct _polyline_graphic_descriptor{
		int     count;
		GPoint* pVtxArr;
	}GdPolyline;

	virtual BOOL OnPositionChange( HGPD hOri, HGPD hCur, HGPD hNew, GPoint grabPos, RvOffset &offset) ;
	virtual BOOL OnExtenderChange( HGPD hCur, HGPD hNew, int index, GPoint &curPos) ;

	virtual void OnEndTrack(CDelegate* pDelegate,HGPD hCur,  GPoint point, int nHitTest) ;

	virtual int  HitTest(CDelegate* pDelegate,  GPoint point);
 
	virtual HGPD CreateGraphicDescriptor(CDelegate* pDelegate) ;
    virtual void DestroyGraphicDescriptor(HGPD hGpd);
	virtual void CopyGraphicDescriptor(const HGPD src, HGPD dest);

	virtual GRect  GetGrabberRect(CDelegate* pDelegate,RvSize size) ;
	virtual GRect  GetExtenderRect(CDelegate* pDelegate,int index, RvSize size) ;
 
protected:
	 
	RvPoint*     m_pPtArr;
	int          m_nCount;
	BOOL         m_bClosed;
};



#endif
