119 lines
5.9 KiB
C++
119 lines
5.9 KiB
C++
//------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2011, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TBaseWallIntegrateTool类
|
|
// = Version : ver1.0
|
|
// = Author : xlc
|
|
// = CreateDate : 2011-04-13
|
|
// = Description: 双线墙融合算法工具
|
|
// = Maintainers:
|
|
//
|
|
//------------------------------------------------------------------------+
|
|
#ifdef TASD
|
|
#ifndef _TBASEWALLINTEGRATETOOL_H_
|
|
#define _TBASEWALLINTEGRATETOOL_H_
|
|
|
|
class TBaseWallLine;
|
|
class TGGeVisibilityPoly2D;
|
|
class TARCH_EXP TBaseWallIntegrateTool
|
|
{
|
|
public:
|
|
// 判断是否是端点融合
|
|
// 返回值:0:两端不相交;1:起始端相交;2:终止端相交;3:两端都相交;
|
|
static int IsIntegrateAtTail(const TGGeCurveSegment& cvThis, const TGGeCurveSegment& cvThat);
|
|
|
|
// 双线普通融合
|
|
// 返回值:FALSE:融合不成功;1:融合成功;
|
|
static BOOL Integrate(TBaseWallLine& baseWallThis, const TBaseWallLine& baseWallThat);
|
|
|
|
// 双线尾端融合,baseWall2为实际发生相交的线,转角情况
|
|
static BOOL IntegrateAtTail(bool bStart, TBaseWallLine& baseWallThis, const TBaseWallLine& baseWallThat);
|
|
|
|
// 双线尾端融合,baseWallThis为实际发生相交的线,arBaseWallLine为关联双线数组,支持多分支
|
|
// 多分支常规情况为1种材料;多分支超过2种材质暂不处理;
|
|
// 2种材料:以双线数多的材质为优先级高,数目相同时,以实际材质优先级为准
|
|
// 返回值:TRUE:成功;FALSE:失败
|
|
static BOOL IntegrateAtTail(bool bStart, TBaseWallLine& baseWallThis, const TDPtrList<TBaseWallLine>& arBaseWallLine);
|
|
|
|
// 双线与Poly2D线的融合
|
|
// 返回值:FALSE:融合不成功;1:融合成功;
|
|
static BOOL Integrate(TBaseWallLine& baseWall, const TGGePoly2D& polyHole);
|
|
|
|
// 判断是否是端点融合
|
|
// 返回值:0:两端不相交;1:起始端相交;2:终止端相交;3:两端都相交;
|
|
static int IsIntegrateAtTail(const TBaseWallLine& baseWallThis, const TBaseWallLine& baseWallThat);
|
|
|
|
//两条线是否相交
|
|
//返回值:true:相交;false:不相交
|
|
static bool IsIntegrate(TGGeLine &line1, TGGeLine &line2, double dSkipDistTol, double dTotalWidth);
|
|
|
|
//求两个封闭区域的最小间隙
|
|
//返回值:true:成功;false:失败
|
|
static bool GetMinGap(const TGGePoly2D& polyFirst, const TGGePoly2D& polySecond, double& dGap);
|
|
|
|
// 按照绘制走向, 区分两根TGGeVisibilityPoly2D线的左右
|
|
// 第一个参数返回引用左线
|
|
static bool GetLeftPoly2D(TGGeVisibilityPoly2D& pl1, TGGeVisibilityPoly2D& pl2);
|
|
// 根据两个多段线交点移动plSrc的起始端或者终止端
|
|
// 返回值: 成功: true; 失败: false
|
|
static bool ModifyPoly2D(TGGeVisibilityPoly2D& plSrc, const TGGeVisibilityPoly2D& plDes, bool bStart = false);
|
|
// 修改TGGeVisibilityPoly2D的首端或者尾端到指定点
|
|
static bool MovePoly2DDesPt(TGGeVisibilityPoly2D& pl, const TADSGePoint3d& ptGiven, bool bStart = false);
|
|
|
|
//////////////////////// 临时修改InterSectWith访问权限, 以便外部直接调用
|
|
//private:
|
|
public:
|
|
// poly1与poly2的交点个数
|
|
// 返回值:交点个数
|
|
static int InterSectWith(const TGGePoly2D& polyThis, const TGGePoly2D& polyThat, AcGePoint3dArray &ptArray, AcDb::Intersect intType = AcDb::kExtendBoth);
|
|
|
|
private:
|
|
// 获得平行线段中心线
|
|
static bool GetCenterPoly(const TGGeCurveSegment& seg1, const TGGeCurveSegment& seg2, TGGeCurveSegment& segRet);
|
|
static bool GetCenterPoly(const TGGePoly2D& pl1, const TGGePoly2D& pl2, TGGePoly2D& plRet);
|
|
// 求pl1, pl2中距离plSrc较近或较远的线
|
|
// 返回值: pl1或者pl2指针
|
|
static const TGGePoly2D* GetNearestPoly2DByTail(const TGGePoly2D* plSrc, const TGGePoly2D* pl1, const TGGePoly2D* pl2, bool bNearest = true);
|
|
static const TGGePoly2D* GetDesPoly2D(const TGGePoly2D* plSrc,
|
|
const TGGePoly2D* pl1,
|
|
const TGGePoly2D* pl2,
|
|
bool bStart = false,
|
|
bool bNearest = true);
|
|
// 确定四根儿polyline的空间位置关系
|
|
static bool ConfirmRelation(int iWight, TGGeVisibilityPoly2D* pSrcLeft, TGGeVisibilityPoly2D* pSrcRight, \
|
|
TGGeVisibilityPoly2D* pDesLeft, TGGeVisibilityPoly2D* pDesRight, \
|
|
std::vector<std::pair<TGGeVisibilityPoly2D*, TGGeVisibilityPoly2D*> >& vPlRef, \
|
|
bool bStart = false);
|
|
// iSeg指示在原来多短线上面的第几段
|
|
// ptNearest距离pt最近的点
|
|
static bool GetSegByNearestPt(const TGGePoly2D& plDes, const AcGePoint3d& pt, TGGeCurveSegment& seg, int& iSeg);
|
|
// 获得距离ptGiven最近或最远的点
|
|
static AcGePoint3d& GetDesPt(const AcGePoint3d& ptGiven, const AcGePoint3d& ptDesc1, const AcGePoint3d& ptDesc2, bool bNearest = true);
|
|
|
|
// 正或反方向获得同优先级的关联双线
|
|
static bool GetSameStyleLine(int nThisStyle, BOOL bReverse, const TDPtrList<TBaseWallLine> &arBaseWallLines, TBaseWallLine& bwl);
|
|
// 获得另外一种材质的优先级
|
|
// 返回值:与nThisStyle不同材质的双线的优先级
|
|
static int GetAnotherStyle(int nThisStyle, const TDPtrList<TBaseWallLine>& arBaseWallLines);
|
|
// 获得与nThisStyle同优先级的双线数
|
|
// 返回值:与nThisStyle同优先级的双线个数
|
|
static int GetStyleCount(int nThisStyle, const TDPtrList<TBaseWallLine>& arBaseWallLines);
|
|
// 优先级数组
|
|
static void GetStyleKindArray(const TDPtrList<TBaseWallLine>& arBaseWallLines, AcDbIntArray& intArray);
|
|
// 对arBaseWallLines数组以bwLine为基准,逆时针排序
|
|
static void SortBwl(bool bStart,const TBaseWallLine & bwLine,TDPtrList<TBaseWallLine>& arBaseWallLines);
|
|
|
|
// 求两条直线的最小间距
|
|
// 返回值:最小间距
|
|
static double LineToLineDist(const TGGeLine &line1, const TGGeLine &line2);
|
|
|
|
// 求直线与圆弧的最小间距
|
|
// 返回值:最小间距
|
|
static double LineToArcDist(const TGGeLine &line, const TGGeArc &arc);
|
|
|
|
// 求圆弧的最小间距
|
|
// 返回值:最小间距
|
|
static double ArcToArcDist(const TGGeArc &arc1, const TGGeArc &arc2);
|
|
};
|
|
|
|
#endif
|
|
#endif |