public List <StrDataCollection> ReadLocalStrDatas() { var filePath = GlobalInfo.GetInstance().ProjectPath + "\\" + ConstVar.DataBaseStr + "\\" + ConstVar.StrDataFileName; var strDatas = StrDataReader.Read(filePath);; if (strDatas == null) { strDatas = new List <StrDataCollection>(); } return(strDatas); }
protected override void InitializeData() { BaseData = StrDataReader.Read(filePath); UpdateCurrentSelectedFitData("一般子串"); }
/// <summary> /// 直接读取本地文件xml信息 同时需要判断 塔型、导线型号、导线串型、地线型号 是否满足在本项目中存在 /// </summary> /// <param name="path">文件路径</param> /// <returns></returns> public static List <TowerSerial> ReadXml(string projectDir, string navg) { #region 获取本项目 塔型、导线型号、导线串型、地线型号 信息 string filePath = ""; string basePath = projectDir + "\\" + ConstVar.DataBaseStr + "\\"; //判断塔型 filePath = basePath + "TowerStr.xml"; List <TowerStrData> towerList = TowerStrDataReader.ReadLoadFile(filePath).ToList(); List <String> towerNameList = towerList.Select(t => t.Name).ToList(); //导地线 filePath = basePath + "Wire.xml"; List <WireType> allList = WireReader.Read(filePath); //判断导线 List <string> wireList = allList.Where(w => w.Type == "导线").First().Wires.Select(w => w.ModelSpecification).ToList(); //判断地线 List <string> groundList = allList.Where(g => g.Type == "地线").First().Wires.Select(g => g.ModelSpecification).ToList(); //判断绝缘串 filePath = basePath + @"\StrData.xml"; List <string> strList = StrDataReader.Read(filePath).Where(s => s.Type == "一般子串").First().StrDatas.Select(s => s.Name).ToList(); #endregion //读取序列信息,并进行逻辑判断 string loadPath = projectDir + "\\" + ConstVar.TowerSequenceStr + "\\" + navg + "\\TowerSequenceStr.xml"; List <TowerSerial> towerSeriList = new List <TowerSerial>(); XmlDocument doc = new XmlDocument(); doc.Load(loadPath); XmlNode rootNode = doc.GetElementsByTagName("Root")[0]; foreach (XmlNode xmlNode in rootNode.ChildNodes) { TowerSerial item = new TowerSerial(); item.ID = int.Parse(xmlNode.Attributes.GetNamedItem("ID").InnerText); //序号 item.IsChecking = bool.Parse(xmlNode.Attributes.GetNamedItem("IsChecking").InnerText); //气象条件 item.WeatherCondition = xmlNode.Attributes.GetNamedItem("WeatherCondition").InnerText; //气象条件 item.TowerName = xmlNode.Attributes.GetNamedItem("TowerName").InnerText; //塔位号 item.TowerType = int.Parse(xmlNode.Attributes.GetNamedItem("TowerType").InnerText); //塔型 item.NameOfPositioningPile = xmlNode.Attributes.GetNamedItem("NameOfPositioningPile").InnerText; //塔位点 item.TowerPattern = xmlNode.Attributes.GetNamedItem("TowerPattern").InnerText; //塔型 item.CallItHigh = double.Parse(xmlNode.Attributes.GetNamedItem("CallItHigh").InnerText); //呼高 item.TowerFootElevation = double.Parse(xmlNode.Attributes.GetNamedItem("TowerFootElevation").InnerText); //塔位桩高程 item.BaseLevelDescent = double.Parse(xmlNode.Attributes.GetNamedItem("BaseLevelDescent").InnerText); //定位高差 item.Span = double.Parse(xmlNode.Attributes.GetNamedItem("Span").InnerText); //档距 item.HorizontalSpan = double.Parse(xmlNode.Attributes.GetNamedItem("HorizontalSpan").InnerText); //水平档距 item.VerticalSpan = double.Parse(xmlNode.Attributes.GetNamedItem("VerticalSpan").InnerText); //垂直档距 item.FrontVerticalSpan = double.Parse(xmlNode.Attributes.GetNamedItem("FrontVerticalSpan").InnerText); //前侧垂直档距 item.BackVerticalSpan = double.Parse(xmlNode.Attributes.GetNamedItem("BackVerticalSpan").InnerText); //后侧垂直档距 item.FrontPreSpan = double.Parse(xmlNode.Attributes.GetNamedItem("FrontPreSpan").InnerText); //前侧代表档距 item.FrontAccPreSpan = double.Parse(xmlNode.Attributes.GetNamedItem("FrontAccPreSpan").InnerText); //前侧耐张段长度 item.BackPreSpan = double.Parse(xmlNode.Attributes.GetNamedItem("BackPreSpan").InnerText); //后侧代表档距 item.BackAccPreSpan = double.Parse(xmlNode.Attributes.GetNamedItem("BackAccPreSpan").InnerText); //后侧耐张段长度 item.TurningAngle = double.Parse(xmlNode.Attributes.GetNamedItem("TurningAngle").InnerText); //转角中心桩位移(m) item.TurningAngleStr = xmlNode.Attributes.GetNamedItem("TurningAngleStr").InnerText; //转角中心桩位移(m) item.ConductorModel = xmlNode.Attributes.GetNamedItem("ConductorModel").InnerText; //导线型号 item.InsulationStringModel = xmlNode.Attributes.GetNamedItem("InsulationStringModel").InnerText; //导线串型号 item.InsulationStringSlices = xmlNode.Attributes.GetNamedItem("InsulationStringSlices").InnerText; //导线串片数 item.InsulationStringNumber = double.Parse(xmlNode.Attributes.GetNamedItem("InsulationStringNumber").InnerText); //导线串数量 item.InsulationStringLength = double.Parse(xmlNode.Attributes.GetNamedItem("InsulationStringLength").InnerText); //导线串长度 item.GroundWireModel = xmlNode.Attributes.GetNamedItem("GroundWireModel").InnerText; //地线型号 item.GroundWireInsulationStringModel = xmlNode.Attributes.GetNamedItem("GroundWireInsulationStringModel").InnerText; //地线串型号 item.GroundWireInsulationStringNumber = xmlNode.Attributes.GetNamedItem("GroundWireInsulationStringNumber").InnerText; //地线串数量 if (towerNameList.Contains(item.TowerPattern)) //塔型判断 { item.ExistsTowerPattern = true; } if (wireList.Contains(item.ConductorModel))//导线型号判断 { item.ExistsConductorModel = true; } if (groundList.Contains(item.GroundWireModel))//地线型号判断 { item.ExistsGroundWireModel = true; } if (strList.Contains(item.InsulationStringModel))//导线串型号判断 { item.ExistsWireInsulationString = true; } item.CommPar = xmlNode.Attributes.GetNamedItem("CommPar").InnerText; item.FrontSidePar = xmlNode.Attributes.GetNamedItem("FrontSidePar").InnerText; item.BackSidePar = xmlNode.Attributes.GetNamedItem("BackSidePar").InnerText; item.TowerPar = xmlNode.Attributes.GetNamedItem("TowerPar").InnerText; towerSeriList.Add(item); } return(towerSeriList); }