123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /*-------------------------------------------------------------------------
- * 功能描述: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; }
- /// <summary>
- /// 附加信息,预留
- /// </summary>
- public string Tag { get; set; }
- /// <summary>
- /// 获取类型Type
- /// </summary>
- /// <returns></returns>
- 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;
- }
- }
- }
|