/* ==============================================================================
 * 功能描述：ParseUnit  
 * 创 建 者：Garrett
 * 创建日期：2019/6/26 15:15:33
 * ==============================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JBIM;
using RevitExport.Export;
using Autodesk.Revit.DB;
using RevitToJBim.Common;
using JUnit=JBIM.Component.Unit;

namespace RevitToJBim.ComponentParse
{
    /// <summary>
    /// ParseUnit
    /// </summary>
    [UsableParseAttribute]
    class ParseUnit : ParseBase
    {
        public override bool Match(ElementWrapper wrapper)
        {
            return wrapper.RefObject is FormatOptions;
        }

        protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
        {
            var options= wrapper.RefObject as FormatOptions;
            if (options == null)
            {
                return null;
            }

            JUnit jObject = new JUnit();
            jObject.Name = "Length";
            jObject.Tag = "长度单位";
            jObject.Value = options.DisplayUnits.ToString();
            context.AddBimObject(jObject);
            return new List<BimId>(){jObject.Id};
        }
    }
}
