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

72 lines
1.4 KiB
C++

#pragma once
#include <map>
#include <typeinfo>
#include <string>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <functional>
struct BIMEntity
{
typedef std::wstring string;
typedef std::map<string, string> Datas;
struct Geometry
{
// AcDbSubDMesh面的定义: 一个面由N+1个索引组成
// 索引 0 - 记录此面由N个vertex构成
// 索引 1-N 记录组成此面的vertex索引
Geometry(): faces(0), vertices(0){}
AcArray<Adesk::Int32> faces;
AcGePoint3dArray vertices;
AcGePoint3dArray edges;
void clear()
{
faces.removeAll();
vertices.removeAll();
edges.removeAll();
}
};
template <class out_type, class in_value>
bool convert(const in_value & t, out_type &out_value)
{
std::wstringstream stream;
stream << t;//向流中传值
return stream >> out_value;//向result中写入值
}
template <class InData>
bool insertData(std::wstring &key, InData & value)
{
string v(_T(""));
if (convert<string, InData>(value))
{
std::pair<Datas::iterator, bool> pr = datas.insert(std::make_pair(key, v));
return pr.second;
}
return false;
}
void setGeometry(const AcArray<Adesk::Int32> &fs, const AcGePoint3dArray &pts)
{
geometry.faces = fs;
geometry.vertices = pts;
}
void clear()
{
datas.clear();
geometry.clear();
}
// bim数据
Datas datas;
// 几何数据
Geometry geometry;
string id, name, type;
};