Esempio n. 1
0
 public BIFVM(BIFStruct bifStruct)
 {
     _bif = bifStruct;
 }
        /// <summary>
        /// 根据XML 反序列化
        /// </summary>
        /// <param name="xmlNode"></param>
        /// <returns></returns>
        private BIFStruct UnSerializePoint(XmlNode xmlNode)
        {
            BIFStruct bif = new BIFStruct();

            int arrayNo = 0;

            int.TryParse(xmlNode.SelectSingleNode("ArrayNo").InnerText, out arrayNo);

            string pointNo = xmlNode.SelectSingleNode("PointNo").InnerText;

            double height = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Height").InnerText, out height);

            double distance = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Distance").InnerText, out distance);

            StaffTypeEnum staffType = ("Upright" == xmlNode.SelectSingleNode("StaffType").InnerText ? StaffTypeEnum.Upright
                : StaffTypeEnum.Down);

            string referNo = xmlNode.SelectSingleNode("ReferNo").InnerText;

            MeasureTypeEnum measureType = MeasureTypeEnum.I;

            switch (xmlNode.SelectSingleNode("MeasureType").InnerText)
            {
            case "B": measureType = MeasureTypeEnum.B; break;

            case "I": measureType = MeasureTypeEnum.I; break;

            case "F": measureType = MeasureTypeEnum.F; break;

            default: measureType = MeasureTypeEnum.I; break;
            }

            string isReferNo = xmlNode.SelectSingleNode("IsReferNo").InnerText;

            double elevation = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Elevation").InnerText, out elevation);

            double designElevation = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("DesignElevation").InnerText, out designElevation);

            double cut = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Cut").InnerText, out cut);

            double fill = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Fill").InnerText, out fill);

            double deltaHeight = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("DeltaHeight").InnerText, out deltaHeight);

            bif.ArrayNo         = arrayNo;
            bif.PointNo         = pointNo;
            bif.Height          = height;
            bif.Distance        = distance;
            bif.StaffType       = staffType;
            bif.ReferNo         = referNo;
            bif.MeasureType     = measureType;
            bif.IsReferNo       = isReferNo;
            bif.Elevation       = elevation;
            bif.DesignElevation = designElevation;
            bif.Cut             = cut;
            bif.Fill            = fill;
            bif.DeltaHeightDh   = deltaHeight;

            return(bif);
        }
Esempio n. 3
0
 public BIFVM()
 {
     _bif = new BIFStruct();
 }