102 lines
2.9 KiB
C++
102 lines
2.9 KiB
C++
//-------------------------------------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TPGeArc2D 类
|
|
// = Version : ver2.0
|
|
// = Author : wlw
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: TPGeArc2D 声明
|
|
// = Maintainers:
|
|
//
|
|
//-------------------------------------------------------------------------------------------------------+
|
|
#ifndef _TPGEARC2D_H_
|
|
#define _TPGEARC2D_H_
|
|
|
|
#ifndef _TPGECURVE2D_H_
|
|
#include "TPGeCurve2D.h"
|
|
#endif
|
|
|
|
#ifndef _TPGECIRCLE2D_H_
|
|
#include "TPGeCircle2D.h"
|
|
#endif
|
|
|
|
class GEOAPI TPGeArc2D : public TPGeCurve2D
|
|
{
|
|
DECLARE_RUN_TIME_CLASS(TPGeArc2D)
|
|
|
|
public:
|
|
//construct
|
|
TPGeArc2D();
|
|
TPGeArc2D(const TGPoint&pt,double radius,double sA,double cA,bool bUnClockWise=true);
|
|
TPGeArc2D(const TGPoint&sPt,const TGPoint&ePt,double angle);
|
|
TPGeArc2D(const TGPoint&pt0,const TGPoint&pt1,const TGPoint&pt2);
|
|
TPGeArc2D(const TPGeCircle2D& c);
|
|
|
|
virtual TPGeCurve2D* GetExtendCurve() const;
|
|
//与起始角的夹角,存在区间[0,centralAngle]
|
|
virtual void Pa2Pt(double pa,TGPoint&pt) const;
|
|
//返回区间[0,2PI)
|
|
virtual void Pt2Pa(const TGPoint&pt,double&pa) const;
|
|
virtual void GetStartPoint(TGPoint&pt) const;
|
|
virtual void GetEndPoint(TGPoint&pt) const;
|
|
virtual void Reverse();
|
|
virtual void GetTangent(double pa,TPGeLine2D&line) const;
|
|
|
|
virtual bool IsClosed() const;
|
|
virtual bool IsClockwise() const;
|
|
virtual bool Offset(double offset);
|
|
|
|
virtual double Integration(double pa0,double pa1) const;
|
|
virtual double Length() const;
|
|
virtual double Area() const;
|
|
virtual double GetMLinePrec() const;
|
|
virtual double GetElev() const;
|
|
|
|
virtual TGMLine2D* PLinearize(double paDist=0) const;
|
|
virtual TPGeCurve2D* GetSubCurve(double pa0,double pa1) const;
|
|
|
|
//override TGObject2D
|
|
virtual void SetElev(double elev);
|
|
|
|
//override TGObject
|
|
virtual bool IsValid() const;
|
|
virtual void TransformBy(const TGMatrix&matrix);
|
|
virtual TGObject * Clone() const;
|
|
virtual bool Intersect(const TGObject&obj,TGObjectList&res) const;
|
|
virtual bool IsInclude(const TGObject&obj) const;
|
|
|
|
//测试GR_IN/GR_INSIDE/GR_OUTSIDE/GR_LEFT/GR_RIGHT
|
|
virtual GRelation HitTest(const TGPoint&pt) const;
|
|
virtual bool GetExtend2D(TPGeExtend2D&ext) const;
|
|
|
|
//edit
|
|
void Init(const TGPoint&sPt,const TGPoint&ePt,double angle);
|
|
//起点,中间点,终点
|
|
void Init(const TGPoint&pt0,const TGPoint&pt1,const TGPoint&pt2);
|
|
void SetStartAngle(double angle);
|
|
|
|
//query
|
|
double GetEndAngle() const;
|
|
TGPoint GetStartPoint() const;
|
|
TGPoint GetEndPoint() const;
|
|
TGPoint GetMidPoint() const;
|
|
|
|
|
|
public:
|
|
//弧继承所在圆的曲线方向
|
|
TPGeCircle2D circle;
|
|
|
|
//[0,2PI),正向弧度或负向弧度
|
|
double startAngle;
|
|
|
|
//(0,2PI],终止角与起始角的夹角
|
|
double centralAngle;
|
|
|
|
private:
|
|
double GetAnglePrecFromRadius(double dradius)const;
|
|
double GetParaPrecFromLength(double dlength)const;
|
|
bool IsParaInSeg(double dpa,double dprec)const;
|
|
};
|
|
|
|
#endif
|
|
|