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

120 lines
5.9 KiB
C++

#ifndef __CFoldPinRelation_H__
#define __CFoldPinRelation_H__
#if _MSC_VER > 1000
#pragma once
#endif
class CFoldProTool;
class CFoldPinRelation
{
public:
static CFoldPinRelation* Instance();
static void DisInstance();
void GetAllFoldThunder(FOLDPINGROUP& PinLst);
void ReadDataFromID(const AcDbObjectId& oid,XFoldThunder& thunder);
void ReadDataFromID(AcDbEntity* pEnt,XFoldThunder& FoldThunder);
void GetNumArrayBySpecGroup(int nGroup,AcGeIntArray& nNo);
//过滤所有避雷针
void FilterAllFoldPin();
//添加避雷针
void AddFoldPinToMap(const XFoldThunder& FoldThunder);
void AddFoldPinToMap(const AcDbObjectId& oid);
//删除避雷针
void DelFoldPinFromMap(const CString& sGroup,const AcDbObjectId& oid);
void DelFoldPinFromMap(const AcDbObjectId& oid);
void DelFoldPinFromMap(const XFoldThunder& FoldThunder);
//更新避雷针
void UpdateFoldPinInMap(int nOldGroup,const AcDbObjectId& oid);
void UpdateFoldPinInMap(int nOldGroup,const XFoldThunder& FoldThunder);
//获取指定保护高度的所有可联合的针
void GetFoldUnionPin(const XFoldThunder& Src,double dHx,const FOLDPINLST& arFrom,FOLDPINLST& arConnectPins);
//获取与指定避雷针相邻且有联合保护的避雷针
void GetFoldPinCloseBy(const XFoldThunder& Src,double dHx,FOLDPINLST& arPoldPin);
void GetFoldPinCloseBy(const XFoldThunder& Src,double dHx,const FOLDPINLST& arPins,FOLDPINLST& arPoldPin);
//计算联合保护边线
void ProductUnionPro2d(const XFoldThunder& thunder1,const XFoldThunder& thunder2,double dHx,std::list<PFoldProLine>& arEdges);
void ProductUnionPro2d(FOLDPINLST& arPoldPin,double dHx,std::list<PFoldProLine>& arEdges);
void FilerUnionPro2d(FOLDPINLST& arPoldPin,double dHx,std::list<PFoldProLine>& arEdges);
//根据3针过滤无效边
void FilterInvalidEdge(const XFoldThunder& pt1,const XFoldThunder& pt2,const XFoldThunder& pt3,std::list<PFoldProLine>& arEdges);
void FilterInvalidEdge2(const XFoldThunder& thunder1,const XFoldThunder& thunder2,const XFoldThunder& thunder3,double dHx,std::list<PFoldProLine>& arEdges);
//由边集生成2d联合保护范围
void ShowUnionPro2d(std::list<PFoldProLine>& arEdges,AcDbObjectIdArray& arProIds);
//获取联合保护范围
void ShowUnionPro2d(const AcDbObjectId& oid,BOOL bRemove = FALSE);
void ShowUnionPro2d(const CString& sGroup);
//求2切点
BOOL GetTangencyPoint(const XFoldThunder& thunder,double dHx,const AcGePoint3d& ptBase,const AcGePoint3d& ptRef,const AcGeVector3d & vtOffset,AcGePoint3d& ptTang);
//得到指定2点得到避雷针保护员圆上的弧,ptBase为 通过圆心与弧相对的参照点
void GetArcOnCircle(const XFoldThunder& thunder,double dHx,const AcGePoint3dArray& arPts,const AcGePoint3d& ptBase,XFoldProArc& arc);
//指定3点得圆上圆弧
void GetArcOnCircle(const XFoldThunder& thunder,double dHx,const AcGePoint3dArray& arPts,XFoldProArc& arc);
BOOL IsRightCross(PFoldProLine ProLine1,PFoldProLine ProLine2);
//获取2折线的公共针编号
int GetSameNo(PFoldProLine ProLine1,PFoldProLine ProLine2,int& nNo1,int& nNo2);
//默认只共一个针编号
int GetSameNo(PFoldProLine ProLine1,PFoldProLine ProLine2);
int GetNoByPt(PFoldProLine ProLine1,const AcGePoint3d& ptOn);
BOOL GetThunderById(const AcDbObjectId& oid,XFoldThunder& FoldThunder);
//显示保护圆
void ShowProCircle(const AcDbObjectId& oid,AcDbObjectIdArray& arIds);
void ShowProCircle(const XFoldThunder& FoldThunder,AcDbObjectIdArray& arIds);
//获取指定3针的保护线
void GetProLineByThree(std::list<PFoldProLine>& arEdges,const AcGeIntArray& arNos,std::list<PFoldProLine>& arProLines);
void EraseProLine(std::list<PFoldProLine>& arEdges);
//由基准线将边分类
void SortProLineByLine(AcGeLine3d& line,std::list<PFoldProLine>& arEdges,std::list<PFoldProLine>& arUp,std::list<PFoldProLine>& arDown);
void FilterProLineByLine(const AcGeLine3d& line,std::list<PFoldProLine>& arEdges);
//对由基准线分边的边线进行2次过滤
void FilterReProLineByBase(const AcGeLine3d& line,std::list<PFoldProLine>& arEdges);
//整合基准线半边的保护线
void FixProLineByLine(const AcGeLine3d& line,const XFoldThunder& thunder,double dHx,const AcGeIntArray& arNoBase,std::list<PFoldProLine>& arEdges);
void FixProLineByLine(const AcGeLine3d& line,PFoldProLine& pProLine1,PFoldProLine& pProLine2);
void FixProLineByLine(const AcGeLine3d& line,PFoldProLine& pProLine1,PFoldProLine& pProLine2,PFoldProLine& pProLine3);
void FixProLineByPt(PFoldProLine pProline,const AcGePoint3d& ptNew,BOOL bUnion = FALSE,BOOL bHalfValid = TRUE);
void FixProLineByThunder(PFoldProLine& ProLine,PFoldProLine ProLineRef,double dHx,const XFoldThunder& thunder);
void GetAllProArc(std::list<PFoldProLine>& arEdges,std::list<XFoldProArc>& arArcs);
void UnionProLine(std::list<PFoldProLine>& arEdges);
void UnionProLine(PFoldProLine& ProLine1,PFoldProLine& ProLine2);
BOOL UnionProArc(std::vector<XFoldProArc>& arArc,std::vector<XFoldProArc>& ArcRet);
BOOL UnionProArc(const XFoldProArc& arc1,const XFoldProArc& arc2,XFoldProArc& arc);
void SortProArc(std::vector<XFoldProArc>& arArc);
protected:
CFoldPinRelation(void);
~CFoldPinRelation(void);
void GroupFoldPro(const AcDbObjectIdArray& arPros);
//删除联合保护范围
void DelFoldUnionPro(int nGroup);
//获取联合保护范围
void GetFoldUnionPro(const AcDbObjectIdArray& arPins,double dHx,std::vector<AcDbObjectIdArray>& arPros);
//记录联合保护范围
void RecordFoldPro(AcDbObjectIdArray& arPros,int nGroup);
void RecordFoldPro(AcDbObjectIdArray& arPros,int nGroup,double dHx);
//将避雷针进行分块
void BlockingFoldPin(FOLDPINLST& arPins,std::vector<FOLDPINLST>& arBlocks,double dHx);
//修改标高
void UpdateGroupHeight(FOLDPINLST& arPins,const AcGeDoubleArray& arHeights);
//筛选较大的联合保护范围(有部分重叠的)
void FilterBigUnion(DList<XPoly2D>& lstUnions);
protected:
FOLDPINGROUP m_arAllPoldPin;// 所有避雷针 <组号,避雷针>
static CFoldPinRelation* m_pInstance;
CFoldProTool* m_pProTool;
};
#endif