//输出报告 public override string ToString() { int CurIndex = 0; string strReport = "------速度和方位角计算------\r\n"; string strHuiZon = "------距离和计算结果------\r\n"; double SumDis = 0; double fdDis = 0; for (int i = 0; i < ListName.Count; i++) { SumDis = 0; string CurName = ListName[i]; for (int t = 0; t < ListTime.Count; t++) { if (ListTime[t].Code == CurName) { SumDis += ListTime[t].Length; double azimuth = BasicClass.Rad2Dms(ListTime[t].Azimuth); strReport += String.Format("{0:D2},{1:F5}-{2:F5},{3:F5},{4:F5}\r\n", CurIndex++, ListTime[t].FData.MDJTime, ListTime[t].BData.MDJTime, ListTime[t].Vectory, azimuth); } } int minIndex = 0, maxIndex = 0; for (int j = 0; j < ListTime.Count; j++) { if (ListTime[j].Code.Equals(CurName)) { minIndex = j; break; } }//找到结尾行 for (int j = 1; j < ListTime.Count; j++) { if (ListTime[ListTime.Count - j].Code.Equals(CurName)) { maxIndex = ListTime.Count - j; break; } }//找到起始行 fdDis = BasicClass.GetDis(ListTime[minIndex].FData, ListTime[maxIndex].BData); strHuiZon += String.Format("车辆标识:{0}\r\n", ListTime[minIndex].FData.Code); strHuiZon += String.Format("累计距离:{0:F3}(Km)\r\n", Math.Round(SumDis / 1000, 3)); strHuiZon += String.Format("首尾直线距离:{0:F3}(Km)\r\n", Math.Round(fdDis / 1000, 3)); strReport += strHuiZon; strHuiZon = ""; } return(strReport + strHuiZon); }
private void Cal_Click(object sender, EventArgs e) { // ReportText.Text = DataM.ToString(); ReportText.Text += BasicClass.DMS2RAD(179.59599999) + "\r\n"; ReportText.Text += BasicClass.Dms2Rad(179.59599999); }