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

151 lines
7.1 KiB
C++

#ifndef _UNFOLDINSTALLSANITARYSYS_H__
#define _UNFOLDINSTALLSANITARYSYS_H__
#include "PartitionSanitarySys.h"
#include "SanitarySysForFeedWater.h"
#include "UnfoldInstallAdjustElevation.h"
class UnfoldInstallSanitarySys : public SanitarySysForFeedWater
{
public:
UnfoldInstallSanitarySys();
virtual void AutoLinkSanitary(const SanitarySysData &data);
// 设置明装还是安装方式
void SetInstallType(int nInstallType);
void SetErrorNote(bool bErrorNote);
bool GetErrorNote();
void IsCreatPipe(bool bCreatPipe);
private:
// 墙体数据结构
struct WallData
{
AcGePoint3d ptS;
AcGePoint3d ptE;
double dWidth;
AcDbObjectId id;
int nNum;// 墙体上门窗个数
DList<WallData> lstNode;
};
// 可投影的管线数据
struct LinkedLine
{
AcGePoint3d ptIntersect;// 投影点
AcDbLine *pLine;
int nId; // 管线编号
};
void LinkSanitary(const SanitarySysData &data);
// 给水管是立管时 确定主干方向
bool ConfirmPipeDir(AcGeVector3d &vtPipe, const AcGePoint3d &ptSan, AcGeVector3d &vtDir);
// 获取距离点最近的墙体的中线
bool GetWallMiddleLine(const AcGePoint3d &pt, AcDbLine &line);
// 获取两个墙体之间的最短路径
bool GetWallRoad(AcDbLine &lineStart, AcDbLine &lineEnd, std::vector<WallData *> &vecRoad);
// 获取起始墙体到终止墙体之间的所有路径
void GetRoad(WallData *pNode, const AcDbObjectId &idEnd, std::map<double, std::vector<WallData *> > &mapRoad, std::vector<WallData *> vecRoad, double dLen, WallData *pNodePre);
// 查找距离该墙体最近的主干管
bool GetBranchWallRoad(AcDbLine &line, std::vector<WallData *> &vecRoad);
// 查找该节点到最近主干的所有路径
void GetBranchRoad(WallData *pNode, std::map<double, std::vector<WallData *> > &mapRoad, std::vector<WallData *> &vecRoad, double dLen, WallData *pNodePre);
// 把墙体关系转换为链表
void SetWallMap(PickSet &ss, WallData *&pNode, std::vector<WallData *> &vecNode);
// 判断两个墙体节点之间是否有关联关系
bool CheckRelation(WallData *pNode, WallData *pNodeFind);
// 判断该ID是否存在于墙体链表中,若存在,则返回指向该节点的链表
bool CheckWallInLst(const std::vector<WallData *> &vecNode, const AcDbObjectId &id, WallData *&pNodeFind);
// 用墙体的起点和终点 获取墙体ID
bool GetWallId(const std::vector<WallData *> &vecWall, const AcDbLine &line, AcDbObjectId &id);
// 获得路径的转折点总数
int GetTurnNum(const std::vector<WallData *> &vecPt);
// 根据路径长度和转折点数量 取得最短路径
void GetShortestRoad(std::map<double, std::vector<WallData *> > &mapRoad, std::vector<WallData *> &vecRoad);
// 分别延长管线和墙体 求交点
bool GetExtendPipe(std::map<double, LinkedLine> &mapLink, AcDbLine &line, const AcGePoint3d &pt, bool bExtend);
// 在XOY平面内与vtDir平行,并且在pt点vtPipe方向的墙体
virtual bool GetIntersectWall( const AcGePoint3d &pt, const AcGeVector3d &vtDir, AcDbLine &line, AcGeVector3d &vtPipe, bool bExtend);
// 设定主干
bool SetMainPipe(std::vector<WallData *> &vecRoad, std::vector<SanitaryNode> &vecNode);
// 根据主干 设定分支管和小支管
void LinkSanitary(std::vector<WallData *> &vecRoad, std::vector<SanitaryNode> &vecNode);
// 连接次级主干
void SetNewMainPipe(const AcGePoint3d &pt, std::vector<WallData *> &vecRoad, const std::vector<SanitaryNode> &vecNode);
// 连接次级主干
void LinkNewMainPipe(std::vector<WallData *> &vecRoad, const std::vector<SanitaryNode> &vecNode, std::map<double, LinkedLine> &mapLink,
const AcGePoint3d &pt, AcGePoint3d &ptOnLine, AcGePoint3d &ptPerS, AcGePoint3d ptPerE, AcGeVector3d &vtPer);
// 添加支管和小支管
bool LinkSanitary2MainPipe(const AcGePoint3d &ptSan, const AcGePoint3d &ptS, const AcGePoint3d &ptE, const std::vector<SanitaryNode> vecNode);
// 设置起始管线
void SetStartPipe(AcDbLine *pLine, AcGePoint3d &ptStart, const AcDbLine &line, AcGeVector3d &vtPer);
// 设置中间管线
void SetMiddlePipe(AcGePoint3d &ptStart, AcGePoint3d &ptEnd, const AcDbLine &line, const std::vector<SanitaryNode> &vecNode, double dWidth, AcGePoint3d &ptPerS, AcGePoint3d &ptPerE, AcGeVector3d &vtPer);
// 设置终止管线
void SetEndPipe(AcDbLine *pLine, AcGePoint3d &ptEnd, const AcDbLine &line, double dWidth);
// 判定管线位置是否合适
bool CheckPipePos(const AcGePoint3d &ptS, const AcGePoint3d &ptE);
// 校准管线
void ModifyPipe(std::vector<AcDbLine *> &vecLine, double dDist);
// 校准墙体路径的起点到终点顺序
void ModifyRoad(std::vector<WallData *> &vecRoad);
// 偏移管线
void OffSetPipe(AcGePoint3d &ptS, AcGePoint3d &ptE, AcGeVector3d vt, double dWidth);
// 添加管线
void AddPipeLine(const AcGePoint3d &ptS, const AcGePoint3d &ptE, PipeType type);
// 生成管线
void CreatePipe();
// 释放管线节点
void FreeLine(std::vector<AcDbLine *> &vecLine);
// 释放路径节点
void FreeNode(std::vector<WallData *> &vecNode);
// 设置可用墙体边线
void ModifyUsefulWall();
// 沿墙体延长管线 连接洁具
bool ExtendPipe2San(std::map<double, LinkedLine> &mapPipe, const AcGePoint3d &ptSan, AcGePoint3d &ptOnLine, AcDbLine &line);
// 检查管线是否沿墙敷设
bool CheckPipe2Wall(const AcGePoint3d &ptS, const AcGePoint3d &ptE, const AcDbLine &lineStartWall);
// 从交点处打断管线,构造管网
void SetLinkableNode();
// 根据管线构造管网
void GetNodeLst(std::vector<LinkNode *> &vecNode);
// 校准标高点
void ModifyNode(std::vector<LinkNode *> &vecNode);
// 判断点是否在链表中,若存在 ,返回该节点
bool CheckPtInLst(std::vector<LinkNode *> &vecNode, LinkNode *&pNode, AcGePoint3d pt);
// 判断所有洁具点是否共线
bool IsSanPtsParallel(std::vector<SanitaryNode> &vecNode, AcGeVector3d &vtSan);
// 连接无墙共线洁具
void LinkSanWithoutWall(std::vector<SanitaryNode> &vecNode, AcGeVector3d &vtPipe, bool bExtendFeedPipe, AcGeVector3d &vtSan);
// 从链表起点生成管网
void CreatePipeFromStart(LinkNode *pNode, std::vector<LinkNode *> &vecNode);
// 设定管线标高
void ModifyPipeElve();
// 连接管线直接穿过洁具点的洁具
void LinkSanCrossPipe(std::vector<SanitaryNode> &vecNode, AcGePoint3d &ptCross);
// 连接投影到管线的洁具点
void LinkSan2Proj(std::vector<SanitaryNode> &vecNode, AcDbLine &lineMain);
private:
bool m_bCreatPipe; // 是否绘制管线
double m_dElev; // 管线标高
bool m_bErrorNote; // 错误提示
int m_nInstallType; // 安装方式 0:垂直连接 1:水平连接
bool m_bPipeDir; // 供水管为直管时,其方向是否正确
AcGePoint3d m_ptFeed;
LinkNode *m_pNodeStart; // 起始点
AcGeVector3d m_vtSan; // 当前洁具方向
// 洁具对应的连接点
std::map<AcDbObjectId, AcGePoint3d> m_mapSanPt;
std::vector<WallData *> m_vecRoad; // 存储已经存在的路径
std::vector<WallData *> m_vecAllWall; // 记录所有墙体
std::vector<std::pair<XCurveSegment, XCurveSegment> > m_vecAllWallSide; // 记录所有墙体边线,m_vecWallSide中保存有用的墙体边线(即:去除掉卫生墙等薄墙);
};
#endif