JBimParseContext.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:JBimParseContext
  3. * 作者:xulisong
  4. * 创建时间: 2019/6/13 16:50:43
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using JBIM;
  13. using RevitExport;
  14. namespace RevitToJBim
  15. {
  16. /// <summary>
  17. /// JBimParseContext解析上下文
  18. /// </summary>
  19. public class JBimParseContext: ParseContext
  20. {
  21. public JBimParseContext()
  22. {
  23. Document = new BimDocument();
  24. }
  25. public BimDocument Document { get;private set; }
  26. #region 数据缓存相关
  27. private Dictionary<string, BimId> m_RevitIdMap = new Dictionary<string, BimId>();
  28. public BimId GetBimId(string revitSourceId)
  29. {
  30. if (string.IsNullOrWhiteSpace(revitSourceId))
  31. {
  32. return null;
  33. }
  34. m_RevitIdMap.TryGetValue(revitSourceId, out BimId result);
  35. return result;
  36. }
  37. public BimId AddBimObject(BimObject obj)
  38. {
  39. return this.Document.NewObject(obj)?.Id;
  40. }
  41. #endregion
  42. #region 关系数据统一存储
  43. #endregion
  44. #region 解析方法
  45. public List<BimId> Parse(ElementWrapper wrapper)
  46. {
  47. return new List<BimId>();
  48. }
  49. #endregion
  50. }
  51. }