/// <summary> /// 比较 /// </summary> /// <param name="netA"></param> /// <param name="netB"></param> /// <returns></returns> public static List <NamedXyzEnu> Compare(BaseLineNet netA, BaseLineNet netB) {//提取和转换,有的方向不一致 List <NamedXyz> netBlines = new List <NamedXyz>(); foreach (var item in netB) { var line = netA.GetOrReversed(item.BaseLineName); if (line == null) { continue; } var namedXyz = new NamedXyz(line.BaseLineName.Name, line.EstimatedVector); netBlines.Add(namedXyz); } var CoordsB = netB.GetNamedXyzs(); var Compared = NamedXyz.Compare(netBlines, CoordsB); var CompareResults = new List <NamedXyzEnu>(); foreach (var localXyz in Compared) { GnssBaseLineName name = new GnssBaseLineName(localXyz.Name); var staXyz = netA.GetSiteCoord(name.RefName); if (staXyz == null) { continue; } var item = NamedXyzEnu.Get(localXyz.Name, localXyz.Value, staXyz); CompareResults.Add(item); } return(CompareResults); }
private void Read() { string pathA = fileOpenControlA.FilePath; if (!File.Exists(pathA)) { FormUtil.ShowFileNotExistBox(pathA); return; } string pathB = this.fileOpenControlB.FilePath; if (!File.Exists(pathB)) { FormUtil.ShowFileNotExistBox(pathB); return; } bool isBaseLine = checkBox_isBaseline.Checked; if (!isBaseLine)//坐标的比较 { this.CoordsA = NamedXyzParser.GetCoords(pathA); this.CoordsB = NamedXyzParser.GetCoords(pathB); //此用于地图显示 this.ShowCoordsA = this.CoordsA; this.ShowCoordsB = this.CoordsB; ObjectTableStorage tableA = BuildObjectTable(CoordsA); ObjectTableStorage tableB = BuildObjectTable(CoordsB); objectTableControl_tableA.DataBind(tableA); objectTableControl_tableB.DataBind(tableB); this.Compared = NamedXyz.Compare(CoordsA, CoordsB, NameLength.Enabled, NameLength.Value); CompareResults = new List <NamedXyzEnu>(); var nameLen = NameLength; foreach (var localXyz in Compared) { // var name = GetCuttedName(localXyz.Name, nameLen); var staXyz = CoordsA.Find(m => String.Equals(GetCuttedName(m.Name, nameLen), GetCuttedName(localXyz.Name, nameLen), StringComparison.CurrentCultureIgnoreCase)); if (staXyz == null) { continue; } var item = NamedXyzEnu.Get(localXyz.Name, localXyz.Value, new XYZ(staXyz.X, staXyz.Y, staXyz.Z)); CompareResults.Add(item); } } else//基线选择与输出 { try { var path = pathA; ObjectTableStorage tableA = ParseLineTable(pathA); ObjectTableStorage tableB = ParseLineTable(pathB); if (tableA == null || tableB == null) { Geo.Utils.FormUtil.ShowWarningMessageBox("不支持的基线格式!"); return; } this.CoordsA = PareToNamedXyz(tableA); this.CoordsB = PareToNamedXyz(tableB); objectTableControl_tableA.DataBind(tableA); objectTableControl_tableB.DataBind(tableB); var netA = MultiPeriodBaseLineNet.Parse(tableA); var netB = MultiPeriodBaseLineNet.Parse(tableB); //此用于地图显示 this.ShowCoordsA = netA.GetSiteCoords(); this.ShowCoordsB = netB.GetSiteCoords(); var compared = MultiPeriodBaseLineNet.Compare(netA, netB); CompareResults = new List <NamedXyzEnu>(); foreach (var item in compared) { CompareResults.AddRange(item.Value); } } catch (Exception ex) { Geo.Utils.FormUtil.ShowErrorMessageBox(ex.Message + ",发生了错误\r\n注意:文件内只能有一条同名基线!"); return; } } ObjectTableStorage table = BuildObjectTable(CompareResults); //转换为毫米单位 if (IsInUnitMm) { table.UpdateAllBy(1000, NumeralOperationType.乘); } ; this.objectTableControl_result.DataBind(table); //更进一步,计算偏差RMS var residualRms = table.GetResidualRmse(); var meanError = table.GetAbsMean(); var vector = table.GetAveragesWithStdDev(); StringBuilder sb = new StringBuilder(); sb.AppendLine("参数\t平均误差\t互差中误差\t系统偏差\t系统差中误差"); var format = "G4"; foreach (var item in vector) { sb.AppendLine(item.Key + "\t" + meanError[item.Key][0].ToString(format) + "\t" + residualRms[item.Key][0].ToString(format) + "\t" + item.Value[0].ToString(format) + "\t" + item.Value[1].ToString(format)); } var info = sb.ToString(); MessageBox.Show(info); log.Info(info); ObjectTableStorage summeryTable = new ObjectTableStorage("结果汇总"); summeryTable.NewRow(); summeryTable.AddItem("Name", "MeanError"); foreach (var item in meanError) { summeryTable.AddItem(item.Key, item.Value[0].ToString(format)); } summeryTable.NewRow(); summeryTable.AddItem("Name", "MutualDevRms"); foreach (var item in residualRms) { summeryTable.AddItem(item.Key, item.Value[0].ToString(format)); } summeryTable.NewRow(); summeryTable.AddItem("Name", "AveOrSysDev"); foreach (var item in vector) { summeryTable.AddItem(item.Key, item.Value[0].ToString(format)); } summeryTable.NewRow(); summeryTable.AddItem("Name", "AveDevRms"); foreach (var item in vector) { summeryTable.AddItem(item.Key, item.Value[1].ToString(format)); } summeryTable.EndRow(); objectTableControl_ave.DataBind(summeryTable); }