/// <summary> /// 解析坐标 /// </summary> /// <param name="content"></param> /// <returns></returns> public static LgoAscPoint ParsePoint(string content) { NamedXyz namedXyz = ParseNamedXyz(content); LgoAscPoint result = new LgoAscPoint() { Name = namedXyz.Name, XYZ = namedXyz.Value, // CoordinateType = strs[6] }; return(result); }
/// <summary> /// 读取文件 /// </summary> /// <returns></returns> public MultiEpochLgoAscBaseLineFile Read() { var file = new MultiEpochLgoAscBaseLineFile(); file.Name = Path.GetFileName(FilePath); file.Header = LoadHeader(); string line = null; using (StreamReader reader = new StreamReader(FilePath)) { LgoAscPoint currentPoint = null; LgoAscBaseLine currentLine = null; EpochLgoAscBaseLine epochLgoAscBaseLine = null; bool isInPoint = true; while ((line = reader.ReadLine()) != null) { var label = line.Substring(0, 2); if (label == LgoAscLable.HeaderLines) { continue; } //跳过头部 var content = Geo.Utils.StringUtil.SubString(line, 2); switch (label) { case LgoAscLable.PointAndCoordinateInformation: { currentPoint = ParsePoint(content); isInPoint = true; } break; case LgoAscLable.ReferencePointOfBaseline: { var xyz = ParseNamedXyz(content); //由于第一次无法将名称读完,因此只能读完后再存储 currentLine = new LgoAscBaseLine(); currentLine.LineName.RefName = xyz.Name; currentLine.Baseline.ApproxXyzOfRef = xyz.Value; isInPoint = false; } break; case LgoAscLable.BaselineVectorComponents: { var xyz = ParseNamedXyz(content); currentLine.Baseline.BaseLineName.RovName = xyz.Name; currentLine.Baseline.EstimatedVectorRmsedXYZ.Value = xyz.Value; //流动站坐标位于基线上方 if (currentPoint != null && currentPoint.Name == xyz.Name) { currentLine.Baseline.ApproxXyzOfRov = currentPoint.XYZ; } else { currentLine.Baseline.ApproxXyzOfRov = currentLine.Baseline.ApproxXyzOfRef + xyz.Value; } currentLine.Baseline.BaseLineName.Init(); isInPoint = false; } break; case LgoAscLable.VarianceCovarianceOfPoint: { double sigma0; var cova = ParseCovaMatrix(content, out sigma0); currentPoint.CovaMatrix = new Matrix(cova); } break; case LgoAscLable.VarianceCovarianceOfBaseLine: { double sigma0; var cova = ParseCovaMatrix(content, out sigma0); currentLine.Baseline.StdDev = sigma0; currentLine.Baseline.CovaMatrix = new Matrix(cova); currentLine.Baseline.EstimatedVectorRmsedXYZ.Rms = new XYZ(Math.Sqrt(cova[0, 0]), Math.Sqrt(cova[1, 1]), Math.Sqrt(cova[2, 2])); } break; case LgoAscLable.ErrorEllipseAbsolute: { var result = ParseErrorEllipse(content); if (isInPoint) { currentPoint.ErrorEllipse = result; } else { currentLine.ErrorEllipse = result; } } break; case LgoAscLable.DateTimeOfFirstCommonEpoch: { currentLine.Epoch = ParseEpoch(content); file.GetOrCreate(currentLine.Epoch).Set(currentLine); } break; case LgoAscLable.ReferenceAntennaHeightAndOffset: { currentLine.AntennaBiasOfRef = ParseHeightOffset(content); } break; case LgoAscLable.RoverAntennaHeightAndOffset: { currentLine.AntennaBiasOfRov = ParseHeightOffset(content); } break; default: break; } } //最后保存最后的次基线 var epochFile = file.GetOrCreate(currentLine.Epoch); epochFile.Set(currentLine); } return(file); }