/*------------------------------------------------------------------------- * 功能描述:ParseBase * 作者:xulisong * 创建时间: 2019/6/13 16:55:35 * 版本号:v1.0 * -------------------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using JBIM; using RevitExport; using RevitExport.Export; using RevitExport.Parse; using RevitToJBim.Common; namespace RevitToJBim.ComponentParse { public abstract class ParseBase : IParseElement { #region 接口类相关 /// /// 快速索引 /// /// public virtual List FastIndex() { return new List();//Guid.NewGuid().ToString("N"); } public abstract bool Match(ElementWrapper wrapper); public virtual List ArrangeRefElements(ElementWrapper wrapper, JBimParseContext context) { return null; } public virtual List Parse(ElementWrapper wrapper, JBimParseContext context) { BimId result = context.GetBimId(wrapper.SourceId); if (result != null) { return new List() { result }; } var innerResults = ParseInner(wrapper, context); var refElements = ArrangeRefElements(wrapper, context); if (refElements != null) { foreach (var elementWrapper in refElements) { try { context.Parser.ParseElement(elementWrapper); } catch (Exception e) { ExceptionUtil.ThrowIfDubug(e); } } } return innerResults; } #endregion protected abstract List ParseInner(ElementWrapper wrapper, JBimParseContext context); } }