/* ==============================================================================
 * 功能描述：ParseLevel  
 * 创 建 者：Garrett
 * 创建日期：2019/6/26 15:16:34
 * ==============================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using JBIM;
using RevitExport.Export;
using RevitToJBim.Common;
using SAGA.RevitUtils.Extends;
using JLevel=JBIM.Component.Level;

namespace RevitToJBim.ComponentParse
{
    /// <summary>
    /// ParseLevel
    /// </summary>
    [UsableParseAttribute]
    class ParseLevel : ParseBase
    {
        public override List<string> FastIndex()
        {
            return new List<string>() { typeof(Level).FullName };
        }
        public override bool Match(ElementWrapper wrapper)
        {
            return wrapper.RefElement is Level;
        }

        protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
        {
            var level = wrapper.RefElement as Level;

            if (level == null)
            {
                return null;
            }
            JLevel jObject=new JLevel();
            //ElementType
            ParseCore.AttachObject(jObject,wrapper);
            //Name,SourceId
            jObject.Name = level.Name;
            //Value
            jObject.Value = level.Elevation.FtToUse();
            //Id
            context.AddBimObject(jObject);
            return new List<BimId>(){jObject.Id};
        }
    }
}
