/*------------------------------------------------------------------------- * 功能描述:BimObject * 作者:xulisong * 创建时间: 2019/6/12 10:36:34 * 版本号:v1.0 * -------------------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using JBIM.Common; using JBIM.Definition; namespace JBIM { [TypeDefiniton(TypeDefinition.BimObject)] public class BimObject { public BimObject() { ElementType = GetElementType(); } public BimId Id { get; internal set; } public string ElementType { get; protected set; } /// /// 附加信息,预留 /// public string Tag { get; set; } /// /// 获取类型Type /// /// protected string GetElementType() { var attributes = this.GetType().GetCustomAttributes(typeof(TypeDefinitonAttribute), true); string result = null; if (attributes.Any()) { result = (attributes[0] as TypeDefinitonAttribute)?.GetTypeDefiniton(); } if (string.IsNullOrEmpty(result)) { result = TypeDefinitonUtil.GetTypeDefiniton(TypeDefinition.BimObject); } return result; } } }