Files
envi-code/SourceCode/Code2026/tg_shs/shs_public/ExternRefClone.h
T

75 lines
2.7 KiB
C++
Raw Normal View History

2026-10-04 00:04:20 +08:00
#ifndef __EXTERNREFCLONE_H__
2026-09-28 15:28:50 +08:00
#define __EXTERNREFCLONE_H__
2026-10-04 00:04:20 +08:00
// 选择实体时获得的数据
2026-09-28 15:28:50 +08:00
struct EntData
{
XPoint ptPick;
AcGeMatrix3d mat;
};
2026-10-04 00:04:20 +08:00
// 被克隆实体需要满足的条件
2026-09-28 15:28:50 +08:00
struct CloneCondition
{
2026-10-04 00:04:20 +08:00
CString sLayer; // 图层
2026-09-28 15:28:50 +08:00
bool operator== (const CloneCondition &data) const
{
if (sLayer.CompareNoCase(data.sLayer) == 0)
{
return true;
}
return false;
}
};
class ExternRefClone
{
public:
2026-10-04 00:04:20 +08:00
// 选择实体
2026-09-28 15:28:50 +08:00
int SelectEnt(const CString &sTip, Entity &ent, EntData &data, const CString &sKeyWord, TCHAR &chKey);
int SelectEnt(const CString &sTip, Entity &ent, EntData &data);
2026-10-04 00:04:20 +08:00
// 设置克隆的外部参照
2026-09-28 15:28:50 +08:00
void SetExternRef(Entity &ent);
2026-10-04 00:04:20 +08:00
// 克隆满足条件的所有实体
2026-09-28 15:28:50 +08:00
void CloneByCondition(std::vector<std::pair<Entity,EntData> > &vecEnt);
2026-10-04 00:04:20 +08:00
// 仅克隆选择实体
2026-09-28 15:28:50 +08:00
void CloneBySel(std::vector<std::pair<Entity,EntData> > &vecEnt);
private:
2026-10-04 00:04:20 +08:00
// 创建拷贝实体图层
2026-09-28 15:28:50 +08:00
AcDbObjectId CreateCloneLayer(const CString &sLayer);
2026-10-04 00:04:20 +08:00
// 绘制块参照中同层同类型的实体
2026-09-28 15:28:50 +08:00
void DrawEntity(Entity &entBlkRef, const std::vector<CloneCondition> &vecCdn, int &nDrawNum);
void DrawEntity(AcDbBlockReference *pRef,const std::vector<CloneCondition> &vecCdn, int &nDrawNum);
2026-10-04 00:04:20 +08:00
// 克隆实体
2026-09-28 15:28:50 +08:00
void CloneEntity(const AcDbEntity *pEnt,const std::vector<CloneCondition> &vecCdn, int &nDrawNum, AcDbEntity *&pCloneEnt);
2026-10-04 00:04:20 +08:00
// 是否为外部参照
2026-09-28 15:28:50 +08:00
bool IsExternRef(const AcDbObjectId &idRec);
2026-10-04 00:04:20 +08:00
// 是否普通图块
2026-09-28 15:28:50 +08:00
bool IsOrdinaryRef(const AcDbObjectId &idRec);
2026-10-04 00:04:20 +08:00
// 获得实体所属图块的id
2026-09-28 15:28:50 +08:00
bool GetBlkId(const AcDbObjectId &idRec, const EntData &data, AcDbObjectId &idBlk);
2026-10-04 00:04:20 +08:00
// 更新选择集,将其中选择的实体属于图块的,改为选择图块
2026-09-28 15:28:50 +08:00
void UpdateSelectionSet(std::vector<std::pair<Entity,EntData> > &vecSelEnt);
2026-10-04 00:04:20 +08:00
// 根据选择实体获得被克隆实体需满足的克隆条件
2026-09-28 15:28:50 +08:00
void GetCloneCondition(std::vector<std::pair<Entity,EntData> > &vecSelEnt, std::vector<CloneCondition> &vecCdn);
void GetCloneCondition(AcDbEntity *pEnt, CloneCondition &data);
2026-10-04 00:04:20 +08:00
// 是否克隆条件已经存在
2026-09-28 15:28:50 +08:00
bool FindCloneCondition(const std::vector<CloneCondition> &vecCdn, const CloneCondition &data);
2026-10-04 00:04:20 +08:00
// 创建图块
2026-09-28 15:28:50 +08:00
AcDbObjectId CreateCloneBlkRecord(const CString &sBlkName);
2026-10-04 00:04:20 +08:00
// 更新字符串,如果sText中包含sTok,则返回后一部分实体,否则不修改sText
2026-09-28 15:28:50 +08:00
void UpdateCString(CString &sText, const CString &sTok = _T("|"));
2026-10-04 00:04:20 +08:00
// 获得线型名
2026-09-28 15:28:50 +08:00
CString GetLinetypeName(const AcDbObjectId &idLinetype);
2026-10-04 00:04:20 +08:00
// 非图块实体中是否包含图块
2026-09-28 15:28:50 +08:00
bool IsIncludeBlk(const AcDbEntity *pEnt);
2026-10-04 00:04:20 +08:00
// 创建克隆线型
2026-09-28 15:28:50 +08:00
AcDbObjectId CreateCloneLinetype(const AcDbObjectId &idLinetype);
private:
2026-10-04 00:04:20 +08:00
// 外部参照
2026-09-28 15:28:50 +08:00
Entity m_entExternRef;
};
#endif