Files
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

155 lines
4.3 KiB
C++

//-----------------------------------------------------------------------------+
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
// = FileName : TGGeArc弧类
// = Version : ver2.0
// = Author : wlw
// = CreateDate : 2002-09-09
// = Description: TGGeArc类声明
// = Maintainers:
//
//-----------------------------------------------------------------------------+
#ifndef _TGGEARC_H_
#define _TGGEARC_H_
#ifndef _TGGECIRCLE_H_
#include "TGGeCircle.h"
#endif
#ifndef _TGGESECTOR_H_
#include "TGGeSector.h"
#endif
#ifndef _TADSGEPOINT3D_H_
#include "TADSGePoint3d.h"
#endif
class TEntitySet;
class GEOAPI TGGeArc : public TGGeCircle, public TGGeSector
{
public :
TGGeArc();
TGGeArc(const TGGeArc &src);
TGGeArc(const TEntitySet &aCircle);
TGGeArc(const TEntitySet &aArc, ads_matrix mat);
TGGeArc(const TADSGePoint3d &spt, const TADSGePoint3d &ept, ads_real dang);
TGGeArc(const TADSGePoint3d &ptStart, const TADSGePoint3d &pt2, const TADSGePoint3d &ptEnd);
TGGeArc(ads_point ptcenter, double dradius, double ptstartAngle, double ptendAngle);
virtual ~TGGeArc();
virtual bool IsKindOf(TEntityId entType) const;
virtual TEntityId Type() const;
virtual void CopyFrom(const TGGeEntity* pImpSrc);
virtual int Make(const TCHAR *szlay = NULL) const;
virtual int Modify(const TEntitySet* pEnt) const;
virtual int GetExtend(ads_point lowPt, ads_point upPt) const;
virtual int MakeEntity(const TEntitySet* pEnt) const;
virtual int GetSubArc(const TADSGePoint3d &ptloc, ads_real dchordLen, TGGeArc &arcRes) const;
//图形长度,周长
virtual ads_real GetLength() const;
TGGeArc& operator = (const TGGeSector &src);
TGGeArc& operator = (const TGGeArc &src);
bool operator == (const TGGeArc &src) const;
int operator ! () const;
virtual int HitTest2d(const TADSGePoint3d &ptTest) const;
virtual int OSnap(int nMode, TADSGePoint3d &ptPick) const;
bool Set(const TADSGePoint3d &spt, const TADSGePoint3d &ept, ads_real dang);
bool Set(const TADSGePoint3d &ptStart, const TADSGePoint3d &ptOn, const TADSGePoint3d &ptEnd);
void SetAngleByPoints(const TADSGePoint3d &ptStart, const TADSGePoint3d &ptEnd);
void GetStartPoint(TADSGePoint3d &ptStart) const;
void GetEndPoint(TADSGePoint3d &ptEnd) const;
void MidPoint(TADSGePoint3d &ptres) const;
TADSGePoint3d MidPoint() const;
//求弦长
ads_real ChordLength() const;
// 扇形面积
ads_real Area() const;
//起点到终点的积分面积
ads_real PathArea() const;
TGGeArc Offset(ads_real dist) const;
virtual void TransUCS(ads_matrix mat);
//上华direction
ads_real IDirection(int pt) const;
ads_real ODirection(int pt) const;
virtual int Intersection(const TGGeLine* pLine, ads_point ptRp1 = NULL, ads_point ptRp2 = NULL) const;
virtual int Intersection(const TGGeArc* pArc, ads_point ptRp1 = NULL, ads_point ptRp2 = NULL) const;
virtual int Intersection(const TGGeCircle* pCir, ads_point ptRp1 = NULL, ads_point ptRp2 = NULL) const;
ads_real * SelectNear(ads_point pt1, ads_point pt2) const;
int PtOnArc(const TADSGePoint3d &pt) const;
};
inline TGGeArc& TGGeArc::operator = (const TGGeSector &src)
{
m_dstartAngle = src.m_dstartAngle;
m_dendAngle = src.m_dendAngle;
return *this;
}
inline TGGeArc& TGGeArc::operator = (const TGGeArc &src)
{
if (this != &src)
{
m_dstartAngle = src.m_dstartAngle;
m_dendAngle = src.m_dendAngle;
m_ptCenter = src.m_ptCenter;
m_dRadius = src.m_dRadius;
}
return *this;
}
inline int TGGeArc::operator ! () const
{
return (TGGeCircle::operator !() || GetLength() < TchGeLib::_DIST_SNAP);
}
inline bool TGGeArc::operator == (const TGGeArc &src) const
{
return (TGGeCircle::operator == (src) && TGGeSector::operator == (src));
}
inline TGGeArc TGGeArc::Offset(ads_real dist) const
{
ads_real r = m_dRadius + dist;
if (r < TchGeLib::_DIST_SNAP)
{
r = 0;
}
return TGGeArc(m_ptCenter, r, m_dstartAngle, m_dendAngle);
}
inline ads_real TGGeArc::GetLength() const
{
return Bulge() * m_dRadius;
}
inline ads_real TGGeArc::ChordLength() const
{
return fabs(2.0 * m_dRadius * sin(Bulge() / 2.0));
}
inline void TGGeArc::MidPoint(TADSGePoint3d &ptres) const
{
ads_polar(m_ptCenter, MidAngle(), m_dRadius, ptres);
}
inline TADSGePoint3d TGGeArc::MidPoint() const
{
TADSGePoint3d ptres;
ads_polar(m_ptCenter, MidAngle(), m_dRadius, ptres);
return ptres;
}
#endif