#ifndef _SANITARYSYSY_H__ #define _SANITARYSYSY_H__ #include "PartitionSanitarySys.h" class SanitarySys { public: ~SanitarySys(); // 根据排水管或给水管自动连接洁具 virtual void AutoLinkSanitary(const SanitarySysData &data); //获取系统中所有的立管和门窗 void SetVertivalPipeAndDoor(PickSet &ss); public: // 管线类型 enum PipeType { eError, // 失效 eVertival, // 立管 eBranch, // 支管 eMainPipe, // 主干管 eVertival2, // 排水或给水立管 eBranch2, // 排水或给水支管 eChamfer, // 倒角管 eSmallPipe, // 小支管 }; // 管线在xy平面的方向 enum PipeDir { eNone, eParallelX, // 平行X轴 eParallelY, // 平行Y轴 eOther, // 其他方向 }; struct PipeData { AcDbLine *pLine; // 管线(流向由起点流向终点) PipeType type; // 管线类型 PipeDir drection; // 管线在xy平面方向 int nId; // 管线编号 }; protected: // 直线穿过的墙数 int PassWallNumByLine(const AcGePoint3d &ptXOY, const AcGePoint3d &ptSanitary, double &dWidth); // 洁具点最近的墙体厚度 void GetNearestWallWidth(const AcGePoint3d &ptSanitary, const AcGePoint3d &ptDir, PickSet &ssTGWall, PickSet &ssLineWall, double &dWidth); void GetLineWallWidth(const AcGePoint3d &ptSanitary, const AcGePoint3d &ptDir, PickSet &ssLineWall, double &dDist, double &dWidth); void GetTGWallWidth(const AcGePoint3d &ptSanitary, const AcGePoint3d &ptDir, PickSet &ssTGWall, double &dDist, double &dWidth); // 直线穿过的洁具点数 int PassSanitaryNumByLine(const std::vector &data, const AcGePoint3d &pt1, const AcGePoint3d &pt2); // 直线穿过的立管数 int PassVertivalPipeNumByLine(const AcGePoint3d &pt1, const AcGePoint3d &pt2); // 直线是否挨着门(dDist为范围) int IsNextToDoor(double dDist, const AcGePoint3d &pt1, const AcGePoint3d &pt2); // 是否为立管 bool IsVertivalPipe(const AcDbObjectId &id); // 添加sys洁具管线系统 bool AddSanitarySys(TPipeSys::SysType sys, double dDn); // 管径 double GetPipeDn(const AcDbObjectId &id); // 管线方向 PipeDir GetPipeDirection(const AcDbObjectId &id); PipeDir GetPipeDirection(TPipeSys::SysType sys, int nId); // 获得管线端点 bool GetPipePoint(const AcDbObjectId &id, AcGePoint3d &ptS, AcGePoint3d &ptE); // 获取支管可供连接洁具点的给水点或排水点 void GetLinkablePt(const AcDbObjectId &id, AcGePoint3d &ptFrom, AcGePoint3d &ptS, AcGePoint3d &ptE); // 获取管线类型 PipeType GetDataType(TPipeSys::SysType sys, int nId); void Sort(std::vector &data, const AcGePoint3d &pt); // 获取管线图层 CString GetPipeLayer(TPipeSys::SysType sys); CString GetVPipeLayer(TPipeSys::SysType sys); // 绘制管线 void CreatePipe(); protected: struct Node { std::vector data; // 系统中的管线 TPipeSys::SysType sys; // 系统类型 double dPipeDn; // 管径 }; protected: std::vector m_vecPipe; PickSet m_ssDoorWall; // 当前图中所有门墙实体 PickSet m_ssPipe; // 当前图中的所有立管 }; #endif