using Autodesk.Revit.DB;
namespace RevitExport.Export
{
///
/// 元素包装
///
public class ElementWrapper
{
public ElementWrapper(Element element)
{
RefElement = element;
IsRevitElement = true;
UseDefaultCategory();
SourceId = element.Id.ToString();
}
public ElementWrapper(object instance,string sourceId)
{
RefObject = instance;
IsRevitElement = false;
UseDefaultCategory();
SourceId = sourceId;
}
public bool IsRevitElement { get; private set; }
///
/// 使用默认的分类
///
public void UseDefaultCategory()
{
Category = IsRevitElement ? RefElement.GetType().FullName : RefObject.GetType().FullName;
}
public Element RefElement { get; private set; }
public string Category { get; set; }
public string SourceId { get; private set; }
#region 普通对象处理
public object RefObject{ get; private set; }
public T GetObject()
{
return (T)RefObject;
}
#endregion
}
}