153 lines
5.1 KiB
C++
153 lines
5.1 KiB
C++
#ifndef _UNFOLDINSTALLADJUSTELEVATION_H__
|
|
#define _UNFOLDINSTALLADJUSTELEVATION_H__
|
|
|
|
// 连接点类型
|
|
#define Point_Sanitary 0x01 // 洁具点
|
|
#define Point_Feed 0x02 // 供水点
|
|
#define Point_Int 0x04 // 交点
|
|
#define Point_VPipe 0x08 // 由立管充当的洁具点
|
|
#define Point_KW 0x10 // 扣弯点
|
|
|
|
// 明装连接点信息存储结构
|
|
struct LinkNode
|
|
{
|
|
LinkNode *pPreNode; // 前向连接点
|
|
AcGePoint3d ptCur; // 当前连接点
|
|
std::vector<LinkNode*> m_vecNode; // 后续连接点
|
|
int type; // 点类型
|
|
};
|
|
|
|
// 明装铺设后管线标高设置
|
|
class UnfoldInstallAdjustElevation
|
|
{
|
|
public:
|
|
|
|
UnfoldInstallAdjustElevation();
|
|
~UnfoldInstallAdjustElevation();
|
|
// 明装铺设管道变高
|
|
void AdjustElevation();
|
|
// 明装铺设中所有关键点
|
|
void SetLinkNode( LinkNode *pNode );
|
|
// 供水管为立管时,供水点标高
|
|
void SetFeedElevation(double dEle);
|
|
// 供水管id
|
|
void SetFeedPipe(const AcDbObjectId &idPipe);
|
|
// 洁具供水点
|
|
void SetSanitaryPt(const std::map<AcDbObjectId,AcGePoint3d> &mapSan);
|
|
// 设置管线类型
|
|
void SetPipeSysType(TPipeSys::SysType sys);
|
|
|
|
private:
|
|
|
|
// 变高过程中产生的直线类型
|
|
enum LineType
|
|
{
|
|
eSmallPipe, // 小支管
|
|
eKWPipe, // 扣弯
|
|
ePipe, // 干管
|
|
};
|
|
// 变高过程中产生的直线
|
|
struct LineInfo
|
|
{
|
|
AcGePoint3d ptS;
|
|
AcGePoint3d ptE;
|
|
LineType type;
|
|
};
|
|
|
|
// 按供水点流向洁具的先后排序
|
|
void SanitarySort(std::vector<LinkNode*> &vecNode);
|
|
// 判断是否具有nType点类型
|
|
bool SearchPointType(int nType, int nOrignType);
|
|
// 调整第一个洁具标高
|
|
void AdjustFirstSanEle(LinkNode *pFirstNode);
|
|
// 调整剩余洁具标高
|
|
void AdjustSanitaryElevation(const std::vector<LinkNode*> vecNode);
|
|
// 删除节点
|
|
void DeleteNode(LinkNode *pNode);
|
|
// 按从给水点流经洁具的顺序获得洁具点
|
|
void GetSanitaryNode(LinkNode *pNode, std::vector<LinkNode*> &vecNode);
|
|
// 三点是否共线
|
|
bool IsSameOnLine(const AcGePoint3d &pt1, const AcGePoint3d &pt2, const AcGePoint3d &pt3);
|
|
// 供水管是否为立管
|
|
bool IsFeedVPipe();
|
|
// 供水点标高
|
|
double GetFeedPtEle();
|
|
// 洁具点标高是否随支管
|
|
bool IsSanitaryPtEleSamePipe(const AcDbObjectId &idSan);
|
|
// 用户指定的洁具点标高
|
|
bool GetSanitaryPtEle(const AcDbObjectId &idSan, double &dSanEle);
|
|
// 洁具定义的管线标高
|
|
bool GetPipeEleForSanitary(const AcDbObjectId &idSan, double &dPipeEle);
|
|
// 根据洁具点获得洁具id
|
|
AcDbObjectId GetSanitaryId(const AcGePoint3d &ptSan);
|
|
// 根据起始点产生一条直线
|
|
void CreateLine(const AcGePoint3d &ptS, const AcGePoint3d &ptE, LineType type);
|
|
// 记录点的标高值
|
|
void AddPointElevation(const AcGePoint3d &pt, double dEle);
|
|
// 点的标高值
|
|
bool GetPointElevation(const AcGePoint3d &pt, std::set<double> &setEle);
|
|
// 点所在位置是否为转角
|
|
bool IsCorner(const AcGePoint3d &pt);
|
|
// 判断点pt是否具有Point_KW类型
|
|
bool IsPointKw(const AcGePoint3d &pt);
|
|
// 当前点所在节点
|
|
LinkNode* GetLinkNode(const AcGePoint3d &pt);
|
|
// 两点间是否存在与两点连线垂直的墙体
|
|
bool IsExistPerpendicularWall(const AcGePoint3d &pt1, const AcGePoint3d &pt2, AcDbObjectId &idWall);
|
|
// 穿墙而过时变高点
|
|
bool GetAdjustPoint(const AcGePoint3d &ptS, const AcGePoint3d &ptE, const AcDbObjectId &idWall, AcGePoint3d &pt);
|
|
// 判断一点是否进行了变高
|
|
bool IsAdjustPointEle(const AcGePoint3d &pt);
|
|
// 查找直线终点与ptS重合,且与ptE共线的直线,dPipeEle为该线的标高
|
|
bool FindParallelLine(const AcGePoint3d &ptS, const AcGePoint3d &ptE, double &dPipeEle);
|
|
// 两点变高
|
|
void AdjustEleBetweenPts(const AcGePoint3d &ptCur, const AcGePoint3d &ptPre, double dFeedEle, double dPipeEle);
|
|
// 两点变高
|
|
void AdjustEleBetweenPts(const AcGePoint3d &ptCur, const AcGePoint3d &ptPre, double dPipeEle);
|
|
// 根据pt点已确定的标高值,更新点的连接
|
|
void UpdateNodeLink(const AcGePoint3d &pt, double dEle);
|
|
// 显示管线
|
|
void DrawPipe();
|
|
// 根据管线类型获得管线图层
|
|
CString GetPipeLayer(TPipeSys::SysType sys);
|
|
// 根据管线类型获得立管图层
|
|
CString GetVPipeLayer(TPipeSys::SysType sys);
|
|
// 修改洁具点标高
|
|
void ModifySanitaryPt(const AcGePoint3d &ptSan);
|
|
// 插入洁具附件
|
|
void InsertSanitaryEquip();
|
|
// 绘制附件
|
|
void DrawFeedEquip(const AcDbObjectId &idSan, const AcGePoint3d &ptSan);
|
|
// 遍历当前节点的父节点返回第一个设置了标高的节点的标高值
|
|
double GetParentNodeEle(const AcGePoint3d &ptCur);
|
|
/////////////////////////
|
|
void DrawLine();
|
|
|
|
private:
|
|
// 明装连接点
|
|
LinkNode *m_pLinkNode;
|
|
// 给水管id
|
|
AcDbObjectId m_idFeedPipe;
|
|
// 当供水管为立管时,供水点标高
|
|
double m_dFeedEle;
|
|
// 洁具对应的连接点
|
|
std::map<AcDbObjectId,AcGePoint3d> m_mapSanPt;
|
|
// 管线系统类型
|
|
TPipeSys::SysType m_sysPipeType;
|
|
// 变高过程中产生的直线信息
|
|
std::vector<LineInfo> m_vecLineInfo;
|
|
|
|
struct PointNode
|
|
{
|
|
AcGePoint3d pt;
|
|
std::set<double> setEle; // pt点的标高值
|
|
};
|
|
|
|
// 记录各点变高后的标高值
|
|
std::vector<PointNode> m_vecPtEle;
|
|
// 在墙体处变高时,边高点距墙距离
|
|
double m_dToWallDist;
|
|
|
|
};
|
|
|
|
#endif |