/*-------------------------------------------------------------------------
 * 功能描述：JBimParseContext
 * 作者：xulisong
 * 创建时间： 2019/6/13 16:50:43
 * 版本号：v1.0
 *  -------------------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JBIM;
using RevitExport;

namespace RevitToJBim
{
    /// <summary>
    /// JBimParseContext解析上下文
    /// </summary>
    public class JBimParseContext: ParseContext
    {
        public JBimParseContext()
        {
            Document = new BimDocument();
        }
        public BimDocument Document { get;private set; }

        #region 数据缓存相关

        private Dictionary<string, BimId> m_RevitIdMap = new Dictionary<string, BimId>();
        public BimId GetBimId(string revitSourceId)
        {
            if (string.IsNullOrWhiteSpace(revitSourceId))
            {
                return null;
            }
            m_RevitIdMap.TryGetValue(revitSourceId, out BimId result);
            return result;
        } 
        public BimId AddBimObject(BimObject obj)
        {
          return  this.Document.NewObject(obj)?.Id;
        }
        #endregion
    }
}
