/// <summary> /// 获取一测段的测量信息 /// </summary> /// <param name="partLineList"></param> /// <returns></returns> private static PartInfo GetPartInfo(List <string> partLineList) { int sightNum = 2; // 1测站测量次数 string tempLine = ""; PartInfo thePart = new PartInfo(); List <string> CLDataLineList = new List <string>(); // 正常测量数据行列表 List <int> CLDataLineID = new List <int>(); // 正常测量数据行序号 for (int i = 0; i < partLineList.Count; i++) { tempLine = partLineList[i]; if (tempLine.Contains("Start-Line"))//测段开始标记行 { if (tempLine.Substring(37, 5).Trim().Length > 3) { sightNum = 4; // 如aBFFB,BFFB等 } thePart.partNum = Convert.ToInt32(tempLine.Substring(44, 4).Trim()); // 测段号 i += 1; //前进一行,获取线路起点信息 tempLine = partLineList[i]; thePart.StartPtName = tempLine.Substring(20, 9).Trim(); // 开始点名 thePart.PartCode = tempLine.Substring(29, 6).Trim(); // 测段代码 thePart.StartPtH = Convert.ToDouble(tempLine.Substring(96, 16).Trim()); // 起点高程 } else if (tempLine.Contains("#####") || tempLine.Contains("Reading") || tempLine.Contains("repeated") || tempLine.Contains("Cont-Line"))//无效测量信息行 { continue; } else if (tempLine.Substring(49, 2) == "Sh")//测段累计高差行 { if (tempLine.Substring(72, 2) != "dz") { continue; //线路中断测量后继续测量导致的 } thePart.EndPtName = tempLine.Substring(20, 9).Trim(); // 结束点点名 thePart.EndPtH = Convert.ToDouble(tempLine.Substring(96, 16).Trim()); // 结束点高程 } else if (tempLine.Substring(49, 2) == "Db") //测段累计视距行 { thePart.Db = Convert.ToDouble(tempLine.Substring(51, 15).Trim()); // 测段累计后视视距 thePart.Df = Convert.ToDouble(tempLine.Substring(74, 15).Trim()); // 测段累计前视视距 } else if (tempLine.Contains("End-Line")) //测段结束标记行 { break; } else//正常数据行 { CLDataLineList.Add(tempLine); CLDataLineID.Add(i); } } // 获取测站数据 double bsPtH; // 后视点高程 bsPtH = thePart.StartPtH; List <StationInfo> STList = new List <StationInfo>(); // 测站列表 for (int i = 0; i <= CLDataLineList.Count - 1; i += sightNum + 1) { StationInfo ST = new StationInfo(); List <SightInfo> CLDataList = new List <SightInfo>(); // 测量数据列表 ST.BPtH = bsPtH; // 后视点高程 for (int j = 0; j <= sightNum; j++) { if (j != sightNum) { CLDataList.Add(GetCLData(CLDataLineList[i + j], CLDataLineID[i + j])); } } ST.SightList = CLDataList; ST.Reset(); // 重新设置测站信息 bsPtH = ST.FPtH; STList.Add(ST); } thePart.StationList = STList; thePart.Reset(); // 重新赋值测段信息 return(thePart); }